function CreateWizardIndex($wizardName, &$errorMessage) { $indexContent = '<' . '?' . 'define("WIZARD_DEFAULT_SITE_ID", "' . (defined("WIZARD_DEFAULT_SITE_ID") ? WIZARD_DEFAULT_SITE_ID : "s1") . '");' . 'require(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");' . 'require_once(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/wizard.php");' . '$' . 'wizard = new CWizard("' . $wizardName . '");' . '$' . 'wizard->Install();' . 'require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");' . '?' . '>'; $p = $_SERVER["DOCUMENT_ROOT"] . "/index.php"; if (defined("WIZARD_DEFAULT_SITE_ID")) { $rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => WIZARD_DEFAULT_SITE_ID)); $arSite = $rsSite->GetNext(); $p = CSite::GetSiteDocRoot($arSite["LID"]) . $arSite["DIR"] . "/index.php"; } $handler = @fopen($p, "wb"); if (!$handler) { $errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR"); return false; } $success = @fwrite($handler, $indexContent); if (!$success) { $errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR"); return false; } if (defined("BX_FILE_PERMISSIONS")) { @chmod($_SERVER["DOCUMENT_ROOT"] . "/index.php", BX_FILE_PERMISSIONS); } fclose($handler); return true; }
function ParseFile($file) { $docRoot = CSite::GetSiteDocRoot(self::$curSite); $file = str_replace("//", "/", $file); $io = CBXVirtualIo::GetInstance(); $bIsDir = $io->DirectoryExists($file); if (is_link($file)) { return; } if ($bIsDir) { // Skip 'bitrix' and 'upload' folders if ($file == $docRoot . '/bitrix' || $file == $docRoot . '/upload' || $file == $docRoot . '/images') { return; } $oDir = new CFilemanUtilDir($file, array('obj' => $this, 'site' => self::$curSite, 'callBack' => "ParseFile", 'checkBreak' => "CheckBreak", 'checkSubdirs' => false)); $bSuccess = $oDir->Start(); $bBreak = $oDir->bBreak; $nextPath = $oDir->nextPath; if ($bBreak) { $this->ParseStop(CFilemanUtils::TrimPath($nextPath, $docRoot), self::$curSite); } } else { if (self::$bSkip) { if ($file == $docRoot . self::$lastPath) { self::$bSkip = false; } else { return; } // Files was handled earlier } $fileName = $io->ExtractNameFromPath($file); // Skip files stating from dot '.' or any non .php files if (GetFileExtension($fileName) != 'php' || preg_match('/^\\..*/i' . BX_UTF_PCRE_MODIFIER, $fileName)) { return; } // 1. Get file content $fTmp = $io->GetFile($file); $fileContent = $fTmp->GetContents(); $fileContent = str_replace("\r", "", $fileContent); $fileContent = str_replace("\n", "", $fileContent); // Find files with needed components $pattern = array('intranet.event_calendar', 'socialnetwork', 'socialnetwork_user', 'socialnetwork_group'); foreach ($pattern as $p) { if (preg_match('/includecomponent\\([\\n\\t\\r\\s]*("|\')bitrix:' . $p . '/i' . BX_UTF_PCRE_MODIFIER, $fileContent)) { $this->FetchParams($fileContent); break; } } } }
public function __construct($arParams) { $this->SITE_ID = $arParams["SITE_ID"]; $this->REWRITE = $arParams["REWRITE"]; $this->ModuleBlogGroup = '[' . $this->SITE_ID . '] ' . GetMessage("IDEA_BLOG_GROUP_NAME"); $this->ModuleBlogUrl .= "_" . $this->SITE_ID; //NULL CACHE BXClearCache(True, '/' . $this->SITE_ID . '/idea/'); BXClearCache(True, '/' . SITE_ID . '/idea/'); global $CACHE_MANAGER; if (CACHED_b_user_field_enum !== false) { $CACHE_MANAGER->CleanDir("b_user_field_enum"); } //Statuses List (for demo) $this->arResult["SETTINGS"]["STATUS"] = CIdeaManagment::getInstance()->Idea()->GetStatusList(); foreach ($this->arResult["SETTINGS"]["STATUS"] as $arStatus) { $this->arResult["SETTINGS"]["STATUS_ID"][$arStatus["XML_ID"]] = $arStatus["ID"]; } //Lang List $l = CLanguage::GetList($by = "sort", $order = "asc"); while ($r = $l->Fetch()) { $this->arResult["SETTINGS"]["LANG"][] = $r; } //Sites List $oSites = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y")); while ($site = $oSites->Fetch()) { $this->arResult["SETTINGS"]["SITE"][$site["LID"]] = array("LANGUAGE_ID" => $site["LANGUAGE_ID"], "ABS_DOC_ROOT" => $site["ABS_DOC_ROOT"], "DIR" => $site["DIR"], "SITE_ID" => $site["LID"], "SERVER_NAME" => $site["SERVER_NAME"], "NAME" => $site["NAME"]); } if (array_key_exists($this->SITE_ID, $this->arResult["SETTINGS"]["SITE"])) { $this->PublicDir = str_replace(array("#SITE_DIR#"), array($this->arResult["SETTINGS"]["SITE"][$this->SITE_ID]["DIR"]), $this->PublicDir); } $site = CFileMan::__CheckSite($this->SITE_ID); $this->DOCUMENT_ROOT = CSite::GetSiteDocRoot($site); $this->IO = CBXVirtualIo::GetInstance(); //SetDefault $this->arResult["INSTALLATION"]["IBLOCK_TYPE_INSTALL"] = true; $this->arResult["INSTALLATION"]["IBLOCK_INSTALL"] = true; $this->arResult["INSTALLATION"]["BLOG_GROUP_INSTALL"] = true; $this->arResult["INSTALLATION"]["BLOG_INSTALL"] = true; $this->CheckParams(); }
function GetEventInfo($row, $arParams, $arUser) { $site = CFileMan::__CheckSite($site); $DOC_ROOT = CSite::GetSiteDocRoot($site); $DESCRIPTION = unserialize($row['DESCRIPTION']); if (empty($DESCRIPTION['path'])) { $DESCRIPTION['path'] = $_SERVER['HTTP_HOST']; $fileURL = SITE_DIR; } else { if ((is_file($DOC_ROOT . "/" . $DESCRIPTION['path']) || is_dir($DOC_ROOT . "/" . $DESCRIPTION['path'])) && !strrpos($DESCRIPTION['path'], " ")) { $fileURL = SITE_DIR . $DESCRIPTION['path']; } } $EventName = $DESCRIPTION['path']; switch ($row['AUDIT_TYPE_ID']) { case "PAGE_ADD": $EventPrint = GetMessage("LOG_PAGE_ADD"); break; case "PAGE_EDIT": $EventPrint = GetMessage("LOG_PAGE_EDIT"); break; case "PAGE_DELETE": $EventPrint = GetMessage("LOG_PAGE_DELETE"); break; case "MENU_ADD": $EventPrint = GetMessage("LOG_MENU_ADD", array("#MENU#" => $DESCRIPTION['menu_name'])); break; case "MENU_EDIT": $EventPrint = GetMessage("LOG_MENU_EDIT", array("#MENU#" => $DESCRIPTION['menu_name'])); break; case "MENU_DELETE": $EventPrint = GetMessage("LOG_MENU_DELETE", array("#MENU#" => $DESCRIPTION['menu_name'])); break; case "FILE_ADD": $EventPrint = GetMessage("LOG_FILE_ADD"); break; case "FILE_EDIT": $EventPrint = GetMessage("LOG_FILE_EDIT"); break; case "FILE_DELETE": $EventPrint = GetMessage("LOG_FILE_DELETE", array("#FILENAME#" => $DESCRIPTION['file_name'])); break; case "FILE_MOVE": $EventPrint = GetMessage("LOG_FILE_MOVE", array("#SECTION#" => $DESCRIPTION["copy_to"])); break; case "FILE_COPY": $EventPrint = GetMessage("LOG_FILE_COPY", array("#SECTION#" => $DESCRIPTION["copy_to"])); break; case "FILE_RENAME": $EventPrint = GetMessage("LOG_FILE_RENAME"); break; case "SECTION_ADD": $EventPrint = GetMessage("LOG_SECTION_ADD"); break; case "SECTION_EDIT": $EventPrint = GetMessage("LOG_SECTION_EDIT"); break; case "SECTION_DELETE": $EventPrint = GetMessage("LOG_SECTION_DELETE"); break; case "SECTION_MOVE": $EventPrint = GetMessage("LOG_SECTION_MOVE", array("#SECTION#" => $DESCRIPTION["copy_to"])); break; case "SECTION_COPY": $EventPrint = GetMessage("LOG_SECTION_COPY", array("#SECTION#" => $DESCRIPTION["copy_to"])); break; case "SECTION_RENAME": $EventPrint = GetMessage("LOG_SECTION_RENAME"); break; } return array("eventType" => $EventPrint, "eventName" => $EventName, "eventURL" => $fileURL); }
if ($createNewFolder && (!$USER->CanDoOperation("fileman_admin_folders") || !$USER->CanDoOperation("fileman_admin_files"))) { $popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED")); } elseif (!$USER->CanDoOperation("fileman_admin_files")) { $popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED")); } if (!$USER->CanDoOperation("fileman_edit_existent_files")) { $canEditNewPage = false; } } $io = CBXVirtualIo::GetInstance(); //Page path $path = "/"; if (isset($_REQUEST["path"]) && strlen($_REQUEST["path"]) > 0) { $path = $io->CombinePath("/", $_REQUEST["path"]); } $documentRoot = CSite::GetSiteDocRoot($site); //Site ID $site = SITE_ID; if (isset($_REQUEST["site"]) && $_REQUEST["site"] != '') { $obSite = CSite::GetByID($_REQUEST["site"]); if ($arSite = $obSite->Fetch()) { $site = $arSite["ID"]; } } //Check permissions if ($createNewFolder && (!$USER->CanDoFileOperation("fm_create_new_folder", array($site, $path)) || !$USER->CanDoFileOperation("fm_create_new_file", array($site, $path)))) { $popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED")); } elseif (!$USER->CanDoFileOperation("fm_create_new_file", array($site, $path))) { $popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED")); } elseif (!$io->DirectoryExists($documentRoot . $path)) { $popupWindow->ShowError(GetMessage("PAGE_NEW_FOLDER_NOT_FOUND") . " (" . htmlspecialcharsbx($path) . ")");
public static function Search($arQuery, $arTypes = array()) { global $DB; $err_mess = CMedialibCollection::GetErrorMess() . "<br>Function: CMedialibItem::Search<br>Line: "; $strSql = "SELECT\n\t\t\t\t\tMI.*, MI.*,MCI.COLLECTION_ID, F.HEIGHT, F.WIDTH, F.FILE_SIZE, F.CONTENT_TYPE, F.SUBDIR, F.FILE_NAME, F.HANDLER_ID,\n\t\t\t\t\t" . $DB->DateToCharFunction("MI.DATE_UPDATE") . " as DATE_UPDATE2\n\t\t\t\tFROM b_medialib_item MI\n\t\t\t\tINNER JOIN b_medialib_collection_item MCI ON (MI.ID=MCI.ITEM_ID)\n\t\t\t\tINNER JOIN b_file F ON (F.ID=MI.SOURCE_ID)\n\t\t\t\tWHERE 1=1"; $l = count($arQuery); if ($l == 0) { return array(); } for ($i = 0; $i < $l; $i++) { $strSql .= " AND MI.SEARCHABLE_CONTENT LIKE '%" . $DB->ForSql($arQuery[$i]) . "%'"; } $strSql .= " ORDER BY MI.ID DESC"; $res = $DB->Query($strSql, false, $err_mess); $arResult = array(); $rootPath = CSite::GetSiteDocRoot(false); $tmbW = COption::GetOptionInt('fileman', "ml_thumb_width", 140); $tmbH = COption::GetOptionInt('fileman', "ml_thumb_height", 105); $elId2Index = array(); $colId2Index = array(); $arCol = CMedialibCollection::GetList(array('arFilter' => array('ACTIVE' => 'Y', "TYPES" => $arTypes))); for ($i = 0, $l = count($arCol); $i < $l; $i++) { $colId2Index[$arCol[$i]['ID']] = $i; } while ($arRes = $res->Fetch()) { $colId = $arRes['COLLECTION_ID']; if (!isset($colId2Index[$colId]) || !CMedialibCollection::IsViewable($arCol[$colId2Index[$colId]], $arCol)) { continue; } if (isset($elId2Index[$arRes['ID']])) { $arResult[$elId2Index[$arRes['ID']]]['collections'][] = $colId; } else { $elId2Index[$arRes['ID']] = count($arResult); $arRes['collections'] = array($colId); $arRes['perm'] = array('edit' => true, 'del' => true); CMedialibItem::GenerateThumbnail($arRes, array('rootPath' => $rootPath, 'width' => $tmbW, 'height' => $tmbH)); $arRes['PATH'] = CFile::GetFileSRC($arRes); $arResult[] = $arRes; } } return $arResult; }
############################################## */ require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/prolog.php"; if (!$USER->CanDoOperation('edit_php')) { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/include.php"; IncludeModuleLangFile(__FILE__); define("HELP_FILE", "translate_list.php"); /*************************************************************************** GET | POST ***************************************************************************/ $strError = ""; $file = Rel2Abs("/", $file); $abs_path = CSite::GetSiteDocRoot(false) . htmlspecialcharsbx($file); if (strpos($file, "/bitrix/") !== 0 || strpos($file, "/lang/") === false || GetFileExtension($file) != "php") { $strError = GetMessage("trans_edit_err") . "<br>"; } $APPLICATION->SetTitle(GetMessage("TRANS_TITLE")); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; if ($strError == "") { $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("TRANS_TITLE"), "ICON" => "translate_edit", "TITLE" => GetMessage("TRANS_TITLE_TITLE"))); $tabControl = new CAdminTabControl("tabControl", $aTabs); $chain = ""; $arPath = array(); $path_back = dirname($file); $arSlash = explode("/", $path_back); if (is_array($arSlash)) { $arSlash_tmp = $arSlash; $lang_key = array_search("lang", $arSlash) + 1;
public function SiteRelativeToAbsolutePath($relativePath, $site = null) { if ((string)$site === "") { $site = SITE_ID; } else { $dbSite = CSite::GetByID($site); $site = ""; if ($arSite = $dbSite->Fetch()) $site = $_REQUEST["site"]; if ((string)$site === "") $site = SITE_ID; } $basePath = CSite::GetSiteDocRoot($site); return $this->CombinePath($basePath, $relativePath); }
HTML ****************************************************************************/ $aMenu = array(); $aMenu[] = array("TEXT" => GetMessage("TRANS_LIST"), "LINK" => "/bitrix/admin/translate_list.php?lang=" . LANGUAGE_ID . "&path=/" . implode("/", $arPath) . "/" . "&" . bitrix_sessid_get(), "TITLE" => GetMessage("TRANS_LIST_TITLE"), "ICON" => "btn_list"); $context = new CAdminContextMenu($aMenu); $context->Show(); ?> <p><?php echo $chain; ?> </p> <?php $_corrupt = false; $_strMess = ''; foreach ($arDirFiles as $_file) { $_content = $APPLICATION->GetFileContent(CSite::GetSiteDocRoot(false) . $_file); $_len = strlen($_content); if (($_pos = strrpos($_content, '>')) !== false) { if ($_len > $_pos + 1) { $_corrupt = true; $_strMess .= '<a class="text" href="translate_edit_php.php?lang=' . LANGUAGE_ID . '&file=' . $_file . '">' . $_file . "</a><br/>"; } } } if (!$_corrupt) { CAdminMessage::ShowMessage(array('MESSAGE' => GetMessage('TR_FILES_NOT_FOUND'), 'TYPE' => 'OK')); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php"; die; } else { CAdminMessage::ShowMessage(GetMessage('TR_FILES_FOUND')); }
function ShowHTMLEditControl($name, $content, $arParams = array()) { global $USER; // We have to avoid of showing HTML-editor with probably unsecure content when loosing the session [mantis:#0007986] if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid()) { return; } CUtil::InitJSCore(array('window', 'ajax')); $relPath = isset($arParams["path"]) ? $arParams["path"] : "/"; $site = isset($arParams["site"]) ? $arParams["site"] : ""; $__path = Rel2Abs("/", $relPath); $site = CFileMan::__CheckSite($site); $name = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $name); if (!isset($arParams["limit_php_access"])) { $arParams["limit_php_access"] = false; } $arParams["light_mode"] = defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 || isset($arParams["light_mode"]) && $arParams["light_mode"] == 'Y'; $io = CBXVirtualIo::GetInstance(); $direction_rtl = false; if ($site) { $DOC_ROOT = CSite::GetSiteDocRoot($site); $abs_path = $DOC_ROOT . $__path; if ($io->FileExists($abs_path)) { $relPath = substr($relPath, 0, strrpos($relPath, "/")); if ($relPath == "") { $relPath = "/"; } } } static $bFirstUsed; $template = $arParams["templateID"]; if (!isset($template) && defined('SITE_TEMPLATE_ID')) { $template = SITE_TEMPLATE_ID; } if (!isset($template) && isset($_GET['siteTemplateId'])) { $template = $_GET['siteTemplateId']; } if (!isset($template) && isset($site)) { $dbSiteRes = CSite::GetTemplateList($site); $SITE_TEMPLATE = array(); while ($arSiteRes = $dbSiteRes->Fetch()) { if ($arSiteRes['CONDITION'] == "" || !isset($template)) { $template = $arSiteRes['TEMPLATE']; } } } if (isset($arParams['use_editor_3'])) { $useEditor3 = $arParams['use_editor_3'] == "Y"; } else { $useEditor3 = COption::GetOptionString('fileman', "use_editor_3", "Y") == "Y"; } if ($useEditor3) { $Editor = new CHTMLEditor(); $Editor->Show(array('name' => $name, 'id' => $name, 'siteId' => $arParams["site"], 'width' => $arParams["width"], 'height' => $arParams["height"], 'content' => $content, 'bAllowPhp' => !$arParams["bWithoutPHP"] && $USER->CanDoOperation('edit_php'), "limitPhpAccess" => $arParams["limit_php_access"], "display" => $arParams['bDisplay'], "componentFilter" => isset($arParams['componentFilter']) ? $arParams['componentFilter'] : false, "setFocusAfterShow" => isset($arParams['setFocusAfterShow']) ? $arParams['setFocusAfterShow'] : true, "relPath" => $relPath, "templateId" => $template)); return; } //Taskbars $arTaskbars = isset($arParams["arTaskbars"]) ? $arParams["arTaskbars"] : array(); //Toolbars $arToolbars = isset($arParams["arToolbars"]) ? $arParams["arToolbars"] : false; // Toolbar config $arParams["toolbarConfig"] = is_array($arParams["toolbarConfig"]) ? $arParams["toolbarConfig"] : false; $arParams["use_advanced_php_parser"] = COption::GetOptionString("fileman", "use_advanced_php_parser", "Y"); $arParams["ar_entities"] = COption::GetOptionString("fileman", "ar_entities", 'umlya,greek,other'); if ($arParams["ar_entities"] == 'none') { $arParams["ar_entities"] = ''; } if (!isset($arParams["usePspell"])) { $arParams["usePspell"] = COption::GetOptionString("fileman", "use_pspell", "N"); } if (!isset($arParams["useCustomSpell"])) { $arParams["useCustomSpell"] = COption::GetOptionString("fileman", "use_custom_spell", "Y"); } $arParams['allowRenderComp2'] = COption::GetOptionString('fileman', "allow_render_components", "N") == 'Y'; $arParams['renderComponents'] = $arParams['allowRenderComp2'] && CUserOptions::GetOption('fileman', "render_components", "Y") == 'Y'; $lca = COption::GetOptionString("fileman", "use_lca", "N"); $styleList_render_style = COption::GetOptionString("fileman", "render_styles_in_classlist", "Y") == 'Y' ? 'true' : 'false'; $arAdditionalParams = isset($arParams["arAdditionalParams"]) ? $arParams["arAdditionalParams"] : array(); $arResult = CFileman::GetAllTemplateParams($template, $site, $arParams["bWithoutPHP"] != true, $arAdditionalParams); $arParams["TEMPLATE"] = $arResult; if ($bUseOnlyDefinedStyles && !is_set($arResult, "STYLES_TITLE")) { $bUseOnlyDefinedStyles = false; } $arParams["body_class"] = COption::GetOptionString("fileman", "editor_body_class", ""); $arParams["body_id"] = COption::GetOptionString("fileman", "editor_body_id", ""); ?> <script bxrunfirst="true"> var relPath = "<?php echo CUtil::JSEscape($relPath); ?> "; var <?php echo 'ar_' . $name . '_taskbars'; ?> = {}; <?php for ($k = 0, $l = count($arTaskbars); $k < $l; $k++) { echo 'ar_' . $name . '_taskbars["' . $arTaskbars[$k] . '"] = true;'; } if ($arToolbars !== false) { echo 'var ar_' . $name . '_toolbars = {};'; for ($k = 0, $l = count($arToolbars); $k < $l; $k++) { echo 'ar_' . $name . '_toolbars["' . $arToolbars[$k] . '"] = true;'; } } else { echo 'var ar_' . $name . '_toolbars = false;'; } ?> window.ar_<?php echo $name; ?> _config = <?php echo CUtil::PhpToJSObject($arParams); ?> ; // editor-config </script> <?php $str_taskbars = ""; CFileman::GetHTMLEditorSettings($name, $arParams["light_mode"], $arTaskbars, $str_taskbars); $str_taskbars .= '_' . CFileman::GetVersion(); if (!$bFirstUsed) { $arTemplates = array(array('value' => '.default', 'name' => GetMessage("FILEMAN_DEFTEMPL"))); $db_site_templates = CSiteTemplate::GetList(array(), array(), array()); while ($ar_site_templates = $db_site_templates->Fetch()) { $arTemplates[] = array('value' => $ar_site_templates['ID'], 'name' => $ar_site_templates['NAME']); } ?> <script bxrunfirst="true"> var arBXTemplates = <?php echo CUtil::PhpToJSObject($arTemplates); ?> , BXSite = "<?php echo CUtil::JSEscape($site); ?> ", BXLang = "<?php echo CUtil::JSEscape(LANGUAGE_ID); ?> ", styleList_render_style = <?php echo $styleList_render_style; ?> , limit_php_access = <?php echo $arParams["limit_php_access"] ? 'true' : 'false'; ?> , lca = <?php echo $lca == 'Y' ? 'true' : 'false'; ?> , lightMode = <?php echo $arParams["light_mode"] ? 'true' : 'false'; ?> , BX_PERSONAL_ROOT = "<?php echo BX_PERSONAL_ROOT; ?> "; window.limit_php_access = top.limit_php_access = limit_php_access; window.lightMode = top.lightMode = lightMode; window.lca = top.lca = lca; window.BXLang = top.BXLang = BXLang; window.BXSite = top.BXSite = BXSite; window.BX_PERSONAL_ROOT = top.BX_PERSONAL_ROOT = BX_PERSONAL_ROOT; </script> <?php $arJS = array(); $arCSS = array(); $events = GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptsGet"); while ($arEvent = $events->Fetch()) { $tmp = ExecuteModuleEventEx($arEvent, array($name, $arParams)); if (!is_array($tmp)) { continue; } if (is_array($tmp['JS'])) { $arJS = array_merge($arJS, $tmp['JS']); } if (is_array($tmp['CSS'])) { $arCSS = array_merge($arCSS, $tmp['CSS']); } } $arr = array(); // Additional JS files from event OnBeforeHtmlEditorScriptGet for ($i = 0, $c = count($arJS); $i < $c; $i++) { $arJS[$i] = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $arJS[$i]); if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arJS[$i])) { $arr[] = $arJS[$i]; } } ?> <script type="text/javascript" src="/bitrix/admin/fileman_js.php?lang=<?php echo LANGUAGE_ID; ?> &v=<?php echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/fileman/lang/' . LANGUAGE_ID . '/admin/fileman_js.php'); ?> "></script> <script type="text/javascript" src="/bitrix/admin/fileman_common_js.php?s=<?php echo $str_taskbars; ?> "></script> <?php for ($i = 0, $l = count($arr); $i < $l; $i++) { $script_filename = $arr[$i]; ?> <script type="text/javascript" src="/bitrix/admin/htmleditor2/<?php echo $script_filename; ?> ?v=<?php echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $script_filename); ?> "></script><?php } ?> <script type="text/javascript" src="/bitrix/js/main/popup_menu.js?v=<?php echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/main/popup_menu.js'); ?> "></script> <?php for ($i = 0, $l = count($arCSS); $i < $l; $i++) { $arCSS[$i] = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $arCSS[$i]); if (!file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arCSS[$i])) { continue; } ?> <link rel="stylesheet" type="text/css" href="/bitrix/admin/htmleditor2/<?php echo $arCSS[$i]; ?> ?v=<?php echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arCSS[$i]); ?> "/><?php } $db_events = GetModuleEvents("fileman", "OnIncludeHTMLEditorScript"); while ($arEvent = $db_events->Fetch()) { ExecuteModuleEventEx($arEvent); } $bFirstUsed = true; } ?> <div class="bxedmain-cont" id="<?php echo $name . '_object'; ?> "><table id="<?php echo $name; ?> _pFrame" class="bxedmainframe dim100x100" style="display:none;"> <tr style="height: 1%;"><td id="<?php echo $name; ?> _toolBarSet0" colspan="2" style="width: 100%; display: none; border-bottom: 1px solid #808080 !important;"></td></tr> <tr> <td id="<?php echo $name; ?> _toolBarSet1" style="width:0%; display: none; border-right: 1px solid #808080 !important;"></td> <td vAlign="top" style="width: 4000px; padding: 0!important;"> <table class="dim100x100"> <tr> <td class="bx-ceditor" id="<?php echo $name; ?> _cEditor"></td> <td id="<?php echo $name; ?> _taskBarSet2" class="bxedtaskbarset" style="width:0%; display: none;"> <table> <tr><td class="bx-move-col-v" rowSpan="3"><img src="/bitrix/images/1.gif" /></td><td style="height:26px;"></td></tr> <tr><td style="vertical-align: top;"></td></tr> <tr><td class="bx-taskbar-tabs"></td></tr> </table> </td> </tr> <tr style="height:0%; display: none;"> <td id="<?php echo $name; ?> _taskBarSet3" colspan="2"> <table> <tr><td class="bx-move-col-h"><img src="/bitrix/images/1.gif" /></td></tr> <tr><td style="height:26px;"></td></tr> <tr><td style="vertical-align: top; background: #F4F4F4 none !important;"></td></tr> <tr><td class="bx-taskbar-tabs"></td></tr> </table> </td> </tr> </table> </td> </tr> <tr id="bx-css-tt"><td id="<?php echo $name; ?> _taskBarTabs" colspan="2" class="tasktabcell"></td></tr> </table> </div> <script> BX.loadCSS('/bitrix/admin/htmleditor2/editor.css'); var bEd = BX("bxed_<?php echo $name; ?> _editor"); if (bEd && !bEd.checked) BX("<?php echo $name; ?> _object").style.display = "none"; </script> <?php if (!$arParams["bFromTextarea"]) { echo '<input type="hidden" name="' . $name . '" id="bxed_' . $name . '" value="' . htmlspecialcharsbx($content) . '">'; } if ($arParams["bDisplay"] !== false) { setEditorEventHandlers($name); ?> <script> BX.ready(function(){ BX.showWait(); BX("bxed_<?php echo $name; ?> ").pMainObj = new BXHTMLEditor("<?php echo $name; ?> "); }); </script> <?php } }
function SetFilePermission($path, $permissions) { $originalPath = $path; CMain::InitPathVars($site, $path); $documentRoot = CSite::GetSiteDocRoot($site); $path = rtrim($path, "/"); if (strlen($path) <= 0) $path = "/"; if( ($position = strrpos($path, "/")) !== false) { $pathFile = substr($path, $position+1); $pathDir = substr($path, 0, $position); } else return false; if ($pathFile == "" && $pathDir == "") $pathFile = "/"; $PERM = Array(); if(file_exists($documentRoot.$pathDir."/.access.php")) @include($documentRoot.$pathDir."/.access.php"); if (!isset($PERM[$pathFile]) || !is_array($PERM[$pathFile])) $arPermisson = $permissions; else $arPermisson = $permissions + $PERM[$pathFile]; return $GLOBALS["APPLICATION"]->SetFileAccessPermission($originalPath, $arPermisson); }
############################################## */ require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/prolog.php"; if (!$USER->CanDoOperation('edit_php')) { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/include.php"; IncludeModuleLangFile(__FILE__); define("HELP_FILE", "translate_list.php"); /*************************************************************************** GET | POST ***************************************************************************/ $strError = ""; $file = Rel2Abs("/", $file); $abs_path = CSite::GetSiteDocRoot($site) . $file; if (strpos($file, "/bitrix/") !== 0 || strpos($file, "/lang/") === false) { $strError = GetMessage("trans_edit_err") . "<br>"; } if ($strError == "") { $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("TRANS_TITLE"), "ICON" => "translate_edit", "TITLE" => GetMessage("TRANS_TITLE_TITLE"))); $tabControl = new CAdminTabControl("tabControl", $aTabs); // form a way to get back $chain = ""; $arPath = array(); $path_back = dirname($file); $arSlash = explode("/", $path_back); if (is_array($arSlash)) { $arSlash_tmp = $arSlash; $lang_key = array_search("lang", $arSlash) + 1; unset($arSlash_tmp[$lang_key]);
$db_msg = CEventMessage::GetList($o = "", $b = "", array("SITE_ID" => $_POST["SITE_MESSAGE_LINK_E_SITE"])); while ($ar_msg = $db_msg->Fetch()) { $msg_id = $ar_msg["ID"]; $db_msg_sites = CEventMessage::GetSite($ar_msg["ID"]); $ar_msg = array("NAME" => $ar_msg["NAME"], "LID" => array($LID)); while ($ar_msg_sites = $db_msg_sites->Fetch()) { $ar_msg["LID"][] = $ar_msg_sites["SITE_ID"]; } $em->Update($msg_id, $ar_msg); } } if ($bNew && $_POST["START_SITE_WIZARD"] == "Y") { $rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => $LID)); $arSite = $rsSite->GetNext(); $siteDir = "/" . ltrim(rtrim($arSite["DIR"], "/") . "/", "/"); $p = CSite::GetSiteDocRoot($LID) . $siteDir; CheckDirPath($p); $indexContent = '<' . '?' . 'define("B_PROLOG_INCLUDED", true);' . 'define("WIZARD_DEFAULT_SITE_ID", "' . $LID . '");' . 'define("WIZARD_DEFAULT_TONLY", true);' . 'define("PRE_LANGUAGE_ID","' . $arSite["LANGUAGE_ID"] . '");' . 'define("PRE_INSTALL_CHARSET","' . $arSite["CHARSET"] . '");' . 'include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/install/wizard/wizard.php");' . '?' . '>'; $handler = fopen($p . "index.php", "wb"); fwrite($handler, $indexContent); fclose($handler); $u = ""; $domains = explode("\n", str_replace("\r", "", $arSite["DOMAINS"])); if (!empty($domains) && $domains[0] != '') { $u .= "http://" . $domains[0]; } $u .= $siteDir; LocalRedirect($u); } if ($_POST["save"] != '') { LocalRedirect(BX_ROOT . "/admin/site_admin.php?lang=" . LANGUAGE_ID);
public static function ReindexFile($path, $SEARCH_SESS_ID = "", $max_file_size = 0) { global $APPLICATION; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); if (!CUrlRewriter::CheckPath($path)) { return 0; } if ($max_file_size > 0 && filesize($DOC_ROOT . "/" . $path) > $max_file_size * 1024) { return 0; } $filesrc = $APPLICATION->GetFileContent($DOC_ROOT . "/" . $path); if (!$filesrc || $filesrc == "") { return 0; } $arComponents = PHPParser::ParseScript($filesrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { if ($arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { if (array_key_exists("SEF_RULE", $arComponents[$i]["DATA"]["PARAMS"])) { $ruleMaker = new \Bitrix\Main\UrlRewriterRuleMaker(); $ruleMaker->process($arComponents[$i]["DATA"]["PARAMS"]["SEF_RULE"]); CUrlRewriter::Add(array("SITE_ID" => $site, "CONDITION" => $ruleMaker->getCondition(), "RULE" => $ruleMaker->getRule(), "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path)); } else { CUrlRewriter::Add(array("SITE_ID" => $site, "CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "RULE" => "", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path)); } } } return true; }
function GetDirList($path, &$arDirs, &$arFiles, $arFilter = array(), $sort = array(), $type = "DF", $bLogical = false, $task_mode = false) { global $USER, $APPLICATION; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); $arDirs = array(); $arFiles = array(); $exts = strtolower($arFilter["EXTENSIONS"]); $arexts = explode(",", $exts); if (isset($arFilter["TYPE"])) { $type = strtoupper($arFilter["TYPE"]); } $io = CBXVirtualIo::GetInstance(); $path = $io->CombinePath("/", $path); $abs_path = $io->CombinePath($DOC_ROOT, $path); if (!$io->DirectoryExists($abs_path)) { return false; } $date_format = CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")); $tzOffset = CTimeZone::GetOffset(); $dir = $io->GetDirectory($abs_path); $arChildren = $dir->GetChildren(); foreach ($arChildren as $child) { $arFile = array(); if (($type == "F" || $type == "") && $child->IsDirectory()) { continue; } if (($type == "D" || $type == "") && !$child->IsDirectory()) { continue; } $file = $child->GetName(); if ($bLogical) { if ($child->IsDirectory()) { $sSectionName = ""; $fsn = $io->CombinePath($abs_path, $file, ".section.php"); if (!$io->FileExists($fsn)) { continue; } include $io->GetPhysicalName($fsn); $arFile["LOGIC_NAME"] = $sSectionName; } else { if (CFileMan::GetFileTypeEx($file) != "php") { continue; } if ($file == '.section.php') { continue; } if (!preg_match('/^\\.(.*)?\\.menu\\.(php|html|php3|php4|php5|php6|phtml)$/', $file, $regs)) { $f = $io->GetFile($abs_path . "/" . $file); $filesrc = $f->GetContents(); $title = PHPParser::getPageTitle($filesrc); if ($title === false) { continue; } $arFile["LOGIC_NAME"] = $title; } } } $arFile["PATH"] = $abs_path . "/" . $file; $arFile["ABS_PATH"] = $path . "/" . $file; $arFile["NAME"] = $file; $arPerm = $APPLICATION->GetFileAccessPermission(array($site, $path . "/" . $file), $USER->GetUserGroupArray(), $task_mode); if ($task_mode) { $arFile["PERMISSION"] = $arPerm[0]; if (count($arPerm[1]) > 0) { $arFile["PERMISSION_EX"] = $arPerm[1]; } } else { $arFile["PERMISSION"] = $arPerm; } $arFile["TIMESTAMP"] = $child->GetModificationTime() + $tzOffset; $arFile["DATE"] = date($date_format, $arFile["TIMESTAMP"]); if (isset($arFilter["TIMESTAMP_1"]) && strtotime($arFile["DATE"]) < strtotime($arFilter["TIMESTAMP_1"])) { continue; } if (isset($arFilter["TIMESTAMP_2"]) && strtotime($arFile["DATE"]) > strtotime($arFilter["TIMESTAMP_2"])) { continue; } if (is_set($arFilter, "MIN_PERMISSION") && $arFile["PERMISSION"] < $arFilter["MIN_PERMISSION"] && !$task_mode) { continue; } if (!$child->IsDirectory() && $arFile["PERMISSION"] <= "R" && !$task_mode) { continue; } if ($bLogical) { if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["LOGIC_NAME"], $arFilter["NAME"]) === false) { continue; } } else { if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["NAME"], $arFilter["NAME"]) === false) { continue; } } //if(strlen($arFilter["NAME"])>0 && strpos($arFile["NAME"], $arFilter["NAME"])===false) // continue; if (substr($arFile["ABS_PATH"], 0, strlen(BX_ROOT . "/modules")) == BX_ROOT . "/modules" && !$USER->CanDoOperation('edit_php') && !$task_mode) { continue; } if ($arFile["PERMISSION"] == "U" && !$task_mode) { $ftype = GetFileType($arFile["NAME"]); if ($ftype != "SOURCE" && $ftype != "IMAGE" && $ftype != "UNKNOWN") { continue; } if (substr($arFile["NAME"], 0, 1) == ".") { continue; } } if ($child->IsDirectory()) { $arFile["SIZE"] = 0; $arFile["TYPE"] = "D"; $arDirs[] = $arFile; } else { if ($exts != "") { if (!in_array(strtolower(substr($file, bxstrrpos($file, ".") + 1)), $arexts)) { continue; } } $arFile["TYPE"] = "F"; $arFile["SIZE"] = $child->GetFileSize(); $arFiles[] = $arFile; } } if (is_array($sort) && count($sort) > 0) { $by = key($sort); $order = strtolower($sort[$by]); $by = strtolower($by); if ($order != "desc") { $order = "asc"; } if ($by != "size" && $by != "timestamp") { $by = "name"; } usort($arDirs, array("_FilesCmp", "cmp_" . $by . "_" . $order)); usort($arFiles, array("_FilesCmp", "cmp_" . $by . "_" . $order)); } return null; }
$show_error = $show_error == "Y" ? "Y" : ""; GetLangDirs($arDirs, $SHOW_LANG_DIFF); $arLangDirFiles = array_merge($arLangDirs, $arFiles); // find if ($arSearchParam) { $_arLangDirFiles = $arLangDirFiles; $arLangDirFiles = array(); foreach ($_arLangDirFiles as $_k => $_v) { if ($_v['IS_DIR'] == 'Y') { continue; } if ($_v['LANG'] != LANGUAGE_ID) { continue; } $_coincidence = 0; if (!TSEARCH(CSite::GetSiteDocRoot(false) . $_v['PATH'], $_coincidence)) { continue; } $_v['COINCIDENCE'] = $_coincidence; $arLangDirFiles[$_k] = $_v; } } $lAdmin->BeginPrologContent(); ?> <p><?php if (!$arSearchParam) { $last_path = ""; for ($i = 0; $i <= sizeof($arrChain) - 1; $i++) { echo " / "; if (strlen($arrChain[$i]["PATH"]) > 0) { $last_path = $arrChain[$i]["PATH"];
function SaveFileContent($abs_path, $strContent) { $strContent = str_replace("\r\n", "\n", $strContent); $file = array(); $this->ResetException(); foreach (GetModuleEvents("main", "OnBeforeChangeFile", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($abs_path, &$strContent)) == false) { if (!$this->GetException()) { $this->ThrowException(GetMessage("main_save_file_handler_error", array("#HANDLER#" => $arEvent["TO_NAME"]))); } return false; } } $io = CBXVirtualIo::GetInstance(); $fileIo = $io->GetFile($abs_path); $io->CreateDirectory($fileIo->GetPath()); if ($fileIo->IsExists()) { $file["exists"] = true; if (!$fileIo->IsWritable()) { $fileIo->MarkWritable(); } $file["size"] = $fileIo->GetFileSize(); } /****************************** QUOTA ******************************/ if (COption::GetOptionInt("main", "disk_space") > 0) { $quota = new CDiskQuota(); if (false === $quota->checkDiskQuota(array("FILE_SIZE" => intVal(strLen($strContent) - intVal($file["size"]))))) { $this->ThrowException($quota->LAST_ERROR, "BAD_QUOTA"); return false; } } /****************************** QUOTA ******************************/ if ($fileIo->PutContents($strContent)) { $fileIo->MarkWritable(); } else { if ($file["exists"]) { $this->ThrowException(GetMessage("MAIN_FILE_NOT_CREATE"), "FILE_NOT_CREATE"); } else { $this->ThrowException(GetMessage("MAIN_FILE_NOT_OPENED"), "FILE_NOT_OPEN"); } return false; } bx_accelerator_reset(); $site = CSite::GetSiteByFullPath($abs_path); $DOC_ROOT = CSite::GetSiteDocRoot($site); if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { //Fix for name case under Windows $abs_path = strtolower($abs_path); $DOC_ROOT = strtolower($DOC_ROOT); } if (strpos($abs_path, $DOC_ROOT) === 0 && $site !== false) { $DOC_ROOT = rtrim($DOC_ROOT, "/\\"); $path = "/" . ltrim(substr($abs_path, strlen($DOC_ROOT)), "/\\"); foreach (GetModuleEvents("main", "OnChangeFile", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($path, $site)); } } /****************************** QUOTA ******************************/ if (COption::GetOptionInt("main", "disk_space") > 0) { $fs = $fileIo->GetFileSize(); CDiskQuota::updateDiskQuota("files", intVal($fs - intVal($file["size"])), "update"); } /****************************** QUOTA ******************************/ return true; }
function SetFilePermission($path, $permissions) { $originalPath = $path; CMain::InitPathVars($site, $path); $documentRoot = CSite::GetSiteDocRoot($site); $path = rtrim($path, "/"); if (strlen($path) <= 0) { $path = "/"; } if (($position = strrpos($path, "/")) !== false) { $pathFile = substr($path, $position + 1); $pathDir = substr($path, 0, $position); } else { return false; } if ($pathFile == "" && $pathDir == "") { $pathFile = "/"; } $PERM = array(); if (file_exists($documentRoot . $pathDir . "/.access.php")) { //include replaced with eval in order to honor of ZendServer eval("?>" . file_get_contents($documentRoot . $pathDir . "/.access.php")); } if (!isset($PERM[$pathFile]) || !is_array($PERM[$pathFile])) { $arPermisson = $permissions; } else { $arPermisson = $permissions + $PERM[$pathFile]; } return $GLOBALS["APPLICATION"]->SetFileAccessPermission($originalPath, $arPermisson); }
public static function Init($Params) { global $USER; $arWarnings = array(); if (!$USER->CanDoOperation('fileman_admin_files') && !$USER->CanDoOperation('fileman_admin_folders')) { $arWarnings[] = GetMessage('FM_UTIL_ACCESS_DENIED'); } $io = CBXVirtualIo::GetInstance(); if (count($arWarnings) == 0) { $pathTo = trim($Params['copyTo'], " /"); $site = CFileMan::__CheckSite($_GET['site']); $siteTo = $Params['siteTo'] ? $Params['siteTo'] : $site; $pathTo = $pathTo == "" ? "/" : "/" . $pathTo . "/"; $absPathTo = CSite::GetSiteDocRoot($siteTo) . $pathTo; $docRootFrom = CSite::GetSiteDocRoot($site); if (!$io->DirectoryExists($absPathTo)) { // Create destination directory $bAccess = $USER->CanDoOperation('fileman_admin_folders') && $USER->CanDoFileOperation('fm_create_new_folder', $pathTo); if ($Params['createCopyTo']) { if ($bAccess) { CFileMan::CreateDir(array($siteTo, $pathTo)); } } else { ?> <script>window.BXFM_NoCopyToDir = "<?php echo $bAccess ? "ask_user" : "access_denied"; ?> ";</script><?php return; } } foreach ($Params['arFiles'] as $file) { $filePath = $file['path']; $caseOption = $Params['caseOption']; if ($Params["userCaseLastPath"]) { if ($Params["userCaseLastPath"] != $filePath) { continue; } $caseOption = $Params['userCaseAnswer']; if ($Params["userCaseToAll"]) { $Params['caseOption'] = $caseOption; } $Params["userCaseLastPath"] = false; } $arPath_i = array($site, $filePath); $absPath_i = $docRootFrom . $filePath; $bDir_i = $io->DirectoryExists($absPath_i); $name_i = CFileman::GetFileName($filePath); $strWarn = ""; // Check if file already exists in destination folder if ($io->FileExists($absPathTo . $name_i) || $bDir_i == $io->DirectoryExists($absPathTo . $name_i) && $bDir_i) { $fTmp = $io->GetFile($absPathTo . $name_i); $fTmp1 = $io->GetFile($absPath_i); $altName = CFilemanCopy::GetAltFileName($absPathTo, $name_i, $bDir_i); if ($caseOption == 'ask') { ?> <script> window.BXFM_fileExist = { fileOld: { name: "<?php echo CUtil::JSEscape($name_i); ?> ", path: "<?php echo CUtil::JSEscape($pathTo . $name_i); ?> ", site: "<?php echo CUtil::JSEscape($siteTo); ?> ", bDir: <?php echo $bDir_i ? "true" : "false"; ?> , size: "<?php echo $bDir_i ? '-' : CFile::FormatSize($fTmp->GetFileSize()); ?> ", date: "<?php echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPathTo . $name_i) + CTimeZone::GetOffset()); ?> " }, fileNew: { alt_name: "<?php echo CUtil::JSEscape($altName); ?> ", name: "<?php echo CUtil::JSEscape($name_i); ?> ", path: "<?php echo CUtil::JSEscape($filePath); ?> ", site: "<?php echo CUtil::JSEscape($site); ?> ", bDir: <?php echo $bDir_i ? "true" : "false"; ?> , size: "<?php echo $bDir_i ? '-' : CFile::FormatSize($fTmp1->GetFileSize()); ?> ", date: "<?php echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPath_i) + CTimeZone::GetOffset()); ?> " } }; </script><?php return; } elseif ($caseOption == 'replace') { // We don't need to replace, couse it's one file if (CFileMan::NormalizePath($pathTo . "/" . $name_i) == $filePath) { continue; } $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy'], true); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } elseif ($caseOption == 'auto_rename') { $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $altName)), !$Params['bCopy']); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } elseif ($caseOption == 'skip') { continue; } } else { $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy']); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } $module_id = "fileman"; if (COption::GetOptionString($module_id, "log_page", "Y") == "Y" && $log) { $res_log['copy_to'] = substr($pathTo, 1); $res_log['path'] = substr($filePath, 1); if ($Params['bCopy'] == "copy") { if (!$bDir_i) { CEventLog::Log("content", "FILE_COPY", "fileman", "", serialize($res_log)); } else { CEventLog::Log("content", "SECTION_COPY", "fileman", "", serialize($res_log)); } } else { if (!$bDir_i) { CEventLog::Log("content", "FILE_MOVE", "fileman", "", serialize($res_log)); } else { CEventLog::Log("content", "SECTION_MOVE", "fileman", "", serialize($res_log)); } } } } } $arWarnings; ?> <script> window.BXFM_result = { status: "<?php echo count($arWarnings) > 0 ? 'errors' : 'ok'; ?> ", errors: <?php echo count($arWarnings) > 0 ? CUtil::PhpToJSObject($arWarnings) : '{}'; ?> }; </script><?php }
<?php require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php"; /********************** Check user access rights ***********************/ if (!$USER->CanDoOperation('seo_tools')) { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } $io = CBXVirtualIo::GetInstance(); $path = "/"; if (isset($_REQUEST["path"]) && strlen($_REQUEST["path"]) > 0) { $path = $_REQUEST["path"]; $path = $io->CombinePath("/", $path); } //Page path $documentRoot = CSite::GetSiteDocRoot($_REQUEST['site']); $absoluteFilePath = $documentRoot . $path; if (false !== ($pos = strrpos($absoluteFilePath, '/'))) { $absoluteDirPath = substr($absoluteFilePath, 0, $pos); } $bReadOnly = false; // this rights check is temporary disabled. it's fileman rights, we don't have to take a look on'em... // if (IsModuleInstalled("fileman")) // { // if (!$USER->CanDoOperation('fileman_admin_files') && !$USER->CanDoOperation('fileman_edit_existent_files')) // $bReadOnly = true; // } IncludeModuleLangFile(__FILE__); //Check permissions if (!$io->FileExists($absoluteFilePath)) { CAdminMessage::ShowMessage(GetMessage('SEO_TOOLS_ERROR_FILE_NOT_FOUND') . " (" . htmlspecialcharsbx($path) . ")");
function UploadFile($Params) { $buffer = 'parent.oWaitWindow.Hide();'; $F = $Params['file']; $io = CBXVirtualIo::GetInstance(); if (isset($F["tmp_name"]) && strlen($F["tmp_name"]) > 0 && strlen($F["name"]) > 0 || is_uploaded_file($F["tmp_name"])) { global $APPLICATION, $USER; $strWarning = ''; $filename = $Params['filename']; $path = $Params['path']; $site = $Params['site']; $upload_and_open = $Params['upload_and_open']; $rootPath = CSite::GetSiteDocRoot($site); if ($filename == '') { $filename = $F["name"]; } $pathto = Rel2Abs($path, $filename); if (strlen($filename) > 0 && ($mess = self::CheckFileName($filename)) !== true) { $strWarning = $mess; } if ($strWarning == '') { $fn = $io->ExtractNameFromPath($pathto); if ($APPLICATION->GetFileAccessPermission(array($site, $pathto)) > "R" && ($USER->IsAdmin() || !HasScriptExtension($fn) && substr($fn, 0, 1) != "." && $io->ValidateFilenameString($fn))) { if (!$io->FileExists($rootPath . $pathto) || $_REQUEST["rewrite"] == "Y") { //************************** Quota **************************// $bQuota = true; if (COption::GetOptionInt("main", "disk_space") > 0) { $bQuota = false; $quota = new CDiskQuota(); if ($quota->checkDiskQuota(array("FILE_SIZE" => filesize($F["tmp_name"])))) { $bQuota = true; } } //************************** Quota **************************// if ($bQuota) { $io->Copy($F["tmp_name"], $rootPath . $pathto); $flTmp = $io->GetFile($rootPath . $pathto); $flTmp->MarkWritable(); if (COption::GetOptionInt("main", "disk_space") > 0) { CDiskQuota::updateDiskQuota("file", $flTmp->GetFileSize(), "copy"); } $buffer = 'setTimeout(function(){parent.oBXDialogControls.Uploader.OnAfterUpload("' . $filename . '", ' . ($upload_and_open == "Y" ? 'true' : 'false') . ');}, 50);'; } else { $strWarning = $quota->LAST_ERROR; } } else { $strWarning = GetMessage("FD_LOAD_EXIST_ALERT"); } } else { $strWarning = GetMessage("FD_LOAD_DENY_ALERT"); } } } else { $strWarning = GetMessage("FD_LOAD_ERROR_ALERT"); } if ($strWarning != '') { $buffer = 'alert("' . addslashes(htmlspecialcharsex($strWarning)) . '");'; } return '<script>' . $buffer . '</script>'; }
$arHeaders = array(array("id" => "NAME", "content" => GetMessage("FILEMAN_FILE_NAME"), "sort" => "name_nat", "default" => true), array("id" => "SIZE", "content" => GetMessage("FILEMAN_ADMIN_FILE_SIZE"), "sort" => "size", "default" => true), array("id" => "DATE", "content" => GetMessage('FILEMAN_ADMIN_FILE_TIMESTAMP'), "sort" => "timestamp", "default" => true), array("id" => "TYPE", "content" => GetMessage('FILEMAN_ADMIN_FILE_TYPE'), "sort" => "", "default" => true)); } if (!CFileMan::IsWindows()) { $arHeaders[] = array("id" => "PERMS", "content" => GetMessage('FILEMAN_ADMIN_ACCESS_PERMS'), "sort" => "", "default" => true); } $arHeaders[] = array("id" => "PERMS_B", "content" => GetMessage('FILEMAN_ADMIN_ACCESS_PERMS_B'), "sort" => "", "default" => true); $lAdmin->AddHeaders($arHeaders); if (IntVal($show_perms_for) > 0) { $lAdmin->AddVisibleHeaderColumn("PERMS_B"); } $arVisibleColumns = $lAdmin->GetVisibleHeaderColumns(); if (!$bSearch && strlen($path) > 0 && ($logical != "Y" || rtrim($arSite["DIR"], "/") != rtrim($arParsedPath["FULL"], "/"))) { $row =& $lAdmin->AddRow(".", array("NAME" => GetMessage("FILEMAN_UP"))); $dbSitesList = CSite::GetList($b = "lendir", $o = "desc"); while ($arSite = $dbSitesList->GetNext()) { if ($arSite['DOC_ROOT'] == CSite::GetSiteDocRoot($site) || $arSite['DOC_ROOT'] == '') { $resSites[] = array('ID' => $arSite['ID'], 'DIR' => $arSite['DIR'], 'DOC_ROOT' => $arSite['DOC_ROOT']); } } $cnt_resSites = count($resSites); for ($i = 0; $i < $cnt_resSites; $i++) { $dir = trim($resSites[$i]["DIR"], "/"); if (substr(trim($arParsedPath["PREV"], "/"), 0, strlen($dir)) == $dir) { $site = $resSites[$i]["ID"]; break; } } if ($logical == "Y") { $showField = "<a href=\"javascript:" . $sTableID . ".GetAdminList('fileman_admin.php?" . $addUrl_s . "&site=" . $site . "&path=" . urlencode(urlencode($arParsedPath["PREV"])) . "&show_perms_for=" . IntVal($show_perms_for) . "', GALCallBack);\"><span class=\"adm-submenu-item-link-icon fileman_icon_folder_up\" alt=\"" . GetMessage("FILEMAN_UP") . "\"></span> <a href=\"javascript:" . $sTableID . ".GetAdminList('fileman_admin.php?" . $addUrl_s . "&site=" . $site . "&path=" . urlencode(urlencode($arParsedPath["PREV"])) . "&show_perms_for=" . IntVal($show_perms_for) . "', GALCallBack);\">..</a>"; } else { $showField = "<a href=\"javascript:" . $sTableID . ".GetAdminList('fileman_admin.php?" . $addUrl_s . "&site=" . $site . "&path=" . urlencode(urlencode($arParsedPath["PREV"])) . "&show_perms_for=" . IntVal($show_perms_for) . "', GALCallBack);\"><span class=\"adm-submenu-item-link-icon fileman_icon_folder_up\" alt=\"" . GetMessage("FILEMAN_UP") . "\"></span> <a href=\"javascript:" . $sTableID . ".GetAdminList('fileman_admin.php?" . $addUrl_s . "&site=" . $site . "&path=" . urlencode(urlencode($arParsedPath["PREV"])) . "&show_perms_for=" . IntVal($show_perms_for) . "', GALCallBack);\">..</a>";
$sPreviewFile = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/tmp/templates/__bx_preview/header.php"; if (defined("SITE_TEMPLATE_PREVIEW_MODE") && file_exists($sPreviewFile)) { include_once $sPreviewFile; } else { \Bitrix\Main\Page\Asset::getInstance()->startTarget('TEMPLATE'); include_once $_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . "/header.php"; \Bitrix\Main\Page\Asset::getInstance()->startTarget('PAGE'); } /* Draw edit menu for whole content */ global $BX_GLOBAL_AREA_EDIT_ICON; $BX_GLOBAL_AREA_EDIT_ICON = false; if ($APPLICATION->GetShowIncludeAreas()) { require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php"; $aUserOpt = CUserOptions::GetOption("global", "settings", array()); if ($aUserOpt["page_edit_control_enable"] != "N") { $documentRoot = CSite::GetSiteDocRoot(SITE_ID); if (isset($_SERVER["REAL_FILE_PATH"]) && $_SERVER["REAL_FILE_PATH"] != "") { $currentFilePath = $_SERVER["REAL_FILE_PATH"]; } else { $currentFilePath = $APPLICATION->GetCurPage(true); } $bCanEdit = true; if (!is_file($documentRoot . $currentFilePath) || !$USER->CanDoFileOperation("fm_edit_existent_file", array(SITE_ID, $currentFilePath))) { $bCanEdit = false; } //need fm_lpa for every .php file, even with no php code inside if ($bCanEdit && !$USER->CanDoOperation('edit_php') && in_array(GetFileExtension($currentFilePath), GetScriptFileExt()) && !$USER->CanDoFileOperation('fm_lpa', array(SITE_ID, $currentFilePath))) { $bCanEdit = false; } if ($bCanEdit && IsModuleInstalled("fileman") && !($USER->CanDoOperation("fileman_admin_files") && $USER->CanDoOperation("fileman_edit_existent_files"))) { $bCanEdit = false;
public static function Edit($Params) { global $APPLICATION; $name = CFileMan::SecurePathVar($Params['name']); $title = $Params['title']; $description = $Params['description']; $path = CFileMan::SecurePathVar($Params['path']); $template = CFileMan::SecurePathVar($Params['template']); $site = $Params['site']; $code = $Params['code']; $contPath = $_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$template."/snippets"; $thumb = $Params['thumb'] === false ? false : CFileMan::SecurePathVar($Params['thumb']); if (!file_exists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$template)) { ?><script>alert('Error: Incorrect template Id: <?php echo CUtil::JSEscape($template); ?> ');</script><? return; } if ($Params['bNew']) { $location = CUtil::addslashes(CFileMan::SecurePathVar($Params["location"])); $newGroup = CUtil::addslashes(CFileMan::SecurePathVar($Params["newGroup"])); $path = trim(($location ? $location.'/' : '').($newGroup ? $newGroup.'/' : ''), ' /'); if ($name == '') { $name = CSnippets::GetDefaultFileName($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$template."/snippets/".$path); ?><script>window.__bx_res_sn_filename = "<?php echo CUtil::JSEscape($name); ?> ";</script><? } $name = $name.'.snp'; } $key = $path.($path != '' ? '/' : '').$name; // 1. Save new snippet with new content if ($code) $APPLICATION->SaveFileContent($contPath.'/'.$key, $code); // 2. Rewrite title & description in .content.php if ($title || $description) { if (file_exists($contPath."/.content.php")) @include($contPath."/.content.php"); else $SNIPPETS = array(); if ($title) $SNIPPETS[$key]['title'] = $title; if ($description) $SNIPPETS[$key]['description'] = $description; $contentSrc = '<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>'.chr(10); $contentSrc .= '<?'.chr(10).'$SNIPPETS = Array();'.chr(10); foreach ($SNIPPETS as $k=>$_arSn) { if (CSnippets::CheckFile(array('site' => $Params["site"], 'template' => $Params['template'], 'path' => $k))) $contentSrc .= '$SNIPPETS[\''.CUtil::addslashes($k).'\'] = Array("title"=>\''.Cutil::addslashes($_arSn['title']).'\', "description"=>\''.Cutil::addslashes($_arSn['description']).'\');'.chr(10); } $contentSrc .= '?>'; $APPLICATION->SaveFileContent($contPath."/.content.php", $contentSrc); } CSnippets::ClearCache(); // 3. Handle thumbnail if ($thumb !== false) { if (substr($thumb,0,1) == '/') $thumb = substr($thumb,1); $pos = strrpos($name,"."); if ($pos === FALSE) return true; //delete existent thumbnail $f_name = substr($name, 0, $pos); $img_path1 = BX_PERSONAL_ROOT.'/templates/'.$template.'/snippets/images/'.$path.($path == '' ? '' : '/').$f_name; $DOC_ROOT = CSite::GetSiteDocRoot($site); $arExt = array("gif", "jpg", "jpeg", "png", "bmp"); for ($i = 0, $c = count($arExt); $i < $c; $i++) { $p_ = $img_path1.".".$arExt[$i]; if(file_exists($DOC_ROOT.$p_)) CFileman::DeleteFile(Array($site, $p_)); } if (empty($thumb) || strrpos($thumb, '.') === FALSE) return true; // Copy Thumbnail $path_from_1 = $DOC_ROOT."/".$thumb; $path_from = '/'.$thumb; if (file_exists($path_from_1)) { $pos = strrpos($thumb,"."); $f_ext = ($pos !== FALSE) ? strtolower(substr($thumb, $pos + 1)) : ''; if (in_array($f_ext, $arExt)) { $path_to = $img_path1.'.'.$f_ext; $strWarning_tmp = CFileMan::CopyEx(Array($site, $path_from), Array($site, $path_to)); } } } }
function GetStandardButtons() { global $USER, $APPLICATION, $DB; if (isset($_SERVER["REAL_FILE_PATH"]) && $_SERVER["REAL_FILE_PATH"] != "") { $currentDirPath = dirname($_SERVER["REAL_FILE_PATH"]); $currentFilePath = $_SERVER["REAL_FILE_PATH"]; } else { $currentDirPath = $APPLICATION->GetCurDir(); $currentFilePath = $APPLICATION->GetCurPage(true); } $encCurrentDirPath = urlencode($currentDirPath); $encCurrentFilePath = urlencode($currentFilePath); $encRequestUri = urlencode($_SERVER["REQUEST_URI"]); $encSiteTemplateId = urlencode(SITE_TEMPLATE_ID); $documentRoot = CSite::GetSiteDocRoot(SITE_ID); $filemanExists = IsModuleInstalled("fileman"); //create button $defaultUrl = ""; $bCanCreatePage = CTopPanel::IsCanCreatePage($currentDirPath, $documentRoot, $filemanExists); $bCanCreateSection = CTopPanel::IsCanCreateSection($currentDirPath, $documentRoot, $filemanExists); if ($bCanCreatePage || $bCanCreateSection) { require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/admin_tools.php"; //create page from new template $arActPageTemplates = CPageTemplate::GetList(array(SITE_TEMPLATE_ID)); //create page from old template $arPageTemplates = GetFileTemplates(SITE_ID, array(SITE_TEMPLATE_ID)); } // CREATE PAGE button and submenu $arMenu = array(); if ($bCanCreatePage) { $defaultUrl = $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_new.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&templateID=" . $encSiteTemplateId . "&path=" . $encCurrentDirPath . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250))); $arMenu[] = array("TEXT" => GetMessage("top_panel_create_page"), "TITLE" => GetMessage("top_panel_create_page_title"), "ICON" => "panel-new-file", "ACTION" => $defaultUrl, "DEFAULT" => true, "SORT" => 10, "HK_ID" => "top_panel_create_page"); //templates menu for pages $arSubmenu = array(); if (!empty($arActPageTemplates)) { foreach ($arActPageTemplates as $pageTemplate) { if ($pageTemplate['type'] == '' || $pageTemplate['type'] == 'page') { $arSubmenu[] = array("TEXT" => "<b>" . $pageTemplate['name'] . "</b>" . ($pageTemplate['description'] != '' ? "<br>" . $pageTemplate['description'] : ""), "TITLE" => GetMessage("top_panel_template") . " " . $pageTemplate['file'], "ICON" => $pageTemplate['icon'] == '' ? "panel-new-file-template" : "", "IMAGE" => $pageTemplate['icon'] != '' ? $pageTemplate['icon'] : "", "ACTION" => str_replace("public_file_new.php?", "public_file_new.php?wiz_template=" . urlencode($pageTemplate['file']) . "&", $defaultUrl)); } } } if (!empty($arPageTemplates) && (!empty($arSubmenu) || count($arPageTemplates) > 1)) { foreach ($arPageTemplates as $pageTemplate) { $arSubmenu[] = array("TEXT" => $pageTemplate['name'], "TITLE" => GetMessage("top_panel_template") . " " . $pageTemplate['file'], "ICON" => "panel-new-file-template", "ACTION" => str_replace("public_file_new.php?", "public_file_new.php?page_template=" . urlencode($pageTemplate['file']) . "&", $defaultUrl)); } } //page from template if ($bCanCreatePage && !empty($arSubmenu)) { $arMenu[] = array("TEXT" => GetMessage("top_panel_create_from_template"), "TITLE" => GetMessage("top_panel_create_from_template_title"), "ICON" => "panel-new-file-template", "MENU" => $arSubmenu, "SORT" => 20); } } if (!empty($arMenu)) { $APPLICATION->AddPanelButton(array("HREF" => $defaultUrl == "" ? "" : "javascript:" . $defaultUrl, 'TYPE' => 'BIG', "ID" => "create", "ICON" => "bx-panel-create-page-icon", "ALT" => GetMessage("top_panel_create_title"), "TEXT" => GetMessage("top_panel_create_new"), "MAIN_SORT" => "100", "SORT" => 10, "MENU" => $arMenu, "RESORT_MENU" => true, "HK_ID" => "top_panel_create_new", "HINT" => array("TITLE" => GetMessage("top_panel_create_new_tooltip_title"), "TEXT" => GetMessage("top_panel_create_new_tooltip")), "HINT_MENU" => array("TITLE" => GetMessage("top_panel_create_new_menu_tooltip_title"), "TEXT" => GetMessage("top_panel_create_new_menu_tooltip")))); } // CREATE SECTION button and submenu $arMenu = array(); if ($bCanCreateSection) { $defaultUrl = $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_new.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&templateID=" . $encSiteTemplateId . "&newFolder=Y&path=" . $encCurrentDirPath . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250))); $arMenu[] = array("TEXT" => GetMessage("top_panel_create_folder"), "TITLE" => GetMessage("top_panel_create_folder_title"), "ICON" => "panel-new-folder", 'DEFAULT' => true, "ACTION" => $defaultUrl, "SORT" => 10, "HK_ID" => "top_panel_create_folder"); //templates menu for sections $arSectSubmenu = array(); if (!empty($arActPageTemplates)) { foreach ($arActPageTemplates as $pageTemplate) { if ($pageTemplate['type'] == '' || $pageTemplate['type'] == 'section') { $arSectSubmenu[] = array("TEXT" => "<b>" . $pageTemplate['name'] . "</b>" . ($pageTemplate['description'] != '' ? "<br>" . $pageTemplate['description'] : ""), "TITLE" => GetMessage("top_panel_template") . " " . $pageTemplate['file'], "ICON" => $pageTemplate['icon'] == '' ? "panel-new-file-template" : "", "IMAGE" => $pageTemplate['icon'] != '' ? $pageTemplate['icon'] : "", "ACTION" => str_replace("public_file_new.php?", "public_file_new.php?newFolder=Y&wiz_template=" . urlencode($pageTemplate['file']) . "&", $defaultUrl)); } } } if (!empty($arPageTemplates) && (!empty($arSectSubmenu) || count($arPageTemplates) > 1)) { if (!empty($arSectSubmenu)) { $arSectSubmenu[] = array("SEPARATOR" => true); } foreach ($arPageTemplates as $pageTemplate) { $arSectSubmenu[] = array("TEXT" => $pageTemplate['name'], "TITLE" => GetMessage("top_panel_template") . " " . $pageTemplate['file'], "ICON" => "panel-new-file-template", "ACTION" => str_replace("public_file_new.php?", "public_file_new.php?newFolder=Y&page_template=" . urlencode($pageTemplate['file']) . "&", $defaultUrl)); } } //section from template if ($bCanCreateSection && !empty($arSectSubmenu)) { $arMenu[] = array("TEXT" => GetMessage("top_panel_create_folder_template"), "TITLE" => GetMessage("top_panel_create_folder_template_title"), "ICON" => "panel-new-folder-template", "MENU" => $arSectSubmenu, "SORT" => 20); } } if (!empty($arMenu)) { $APPLICATION->AddPanelButton(array("HREF" => $defaultUrl == "" ? "" : "javascript:" . $defaultUrl, 'TYPE' => 'BIG', "ID" => "create_section", "ICON" => "bx-panel-create-section-icon", "ALT" => GetMessage("top_panel_create_title"), "TEXT" => GetMessage("top_panel_create_folder_new"), "MAIN_SORT" => "100", "SORT" => 20, "MENU" => $arMenu, "RESORT_MENU" => true, "HK_ID" => "top_panel_create_folder_new", "HINT" => array("TITLE" => GetMessage("top_panel_create_folder_new_tooltip_title"), "TEXT" => GetMessage("top_panel_create_folder_new_tooltip")), "HINT_MENU" => array("TITLE" => GetMessage("top_panel_create_folder_new_menu_tooltip_title"), "TEXT" => GetMessage("top_panel_create_folder_new_menu_tooltip")))); } // EDIT PAGE button and submenu $defaultUrl = ""; $arMenu = array(); if (CTopPanel::IsCanEditPage($currentFilePath, $documentRoot, $filemanExists)) { $defaultUrl = $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_edit.php?lang=" . LANGUAGE_ID . "&path=" . $encCurrentFilePath . "&site=" . SITE_ID . "&back_url=" . $encRequestUri . "&templateID=" . $encSiteTemplateId, "PARAMS" => array("width" => 780, "height" => 470, "resizable" => true, "min_width" => 780, "min_height" => 400, 'dialog_type' => 'EDITOR'))); $arMenu[] = array("TEXT" => GetMessage("top_panel_edit_page"), "TITLE" => GetMessage("top_panel_edit_page_title"), "ICON" => "panel-edit-visual", "ACTION" => $defaultUrl, "DEFAULT" => true, "SORT" => 10, "HK_ID" => "top_panel_edit_page"); $arMenu[] = array("TEXT" => GetMessage("top_panel_page_prop"), "TITLE" => GetMessage("top_panel_page_prop_title"), "ICON" => "panel-file-props", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_property.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . $encCurrentFilePath . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250))), "SORT" => 20, "HK_ID" => "top_panel_page_prop"); $arMenu[] = array("SEPARATOR" => true, "SORT" => 49); $arMenu[] = array("TEXT" => GetMessage("top_panel_edit_page_html"), "TITLE" => GetMessage("top_panel_edit_page_html_title"), "ICON" => "panel-edit-text", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_edit.php?lang=" . LANGUAGE_ID . "&noeditor=Y&path=" . $encCurrentFilePath . "&site=" . SITE_ID . "&back_url=" . $encRequestUri, "PARAMS" => array("width" => 780, "height" => 470, 'dialog_type' => 'EDITOR'))), "SORT" => 50, "HK_ID" => "top_panel_edit_page_html"); if ($USER->CanDoOperation("edit_php")) { $arMenu[] = array("TEXT" => GetMessage("top_panel_edit_page_php"), "TITLE" => GetMessage("top_panel_edit_page_php_title"), "ICON" => "panel-edit-php", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_edit_src.php?lang=" . LANGUAGE_ID . "&path=" . $encCurrentFilePath . "&site=" . SITE_ID . "&back_url=" . $encRequestUri . "&templateID=" . $encSiteTemplateId, "PARAMS" => array("width" => 770, "height" => 470, 'dialog_type' => 'EDITOR'))), "SORT" => 60, "HK_ID" => "top_panel_edit_page_php"); } } $bNeedSep = false; if (CTopPanel::IsCanEditPermission($currentFilePath, $documentRoot, $filemanExists)) { $bNeedSep = true; //access button $arMenu[] = array("TEXT" => GetMessage("top_panel_access_page_new"), "TITLE" => GetMessage("top_panel_access_page_title"), "ICON" => "panel-file-access", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_access_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . $encCurrentFilePath . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250))), "SORT" => 30, "HK_ID" => "top_panel_access_page_new"); } //delete button if (CTopPanel::IsCanDeletePage($currentFilePath, $documentRoot, $filemanExists)) { $bNeedSep = true; $arMenu[] = array("ID" => "delete", "ICON" => "icon-delete", "ALT" => GetMessage("top_panel_del_page"), "TEXT" => GetMessage("top_panel_del_page"), "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_delete.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . $encCurrentFilePath, "PARAMS" => array("min_width" => 250, "min_height" => 180, 'height' => 180, 'width' => 440))), "SORT" => 40, "HK_ID" => "top_panel_del_page"); } if ($bNeedSep) { $arMenu[] = array("SEPARATOR" => true, "SORT" => 29); } if (!empty($arMenu)) { //check anonymous access $arOperations = CUser::GetFileOperations(array(SITE_ID, $currentFilePath), array(2)); $bAllowAnonymous = in_array("fm_view_file", $arOperations); $APPLICATION->AddPanelButton(array("HREF" => $defaultUrl == "" ? "" : "javascript:" . $defaultUrl, "TYPE" => "BIG", "ID" => "edit", "ICON" => $bAllowAnonymous ? "bx-panel-edit-page-icon" : "bx-panel-edit-secret-page-icon", "ALT" => GetMessage("top_panel_edit_title"), "TEXT" => GetMessage("top_panel_edit_new"), "MAIN_SORT" => "200", "SORT" => 10, "MENU" => $arMenu, "HK_ID" => "top_panel_edit_new", "RESORT_MENU" => true, "HINT" => array("TITLE" => GetMessage("top_panel_edit_new_tooltip_title"), "TEXT" => GetMessage("top_panel_edit_new_tooltip")), "HINT_MENU" => array("TITLE" => GetMessage("top_panel_edit_new_menu_tooltip_title"), "TEXT" => GetMessage("top_panel_edit_new_menu_tooltip")))); } // EDIT SECTION button $arMenu = array(); if (CTopPanel::IsCanEditSection($currentDirPath, $filemanExists)) { $defaultUrl = 'javascript:' . $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_folder_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . urlencode($APPLICATION->GetCurDir()) . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250))); $arMenu[] = array("TEXT" => GetMessage("top_panel_folder_prop"), "TITLE" => GetMessage("top_panel_folder_prop_title"), "ICON" => "panel-folder-props", "DEFAULT" => true, "ACTION" => $defaultUrl, "SORT" => 10, "HK_ID" => "top_panel_folder_prop"); } if (CTopPanel::IsCanEditPermission($currentDirPath, $documentRoot, $filemanExists)) { $arMenu[] = array("TEXT" => GetMessage("top_panel_access_folder_new"), "TITLE" => GetMessage("top_panel_access_folder_title"), "ICON" => "panel-folder-access", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_access_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . $encCurrentDirPath . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250))), "SORT" => 30, "HK_ID" => "top_panel_access_folder_new"); } if (!empty($arMenu)) { //check anonymous access $arOperations = CUser::GetFileOperations(array(SITE_ID, $currentDirPath), array(2)); $bAllowAnonymous = in_array("fm_view_listing", $arOperations); $APPLICATION->AddPanelButton(array("HREF" => $defaultUrl, "ID" => 'edit_section', "TYPE" => "BIG", "TEXT" => GetMessage("top_panel_folder_prop_new"), "TITLE" => GetMessage("top_panel_folder_prop_title"), "ICON" => $bAllowAnonymous ? "bx-panel-edit-section-icon" : "bx-panel-edit-secret-section-icon", "MAIN_SORT" => "200", "SORT" => 20, "MENU" => $arMenu, "HK_ID" => "top_panel_folder_prop_new", "RESORT_MENU" => true, "HINT" => array("TITLE" => GetMessage("top_panel_folder_prop_new_tooltip_title"), "TEXT" => GetMessage("top_panel_folder_prop_new_tooltip")), "HINT_MENU" => array("TITLE" => GetMessage("top_panel_folder_prop_new_menu_tooltip_title"), "TEXT" => GetMessage("top_panel_folder_prop_new_menu_tooltip")))); } // STRUCTURE button and submenu if ($USER->CanDoOperation('fileman_view_file_structure') && $USER->CanDoFileOperation('fm_edit_existent_folder', array(SITE_ID, "/"))) { $defaultUrl = $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_structure.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . $encCurrentFilePath . "&templateID=" . $encSiteTemplateId, "PARAMS" => array("width" => 350, "height" => 470, "resize" => true))); $arMenu = array(); if ($filemanExists) { $arMenu[] = array("TEXT" => GetMessage("main_top_panel_struct"), "TITLE" => GetMessage("main_top_panel_struct_title"), "ACTION" => $defaultUrl, "DEFAULT" => true, "HK_ID" => "main_top_panel_struct"); $arMenu[] = array('SEPARATOR' => true); $arMenu[] = array("TEXT" => GetMessage("main_top_panel_struct_panel"), "TITLE" => GetMessage("main_top_panel_struct_panel_title"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape("/freetrix/admin/fileman_admin.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . urlencode($APPLICATION->GetCurDir())) . "')", "HK_ID" => "main_top_panel_struct_panel"); } $APPLICATION->AddPanelButton(array("HREF" => "javascript:" . $defaultUrl, "ID" => "structure", "ICON" => "bx-panel-site-structure-icon", "ALT" => GetMessage("main_top_panel_struct_title"), "TEXT" => GetMessage("main_top_panel_structure"), "MAIN_SORT" => "300", "SORT" => 30, "MENU" => $arMenu, "HK_ID" => "main_top_panel_structure", "HINT" => array("TITLE" => GetMessage("main_top_panel_structure_tooltip_title"), "TEXT" => GetMessage("main_top_panel_structure_tooltip")))); } //cache button if ($USER->CanDoOperation("cache_control")) { //recreate cache on the current page $arMenu = array(array("TEXT" => GetMessage("top_panel_cache_page"), "TITLE" => GetMessage("top_panel_cache_page_title"), "ICON" => "panel-page-cache", "ACTION" => "BX.clearCache()", "DEFAULT" => true, "HK_ID" => "top_panel_cache_page")); if (!empty($APPLICATION->aCachedComponents)) { $arMenu[] = array("TEXT" => GetMessage("top_panel_cache_comp"), "TITLE" => GetMessage("top_panel_cache_comp_title"), "ICON" => "panel-comp-cache", "ACTION" => "jsComponentUtils.ClearCache('component_name=" . CUtil::addslashes(implode(",", $APPLICATION->aCachedComponents)) . "&site_id=" . SITE_ID . "');", "HK_ID" => "top_panel_cache_comp"); } $arMenu[] = array("SEPARATOR" => true); $sessionClearCache = isset($_SESSION["SESS_CLEAR_CACHE"]) && $_SESSION["SESS_CLEAR_CACHE"] == "Y"; $arMenu[] = array("TEXT" => GetMessage("top_panel_cache_not"), "TITLE" => GetMessage("top_panel_cache_not_title"), "CHECKED" => $sessionClearCache, "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($APPLICATION->GetCurPageParam("clear_cache_session=" . ($sessionClearCache ? "N" : "Y"), array("clear_cache_session"))) . "');", "HK_ID" => "top_panel_cache_not"); // $APPLICATION->AddPanelButton(array( // "HREF" => "javascript:BX.clearCache()", // "TYPE" => "BIG", // "ICON"=>"bx-panel-clear-cache-icon", // "TEXT"=> GetMessage("top_panel_cache_new"),//GetMessage("top_panel_cache"), // "ALT"=>GetMessage("top_panel_clear_cache"), // "MAIN_SORT"=>"400", // "SORT"=>10, // "MENU"=>$arMenu, // "HK_ID"=>"top_panel_clear_cache", // "HINT" => array( // "TITLE" => GetMessage("top_panel_cache_new_tooltip_title"), // "TEXT" => GetMessage("top_panel_cache_new_tooltip") // ), // "HINT_MENU" => array( // "TITLE" => GetMessage("top_panel_cache_new_menu_tooltip_title"), // "TEXT" => GetMessage("top_panel_cache_new_menu_tooltip") // ), // )); } $bHideComponentsMenu = false; if ($USER->CanDoOperation('edit_php') || !empty($APPLICATION->arPanelFutureButtons['components'])) { if (empty($APPLICATION->arPanelFutureButtons['components'])) { if ($APPLICATION->GetShowIncludeAreas() != 'Y') { $APPLICATION->AddPanelButtonMenu('components', array("TEXT" => GetMessage("top_panel_edit_mode"), "TITLE" => GetMessage("top_panel_edit_mode_title"), "ACTION" => "jsUtils.Redirect([], BX('bx-panel-toggle').href);", "HK_ID" => "top_panel_edit_mode")); } else { $bHideComponentsMenu = true; } } if ($bHideComponentsMenu) { $APPLICATION->AddPanelButton(array("ID" => "components_empty", "HREF" => "javascript:void(0)", "ICON" => "bx-panel-components-icon", "TEXT" => GetMessage("top_panel_comp"), "MAIN_SORT" => "500", "SORT" => 10, "HINT" => array("TITLE" => GetMessage("top_panel_comp_tooltip_title"), "TEXT" => GetMessage('top_panel_comp_tooltip_empty')))); } else { $APPLICATION->AddPanelButton(array("ID" => "components", "ICON" => "bx-panel-components-icon", "TEXT" => GetMessage("top_panel_comp"), "MAIN_SORT" => "500", "SORT" => 10, "HINT" => array("TITLE" => GetMessage("top_panel_comp_tooltip_title"), "TEXT" => GetMessage("top_panel_comp_tooltip")))); } } //TEMPLATE button and submenu if ($USER->CanDoOperation("edit_php") || $USER->CanDoOperation("lpa_template_edit")) { $arMenu = array(); $bUseSubmenu = false; $defaultUrl = ''; if ($USER->CanDoOperation("edit_php")) { $filePath = SITE_TEMPLATE_PATH . "/styles.css"; if (file_exists($_SERVER['DOCUMENT_ROOT'] . $filePath)) { $arMenu[] = array("TEXT" => GetMessage("top_panel_templ_site_css"), "TITLE" => GetMessage("top_panel_templ_site_css_title"), "ICON" => "panel-edit-text", "HK_ID" => "top_panel_templ_site_css", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_edit_src.php?lang=" . LANGUAGE_ID . "&path=" . urlencode($filePath) . "&site=" . SITE_ID . "&back_url=" . $encRequestUri, "PARAMS" => array("width" => 770, 'height' => 470, 'resize' => true, 'dialog_type' => 'EDITOR')))); $bUseSubmenu = true; } $filePath = SITE_TEMPLATE_PATH . "/template_styles.css"; if (file_exists($_SERVER['DOCUMENT_ROOT'] . $filePath)) { $arMenu[] = array("TEXT" => GetMessage("top_panel_templ_templ_css"), "TITLE" => GetMessage("top_panel_templ_templ_css_title"), "ICON" => "panel-edit-text", "HK_ID" => "top_panel_templ_templ_css", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/public_file_edit_src.php?lang=" . LANGUAGE_ID . "&path=" . urlencode($filePath) . "&site=" . SITE_ID . "&back_url=" . $encRequestUri, "PARAMS" => array("width" => 770, 'height' => 470, 'resize' => true, 'dialog_type' => 'EDITOR')))); $bUseSubmenu = true; } } $arSubMenu = array(array("TEXT" => GetMessage("top_panel_templ_edit"), "TITLE" => GetMessage("top_panel_templ_edit_title"), "ICON" => "icon-edit", "ACTION" => "jsUtils.Redirect([], '/freetrix/admin/template_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $encSiteTemplateId . "')", "DEFAULT" => !$bUseSubmenu, "HK_ID" => "top_panel_templ_edit"), array("TEXT" => GetMessage("top_panel_templ_site"), "TITLE" => GetMessage("top_panel_templ_site_title"), "ICON" => "icon-edit", "ACTION" => "jsUtils.Redirect([], '/freetrix/admin/site_edit.php?lang=" . LANGUAGE_ID . "&LID=" . SITE_ID . "')", "DEFAULT" => false, "HK_ID" => "top_panel_templ_site")); if ($bUseSubmenu) { $arMenu[] = array('SEPARATOR' => "Y"); $arMenu[] = array("TEXT" => GetMessage("top_panel_cp"), "MENU" => $arSubMenu); } else { $arMenu = $arSubMenu; $defaultUrl = "javascript:" . $arSubMenu[0]['ACTION']; } $APPLICATION->AddPanelButton(array("HREF" => $defaultUrl, "ICON" => "bx-panel-site-template-icon", "ALT" => GetMessage("top_panel_templ_title"), "TEXT" => GetMessage("top_panel_templ"), "MAIN_SORT" => "500", "SORT" => 30, "MENU" => $arMenu, "HK_ID" => "top_panel_templ", "HINT" => array("TITLE" => GetMessage("top_panel_templ_tooltip_title"), "TEXT" => GetMessage("top_panel_templ_tooltip")))); } //statistics buttons if ($USER->CanDoOperation("edit_php")) { //show debug information $sessionShowIncludeTimeExec = isset($_SESSION["SESS_SHOW_INCLUDE_TIME_EXEC"]) && $_SESSION["SESS_SHOW_INCLUDE_TIME_EXEC"] == "Y"; $sessionShowTimeExec = isset($_SESSION["SESS_SHOW_TIME_EXEC"]) && $_SESSION["SESS_SHOW_TIME_EXEC"] == "Y"; $cmd = $sessionShowIncludeTimeExec && $sessionShowTimeExec && $DB->ShowSqlStat ? "N" : "Y"; $url = $APPLICATION->GetCurPageParam("show_page_exec_time=" . $cmd . "&show_include_exec_time=" . $cmd . "&show_sql_stat=" . $cmd, array("show_page_exec_time", "show_include_exec_time", "show_sql_stat")); $arMenu = array(array("TEXT" => GetMessage("top_panel_debug_summ"), "TITLE" => GetMessage("top_panel_debug_summ_title"), "CHECKED" => $cmd == "N", "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($url) . "');", "DEFAULT" => true, "HK_ID" => "top_panel_debug_summ"), array("SEPARATOR" => true), array("TEXT" => GetMessage("top_panel_debug_sql"), "TITLE" => GetMessage("top_panel_debug_sql_title"), "CHECKED" => !!$DB->ShowSqlStat, "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($APPLICATION->GetCurPageParam("show_sql_stat=" . ($DB->ShowSqlStat ? "N" : "Y"), array("show_sql_stat"))) . "');", "HK_ID" => "top_panel_debug_sql"), array("TEXT" => GetMessage("top_panel_debug_cache"), "TITLE" => GetMessage("top_panel_debug_cache_title"), "CHECKED" => !!\Freetrix\Main\Data\Cache::getShowCacheStat(), "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($APPLICATION->GetCurPageParam("show_cache_stat=" . (\Freetrix\Main\Data\Cache::getShowCacheStat() ? "N" : "Y"), array("show_cache_stat"))) . "');", "HK_ID" => "top_panel_debug_cache"), array("TEXT" => GetMessage("top_panel_debug_incl"), "TITLE" => GetMessage("top_panel_debug_incl_title"), "CHECKED" => $sessionShowIncludeTimeExec, "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($APPLICATION->GetCurPageParam("show_include_exec_time=" . ($sessionShowIncludeTimeExec ? "N" : "Y"), array("show_include_exec_time"))) . "');", "HK_ID" => "top_panel_debug_incl"), array("TEXT" => GetMessage("top_panel_debug_time"), "TITLE" => GetMessage("top_panel_debug_time_title"), "CHECKED" => $sessionShowTimeExec, "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($APPLICATION->GetCurPageParam("show_page_exec_time=" . ($sessionShowTimeExec ? "N" : "Y"), array("show_page_exec_time"))) . "');", "HK_ID" => "top_panel_debug_time")); if (IsModuleInstalled("compression")) { $bShowCompressed = isset($_SESSION["SESS_COMPRESS"]) && $_SESSION["SESS_COMPRESS"] == "Y"; if (isset($_GET["compress"])) { if ($_GET["compress"] === "Y" || $_GET["compress"] === "y") { $bShowCompressed = true; } elseif ($_GET["compress"] === "N" || $_GET["compress"] === "n") { $bShowCompressed = false; } } $arMenu[] = array("SEPARATOR" => true); $arMenu[] = array("TEXT" => GetMessage("top_panel_debug_compr"), "TITLE" => GetMessage("top_panel_debug_compr_title"), "CHECKED" => !!$bShowCompressed, "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($APPLICATION->GetCurPageParam("compress=" . ($bShowCompressed ? "N" : "Y"), array("compress"))) . "');", "HK_ID" => "top_panel_debug_compr"); } $APPLICATION->AddPanelButton(array("HREF" => $url, "ICON" => "bx-panel-performance-icon", "TEXT" => GetMessage("top_panel_debug"), "ALT" => GetMessage("top_panel_show_debug"), "MAIN_SORT" => "500", "SORT" => 40, "MENU" => $arMenu, "HK_ID" => "top_panel_debug", "HINT" => array("TITLE" => GetMessage("top_panel_debug_tooltip_title"), "TEXT" => GetMessage("top_panel_debug_tooltip")))); } /////////////////////// SHORT URIs //////////////////////////////////////// if ($USER->CanDoOperation('manage_short_uri')) { $url = $APPLICATION->GetPopupLink(array("URL" => "/freetrix/admin/short_uri_edit.php?lang=" . LANGUAGE_ID . "&public=Y&bxpublic=Y&str_URI=" . urlencode($APPLICATION->GetCurPageParam("", array("clear_cache", "sessid", "login", "logout", "register", "forgot_password", "change_password", "confirm_registration", "confirm_code", "confirm_user_id", "freetrix_include_areas", "show_page_exec_time", "show_include_exec_time", "show_sql_stat", "show_link_stat"))) . "&site=" . SITE_ID . "&back_url=" . $encRequestUri, "PARAMS" => array("width" => 770, 'height' => 270, 'resize' => true))); $APPLICATION->AddPanelButton(array("HREF" => "javascript:" . $url, "ICON" => "bx-panel-short-url-icon", "ALT" => GetMessage("MTP_SHORT_URI_ALT"), "TEXT" => GetMessage("MTP_SHORT_URI"), "MAIN_SORT" => 1000, "HK_ID" => "MTP_SHORT_URI", "MENU" => array(array("TEXT" => GetMessage("MTP_SHORT_URI1"), "TITLE" => GetMessage("MTP_SHORT_URI_ALT1"), "ACTION" => "javascript:" . $url, "DEFAULT" => true, "HK_ID" => "MTP_SHORT_URI1"), array("TEXT" => GetMessage("MTP_SHORT_URI_LIST"), "TITLE" => GetMessage("MTP_SHORT_URI_LIST_ALT"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes("/freetrix/admin/short_uri_admin.php?lang=" . LANGUAGE_ID . "") . "');", "HK_ID" => "MTP_SHORT_URI_LIST")), "MODE" => "view", "HINT" => array("TITLE" => GetMessage("MTP_SHORT_URI_HINT"), "TEXT" => GetMessage("MTP_SHORT_URI_HINT_ALT")))); } }
function OnChangeFilePermissions($path, $permission = array(), $old_permission = array(), $arGroups = false) { global $APPLICATION; $DB = CDatabase::GetModuleConnection('search'); $site = false; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); $path = rtrim($path, "/"); if(!is_array($arGroups)) { $arGroups = CSearch::GetGroupCached(); //Check if anonymous permission was changed if(!array_key_exists(2, $permission) && array_key_exists("*", $permission)) $permission[2] = $permission["*"]; if(!is_array($old_permission)) $old_permission = array(); if(!array_key_exists(2, $old_permission) && array_key_exists("*", $old_permission)) $old_permission[2] = $old_permission["*"]; //And if not when will do nothing if( (array_key_exists(2, $permission) && $permission[2] >= "R") && array_key_exists(2, $old_permission) && $old_permission[2] >= "R" ) { return; } } if(file_exists($DOC_ROOT.$path)) { @set_time_limit(300); if(is_dir($DOC_ROOT.$path)) { $handle = @opendir($DOC_ROOT.$path); while(false !== ($file = @readdir($handle))) { if($file == "." || $file == "..") continue; $full_file = $path."/".$file; if($full_file == "/bitrix") continue; if(is_dir($DOC_ROOT.$full_file) || CSearch::CheckPath($full_file)) CSearch::OnChangeFilePermissions(array($site, $full_file), array(), array(), $arGroups); } } else//if(is_dir($DOC_ROOT.$path)) { $rs = $DB->Query(" SELECT SC.ID FROM b_search_content SC WHERE MODULE_ID='main' AND ITEM_ID='".$DB->ForSql($site."|".$path)."' ", false, "File: ".__FILE__."<br>Line: ".__LINE__); if($ar = $rs->Fetch()) { $arNewGroups = array(); foreach($arGroups as $group_id) { $p = $APPLICATION->GetFileAccessPermission(array($site, $path), array($group_id)); if($p >= "R") { $arNewGroups[$group_id] = 'G'.$group_id; if($group_id == 2) break; } } CAllSearch::SetContentItemGroups($ar["ID"], $arNewGroups); } } //if(is_dir($DOC_ROOT.$path)) }//if(file_exists($DOC_ROOT.$path)) }
function ReindexFile($path, $SEARCH_SESS_ID = "", $max_file_size = 0) { global $APPLICATION; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); if (!CUrlRewriter::CheckPath($path)) { return 0; } if ($max_file_size > 0 && filesize($DOC_ROOT . "/" . $path) > $max_file_size * 1024) { return 0; } $filesrc = $APPLICATION->GetFileContent($DOC_ROOT . "/" . $path); if (!$filesrc || $filesrc == "") { return 0; } $arComponents = PHPParser::ParseScript($filesrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { if ($arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { $arFields = array("SITE_ID" => $site, "CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "RULE" => "", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path); CUrlRewriter::Add($arFields); } } return true; }
function __check_folder($site, $path) { $DOC_ROOT = CSite::GetSiteDocRoot($site); $foldersExists = false; $io = CBXVirtualIo::GetInstance(); $dir = $io->GetDirectory($DOC_ROOT . $path); $arChildren = $dir->GetChildren(); foreach ($arChildren as $child) { if (!$child->IsDirectory()) { continue; } return true; } return false; }
$bNeedButton = $arParams["OBJECT"]->workflow == "bizproc"; if ($arParams["OBJECT"]->workflow == "bizproc_limited") { $bNeedButton = CIBlock::GetArrayByID($arParams["OBJECT"]->IBLOCK_ID, "BIZPROC") != "N"; } if ($bNeedButton) { $component->arResult["arButtons"] = is_array($component->arResult["arButtons"]) ? $component->arResult["arButtons"] : array(); $component->arResult["arButtons"][] = array("TEXT" => GetMessage("SOCNET_SETTINGS"), "TITLE" => GetMessage("SOCNET_SETTINGS_ALT"), "LINK" => "javascript:" . $APPLICATION->GetPopupLink(array("URL" => $component->__path . "/include/webdav_settings.php?DOCUMENT_ID=" . $arParams["OBJECT"]->wfParams['DOCUMENT_TYPE'][2] . "&back_url=" . urlencode($APPLICATION->GetCurPage()), "PARAMS" => array("min_width" => 300, "min_height" => 150))), "ICON" => "btn-list settings"); } // } } $result = $APPLICATION->IncludeComponent("bitrix:webdav.menu", ".default", array("OBJECT" => $arParams["OBJECT"], "SECTION_ID" => $arResult["VARIABLES"]["SECTION_ID"], "ELEMENT_ID" => $arResult["VARIABLES"]["ELEMENT_ID"], "PAGE_NAME" => $arResult["VARIABLES"]["PAGE_NAME"], "ACTION" => $arResult["VARIABLES"]["ACTION"], "BASE_URL" => $arResult["VARIABLES"]["BASE_URL"], "SECTIONS_URL" => $arResult["~PATH_TO_USER_FILES"], "SECTION_EDIT_URL" => $arResult["~PATH_TO_USER_FILES_SECTION_EDIT"], "ELEMENT_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT"], "ELEMENT_EDIT_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT_EDIT"], "ELEMENT_FILE_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT_FILE"], "ELEMENT_HISTORY_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT_HISTORY"], "ELEMENT_HISTORY_GET_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT_HISTORY_GET"], "ELEMENT_VERSION_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT_VERSION"], "ELEMENT_VERSIONS_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT_VERSIONS"], "ELEMENT_UPLOAD_URL" => $arResult["~PATH_TO_USER_FILES_ELEMENT_UPLOAD"], "HELP_URL" => $arResult["~PATH_TO_USER_FILES_HELP"], "USER_VIEW_URL" => $arResult["~PATH_TO_USER"], "WEBDAV_BIZPROC_HISTORY_URL" => $arResult["~PATH_TO_USER_FILES_WEBDAV_BIZPROC_HISTORY"], "WEBDAV_BIZPROC_HISTORY_GET_URL" => $arResult["~PATH_TO_USER_FILES_WEBDAV_BIZPROC_HISTORY_GET"], "WEBDAV_BIZPROC_LOG_URL" => $arResult["~PATH_TO_USER_FILES_WEBDAV_BIZPROC_LOG"], "WEBDAV_BIZPROC_VIEW_URL" => $arResult["~PATH_TO_USER_FILES_WEBDAV_BIZPROC_VIEW"], "WEBDAV_BIZPROC_WORKFLOW_ADMIN_URL" => $arResult["~PATH_TO_USER_FILES_WEBDAV_BIZPROC_WORKFLOW_ADMIN"], "WEBDAV_BIZPROC_WORKFLOW_EDIT_URL" => $arResult["~PATH_TO_USER_FILES_WEBDAV_BIZPROC_WORKFLOW_EDIT"], "WEBDAV_START_BIZPROC_URL" => $arResult["~PATH_TO_USER_FILES_WEBDAV_START_BIZPROC"], "WEBDAV_TASK_LIST_URL" => $arResult["~PATH_TO_BIZPROC_TASK_LIST"], "WEBDAV_TASK_URL" => $arResult["~PATH_TO_BIZPROC_TASK"], "BIZPROC" => $arResult["VARIABLES"]["BIZPROC"], "USE_COMMENTS" => "N", "FORUM_ID" => false, "STR_TITLE" => $arResult["VARIABLES"]["STR_TITLE"], "SHOW_WEBDAV" => $arResult["VARIABLES"]["SHOW_WEBDAV"]), $component, array("HIDE_ICONS" => "Y")); $this->__component->__menu_values = $result; if ($arParams["SHOW_NAVIGATION"] != "N") { // text from main CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); $path = $GLOBALS["APPLICATION"]->GetCurDir(); $arChain = array(); while (true) { $path = rtrim($path, "/"); $chain_file_name = $DOC_ROOT . $path . "/.section.php"; if (file_exists($chain_file_name)) { $sSectionName = ""; include $chain_file_name; if (strlen($sSectionName) > 0) { $arChain[] = array("TITLE" => $sSectionName, "LINK" => $path . "/"); } } if ($path . '/' == SITE_DIR) { break; }
} elseif ($SITE_MESSAGE_LINK == "E" && strlen($SITE_MESSAGE_LINK_E_SITE) > 0) { $db_msg = CEventMessage::GetList($o, $b, array("SITE_ID" => $SITE_MESSAGE_LINK_E_SITE)); while ($ar_msg = $db_msg->Fetch()) { $msg_id = $ar_msg["ID"]; $db_msg_sites = CEventMessage::GetSite($ar_msg["ID"]); $ar_msg = array("NAME" => $ar_msg["NAME"], "LID" => array($LID)); while ($ar_msg_sites = $db_msg_sites->Fetch()) { $ar_msg["LID"][] = $ar_msg_sites["SITE_ID"]; } $em->Update($msg_id, $ar_msg); } } if ($bNew && $_POST["START_SITE_WIZARD"] == "Y") { $rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => $LID)); $arSite = $rsSite->GetNext(); $p = CSite::GetSiteDocRoot($LID) . $arSite["DIR"]; CheckDirPath($p); $indexContent = '<' . '?' . 'define("B_PROLOG_INCLUDED", true);' . 'define("WIZARD_DEFAULT_SITE_ID", "' . $LID . '");' . 'define("WIZARD_DEFAULT_TONLY", true);' . 'define("PRE_LANGUAGE_ID","' . $arSite["LANGUAGE_ID"] . '");' . 'define("PRE_INSTALL_CHARSET","' . $arSite["CHARSET"] . '");' . 'include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/install/wizard/wizard.php");' . '?' . '>'; $handler = fopen($p . "/index.php", "wb"); fwrite($handler, $indexContent); fclose($handler); $u = ""; if (is_array($arSite["DOMAINS"]) && strlen($arSite["DOMAINS"][0]) > 0 || strlen($arSite["DOMAINS"]) > 0) { $u .= "http://"; } if (is_array($arSite["DOMAINS"])) { $u .= $arSite["DOMAINS"][0]; } else { $u .= $arSite["DOMAINS"]; } $u .= $arSite["DIR"];