mcanoglu/cwe-class-group huggingface dataset:
function preview()
    {
        if ($this->params['id'] == 0) { // we want the default editor
            $demo = new stdClass();
            $demo->id = 0;
            $demo->name = "Default";
            if ($this->params['editor'] == 'ckeditor') {
                $demo->skin = 'kama';
            } elseif ($this->params['editor'] == 'tinymce') {
                $demo->skin = 'lightgray';
            }
        } else {
            $demo = self::getEditorSettings($this->params['id'], $this->params['editor']);
        }
        assign_to_template(
            array(
                'demo' => $demo,
                'editor' => $this->params['editor']
            )
        );
    }

// Vulnerability class: CWE-200
function test1Controller($hphpdOutput, $hphpdProcessId, $serverPort) {
  // Request a page so that the client can debug it.
  waitForClientToOutput($hphpdOutput, "Waiting for server response");
  $url = "http://".php_uname('n').':'.$serverPort.'/test1.php';
  echo "Requesting test1.php\n";
  request(php_uname('n'), $serverPort, 'test1.php', 10); // ignore response

  // Let client run until script quits
  waitForClientToOutput($hphpdOutput, "quit");
}

// Vulnerability class: CWE-668
foreach ($aco_value_array as $aco_value) {
					$this->debug_text("shift_acl(): ACO Section Value: $aco_section_value ACO VALUE: $aco_value");
					$aco_key = array_search($aco_value, $acl_array['aco'][$aco_section_value]);

					if ($aco_key !== FALSE) {
						$this->debug_text("shift_acl(): Removing ACO. ($aco_key)");
						unset($acl_array['aco'][$aco_section_value][$aco_key]);
						$update = 1;
					} else {
						$this->debug_text("shift_acl(): ACO doesn't exist, can't remove it.");
					}
				}

// Vulnerability class: CWE-863
static public function getCategoryName($_id = 0) {

		if ($_id != 0) {
			$stmt = Database::prepare("
				SELECT `name` FROM `" . TABLE_PANEL_TICKET_CATS . "` WHERE `id` = :id"
			);
			$category = Database::pexecute_first($stmt, array('id' => $_id));
			return $category['name'];
		}
		return null;
	}

// Vulnerability class: CWE-732
function XMLRPCaddResourceGroupPriv($name, $type, $nodeid, $permissions){
    require_once(".ht-inc/privileges.php");
    global $user;

    if(! checkUserHasPriv("resourceGrant", $user['id'], $nodeid)){
        return array('status' => 'error',
                     'errorcode' => 53,
                     'errormsg' => 'Unable to add resource group to this node');
    }

    if($typeid = getResourceTypeID($type)){
        if(!checkForGroupName($name, 'resource', '', $typeid)){
            return array('status' => 'error',
                         'errorcode' => 28,
                         'errormsg' => 'resource group does not exist');
        }
        $perms = explode(':', $permissions);
        updateResourcePrivs("$type/$name", $nodeid, $perms, array());
        return array('status' => 'success');
    } else {
        return array('status' => 'error',
                     'errorcode' => 56,
                     'errormsg' => 'Invalid resource type');
    }
}

// Vulnerability class: CWE-20
public function shouldRun(DateTime $date)
    {
        global $timedate;

        $runDate = clone $date;
        $this->handleTimeZone($runDate);

        $cron = Cron\CronExpression::factory($this->schedule);
        if (empty($this->last_run) && $cron->isDue($runDate)) {
            return true;
        }

        $lastRun = $this->last_run ? $timedate->fromDb($this->last_run) : $timedate->fromDb($this->date_entered);
        
        $this->handleTimeZone($lastRun);
        $next = $cron->getNextRunDate($lastRun);

        return $next <= $runDate;
    }

// Vulnerability class: CWE-863
$fieldPickListValues[$value] = \App\Language::translate($value, $this->getModuleName(),false,false);
			}
			// Protection against deleting a value that does not exist on the list
			if ('picklist' === $fieldDataType) {
				$fieldValue = $this->get('fieldvalue');
				if (!empty($fieldValue) && !isset($fieldPickListValues[$fieldValue])) {
					$fieldPickListValues[$fieldValue] = \App\Language::translate($fieldValue, $this->getModuleName(),false,false);
					$this->set('isEditableReadOnly', true);
				}
			}
		} elseif (method_exists($this->getUITypeModel(), 'getPicklistValues')) {

// Vulnerability class: CWE-20
public function Insert() {

		$ins_stmt = Database::prepare("
			INSERT INTO `" . TABLE_PANEL_TICKETS . "` SET
                `customerid` = :customerid,
                `adminid` = :adminid,
                `category` = :category,
                `priority` = :priority,
                `subject` = :subject,
                `message` = :message,
                `dt` = :dt,
                `lastchange` = :lastchange,
                `ip` = :ip,
                `status` = :status,
                `lastreplier` = :lastreplier,
                `by` = :by,
                `answerto` = :answerto"
		);
		$ins_data = array(
			'customerid' => $this->Get('customer'),
			'adminid' => $this->Get('admin'),
			'category' => $this->Get('category'),
			'priority' => $this->Get('priority'),
			'subject' => $this->Get('subject'),
			'message' => $this->Get('message'),
			'dt' => time(),
			'lastchange' => time(),
			'ip' => $this->Get('ip'),
			'status' => $this->Get('status'),
			'lastreplier' => $this->Get('lastreplier'),
			'by' => $this->Get('by'),
			'answerto' => $this->Get('answerto')
		);
		Database::pexecute($ins_stmt, $ins_data);
		$this->tid = Database::lastInsertId();
		return true;
	}

// Vulnerability class: CWE-732
private static function sign($input, $key, $algo = 'HS256')
    {
        switch ($algo) {

            case 'HS256':
                return hash_hmac('sha256', $input, $key, true);

            case 'HS384':
                return hash_hmac('sha384', $input, $key, true);

            case 'HS512':
                return hash_hmac('sha512', $input, $key, true);

            case 'RS256':
                return JWT::generateRSASignature($input, $key, OPENSSL_ALGO_SHA256);

            case 'RS384':
                return JWT::generateRSASignature($input, $key, OPENSSL_ALGO_SHA384);

            case 'RS512':
                return JWT::generateRSASignature($input, $key, OPENSSL_ALGO_SHA512);

            default:
                throw new Exception("Unsupported or invalid signing algorithm.");
        }
    }

// Vulnerability class: CWE-20
function XMLRPCremoveUserGroupPriv($name, $affiliation, $nodeid, $permissions){
    require_once(".ht-inc/privileges.php");
	global $user;

    if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)){
		return array('status' => 'error',
                     'errorcode' => 53,
                     'errormsg' => 'Unable to remove group privileges on this node');
    }

	$validate = array('name' => $name,
	                  'affiliation' => $affiliation);
	$rc = validateAPIgroupInput($validate, 1);
	if($rc['status'] == 'error')
		return $rc;

    $groupid = $rc['id'];
    $groupname = "$name@$affiliation";
    $perms = explode(':', $permissions);
    $usertypes = getTypes('users');
    array_push($usertypes["users"], "block");
	array_push($usertypes["users"], "cascade");
    $cascadePrivs = getNodeCascadePriviliges($nodeid, "usergroups");
    $removegroupprivs = array();
    if(array_key_exists($groupname, $cascadePrivs['usergroups'])){
        foreach($perms as $permission){
            if(in_array($permission, $cascadePrivs['usergroups'][$groupname]['privs'])){
                array_push($removegroupprivs, $permission);
            }
        }
        $diff = array_diff($cascadePrivs['usergroups'][$groupname], $removegroupprivs);
        if(count($diff) == 1 && in_array("cascade", $diff)){
            array_push($removegroupprivs, "cascade");
	}
	}
    if(empty($removegroupprivs)){
		return array('status' => 'error',
                     'errorcode' => 53,
                     'errormsg' => 'Invalid or missing permissions list supplied');
	}

    updateUserOrGroupPrivs($groupid, $nodeid, array(), $removegroupprivs, "group");
    return array('status' => 'success');
}

// Vulnerability class: CWE-20
private function _addcontribution( $option ) {
		$this->addTable( 'recentchanges', 'rc' );

		$field = 'rc.rc_actor';

		$this->addSelect(
			[
				'contribution'	=> 'SUM(ABS(rc.rc_new_len - rc.rc_old_len))',
				'contributor'	=> $field
			]
		);
		$this->addWhere(
			[
				$this->tableNames['page'] . '.page_id = rc.rc_cur_id'
			]
		);
		$this->addGroupBy( 'rc.rc_cur_id' );
	}

// Vulnerability class: CWE-400
private function getStateId(string $state, string $machine)
    {
        return $this->getContainer()->get(Connection::class)
            ->fetchColumn('
                SELECT LOWER(HEX(state_machine_state.id))
                FROM state_machine_state
                    INNER JOIN  state_machine
                    ON state_machine.id = state_machine_state.state_machine_id
                    AND state_machine.technical_name = :machine
                WHERE state_machine_state.technical_name = :state
            ', [
                'state' => $state,
                'machine' => $machine,
            ]);
    }

// Vulnerability class: CWE-732
$product = X2Model::model('Products')->findByAttributes(array('name'=>$lineItem->name));
                        if (isset($product))
                            $lineItem->productId = $product->id;
            if(empty($lineItem->currency))
				$lineItem->currency = $defaultCurrency;
			if($lineItem->isPercentAdjustment) {
				$lineItem->adjustment = Fields::strToNumeric(
                    $lineItem->adjustment,'percentage');
			} else {
				$lineItem->adjustment = Fields::strToNumeric(
                    $lineItem->adjustment,'currency',$curSym);
			}
			$lineItem->price = Fields::strToNumeric($lineItem->price,'currency',$curSym);
			$lineItem->total = Fields::strToNumeric($lineItem->total,'currency',$curSym);
		}

// Vulnerability class: CWE-20
public function execute(&$params) {
		$options = $this->config['options'];

		$action = new Actions;

		$action->subject = $this->parseOption('subject',$params);
        $action->dueDate = $this->parseOption('dueDate',$params);
		$action->actionDescription = $this->parseOption('description',$params);
		$action->priority = $this->parseOption('priority',$params);
		$action->visibility = $this->parseOption('visibility',$params);

		if(isset($params['model']))
			$action->assignedTo = $this->parseOption('assignedTo',$params);

		// if(isset($this->config['attributes']))
			// $this->setModelAttributes($action,$this->config['attributes'],$params);

        if ($action->save()) {
            return array (
                true,
                Yii::t('studio', "View created action: ").$action->getLink ());
        } else {
            return array(false, array_shift($action->getErrors()));
        }



		// if($this->parseOption('reminder',$params)) {
			// $notif=new Notification;
			// $notif->modelType='Actions';
			// $notif->createdBy=Yii::app()->user->getName();
			// $notif->modelId=$model->id;
			// if($_POST['notificationUsers']=='me'){
				// $notif->user=Yii::app()->user->getName();
			// }else{
				// $notif->user=$model->assignedTo;
			// }
			// $notif->createDate=$model->dueDate-($_POST['notificationTime']*60);
			// $notif->type='action_reminder';
			// $notif->save();
			// if($_POST['notificationUsers']=='both' && Yii::app()->user->getName()!=$model->assignedTo){
				// $notif2=new Notification;
				// $notif2->modelType='Actions';
				// $notif2->createdBy=Yii::app()->user->getName();
				// $notif2->modelId=$model->id;
				// $notif2->user=Yii::app()->user->getName();
				// $notif2->createDate=$model->dueDate-($_POST['notificationTime']*60);
				// $notif2->type='action_reminder';
				// $notif2->save();
			// }
		// }
	}

// Vulnerability class: CWE-20
function generateAutoLoginLink($params){

        $dataRequest = array();
        $dataRequestAppend = array();

        // Destination ID
        if (isset($params['r'])){
            $dataRequest['r'] = $params['r'];
            $dataRequestAppend[] = '/(r)/'.rawurlencode(base64_encode($params['r']));
        }

        // User ID
        if (isset($params['u']) && is_numeric($params['u'])){
            $dataRequest['u'] = $params['u'];
            $dataRequestAppend[] = '/(u)/'.rawurlencode($params['u']);
        }

        // Username
        if (isset($params['l'])){
            $dataRequest['l'] = $params['l'];
            $dataRequestAppend[] = '/(l)/'.rawurlencode($params['l']);
        }

        if (!isset($params['l']) && !isset($params['u'])) {
            throw new Exception('Username or User ID has to be provided');
        }

        $ts = time() + $params['t'];

        // Expire time for link
        if (isset($params['t'])) {
            $dataRequest['t'] = $ts;
            $dataRequestAppend[] = '/(t)/'.rawurlencode($ts);
        }

        $hashValidation = sha1($params['secret_hash'].sha1($params['secret_hash'].implode(',', $dataRequest)));

        return $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect("user/autologin") . "/{$hashValidation}".implode('', $dataRequestAppend);
    }

// Vulnerability class: CWE-116
protected function prepareImport($model, $csvName) {
        $this->openX2 ('/admin/importModels?model='.ucfirst($model));
        $csv = implode(DIRECTORY_SEPARATOR, array(
            Yii::app()->basePath,
            'tests',
            'data',
            'csvs',
            $csvName
        ));
        $this->type ('data', $csv);
        $this->clickAndWait ("dom=document.querySelector ('input[type=\"submit\"]')");
        $this->assertCsvUploaded ($csv);
    }

// Vulnerability class: CWE-20
protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage)
    {
        parent::markCompleted($endStatus, $serviceResponse, $gatewayMessage);
        $this->createMessage(Message\CreateCardResponse::class, $gatewayMessage);
        ErrorHandling::safeExtend($this->payment, 'onCardCreated', $serviceResponse);
    }

// Vulnerability class: CWE-436
private function readData() {

		if (isset($this->tid)
			&& $this->tid != - 1
		) {
			$_ticket_stmt = Database::prepare('
				SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid'
			);
			$_ticket = Database::pexecute_first($_ticket_stmt, array('tid' => $this->tid));

			$this->Set('customer', $_ticket['customerid'], true, false);
			$this->Set('admin', $_ticket['adminid'], true, false);
			$this->Set('subject', $_ticket['subject'], true, false);
			$this->Set('category', $_ticket['category'], true, false);
			$this->Set('priority', $_ticket['priority'], true, false);
			$this->Set('message', $_ticket['message'], true, false);
			$this->Set('dt', $_ticket['dt'], true, false);
			$this->Set('lastchange', $_ticket['lastchange'], true, false);
			$this->Set('ip', $_ticket['ip'], true, false);
			$this->Set('status', $_ticket['status'], true, false);
			$this->Set('lastreplier', $_ticket['lastreplier'], true, false);
			$this->Set('by', $_ticket['by'], true, false);
			$this->Set('answerto', $_ticket['answerto'], true, false);
			$this->Set('archived', $_ticket['archived'], true, false);
		}
	}

// Vulnerability class: CWE-732
protected function AddAnAddress($kind, $address, $name = '') {
    if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
      $this->SetError($this->Lang('Invalid recipient array').': '.$kind);
      if ($this->exceptions) {
        throw new phpmailerException('Invalid recipient array: ' . $kind);
      }
      if ($this->SMTPDebug) {
        $this->edebug($this->Lang('Invalid recipient array').': '.$kind);
      }
      return false;
    }
    $address = trim($address);
    $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
    if (!$this->ValidateAddress($address)) {
      $this->SetError($this->Lang('invalid_address').': '. $address);
      if ($this->exceptions) {
        throw new phpmailerException($this->Lang('invalid_address').': '.$address);
      }
      if ($this->SMTPDebug) {
        $this->edebug($this->Lang('invalid_address').': '.$address);
      }
      return false;
    }
    if ($kind != 'Reply-To') {
      if (!isset($this->all_recipients[strtolower($address)])) {
        array_push($this->$kind, array($address, $name));
        $this->all_recipients[strtolower($address)] = true;
        return true;
      }
    } else {
      if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
        $this->ReplyTo[strtolower($address)] = array($address, $name);
      return true;
    }
  }
  return false;
}

// Vulnerability class: CWE-20
public function getChart($renderer, $id, $store_in_session = true)
    {
        $c          = null;
        $chart_data = null;
        if ($renderer != null && $store_in_session) {
            $session = new Tracker_Report_Session($renderer->report->id);
            $session->changeSessionNamespace("renderers.{$renderer->id}");

            // look for the chart in the session
            $chart_data = $session->get("charts.$id");
        }

        if (! $chart_data) {
            // not found. look in the db
            $dao        = new GraphOnTrackersV5_ChartDao(CodendiDataAccess::instance());
            $chart_data = $dao->searchById($id)->getRow();
        }

        if ($chart_data) {
            if (! $renderer) {
                $report   = null; //We don't know the report
                $renderer = Tracker_Report_RendererFactory::instance()->getReportRendererById($chart_data['report_graphic_id'], $report, $store_in_session);
            }
            if ($renderer) {
                $c = $this->instanciateChart($chart_data, $renderer, $store_in_session);
            }
        }
        return $c;
    }

// Vulnerability class: CWE-862
$item = trim( $item );
				if ( strpos( $item, '|-' ) === 0 ) {
					$item = explode( '|-', $item, 2 );
					if ( count( $item ) == 2 ) {
						$item = $item[1];
					} else {
						$rowsKey[$index] = $item;
						continue;
					}
				}
				if ( strlen( $item ) > 0 ) {
					$word = explode( "\n|", $item );
					if ( isset( $word[0] ) && empty( $word[0] ) ) {
						array_shift( $word );
					}
					if ( isset( $word[abs( $sortColumn ) - 1] ) ) {
						$test = trim( $word[abs( $sortColumn ) - 1] );
						if ( strpos( $test, '|' ) > 0 ) {
							$test = trim( explode( '|', $test )[1] );
						}
						$rowsKey[$index] = $test;
					}
				}
			}
			$this->sort($rowsKey, $sortColumn);
			$newItems = [];
			foreach ( $rowsKey as $index => $val ) {
				$newItems[] = $items[$index];
			}
			$items = $newItems;
		}

		return $this->listStart . $this->implodeItems( $items ) . $this->listEnd;
	}

// Vulnerability class: CWE-400
public function Delete() {

		// Delete "main" ticket
		$del_stmt = Database::prepare('
			DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid'
		);
		Database::pexecute($del_stmt, array('tid' => $this->tid));

		// Delete "answers" to ticket"
		$del_stmt = Database::prepare('
			DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = :tid'
		);
		Database::pexecute($del_stmt, array('tid' => $this->tid));
		return true;
	}

// Vulnerability class: CWE-732
function barcode_encode($code,$encoding)
{
    global $genbarcode_loc;

    if (
    ((preg_match("/^ean$/i", $encoding)
    && ( strlen($code)==12 || strlen($code)==13)))

    || (($encoding) && (preg_match("/^isbn$/i", $encoding))
    && (( strlen($code)==9 || strlen($code)==10) ||
    (((preg_match("/^978/", $code) && strlen($code)==12) ||
    (strlen($code)==13)))))

    || (( !isset($encoding) || !$encoding || (preg_match("/^ANY$/i", $encoding) ))
    && (preg_match("/^[0-9]{12,13}$/", $code)))
    )
    {
        /* use built-in EAN-Encoder */
        dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean");
        $bars=barcode_encode_ean($code, $encoding);
    }
    else if (file_exists($genbarcode_loc))
    {
        /* use genbarcode */
        dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding);
        $bars=barcode_encode_genbarcode($code, $encoding);
    }
    else
    {
        print "barcode_encode needs an external programm for encodings other then EAN/ISBN<BR>\n";
        print "<UL>\n";
        print "<LI>download gnu-barcode from <A href=\"http://www.gnu.org/software/barcode/\">www.gnu.org/software/barcode/</A>\n";
        print "<LI>compile and install them\n";
        print "<LI>download genbarcode from <A href=\"http://www.ashberg.de/bar/\">www.ashberg.de/bar/</A>\n";
        print "<LI>compile and install them\n";
        print "<LI>specify path the genbarcode in barcode module setup\n";
        print "</UL>\n";
        print "<BR>\n";
        return false;
    }
    return $bars;
}

// Vulnerability class: CWE-20
private function _addlasteditor( $option ) {
		//Addlasteditor can not be used with addauthor.
		if ( !isset( $this->parametersProcessed['addauthor'] ) || !$this->parametersProcessed['addauthor'] ) {
			$this->addTable( 'revision_actor_temp', 'rev' );
			$this->addWhere(
				[
					$this->tableNames['page'] . '.page_id = rev.revactor_page',
					'rev.revactor_timestamp = (SELECT MAX(rev_aux_max.revactor_timestamp) FROM ' . $this->tableNames['revision_actor_temp'] . ' AS rev_aux_max WHERE rev_aux_max.revactor_page = rev.revactor_page)'
				]
			);
			$this->_adduser( null, 'rev' );
		}
	}

// Vulnerability class: CWE-400
public function validateMulti(array $credentialCandidates)
    {
        $lastException = null;

        foreach ($credentialCandidates as $credential) {
            if (false == $credential instanceof CredentialInterface) {
                throw new \InvalidArgumentException('Expected CredentialInterface');
            }
            if (null == $credential->getPublicKey()) {
                continue;
            }

            try {
                $result = $this->validate($credential->getPublicKey());

                if ($result === false) {
                    return;
                }

                return $credential;
            } catch (LightSamlSecurityException $ex) {
                $lastException = $ex;
            }
        }

        if ($lastException) {
            throw $lastException;
        } else {
            throw new LightSamlSecurityException('No public key available for signature verification');
        }
    }

// Vulnerability class: CWE-732
private function _qualitypages( $option ) {
		if ( function_exists( 'efLoadFlaggedRevs' ) ) {
			//Do not add this again if 'stablepages' has already added it.
			if ( !$this->parametersProcessed['stablepages'] ) {
				$this->addJoin(
					'flaggedpages',
					[
						"LEFT JOIN",
						"page_id = fp_page_id"
					]
				);
			}
			switch ( $option ) {
				case 'only':
					$this->addWhere( 'fp_quality >= 1' );
					break;
				case 'exclude':
					$this->addWhere( 'fp_quality = 0' );
					break;
			}
		}
	}

// Vulnerability class: CWE-400
function test_empty_comment() {
		$result = $this->myxmlrpcserver->wp_newComment(
			array(
				1,
				'administrator',
				'administrator',
				self::$post->ID,
				array(
					'content' => '',
				),
			)
		);

		$this->assertIXRError( $result );
		$this->assertSame( 403, $result->code );
	}

// Vulnerability class: CWE-862
public function testGetEvents(){
        TestingAuxLib::loadX2NonWebUser ();
        TestingAuxLib::suLogin ('admin');

        Yii::app()->settings->historyPrivacy = null;
        $lastEventId = 0;
        $lastTimestamp = 0;
        $events = Events::getEvents ($lastEventId, $lastTimestamp, 4);
        $this->assertEquals (
            Yii::app()->db->createCommand (
                "select id from x2_events order by timestamp desc, id desc limit 4")
                ->queryColumn (),
            array_map(function ($event) { return $event->id; }, $events['events'])
        ); 
        TestingAuxLib::restoreX2WebUser ();
    }

// Vulnerability class: CWE-20
public function Connect ($host, $port = false, $tval = 30) {
    //  Are we already connected?
    if ($this->connected) {
      return true;
    }

    /*
    On Windows this will raise a PHP Warning error if the hostname doesn't exist.
    Rather than supress it with @fsockopen, let's capture it cleanly instead
    */

    set_error_handler(array(&$this, 'catchWarning'));

    //  Connect to the POP3 server
    $this->pop_conn = fsockopen($host,    //  POP3 Host
                  $port,    //  Port #
                  $errno,   //  Error Number
                  $errstr,  //  Error Message
                  $tval);   //  Timeout (seconds)

    //  Restore the error handler
    restore_error_handler();

    //  Does the Error Log now contain anything?
    if ($this->error && $this->do_debug >= 1) {
      $this->displayErrors();
    }

    //  Did we connect?
    if ($this->pop_conn == false) {
      //  It would appear not...
      $this->error = array(
        'error' => "Failed to connect to server $host on port $port",
        'errno' => $errno,
        'errstr' => $errstr
      );

      if ($this->do_debug >= 1) {
        $this->displayErrors();
      }

      return false;
    }

    //  Increase the stream time-out

    //  Check for PHP 4.3.0 or later
    if (version_compare(phpversion(), '5.0.0', 'ge')) {
      stream_set_timeout($this->pop_conn, $tval, 0);
    } else {
      //  Does not work on Windows
      if (substr(PHP_OS, 0, 3) !== 'WIN') {
        socket_set_timeout($this->pop_conn, $tval, 0);
      }
    }

    //  Get the POP3 server response
    $pop3_response = $this->getResponse();

    //  Check for the +OK
    if ($this->checkResponse($pop3_response)) {
    //  The connection is established and the POP3 server is talking
    $this->connected = true;
      return true;
    }
    return false;
  }

// Vulnerability class: CWE-20
foreach ($fields as $field) {
                $fieldName = $field->fieldName;
                if ($field->type == 'date' || $field->type == 'dateTime') {
                    if (is_numeric($record->$fieldName))
                        $record->$fieldName = Formatter::formatLongDateTime($record->$fieldName);
                }elseif ($field->type == 'link') {
                    $name = $record->$fieldName;
                    if (!empty($field->linkType)) {
                        list($name, $id) = Fields::nameAndId($name);
                    }
                    if (!empty($name))
                        $record->$fieldName = $name;
                }elseif ($fieldName == 'visibility') {
                    $record->$fieldName = $record->$fieldName == 1 ? 'Public' : 'Private';
                }
            }

// Vulnerability class: CWE-20
public static function decode($jwt, $key = null, $verify = true)
    {
        $tks = explode('.', $jwt);

        if (count($tks) != 3) {
            throw new Exception('Wrong number of segments');
        }

        list($headb64, $payloadb64, $cryptob64) = $tks;

        if (null === ($header = json_decode(JWT::urlsafeB64Decode($headb64)))) {
            throw new Exception('Invalid segment encoding');
        }

        if (null === $payload = json_decode(JWT::urlsafeB64Decode($payloadb64))) {
            throw new Exception('Invalid segment encoding');
        }

        $sig = JWT::urlsafeB64Decode($cryptob64);

        if ($verify) {
            if (empty($header->alg)) {
                throw new DomainException('Empty algorithm');
            }

            if (!JWT::verifySignature($sig, "$headb64.$payloadb64", $key, $header->alg)) {
                throw new UnexpectedValueException('Signature verification failed');
            }
        }

        return $payload;
    }

// Vulnerability class: CWE-20
private function SendHello($hello, $host) {
    fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);

    $rply = $this->get_lines();
    $code = substr($rply,0,3);

    if($this->do_debug >= 2) {
      $this->edebug("SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />');
    }

    if($code != 250) {
      $this->error =
        array("error" => $hello . " not accepted from server",
              "smtp_code" => $code,
              "smtp_msg" => substr($rply,4));
      if($this->do_debug >= 1) {
        $this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />');
      }
      return false;
    }

    $this->helo_rply = $rply;

    return true;
  }

// Vulnerability class: CWE-20
function preview()
    {
        if ($this->params['id'] == 0) { // we want the default editor
            $demo = new stdClass();
            $demo->id = 0;
            $demo->name = "Default";
            if ($this->params['editor'] == 'ckeditor') {
                $demo->skin = 'kama';
            } elseif ($this->params['editor'] == 'tinymce') {
                $demo->skin = 'lightgray';
            }
        } else {
            $demo = self::getEditorSettings($this->params['id'], expString::escape($this->params['editor']));
        }
        assign_to_template(
            array(
                'demo' => $demo,
                'editor' => $this->params['editor']
            )
        );
    }

// Vulnerability class: CWE-200
public static function dplNumParserFunction( &$parser, $text = '' ) {
		$parser->addTrackingCategory( 'dplnum-parserfunc-tracking-category' );
		$num = str_replace( '&#160;', ' ', $text );
		$num = str_replace( '&nbsp;', ' ', $text );
		$num = preg_replace( '/([0-9])([.])([0-9][0-9]?[^0-9,])/', '\1,\3', $num );
		$num = preg_replace( '/([0-9.]+),([0-9][0-9][0-9])\s*Mrd/', '\1\2 000000 ', $num );
		$num = preg_replace( '/([0-9.]+),([0-9][0-9])\s*Mrd/', '\1\2 0000000 ', $num );
		$num = preg_replace( '/([0-9.]+),([0-9])\s*Mrd/', '\1\2 00000000 ', $num );
		$num = preg_replace( '/\s*Mrd/', '000000000 ', $num );
		$num = preg_replace( '/([0-9.]+),([0-9][0-9][0-9])\s*Mio/', '\1\2 000 ', $num );
		$num = preg_replace( '/([0-9.]+),([0-9][0-9])\s*Mio/', '\1\2 0000 ', $num );
		$num = preg_replace( '/([0-9.]+),([0-9])\s*Mio/', '\1\2 00000 ', $num );
		$num = preg_replace( '/\s*Mio/', '000000 ', $num );
		$num = preg_replace( '/[. ]/', '', $num );
		$num = preg_replace( '/^[^0-9]+/', '', $num );
		$num = preg_replace( '/[^0-9].*/', '', $num );
		return $num;
	}

// Vulnerability class: CWE-400
function(){function N(){d(K,X,function(){k(X);K.editComment(K.content,function(){p(X)},function(Q){l(X);N();b.handleError(Q,null,null,null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))})})}N()},K.isResolved),M(mxResources.get("delete"),function(){b.confirm(mxResources.get("areYouSure"),function(){k(X);K.deleteComment(function(N){if(!0===N){N=X.querySelector(".geCommentTxt");N.innerHTML="";mxUtils.write(N,mxResources.get("msgDeleted"));var Q=X.querySelectorAll(".geCommentAction");for(N=

// Vulnerability class: CWE-20
this.editor.graph.pageVisible;0==q&&(this.editor.graph.pageVisible=q);var X=this.createDownloadRequest(M,d,l,W,x,p,y,A,B,I,O,P,K);this.editor.graph.pageVisible=U;return X}catch(u){this.handleError(u)}}))}else{var F=null,H=mxUtils.bind(this,function(M){M.length<=MAX_REQUEST_SIZE?this.saveData(z,"svg",M,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(F)}))});if("svg"==d){var S=this.editor.graph.background;

// Vulnerability class: CWE-20
u[E]}catch(J){null!=window.console&&console.log("Error in vars URL parameter: "+J)}};Graph.prototype.getExportVariables=function(){return null!=this.globalVars?mxUtils.clone(this.globalVars):{}};var z=Graph.prototype.getGlobalVariable;Graph.prototype.getGlobalVariable=function(u){var E=z.apply(this,arguments);null==E&&null!=this.globalVars&&(E=this.globalVars[u]);return E};Graph.prototype.getDefaultStylesheet=function(){if(null==this.defaultStylesheet){var u=this.themes["default-style2"];this.defaultStylesheet=
(new mxCodec(u.ownerDocument)).decode(u)}return this.defaultStylesheet};Graph.prototype.isViewer=function(){return urlParams.viewer};var L=Graph.prototype.getSvg;Graph.prototype.getSvg=function(u,E,J,T,N,Q,R,Y,ba,ea,Z,fa,aa,va){var ja=null,Ba=null,Ha=null;fa||null==this.themes||"darkTheme"!=this.defaultThemeName||(ja=this.stylesheet,Ba=this.shapeForegroundColor,Ha=this.shapeBackgroundColor,this.shapeForegroundColor="darkTheme"==this.defaultThemeName?"#000000":Editor.lightColor,this.shapeBackgroundColor=

// Vulnerability class: CWE-20
d.style.width="300px";d.style.display="inline-flex";d.style.justifyContent="center";d.style.alignItems="center";d.style.position="absolute";var g=document.createElement("img");g.onload=function(){function C(){l.model.setStyle(x,y+m())}l=new Graph(k);l.autoExtend=!1;l.autoScroll=!1;l.setGridEnabled(!1);l.setEnabled(!0);l.setPanning(!1);l.setConnectable(!1);l.getRubberband().setEnabled(!1);l.graphHandler.allowLivePreview=!1;var D=l.createVertexHandler;l.createVertexHandler=function(){var J=D.apply(this,
arguments);J.livePreview=!1;return J};if(null!=f)try{if("inset"==f.substring(0,5)){var G=x.geometry,P=g.width,K=g.height,F=(300-P)/2,H=(300-K)/2,S=f.match(/\(([^)]+)\)/)[1].split(/[ ,]+/),V=parseFloat(S[0]),M=parseFloat(S[1]),W=parseFloat(S[2]),U=parseFloat(S[3]);isFinite(V)&&isFinite(M)&&isFinite(W)&&isFinite(U)?(G.x=U/100*P+F,G.y=V/100*K+H,G.width=(100-M)/100*P+F-G.x,G.height=(100-W)/100*K+H-G.y,"round"==S[4]?"50%"==S[5]?I.setAttribute("checked","checked"):(q=parseInt(S[5]),t.value=q,B.setAttribute("checked",
"checked"),O.style.visibility="visible"):A.setAttribute("checked","checked")):f=null}else f=null}catch(J){}x.style=y+(f?f:m());x.vertex=!0;l.addCell(x,null,null,null,null);l.selectAll();l.addListener(mxEvent.CELLS_MOVED,C);l.addListener(mxEvent.CELLS_RESIZED,C);var X=l.graphHandler.mouseUp,u=l.graphHandler.mouseDown;l.graphHandler.mouseUp=function(){X.apply(this,arguments);k.style.backgroundColor="#fff9"};l.graphHandler.mouseDown=function(){u.apply(this,arguments);k.style.backgroundColor=""};l.dblClick=
function(){};var E=l.getSelectionModel().changeSelection;l.getSelectionModel().changeSelection=function(){E.call(this,[x],[x])}};g.onerror=function(){g.onload=null;g.src=Editor.errorImage};g.setAttribute("src",e);g.style.maxWidth="300px";g.style.maxHeight="300px";d.appendChild(g);v.appendChild(d);var k=document.createElement("div");k.style.width="300px";k.style.height="300px";k.style.overflow="hidden";k.style.backgroundColor="#fff9";v.appendChild(k);var l=null,p=new mxGeometry(100,100,100,100),q=

// Vulnerability class: CWE-20
Editor.prototype.csvToArray=function(u){if(!/^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*)*$/.test(u))return null;var E=[];u.replace(/(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^,'"\s\\]*(?:\s+[^,'"\s\\]+)*))\s*(?:,|$)/g,function(J,T,N,Q){void 0!==T?E.push(T.replace(/\\'/g,"'")):void 0!==N?E.push(N.replace(/\\"/g,
'"')):void 0!==Q&&E.push(Q);return""});/,\s*$/.test(u)&&E.push("");return E};Editor.prototype.isCorsEnabledForUrl=function(u){if(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||u.substring(0,window.location.origin.length)==window.location.origin)return!0;null!=urlParams.cors&&null==this.corsRegExp&&(this.corsRegExp=new RegExp(decodeURIComponent(urlParams.cors)));return null!=this.corsRegExp&&this.corsRegExp.test(u)||"https://raw.githubusercontent.com/"===u.substring(0,34)||"https://fonts.googleapis.com/"===

// Vulnerability class: CWE-20
function serializeObject(obj) {
  var seen = [];

  return JSON.stringify(obj, function(key, val) {
    val = toJsonReplacer(key, val);
    if (isObject(val)) {

      if (seen.indexOf(val) >= 0) return '...';

      seen.push(val);
    }
    return val;
  });
}

// Vulnerability class: CWE-74
function(Ta){var za=Fa[Ta],wa=Ta<Fa.length-1?Fa[Ta+1]:null;wa=null!=wa?T.getCellGeometry(wa.cell):null;var Ea=null!=wa&&null!=wa.alternateBounds?wa.alternateBounds:wa;wa=null!=Qa[Ta]?new V(Qa[Ta],mxConstants.NONE,1):new mxLine(new mxRectangle,mxConstants.NONE,1,!1);wa.isDashed=pa.isDashed;wa.svgStrokeTolerance++;za=new mxHandle(za,"row-resize",null,wa);za.tableHandle=!0;var Da=0;za.shape.node.parentNode.insertBefore(za.shape.node,za.shape.node.parentNode.firstChild);za.redraw=function(){if(null!=
this.shape){this.shape.stroke=0==Da?mxConstants.NONE:pa.stroke;if(this.shape.constructor==V)this.shape.line=L(Qa[Ta],0,Da),this.shape.updateBoundsFromLine();else{var Ya=T.getActualStartSize(ma.cell,!0);this.shape.bounds.height=1;this.shape.bounds.y=this.state.y+this.state.height+Da*ia;this.shape.bounds.x=ma.x+(Ta==Fa.length-1?0:Ya.x*ia);this.shape.bounds.width=ma.width-(Ta==Fa.length-1?0:Ya.width+Ya.x+ia)}this.shape.redraw()}};var La=!1;za.setPosition=function(Ya,Ua,eb){Da=Math.max(Graph.minTableRowHeight-

// Vulnerability class: CWE-20
function(u,E,J){if(null!=E){var T=function(Q){if(null!=Q)if(J)for(var R=0;R<Q.length;R++)E[Q[R].name]=Q[R];else for(var Y in E){var ba=!1;for(R=0;R<Q.length;R++)if(Q[R].name==Y&&Q[R].type==E[Y].type){ba=!0;break}ba||delete E[Y]}},N=this.editorUi.editor.graph.view.getState(u);null!=N&&null!=N.shape&&(N.shape.commonCustomPropAdded||(N.shape.commonCustomPropAdded=!0,N.shape.customProperties=N.shape.customProperties||[],N.cell.vertex?Array.prototype.push.apply(N.shape.customProperties,Editor.commonVertexProperties):
Array.prototype.push.apply(N.shape.customProperties,Editor.commonEdgeProperties)),T(N.shape.customProperties));u=u.getAttribute("customProperties");if(null!=u)try{T(JSON.parse(u))}catch(Q){}}};var x=StyleFormatPanel.prototype.init;StyleFormatPanel.prototype.init=function(){var u=this.editorUi.getSelectionState();"image"!=u.style.shape&&!u.containsLabel&&0<u.cells.length&&this.container.appendChild(this.addStyles(this.createPanel()));x.apply(this,arguments);if(Editor.enableCustomProperties){for(var E=

// Vulnerability class: CWE-20
function addInterceptor(parsedExpression, interceptorFn) {
      if (!interceptorFn) return parsedExpression;
      var watchDelegate = parsedExpression.$$watchDelegate;
      var useInputs = false;

      var regularWatch =
          watchDelegate !== oneTimeLiteralWatchDelegate &&
          watchDelegate !== oneTimeWatchDelegate;

      var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {
        var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
        return interceptorFn(value, scope, locals);
      } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
        var value = parsedExpression(scope, locals, assign, inputs);
        var result = interceptorFn(value, scope, locals);
        // we only return the interceptor's result if the
        // initial value is defined (for bind-once)
        return isDefined(value) ? result : value;
      };

      // Propagate $$watchDelegates other then inputsWatchDelegate
      useInputs = !parsedExpression.inputs;
      if (parsedExpression.$$watchDelegate &&
          parsedExpression.$$watchDelegate !== inputsWatchDelegate) {
        fn.$$watchDelegate = parsedExpression.$$watchDelegate;
        fn.inputs = parsedExpression.inputs;
      } else if (!interceptorFn.$stateful) {
        // If there is an interceptor, but no watchDelegate then treat the interceptor like
        // we treat filters - it is assumed to be a pure function unless flagged with $stateful
        fn.$$watchDelegate = inputsWatchDelegate;
        fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];
      }

      return fn;
    }

// Vulnerability class: CWE-74
E=J}return E};Graph.prototype.getCellsById=function(u){var E=[];if(null!=u)for(var J=0;J<u.length;J++)if("*"==u[J]){var T=this.model.getRoot();E=E.concat(this.model.filterDescendants(function(Q){return Q!=T},T))}else{var N=this.model.getCell(u[J]);null!=N&&E.push(N)}return E};var S=Graph.prototype.isCellVisible;Graph.prototype.isCellVisible=function(u){return S.apply(this,arguments)&&!this.isAllTagsHidden(this.getTagsForCell(u))};Graph.prototype.isAllTagsHidden=function(u){if(null==u||0==u.length||
0==this.hiddenTags.length)return!1;u=u.split(" ");if(u.length>this.hiddenTags.length)return!1;for(var E=0;E<u.length;E++)if(0>mxUtils.indexOf(this.hiddenTags,u[E]))return!1;return!0};Graph.prototype.getCellsForTags=function(u,E,J,T){var N=[];if(null!=u){E=null!=E?E:this.model.getDescendants(this.model.getRoot());for(var Q=0,R={},Y=0;Y<u.length;Y++)0<u[Y].length&&(R[u[Y]]=!0,Q++);for(Y=0;Y<E.length;Y++)if(J&&this.model.getParent(E[Y])==this.model.root||this.model.isVertex(E[Y])||this.model.isEdge(E[Y])){var ba=

// Vulnerability class: CWE-20
'" y="'+p.y.toFixed(2)+'"/>'):V+('<line x="'+p.x.toFixed(2)+'" y="'+p.y.toFixed(2)+'"/>')}V+="</foreground></shape>";if(b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())){E=this.createStyle("stencil("+Graph.compress(V)+")");V=b.view.scale;X=b.view.translate;E=new mxCell("",new mxGeometry(H/V-X.x,U/V-X.y,J/V,S/V),E);E.vertex=1;b.model.beginUpdate();try{E=b.addCell(E),b.fireEvent(new mxEventObject("cellsInserted","cells",[E])),b.fireEvent(new mxEventObject("freehandInserted","cell",E))}finally{b.model.endUpdate()}z&&
b.setSelectionCells([E])}}for(E=0;E<u.length;E++)u[E].parentNode.removeChild(u[E]);d=null;u=[];D=[]}n(!1)};b.addListener(mxEvent.FIRE_MOUSE_EVENT,mxUtils.bind(this,function(J,E){J=E.getProperty("eventName");E=E.getProperty("event");J==mxEvent.MOUSE_MOVE&&x&&(null!=E.sourceState&&E.sourceState.setCursor("crosshair"),E.consume())}));b.addMouseListener({mouseDown:mxUtils.bind(this,function(J,E){if(b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())&&(J=E.getEvent(),x&&!mxEvent.isPopupTrigger(J)&&!mxEvent.isMultiTouchEvent(J))){var H=

// Vulnerability class: CWE-20
1E3<=F&&null!=this.sidebarWindow&&"1"!=urlParams.sketch&&this.sidebarWindow.window.setVisible(!0);null!=this.formatWindow&&(1E3<=F||"1"==urlParams.sketch)&&this.formatWindow.window.setVisible(!0)}else null!=this.sidebarWindow&&this.sidebarWindow.window.setVisible(!1),null!=this.formatWindow&&this.formatWindow.window.setVisible(!1)};EditorUi.prototype.chromelessWindowResize=function(){};var M=DiagramFormatPanel.prototype.addView;DiagramFormatPanel.prototype.addView=function(B){B=M.apply(this,arguments);
var F=this.editorUi,G=F.editor.graph;if(G.isEnabled()&&"1"==urlParams.sketch){var N=this.createOption(mxResources.get("sketch"),function(){return Editor.sketchMode},function(J,E){F.setSketchMode(!Editor.sketchMode);null!=E&&mxEvent.isShiftDown(E)||G.updateCellStyles({sketch:J?"1":null},G.getVerticesAndEdges())},{install:function(J){this.listener=function(){J(Editor.sketchMode)};F.addListener("sketchModeChanged",this.listener)},destroy:function(){F.removeListener(this.listener)}});B.appendChild(N)}return B};

// Vulnerability class: CWE-20
function compile(src) {
    var cached;

    if (typeof src !== "string") {
        throw new TypeError("src must be a string, instead saw '" + typeof src + "'");
    }

    if (!compile.cache) {
        return parser.parse(src);
    }

    cached = compile.cache[src];
    if (!cached) {
        cached = compile.cache[src] = parser.parse(src);
    }

    return cached;
}

// Vulnerability class: CWE-74
H&&!V)if("sharepoint"==S)z("site",null,H.id,H.displayName);else if("site"==S)z("subsite",null,H.id,H.name);else{var N=H.folder;H=H.remoteItem?H.remoteItem:H;var Q=(H.parentReference?H.parentReference.driveId:null)||S,R=H.id;N?z(Q,R,null,H.name):B()}}function z(N,Q,R,Y,ba){function ea(ra){P.stop();var Ca=document.createElement("table");Ca.className="odFileListGrid";for(var za=null,Ga=0,Na=0;null!=ra&&Na<ra.length;Na++){var Fa=ra[Na];if(1!=fa||!Fa.webUrl||0<Fa.webUrl.indexOf("sharepoint.com/sites/")||
0>Fa.webUrl.indexOf("sharepoint.com/")){var Ea=Fa.displayName||Fa.name,Da=mxUtils.htmlEntities(Fa.description||Ea);fa&&(Fa.folder=2==fa?{isRoot:!0}:!0);var La=null!=Fa.folder;if(!g||La){var Aa=document.createElement("tr");Aa.className=Ga++%2?"odOddRow":"odEvenRow";var ta=document.createElement("td");ta.style.width="36px";var ka=document.createElement("img");ka.src="/images/"+(La?"folder.png":"file.png");ka.className="odFileImg";ta.appendChild(ka);Aa.appendChild(ta);ta=document.createElement("td");
La=document.createElement("div");La.className="odFileTitle";La.innerHTML=mxUtils.htmlEntities(Ea);La.setAttribute("title",Da);ta.appendChild(La);Aa.appendChild(ta);Ca.appendChild(Aa);null==za&&(za=Aa,za.className+=" odRowSelected",H=Fa,S=N,x||e(H));(function(oa,sa){Aa.addEventListener("dblclick",t);Aa.addEventListener("click",function(){za!=sa&&(za.className=za.className.replace("odRowSelected",""),za=sa,za.className+=" odRowSelected",H=oa,S=N,x||e(H))})})(Fa,Aa)}}}0==Ga?(ra=document.createElement("div"),
ra.className="odEmptyFolder",ra.innerHTML=mxUtils.htmlEntities(mxResources.get("folderEmpty",null,"Folder is empty!")),va.appendChild(ra)):va.appendChild(Ca);O();V=!1}if(!V){y(".odCatsList").style.display="block";y(".odFilesSec").style.display="block";null!=E&&(E.innerHTML="",E.style.top="50%");var Z=V=!0,fa=0;W=arguments;var aa=setTimeout(function(){V=Z=!1;P.stop();d(mxResources.get("timeout"))},2E4),va=y(".odFilesList");va.innerHTML="";P.spin(va);switch(N){case "recent":M=[{name:mxResources.get("recent",

// Vulnerability class: CWE-20
App.prototype.fileCreated=function(b,f,l,d,u){var t=window.location.pathname;null!=f&&0<f.length&&(t+="?libs="+f);null!=u&&0<u.length&&(t+="?clibs="+u);t=this.getUrl(t);b.getMode()!=App.MODE_DEVICE&&(t+="#"+b.getHash());if(this.spinner.spin(document.body,mxResources.get("inserting"))){var D=b.getData();D=0<D.length?this.editor.extractGraphModel(mxUtils.parseXml(D).documentElement,!0):null;var c=window.location.protocol+"//"+window.location.hostname+t,e=D,g=null;null!=D&&/\.svg$/i.test(b.getTitle())&&
(g=this.createTemporaryGraph(this.editor.graph.getStylesheet()),document.body.appendChild(g.container),e=this.decodeNodeIntoGraph(e,g));b.setData(this.createFileData(D,g,b,c));null!=g&&g.container.parentNode.removeChild(g.container);var k=mxUtils.bind(this,function(){this.spinner.stop()}),m=mxUtils.bind(this,function(){k();var q=this.getCurrentFile();null==l&&null!=q&&(l=!q.isModified()&&null==q.getMode());var v=mxUtils.bind(this,function(){window.openFile=null;this.fileLoaded(b);l&&b.addAllSavedStatus();
null!=f&&this.sidebar.showEntries(f);if(null!=u){for(var A=[],z=u.split(";"),L=0;L<z.length;L++)A.push(decodeURIComponent(z[L]));this.loadLibraries(A)}}),x=mxUtils.bind(this,function(){l||null==q||!q.isModified()?v():this.confirm(mxResources.get("allChangesLost"),null,v,mxResources.get("cancel"),mxResources.get("discardChanges"))});null!=d&&d();null==l||l?x():(b.constructor==LocalFile&&(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(b.getData(),b.getTitle(),
null==b.getMode())),null!=d&&d(),window.openWindow(t,null,x))});b.constructor==LocalFile?m():b.saveFile(b.getTitle(),!1,mxUtils.bind(this,function(){m()}),mxUtils.bind(this,function(q){k();null!=q&&"AbortError"==q.name||this.handleError(q)}))}};

// Vulnerability class: CWE-20