Beispiel #1
0
 public static function getName($path)
 {
     //$path = self::normalize($path);
     $p = Text\String::strrpos($path, self::DIRECTORY_SEPARATOR);
     if ($p !== false) {
         return substr($path, $p + 1);
     }
     return $path;
 }
Beispiel #2
0
 public function getValue($propertyCode)
 {
     if ($this->values === false) {
         $this->values = $this->queryValues();
     }
     if (isset($this->values[$propertyCode])) {
         return \Freetrix\Main\Text\String::htmlEncode($this->values[$propertyCode]["VALUE"]);
     } else {
         return "";
     }
 }
 public static function format(\Exception $exception, $htmlMode = false, $level = 0)
 {
     $result = '[' . get_class($exception) . '] ';
     if ($exception instanceof \ErrorException) {
         $result .= static::severityToString($exception->getSeverity());
     }
     $result .= "\n" . static::getMessage($exception) . "\n";
     if ($exception instanceof Main\DB\SqlQueryException) {
         $result .= $exception->getQuery() . "\n";
     }
     $fileLink = static::getFileLink($exception->getFile(), $exception->getLine());
     $result .= $fileLink . (empty($fileLink) ? "" : "\n");
     if ($htmlMode) {
         $result = Main\Text\String::htmlEncode($result);
     }
     $prevArg = null;
     $trace = static::getTrace($exception);
     foreach ($trace as $traceNum => $traceInfo) {
         $traceLine = '#' . $traceNum . ': ';
         if (array_key_exists('class', $traceInfo)) {
             $traceLine .= $traceInfo['class'] . $traceInfo['type'];
         }
         if (array_key_exists('function', $traceInfo)) {
             $traceLine .= $traceInfo['function'];
             $traceLine .= static::getArguments($traceInfo['args'], $level);
         }
         if ($htmlMode) {
             $traceLine = Main\Text\String::htmlEncode($traceLine);
         }
         if (array_key_exists('file', $traceInfo)) {
             $traceLine .= "\n\t" . static::getFileLink($traceInfo['file'], $traceInfo['line']);
         } else {
             $traceLine .= "\n\t" . static::getFileLink(null, null);
         }
         $result .= $traceLine . "\n";
     }
     if ($htmlMode) {
         $result = '<pre>' . $result . '</pre>';
     } else {
         $result .= static::DELIMITER;
     }
     return $result;
 }
		$entity->setFields($arFields);

		$templates = $ipropTemplates->findTemplates();
		if (is_array($_POST["IPROPERTY_TEMPLATES"]))
		{
			foreach ($_POST["IPROPERTY_TEMPLATES"] as $TEMPLATE_NAME => $TEMPLATE_VALUE)
			{
				$templates[$TEMPLATE_NAME] = array(
					"TEMPLATE" => \Freetrix\Iblock\Template\Helper::convertArrayToModifiers($TEMPLATE_VALUE),
				);
			}
		}

		$result = array();
		foreach ($templates as $TEMPLATE_NAME => $templateInfo)
		{
			$result[] = array(
				"id" => $TEMPLATE_NAME,
				"value" => \Freetrix\Main\Text\String::htmlEncode(
					\Freetrix\Iblock\Template\Engine::process($entity, $templateInfo["TEMPLATE"])
				),
			);
		}
		echo CUtil::PhpToJSObject($result);
		//$entity = $values->createTemplateEntity();
		//$entity->setFields($arFields);
		//$templates = $values->getTemplateEntity();
	}
}
require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_after.php");
?>
Beispiel #5
0
 public function write($arAllVars, $baseDir, $initDir, $filename, $TTL)
 {
     $documentRoot = Main\Loader::getDocumentRoot();
     $folder = $documentRoot . "/" . ltrim($baseDir . $initDir, "/");
     $fn = $folder . $filename;
     $fnTmp = $folder . md5(mt_rand()) . ".tmp";
     if (!CheckDirPath($fn)) {
         return;
     }
     if ($handle = fopen($fnTmp, "wb+")) {
         if (is_array($arAllVars)) {
             $contents = "<?";
             $contents .= "\nif(\$INCLUDE_FROM_CACHE!='Y')return false;";
             $contents .= "\n\$datecreate = '" . str_pad(mktime(), 12, "0", STR_PAD_LEFT) . "';";
             $contents .= "\n\$dateexpire = '" . str_pad(mktime() + intval($TTL), 12, "0", STR_PAD_LEFT) . "';";
             $contents .= "\n\$ser_content = '" . str_replace("'", "\\'", str_replace("\\", "\\\\", serialize($arAllVars))) . "';";
             $contents .= "\nreturn true;";
             $contents .= "\n?>";
         } else {
             $contents = "BX" . str_pad(mktime(), 12, "0", STR_PAD_LEFT) . str_pad(mktime() + intval($this->TTL), 12, "0", STR_PAD_LEFT);
             $contents .= $arAllVars;
         }
         $this->written = fwrite($handle, $contents);
         $this->path = $fn;
         $len = Main\Text\String::getBinaryLength($contents);
         fclose($handle);
         static::unlink($fn);
         if ($this->written === $len) {
             rename($fnTmp, $fn);
         }
         static::unlink($fnTmp);
     }
 }
Beispiel #6
0
	BX('bx_culture_link').href = 'culture_edit.php?ID='+culture.ID+'&lang=<?php 
echo LANGUAGE_ID;
?>
';
}
BX.ready(BXSetCulture);
</script>
			<select name="CULTURE_ID" onchange="BXSetCulture()" id="bx_culture_select">
<?
foreach($cultures as $cult):
?>
				<option value="<?php 
echo $cult["ID"];
?>
"<?if($cult["ID"] == $language["CULTURE_ID"]) echo " selected"?>><?php 
echo String::htmlEncode($cult["NAME"]);
?>
</option>
<?
endforeach;
?>
			</select>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><a href="culture_edit.php?lang=<?php 
echo LANGUAGE_ID;
?>
" id="bx_culture_link"><?echo Loc::getMessage("lang_edit_culture_edit")?></a></td>
	</tr>
Beispiel #7
0
 function SetPos($iCurPos = 0)
 {
     $iCurPos = intval($iCurPos);
     if ($iCurPos <= $this->iFileLength) {
         $this->iCurPos = $iCurPos;
     } else {
         $this->iCurPos = $this->iFileLength;
     }
     $pos = $this->iCurPos;
     if ($this->__hasBOM) {
         $pos += 3;
     }
     fseek($this->__file, $pos);
     if (feof($this->__file)) {
         $this->__buffer = "";
     } else {
         $this->__buffer = fread($this->__file, 1024 * 1024);
     }
     $this->__buffer_size = String::getBinaryLength($this->__buffer);
     $this->__buffer_pos = 0;
 }
Beispiel #8
0
 protected function decompress()
 {
     if (is_resource($this->outputStream)) {
         $compressed = stream_get_contents($this->outputStream, -1, 10);
         $compressed = String::getBinarySubstring($compressed, 0, -8);
         if ($compressed != '') {
             $uncompressed = gzinflate($compressed);
             rewind($this->outputStream);
             $len = fwrite($this->outputStream, $uncompressed);
             ftruncate($this->outputStream, $len);
         }
     } else {
         $compressed = String::getBinarySubstring($this->result, 10, -8);
         if ($compressed != '') {
             $this->result = gzinflate($compressed);
         }
     }
 }