public static function GetDirectoryName($hours_to_keep_files = 0, $subdir = "") { if($hours_to_keep_files <= 0) return self::GetFileName(''); if($subdir === "") { $dir_name = self::GetAbsoluteRoot().'/BXTEMP-'.date('Y-m-d/H/', time()+3600*$hours_to_keep_files); $i = 0; while(true) { $i++; $dir_add = md5(mt_rand()); $temp_path = $dir_name.$dir_add."/"; if(!file_exists($temp_path)) break; } } else //Fixed name during the session { $subdir = implode("/", (is_array($subdir) ? $subdir : array($subdir, freetrix_sessid())))."/"; while (strpos($subdir, "//") !== false) $subdir = str_replace("//", "/", $subdir); $bFound = false; for($i = $hours_to_keep_files-1; $i > 0; $i--) { $dir_name = self::GetAbsoluteRoot().'/BXTEMP-'.date('Y-m-d/H/', time()+3600*$i); $temp_path = $dir_name.$subdir; if(file_exists($temp_path) && is_dir($temp_path)) { $bFound = true; break; } } if(!$bFound) { $dir_name = self::GetAbsoluteRoot().'/BXTEMP-'.date('Y-m-d/H/', time()+3600*$hours_to_keep_files); $temp_path = $dir_name.$subdir; } } //Delayed unlink if(empty(self::$arFiles)) register_shutdown_function(array('CTempFile', 'Cleanup')); //Function ends only here return $temp_path; }
protected function initSession($CID, $controlId) { $ts = time(); if (!isset($_SESSION[self::SESSION_LIST][$controlId])) { $_SESSION[self::SESSION_LIST][$controlId] = array(); } else { foreach ($_SESSION[self::SESSION_LIST][$controlId] as $key => $arSession) { if ($arSession["SESSID"] != freetrix_sessid() || $ts - $arSession["TS"] > self::SESSION_TTL) { $c = $_SESSION[self::SESSION_LIST][$controlId][$key]["CID"]; unset($_SESSION[self::SESSION_LIST][$controlId][$key]); unset($_SESSION[self::SESSION_VAR_PREFIX . $c]); } } } $_SESSION[self::SESSION_LIST][$controlId][] = array("CID" => $CID, "TS" => $ts, "SESSID" => freetrix_sessid()); $_SESSION[self::SESSION_VAR_PREFIX . $CID] = array(); }
top.CloseWaitWindow(); top.<?php echo $obJSPopup->jsPopup; ?> .ShowError('<?php echo CUtil::JSEscape($strWarning); ?> '); var pMainObj = top.GLOBAL_pMainObj['<?php echo CUtil::JSEscape($editor_name); ?> ']; pMainObj.Show(true); <?if ($bSessIDRefresh):?> top.BXSetSessionID('<?php echo CUtil::JSEscape(freetrix_sessid()); ?> '); <?endif;?> </script> <? } die(); } } else { ?> <script> top.CloseWaitWindow(); top.<?php
require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_before.php"); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/prolog.php"); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/classes/general/sticker.php"); if (!$USER->CanDoOperation('fileman_view_file_structure') || !$USER->CanDoOperation('fileman_edit_existent_files') || !CSticker::CanDoOperation('sticker_view')) $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/include.php"); if(CModule::IncludeModule("compression")) CCompress::Disable2048Spaces(); $action = isset($_REQUEST['sticker_action']) ? $_REQUEST['sticker_action'] : false; if (!check_freetrix_sessid()) die('<!--FX_STICKER_DUBLICATE_ACTION_REQUEST'.freetrix_sessid().'-->'); CUtil::JSPostUnEscape(); if($action == 'show_stickers' || $action == 'hide_stickers') { // Save user choise CSticker::SetBShowStickers($action == 'show_stickers'); if ($_REQUEST['b_inited'] == "N") { $Stickers = CSticker::GetList(array( 'arFilter' => array( 'USER_ID' => $USER->GetId(), 'PAGE_URL' => $_POST['pageUrl'], 'CLOSED' => 'N', 'DELETED' => 'N',
function PrologActions() { /** @global CMain $APPLICATION */ global $APPLICATION, $USER; if (defined("FX_CHECK_SHORT_URI") && FX_CHECK_SHORT_URI) { if ($arUri = CBXShortUri::GetUri($_SERVER["REQUEST_URI"])) { CBXShortUri::SetLastUsed($arUri["ID"]); if (CModule::IncludeModule("statistic")) { CStatEvent::AddCurrent("short_uri_redirect", "", "", "", "", $arUri["URI"], "N", SITE_ID); } LocalRedirect($arUri["URI"], true, CBXShortUri::GetHttpStatusCodeText($arUri["STATUS"])); die; } } //session expander if (COption::GetOptionString("main", "session_expand", "Y") != "N" && (!defined("FX_SKIP_SESSION_EXPAND") || FX_SKIP_SESSION_EXPAND === false)) { $arPolicy = $USER->GetSecurityPolicy(); $phpSessTimeout = ini_get("session.gc_maxlifetime"); if ($arPolicy["SESSION_TIMEOUT"] > 0) { $sessTimeout = min($arPolicy["SESSION_TIMEOUT"] * 60, $phpSessTimeout); } else { $sessTimeout = $phpSessTimeout; } $cookie_prefix = COption::GetOptionString('main', 'cookie_name', 'FREETRIX_SM'); $salt = $_COOKIE[$cookie_prefix . '_UIDH'] . "|" . $_SERVER["REMOTE_ADDR"] . "|" . @filemtime($_SERVER["DOCUMENT_ROOT"] . "/freetrix/modules/main/classes/general/version.php") . "|" . LICENSE_KEY . "|" . CMain::GetServerUniqID(); $key = md5(freetrix_sessid() . $salt); $bShowMess = $USER->IsAuthorized() && COption::GetOptionString("main", "session_show_message", "Y") != "N"; CUtil::InitJSCore(array('ajax')); $jsMsg = '<script type="text/javascript">' . "\n" . ($bShowMess ? 'bxSession.mess.messSessExpired = \'' . CUtil::JSEscape(GetMessage("MAIN_SESS_MESS", array("#TIMEOUT#" => round($sessTimeout / 60)))) . '\';' . "\n" : '') . 'bxSession.Expand(' . $sessTimeout . ', \'' . freetrix_sessid() . '\', ' . ($bShowMess ? 'true' : 'false') . ', \'' . $key . '\');' . "\n" . '</script>'; $APPLICATION->AddHeadScript('/freetrix/js/main/session.js'); $APPLICATION->AddAdditionalJS($jsMsg); $_SESSION["FX_SESSION_COUNTER"] = intval($_SESSION["FX_SESSION_COUNTER"]) + 1; if (!defined("FX_SKIP_SESSION_TERMINATE_TIME")) { $_SESSION["FX_SESSION_TERMINATE_TIME"] = time() + $sessTimeout; } } //user auto time zone via js cookies if (CTimeZone::Enabled() && (!defined("FX_SKIP_TIMEZONE_COOKIE") || FX_SKIP_TIMEZONE_COOKIE === false)) { CTimeZone::SetAutoCookie(); } // check user options set via cookie if ($USER->IsAuthorized()) { $cookieName = COption::GetOptionString("main", "cookie_name", "FREETRIX_SM") . "_LAST_SETTINGS"; if (!empty($_COOKIE[$cookieName])) { CUserOptions::SetCookieOptions($cookieName); } } if (COption::GetOptionString("main", "buffer_content", "Y") == "Y" && (!defined("FX_BUFFER_USED") || FX_BUFFER_USED !== true)) { ob_start(array(&$APPLICATION, "EndBufferContent")); $APPLICATION->buffered = true; define("FX_BUFFER_USED", true); register_shutdown_function(create_function('', 'while(@ob_end_flush());')); } foreach (GetModuleEvents("main", "OnProlog", true) as $arEvent) { ExecuteModuleEventEx($arEvent); } }
function ShowDialogScript($arConfig = array()) { global $USER; CUtil::InitJSCore(array('ajax')); $strWarn = ''; $arConfig['bReadOnly'] = false; $arConfig['lang'] = LANGUAGE_ID; $event = ''; if (isset($arConfig['event'])) $event = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['event']); if (strlen($event) <= 0) $strWarn .= GetMessage('ML_BAD_EVENT').'. '; $resultDest = ""; $bDest = is_array($arConfig['arResultDest']); if ($bDest) { if (isset($arConfig['arResultDest']["FUNCTION_NAME"])) { $arConfig['arResultDest']["FUNCTION_NAME"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["FUNCTION_NAME"]); $bDest = strlen($arConfig['arResultDest']["FUNCTION_NAME"]) > 0; $resultDest = "FUNCTION"; } elseif (isset($arConfig['arResultDest']["FORM_NAME"], $arConfig['arResultDest']["FORM_ELEMENT_NAME"])) { $arConfig['arResultDest']["FORM_NAME"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["FORM_NAME"]); $arConfig['arResultDest']["FORM_ELEMENT_NAME"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["FORM_ELEMENT_NAME"]); $bDest = strlen($arConfig['arResultDest']["FORM_NAME"]) > 0 && strlen($arConfig['arResultDest']["FORM_ELEMENT_NAME"]) > 0; $resultDest = "FORM"; } elseif (isset($arConfig['arResultDest']["ELEMENT_ID"])) { $arConfig['arResultDest']["ELEMENT_ID"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["ELEMENT_ID"]); $bDest = strlen($arConfig['arResultDest']["ELEMENT_ID"]) > 0; $resultDest = "ID"; } else { $bDest = false; } } if (!$bDest) $strWarn .= GetMessage('ML_BAD_RETURN').'. '; if (strlen($strWarn) <= 0) { ?> <script> if (!window.BX && top.BX) window.BX = top.BX; <?CMedialib::AppendLangMessages();?> window.<?php echo $arConfig['event']; ?> = function(bLoadJS) { if (window.oBXMedialib && window.oBXMedialib.bOpened) return false; <?if(!CMedialib::CanDoOperation('medialib_view_collection', 0)):?> return alert(ML_MESS.AccessDenied); <?else:?> if (!window.BXMediaLib) { if (bLoadJS !== false) { // Append CSS BX.loadCSS("/freetrix/js/fileman/medialib/medialib.css"); var arJS = []; if (!window.jsAjaxUtil) arJS.push("/freetrix/js/main/ajax.js?v=<?php echo filemtime($_SERVER["DOCUMENT_ROOT"] . '/freetrix/js/main/ajax.js'); ?> "); if (!window.jsUtils) arJS.push("/freetrix/js/main/utils.js?v=<?php echo filemtime($_SERVER["DOCUMENT_ROOT"] . '/freetrix/js/main/utils.js'); ?> "); if (!window.CHttpRequest) arJS.push("/freetrix/js/main/admin_tools.js?v=<?php echo filemtime($_SERVER["DOCUMENT_ROOT"] . '/freetrix/js/main/admin_tools.js'); ?> "); arJS.push("/freetrix/js/fileman/medialib/common.js?v=<?php echo filemtime($_SERVER["DOCUMENT_ROOT"] . '/freetrix/js/fileman/medialib/common.js'); ?> "); arJS.push("/freetrix/js/fileman/medialib/core.js?v=<?php echo filemtime($_SERVER["DOCUMENT_ROOT"] . '/freetrix/js/fileman/medialib/core.js'); ?> "); BX.loadScript(arJS); } return setTimeout(function(){<?php echo $arConfig['event']; ?> (false)}, 50); } <?CMedialib::ShowJS()?> <? $arSet = explode(',' , CUserOptions::GetOption("fileman", "medialib_user_set", '600,450,0')); $width = $arSet[0] ? intVal($arSet[0]) : 600; $height = $arSet[1] ? intVal($arSet[1]) : 450; $coll_id = $arSet[2] ? intVal($arSet[2]) : 0; ?> window._mlUserSettings = window._mlUserSettings || {width: <?php echo $width; ?> , height: <?php echo $height; ?> , coll_id: <?php echo $coll_id; ?> } var oConfig = { sessid: "<?php echo freetrix_sessid(); ?> ", thumbWidth : <?php echo COption::GetOptionInt('fileman', "ml_thumb_width", 140); ?> , thumbHeight : <?php echo COption::GetOptionInt('fileman', "ml_thumb_height", 105); ?> , userSettings : window._mlUserSettings, resType: "<?php echo $resultDest; ?> ", Types : <?php echo CUtil::PhpToJSObject(CMedialib::GetTypes($arConfig['types'])); ?> , arResultDest : <?php echo CUtil::PhpToJSObject($arConfig['arResultDest']); ?> , rootAccess: { new_col: '<?php echo CMedialib::CanDoOperation('medialib_new_collection', 0); ?> ', edit: '<?php echo CMedialib::CanDoOperation('medialib_edit_collection', 0); ?> ', del: '<?php echo CMedialib::CanDoOperation('medialib_del_collection', 0); ?> ', new_item: '<?php echo CMedialib::CanDoOperation('medialib_new_item', 0); ?> ', edit_item: '<?php echo CMedialib::CanDoOperation('medialib_edit_item', 0); ?> ', del_item: '<?php echo CMedialib::CanDoOperation('medialib_del_item', 0); ?> ', access: '<?php echo CMedialib::CanDoOperation('medialib_access', 0); ?> ' }, bCanUpload: <?php echo $USER->CanDoOperation('fileman_upload_files') ? 'true' : 'false'; ?> , bCanViewStructure: <?php echo $USER->CanDoOperation('fileman_view_file_structure') ? 'true' : 'false'; ?> , strExt : "<?php echo CUtil::JSEscape(CMedialib::GetMediaExtentions()); ?> ", lang : "<?php echo $arConfig['lang']; ?> ", description_id : '<?php echo CUtil::JSEscape($arConfig['description_id']); ?> ' }; window.oBXMedialib = new BXMediaLib(oConfig); oBXMedialib.Open(); <?endif;?> } </script> <? } else { echo '<font color="#FF0000">'.htmlspecialcharsbx($strWarn).'</font>'; } }
public static function GetCoreMessages() { global $USER; $userId = ""; $autoTimeZone = "N"; if (is_object($USER)) { $autoTimeZone = trim($USER->GetParam("AUTO_TIME_ZONE")); if ($USER->GetID() > 0) { $userId = $USER->GetID(); } } $arMessages = array( "LANGUAGE_ID" => LANGUAGE_ID, "FORMAT_DATE" => FORMAT_DATE, "FORMAT_DATETIME" => FORMAT_DATETIME, "COOKIE_PREFIX" => COption::GetOptionString("main", "cookie_name", "FREETRIX_SM"), "USER_ID" => $userId, "SERVER_TIME" => time(), "SERVER_TZ_OFFSET" => date("Z"), "USER_TZ_OFFSET" => CTimeZone::GetOffset(), "USER_TZ_AUTO" => $autoTimeZone == "N" ? "N": "Y", "freetrix_sessid" => freetrix_sessid(), ); if (!defined("ADMIN_SECTION") || ADMIN_SECTION !== true) $arMessages["SITE_ID"] = SITE_ID; return $arMessages; }
function OnEpilog() { if(isset($_REQUEST["sphrase_id"])) { $phrase_id = intval($_REQUEST["sphrase_id"]); if($phrase_id) { $DB = CDatabase::GetModuleConnection('search'); $rs = $DB->Query(" SELECT * FROM b_search_phrase WHERE ID = ".$phrase_id." AND SESSION_ID = '".$DB->ForSQL(freetrix_sessid())."' AND URL_TO IS NULL "); if($ar = $rs->Fetch()) { $URL_TO = $DB->ForSQL(CSearchStatistic::GetCurrentURL(), 2000); $DB->Query(" UPDATE b_search_phrase SET URL_TO = '".$URL_TO."' ,URL_TO_404 = '".(defined("ERROR_404")? "Y": "N")."' ,URL_TO_SITE_ID = ".(defined("SITE_ID")? "'".$DB->ForSQL(SITE_ID, 2)."'": "null")." WHERE ID = ".$phrase_id." "); } } } }
); $bCustomForm = (strlen($arIBlock["EDIT_FILE_AFTER"])>0 && is_file($_SERVER["DOCUMENT_ROOT"].$arIBlock["EDIT_FILE_AFTER"])) || (strlen($arIBTYPE["EDIT_FILE_AFTER"])>0 && is_file($_SERVER["DOCUMENT_ROOT"].$arIBTYPE["EDIT_FILE_AFTER"])); $arPostParams = array( 'bxpublic' => 'Y' ); if (defined('FX_SUB_SETTINGS') && FX_SUB_SETTINGS == true) { $arPostParams['bxsku'] = 'Y'; } if ('' != $strProductName) { $arPostParams['PRODUCT_NAME'] = $strProductName; $arPostParams['sessid'] = freetrix_sessid(); } $arListUrl = array( 'LINK' => $APPLICATION->GetCurPageParam(), 'POST_PARAMS' => $arPostParams, ); if($ID>0) { $rsElement = CIBlockElement::GetList( array(), array("ID" => $ID, "IBLOCK_ID" => $IBLOCK_ID, "SHOW_HISTORY"=>"Y"), false, false, array("ID", "CREATED_BY")
<? require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_before.php"); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/prolog.php"); if (!isset($_POST['name']) && !isset($_POST['source'])) // Some bogus call die(); if (!($USER->CanDoOperation('fileman_admin_files') || $USER->CanDoOperation('fileman_edit_existent_files'))) die('FX_EDITOR_ERROR: ACCESS_DENIED'); if(!check_freetrix_sessid()) { $APPLICATION->RestartBuffer(); die('<!--FX_EDITOR_ERROR_SESSION_EXPIRED'.freetrix_sessid().'-->'); } require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/include.php"); CEditorUtils::RenderComponents(array( 'name' => isset($_POST['name']) ? $_POST['name'] : false, 'template' => isset($_POST['template']) ? $_POST['template'] : '', 'params' => isset($_POST['params']) ? CEditorUtils::UnJSEscapeArray($_POST['params']) : false, 'source' => isset($_POST['source']) ? $_POST['source'] : false, 'siteTemplateId' => isset($_POST['stid']) ? $_POST['stid'] : false )); require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin_after.php"); ?>
foreach ($arHiddenPropFields as &$strPropField) { if (isset($arProperty[$strPropField])) { $arHidden[$strPropField] = $arProperty[$strPropField]; unset($arProperty[$strPropField]); } } $arProperty['PROPINFO'] = base64_encode(serialize($arHidden)); $strResult = CUtil::PhpToJsObject($arProperty); ?><script type="text/javascript"> arResult = <? echo $strResult; ?>; if (top.<? echo $strReceiver; ?>) { top.<? echo $strReceiver; ?>.SetPropInfo('<? echo $PARAMS['ID']; ?>',arResult,'<? echo freetrix_sessid(); ?>'); } top.BX.closeWait(); top.BX.WindowManager.Get().AllowClose(); top.BX.WindowManager.Get().Close(); </script><? require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin_js.php"); die(); } $aTabs = array(); $tabControl = null; if(!$bFullForm) { $arProperty = array(); $PROPERTY = $_POST['PROP']; $PARAMS = $_POST['PARAMS'];
$idTmp = $f_ID; $arID = explode(":", $f_ID); if (count($arID) > 2) $idTmp = $arID[1].":".$arID[2]; $row->AddField("ID", $idTmp); $arActions = Array(); if ($isAdmin) { $startType = (array_key_exists("START_TYPE",$arRes) ? $arRes["START_TYPE"] : "POPUP"); $startType = strtoupper($startType); if ($startType == "POPUP") $arActions[] = array("DEFAULT" => "Y", "ICON"=>"install", "TEXT" => GetMessage("MAIN_WIZARD_ADMIN_INSTALL"), "ACTION"=>"WizardWindow.Open('".$f_ID."','".freetrix_sessid()."')"); else if ($startType == "WINDOW") $arActions[] = Array( "DEFAULT" => "Y", "ICON"=>"install", "TEXT" => GetMessage("MAIN_WIZARD_ADMIN_INSTALL"), "ACTION"=>"window.open('wizard_install.php?lang=".LANGUAGE_ID."&wizardName=".$f_ID."&".freetrix_sessid_get()."');" ); } if (count($arID) <= 2) $arActions[] = array("ICON"=>"export", "TEXT"=>GetMessage("MAIN_WIZARD_ADMIN_DOWNLOAD"), "ACTION"=>"exportWizard('".$f_ID."')"); if ($isAdmin && (count($arID) <= 2)) { $arActions[] = Array("SEPARATOR"=>true);
/** * Imports an xml file into iblock. File may be an .tar.gz archive. * * @param string $file_name Name of the file to import * @param string $iblock_type IBlock type ID to import iblock to * @param string|array $site_id ID of the site or array of IDs to bind iblock to * @param string $section_action What to do with sections missed in the file. D - delete or A - deactivate. * @param string $element_action What to do with elements missed in the file. D - delete or A - deactivate. * @param bool $use_crc Whenever to use CRC check for optimizi=ation or force an update * @param bool $preview If true when use iblock settings to generate preview pictures from detail. * @param bool $sync If true uses alternative set of tables in order not to interfere with other import processes * @param bool $return_last_error If true will return string with error description in case of failure * @param bool $return_iblock_id If true will return iblock identifier (int) in case of success * @return bool|int|string */ function ImportXMLFile($file_name, $iblock_type = "-", $site_id = '', $section_action = "D", $element_action = "D", $use_crc = false, $preview = false, $sync = false, $return_last_error = false, $return_iblock_id = false) { /** @global CMain $APPLICATION */ global $APPLICATION; $ABS_FILE_NAME = false; if (strlen($file_name) > 0) { if (file_exists($file_name) && is_file($file_name) && (substr($file_name, -4) === ".xml" || substr($file_name, -7) === ".tar.gz")) { $ABS_FILE_NAME = $file_name; } else { $filename = trim(str_replace("\\", "/", trim($file_name)), "/"); $FILE_NAME = rel2abs($_SERVER["DOCUMENT_ROOT"], "/" . $filename); if (strlen($FILE_NAME) > 1 && $FILE_NAME === "/" . $filename && $APPLICATION->GetFileAccessPermission($FILE_NAME) >= "W") { $ABS_FILE_NAME = $_SERVER["DOCUMENT_ROOT"] . $FILE_NAME; } } } if (!$ABS_FILE_NAME) { return GetMessage("IBLOCK_XML2_FILE_ERROR"); } $WORK_DIR_NAME = substr($ABS_FILE_NAME, 0, strrpos($ABS_FILE_NAME, "/") + 1); if (substr($ABS_FILE_NAME, -7) == ".tar.gz") { include_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/general/tar_gz.php"; $obArchiver = new CArchiver($ABS_FILE_NAME); if (!$obArchiver->ExtractFiles($WORK_DIR_NAME)) { $strError = ""; if (is_object($APPLICATION)) { $arErrors = $obArchiver->GetErrors(); if (count($arErrors)) { foreach ($arErrors as $error) { $strError .= $error[1] . "<br>"; } } } if ($strError != "") { return $strError; } else { return GetMessage("IBLOCK_XML2_FILE_ERROR"); } } $IMP_FILE_NAME = substr($ABS_FILE_NAME, 0, -7) . ".xml"; } else { $IMP_FILE_NAME = $ABS_FILE_NAME; } $fp = fopen($IMP_FILE_NAME, "rb"); if (!$fp) { return GetMessage("IBLOCK_XML2_FILE_ERROR"); } if ($sync) { $table_name = "b_xml_tree_sync"; } else { $table_name = "b_xml_tree"; } $NS = array("STEP" => 0); $obCatalog = new CIBlockCMLImport(); $obCatalog->Init($NS, $WORK_DIR_NAME, $use_crc, $preview, false, false, false, $table_name); if ($sync) { if (!$obCatalog->StartSession(freetrix_sessid())) { return GetMessage("IBLOCK_XML2_TABLE_CREATE_ERROR"); } $obCatalog->ReadXMLToDatabase($fp, $NS, 0, 1024); $xml_root = $obCatalog->GetSessionRoot(); $bUpdateIBlock = false; } else { $obCatalog->DropTemporaryTables(); if (!$obCatalog->CreateTemporaryTables()) { return GetMessage("IBLOCK_XML2_TABLE_CREATE_ERROR"); } $obCatalog->ReadXMLToDatabase($fp, $NS, 0, 1024); if (!$obCatalog->IndexTemporaryTables()) { return GetMessage("IBLOCK_XML2_INDEX_ERROR"); } $xml_root = 1; $bUpdateIBlock = true; } fclose($fp); $result = $obCatalog->ImportMetaData($xml_root, $iblock_type, $site_id, $bUpdateIBlock); if ($result !== true) { return GetMessage("IBLOCK_XML2_METADATA_ERROR") . implode("\n", $result); } $obCatalog->ImportSections(); $obCatalog->DeactivateSections($section_action); $obCatalog->SectionsResort(); $obCatalog = new CIBlockCMLImport(); $obCatalog->Init($NS, $WORK_DIR_NAME, $use_crc, $preview, false, false, false, $table_name); if ($sync) { if (!$obCatalog->StartSession(freetrix_sessid())) { return GetMessage("IBLOCK_XML2_TABLE_CREATE_ERROR"); } } $SECTION_MAP = false; $PRICES_MAP = false; $obCatalog->ReadCatalogData($SECTION_MAP, $PRICES_MAP); $obCatalog->ImportElements(time(), 0); $obCatalog->ImportProductSets(); $obCatalog->DeactivateElement($element_action, time(), 0); if ($sync) { $obCatalog->EndSession(); } if ($return_last_error) { if (strlen($obCatalog->LAST_ERROR)) { return $obCatalog->LAST_ERROR; } } if ($return_iblock_id) { return intval($NS["IBLOCK_ID"]); } else { return true; } }
"filterShow"=>GetMessage("interface_grid_from_head_1"), "filterApplyTitle"=>GetMessage("interface_grid_filter_apply"), ), "ajax"=>array( "AJAX_ID"=>$arParams["AJAX_ID"], "AJAX_OPTION_SHADOW"=>($arParams["AJAX_OPTION_SHADOW"] == "Y"), ), "settingWndSize"=>CUtil::GetPopupSize("InterfaceGridSettingWnd"), "viewsWndSize"=>CUtil::GetPopupSize("InterfaceGridViewsWnd", array('height' => 350, 'width' => 500)), "filtersWndSize"=>CUtil::GetPopupSize("InterfaceGridFiltersWnd", array('height' => 350, 'width' => 500)), "filterSettingWndSize"=>CUtil::GetPopupSize("InterfaceGridFilterSettingWnd"), "calendar_image"=>$this->GetFolder()."/images/calendar.gif", "server_time"=>(time()+date("Z")+CTimeZone::GetOffset()), "component_path"=>$component->GetRelativePath(), "template_path"=>$this->GetFolder(), "sessid"=>freetrix_sessid(), "current_url"=>$arResult["CURRENT_URL"], "user_authorized"=>$USER->IsAuthorized(), ); ?> <script type="text/javascript"> var settingsDialog<?php echo $arParams["GRID_ID"]; ?> ; var viewsDialog<?php echo $arParams["GRID_ID"]; ?> ; var filtersDialog<?php
private function fillRequireData($requestType) { $this->mode = $this->getPost("mode", $requestType); $this->CID = $this->getPost("CID", $requestType); $this->path = CTempFile::GetDirectoryName( 12, array( "bxu", md5(serialize(array( "CID" => $this->CID, "sessid" => freetrix_sessid())) ) ) ); if (in_array($this->mode, array("upload", "delete", "view"))) { if (empty($this->CID)) $this->error = "BXU344"; else if (!check_freetrix_sessid()) $this->error = "BXU345"; else if (!CheckDirPath($this->path)) $this->error .= "BXU346"; else if ($this->getPost("packageIndex", $requestType)) { $this->package = array( "handler" => CBXVirtualIo::GetInstance()->GetFile($this->path.$this->getPost("packageIndex").".package"), "id" => $this->getPost("packageIndex"), "data" => array("filesCount" => intval($this->getPost("filesCount")), "files" => array()) ); if ($this->package["handler"]->IsExists()) $this->package["data"] = unserialize($this->package["handler"]->GetContents()); } else if ($this->mode == "upload") $this->error = "BXU344.1"; $this->uploading = array( "handler" => CBXVirtualIo::GetInstance()->GetFile($this->path.".log"), "data" => array()); if ($this->uploading["handler"]->IsExists()) $this->uploading["data"] = unserialize($this->uploading["handler"]->GetContents()); return true; } return false; }
var oForum = {}; oForum.page_number = <?php echo intval($arResult['PAGE_NUMBER']); ?> ; oForum.page_count = <?php echo intval($arResult['PAGE_COUNT']); ?> ; if (typeof oHelp != "object") var oHelp = {}; if (typeof phpVars != "object") var phpVars = {}; phpVars.freetrix_sessid = '<?php echo freetrix_sessid(); ?> '; function reviewsCtrlEnterHandler<?php echo CUtil::JSEscape($arParams["form_index"]); ?> () { if (window.oLHE) window.oLHE.SaveContent(); var form = document.forms["REPLIER<?php echo CUtil::JSEscape($arParams["form_index"]); ?> "]; if (BX.fireEvent(form, 'submit'))
public static function SetCookieOptions($cookieName) { //last user setting $varCookie = array(); parse_str($_COOKIE[$cookieName], $varCookie); setcookie($cookieName, false, false, "/"); if (is_array($varCookie["p"]) && $varCookie["sessid"] == freetrix_sessid()) { $arOptions = $varCookie["p"]; CUtil::decodeURIComponent($arOptions); CUserOptions::SetOptionsFromArray($arOptions); } }
function ShowScript() { /** @global CMain $APPLICATION */ global $APPLICATION; //PHP-depended variables $aUserOpt = CUserOptions::GetOption("global", "settings"); $s = " <script type=\"text/javascript\"> var phpVars = { 'ADMIN_THEME_ID': '".CUtil::JSEscape(ADMIN_THEME_ID)."', 'LANGUAGE_ID': '".CUtil::JSEscape(LANGUAGE_ID)."', 'FORMAT_DATE': '".CUtil::JSEscape(FORMAT_DATE)."', 'FORMAT_DATETIME': '".CUtil::JSEscape(FORMAT_DATETIME)."', 'opt_context_ctrl': ".($aUserOpt["context_ctrl"] == "Y"? "true":"false").", 'cookiePrefix': '".CUtil::JSEscape(COption::GetOptionString("main", "cookie_name", "FREETRIX_SM"))."', 'titlePrefix': '".CUtil::JSEscape(COption::GetOptionString("main", "site_name", $_SERVER["SERVER_NAME"]))." - ', 'freetrix_sessid': '".freetrix_sessid()."', 'messHideMenu': '".CUtil::JSEscape(GetMessage("admin_lib_hide_menu"))."', 'messShowMenu': '".CUtil::JSEscape(GetMessage("admin_lib_show_menu"))."', 'messHideButtons': '".CUtil::JSEscape(GetMessage("admin_lib_less_buttons"))."', 'messShowButtons': '".CUtil::JSEscape(GetMessage("admin_lib_more_buttons"))."', 'messFilterInactive': '".CUtil::JSEscape(GetMessage("admin_lib_filter_clear"))."', 'messFilterActive': '".CUtil::JSEscape(GetMessage("admin_lib_filter_set"))."', 'messFilterLess': '".CUtil::JSEscape(GetMessage("admin_lib_filter_less"))."', 'messLoading': '".CUtil::JSEscape(GetMessage("admin_lib_loading"))."', 'messMenuLoading': '".CUtil::JSEscape(GetMessage("admin_lib_menu_loading"))."', 'messMenuLoadingTitle': '".CUtil::JSEscape(GetMessage("admin_lib_loading_title"))."', 'messNoData': '".CUtil::JSEscape(GetMessage("admin_lib_no_data"))."', 'messExpandTabs': '".CUtil::JSEscape(GetMessage("admin_lib_expand_tabs"))."', 'messCollapseTabs': '".CUtil::JSEscape(GetMessage("admin_lib_collapse_tabs"))."', 'messPanelFixOn': '".CUtil::JSEscape(GetMessage("admin_lib_panel_fix_on"))."', 'messPanelFixOff': '".CUtil::JSEscape(GetMessage("admin_lib_panel_fix_off"))."', 'messPanelCollapse': '".CUtil::JSEscape(GetMessage("admin_lib_panel_hide"))."', 'messPanelExpand': '".CUtil::JSEscape(GetMessage("admin_lib_panel_show"))."' }; </script> "; $APPLICATION->AddHeadScript('/freetrix/js/main/utils.js'); $APPLICATION->AddHeadScript('/freetrix/js/main/admin_tools.js'); $APPLICATION->AddHeadScript('/freetrix/js/main/popup_menu.js'); $APPLICATION->AddHeadScript('/freetrix/js/main/admin_search.js'); $APPLICATION->AddHeadScript('/freetrix/js/main/hot_keys.js'); return $s; }
function ShowScript($arConfig) { global $USER; $bCloudsBrowse = is_object($USER) && $USER->CanDoOperation("clouds_browse") && $arConfig["operation"] === "O"; CUtil::InitJSCore(array('ajax', 'window')); if(CModule::IncludeModule("fileman")) { $arConfig['path'] = (isset($arConfig['arPath']['PATH']) ? $arConfig['arPath']['PATH'] : ''); $arConfig['site'] = (isset($arConfig['arPath']['SITE']) ? $arConfig['arPath']['SITE'] : ''); $arConfig['lang'] = (isset($arConfig['lang']) ? $arConfig['lang'] : LANGUAGE_ID); $arConfig['zIndex'] = isset($arConfig['zIndex']) ? $arConfig['zIndex'] : 2500; $io = CBXVirtualIo::GetInstance(); $path = $io->CombinePath("/", $arConfig['path']); $path = CFileMan::SecurePathVar($path); $rootPath = CSite::GetSiteDocRoot($arConfig['site']); while (!$io->DirectoryExists($rootPath.$path)) { $rpos = strrpos($path, '/'); if ($rpos === false || $rpos < 1) { $path = '/'; break; } $path = rtrim(substr($path, 0, $rpos), "/\\"); } if (!$path || $path == '') $path = '/'; $arConfig['path'] = $path; $functionError = ""; if (!isset($arConfig['event'])) { $functionError .= GetMessage("FX_FD_NO_EVENT").". "; } else { $arConfig['event'] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['event']); if (strlen($arConfig['event']) <= 0) $functionError .= GetMessage("FX_FD_NO_EVENT").". "; } $resultDest = ""; if (!isset($arConfig['arResultDest']) || !is_array($arConfig['arResultDest'])) { $functionError .= GetMessage("FX_FD_NO_RETURN_PRM").". "; } else { if (isset($arConfig['arResultDest']["FUNCTION_NAME"]) && strlen($arConfig['arResultDest']["FUNCTION_NAME"]) > 0) { $arConfig['arResultDest']["FUNCTION_NAME"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["FUNCTION_NAME"]); if (strlen($arConfig['arResultDest']["FUNCTION_NAME"]) <= 0) $functionError .= GetMessage("FX_FD_NO_RETURN_FNC").". "; else $resultDest = "FUNCTION"; } elseif (isset($arConfig['arResultDest']["FORM_NAME"]) && strlen($arConfig['arResultDest']["FORM_NAME"]) > 0 && isset($arConfig['arResultDest']["FORM_ELEMENT_NAME"]) && strlen($arConfig['arResultDest']["FORM_ELEMENT_NAME"]) > 0) { $arConfig['arResultDest']["FORM_NAME"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["FORM_NAME"]); $arConfig['arResultDest']["FORM_ELEMENT_NAME"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["FORM_ELEMENT_NAME"]); if (strlen($arConfig['arResultDest']["FORM_NAME"]) <= 0 || strlen($arConfig['arResultDest']["FORM_ELEMENT_NAME"]) <= 0) $functionError .= GetMessage("FX_FD_NO_RETURN_FRM").". "; else $resultDest = "FORM"; } elseif (isset($arConfig['arResultDest']["ELEMENT_ID"]) && strlen($arConfig['arResultDest']["ELEMENT_ID"]) > 0) { $arConfig['arResultDest']["ELEMENT_ID"] = preg_replace("/[^a-zA-Z0-9_]/i", "", $arConfig['arResultDest']["ELEMENT_ID"]); if (strlen($arConfig['arResultDest']["ELEMENT_ID"]) <= 0) $functionError .= GetMessage("FX_FD_NO_RETURN_ID").". "; else $resultDest = "ID"; } else { $functionError .= GetMessage("FX_FD_BAD_RETURN").". "; } } } else { $functionError = GetMessage("FX_FD_NO_FILEMAN"); } if (strlen($functionError) <= 0) { ?> <script> var mess_SESS_EXPIRED = '<?php echo GetMessage('FX_FD_ERROR') . ': ' . GetMessage('FX_FD_SESS_EXPIRED'); ?> '; var mess_ACCESS_DENIED = '<?php echo GetMessage('FX_FD_ERROR') . ': ' . GetMessage('FX_FD_NO_PERMS'); ?> '; window.<?php echo CUtil::JSEscape($arConfig['event']); ?> = function(bLoadJS, Params) { if (!Params) Params = {}; <?if(!$GLOBALS['USER']->CanDoOperation('fileman_view_file_structure')):?> return alert(mess_ACCESS_DENIED); <?else:?> <? $fd_config = stripslashes(CUserOptions::GetOption("fileman", "file_dialog_config", "N")); if ($fd_config == "N" || $arConfig['saveConfig'] === false) { ?> var UserConfig = { site : '<?php echo CUtil::JSEscape($arConfig['site']); ?> ', path : '<?php echo CUtil::JSEscape($arConfig['path']); ?> ', view : "list", sort : "type", sort_order : "asc" }; <? } else { $res = explode(";", $fd_config); if ($res[0]) $arConfig['site'] = $res[0]; if ($res[1]) $arConfig['path'] = rtrim($res[1], " /\\"); if (!$io->DirectoryExists($rootPath.$arConfig['path'])) $arConfig['path'] = '/'; ?> var UserConfig = { site : '<?php echo CUtil::JSEscape($arConfig['site']); ?> ', path : '<?php echo CUtil::JSEscape($arConfig['path']); ?> ', view : '<?php echo CUtil::JSEscape($res[2]); ?> ', sort : '<?php echo CUtil::JSEscape($res[3]); ?> ', sort_order : '<?php echo CUtil::JSEscape($res[4]); ?> ' }; <? } ?> if (!window.BXFileDialog) { if (bLoadJS !== false) BX.loadScript("/freetrix/js/main/file_dialog.js?v=<?php echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/freetrix/js/main/file_dialog.js'); ?> "); return setTimeout(function(){window['<?php echo CUtil::JSEscape($arConfig['event']); ?> '](false, Params)}, 50); } var oConfig = { submitFuncName : '<?php echo CUtil::JSEscape($arConfig['event']); ?> Result', select : '<?php echo CUtil::JSEscape($arConfig['select']); ?> ', operation: '<?php echo CUtil::JSEscape($arConfig['operation']); ?> ', showUploadTab : <?php echo $arConfig['showUploadTab'] ? 'true' : 'false'; ?> , showAddToMenuTab : <?php echo $arConfig['showAddToMenuTab'] ? 'true' : 'false'; ?> , site : '<?php echo CUtil::JSEscape($arConfig['site']); ?> ', path : '<?php echo CUtil::JSEscape($arConfig['path']); ?> ', lang : '<?php echo CUtil::JSEscape($arConfig['lang']); ?> ', fileFilter : '<?php echo CUtil::JSEscape($arConfig['fileFilter']); ?> ', allowAllFiles : <?php echo $arConfig['allowAllFiles'] !== false ? 'true' : 'false'; ?> , saveConfig : <?php echo $arConfig['saveConfig'] !== false ? 'true' : 'false'; ?> , sessid: "<?php echo freetrix_sessid(); ?> ", checkChildren: true, genThumb: <?php echo COption::GetOptionString("fileman", "file_dialog_gen_thumb", "Y") == 'Y' ? 'true' : 'false'; ?> , zIndex: <?php echo CUtil::JSEscape($arConfig['zIndex']); ?> }; if(window.oBXFileDialog && window.oBXFileDialog.UserConfig) { UserConfig = oBXFileDialog.UserConfig; oConfig.path = UserConfig.path; oConfig.site = UserConfig.site; } if (Params.path) oConfig.path = Params.path; if (Params.site) oConfig.site = Params.site; oBXFileDialog = new BXFileDialog(); oBXFileDialog.Open(oConfig, UserConfig); <?endif;?> }; window.<?php echo CUtil::JSEscape($arConfig['event']); ?> Result = function(filename, path, site, title, menu) { <? $arBuckets = array(); if($bCloudsBrowse && CModule::IncludeModule('clouds')) { foreach(CCloudStorageBucket::GetAllBuckets() as $arBucket) { if($arBucket["ACTIVE"] == "Y") { $obBucket = new CCloudStorageBucket($arBucket["ID"]); if($obBucket->Init()) $arBuckets[$arBucket["BUCKET"]] = rtrim($obBucket->GetFileSRC("/"), "/"); } } } ?> path = jsUtils.trim(path); path = path.replace(/\\/ig,"/"); path = path.replace(/\/\//ig,"/"); if (path.substr(path.length-1) == "/") path = path.substr(0, path.length-1); var full = (path + '/' + filename).replace(/\/\//ig, '/'); if (path == '') path = '/'; var arBuckets = <?echo CUtil::PhpToJSObject($arBuckets)?>; if(arBuckets[site]) { full = arBuckets[site] + filename; path = arBuckets[site] + path; } if ('<?php echo CUtil::JSEscape($arConfig['select']); ?> ' == 'D') name = full; <?if ($resultDest == "FUNCTION"): ?> <?php echo CUtil::JSEscape($arConfig['arResultDest']["FUNCTION_NAME"]); ?> (filename, path, site, title || '', menu || ''); <?elseif($resultDest == "FORM"): ?> document.<?php echo CUtil::JSEscape($arConfig['arResultDest']["FORM_NAME"]); ?> .<?php echo CUtil::JSEscape($arConfig['arResultDest']["FORM_ELEMENT_NAME"]); ?> .value = full; BX.fireEvent(document.<?php echo CUtil::JSEscape($arConfig['arResultDest']["FORM_NAME"]); ?> .<?php echo CUtil::JSEscape($arConfig['arResultDest']["FORM_ELEMENT_NAME"]); ?> , 'change'); <?elseif($resultDest == "ID"): ?> BX('<?php echo CUtil::JSEscape($arConfig['arResultDest']["ELEMENT_ID"]); ?> ').value = full; BX.fireEvent(BX('<?php echo CUtil::JSEscape($arConfig['arResultDest']["ELEMENT_ID"]); ?> '), 'change'); <?endif;?> }; <?self::AttachJSScripts();?> </script> <? } else { echo "<font color=\"#FF0000\">".htmlspecialcharsbx($functionError)."</font>"; } }