"\n);"; $filesrc_for_save = substr($filesrc, 0, $arComponent["START"]).$code.substr($filesrc, $arComponent["END"]); if(!$APPLICATION->SaveFileContent($abs_path, $filesrc_for_save)) $strWarning .= GetMessage("comp_prop_err_save")."<br>"; } if($strWarning == "") { $strJSText = 'window.location = window.location.href;'; if ($_POST["EDIT_TEMPLATE"] == "Y") { $component = new CFreetrixComponent(); if ($component->InitComponent($arComponent["DATA"]["COMPONENT_NAME"], $_POST["TEMPLATE_NAME"])) { if ($component->InitComponentTemplate($_REQUEST["edit_file"], $_POST["SITE_TEMPLATE"])) { $template = & $component->GetTemplate(); if (!is_null($template)) { $strJSText = $APPLICATION->GetPopupLink( array( 'URL' => '/freetrix/admin/public_file_edit_src.php?lang='.LANGUAGE_ID.'&site='.SITE_ID.'&back_url='.urlencode($_REQUEST["back_path"]).'&path='.urlencode($template->GetFile()), "PARAMS" => Array("width" => 770, "height" => 570,"resize" => true,"dialog_type" => 'EDITOR'), ) ); } } }
function __bx_share_get_handlers($template = false, $siteTemplate = false) { if (trim($template) == ".default") $template = ""; $arBookmarkHandlerDropdown = array(); $arBookmarkHandlerDropdownDefault = array(); $shareComponent = new CFreetrixComponent; $shareComponent->InitComponent("freetrix:main.share", $template); $shareComponent->InitComponentTemplate("", $siteTemplate); if (strlen($shareComponent->__template->__folder) > 0) { $path2Handlers = $_SERVER["DOCUMENT_ROOT"]."/".$shareComponent->__template->__folder."/handlers/"; CheckDirPath($path2Handlers); $arHandlers = array(); if ($handle = opendir($path2Handlers)) { while (($file = readdir($handle)) !== false) { if ($file == "." || $file == "..") continue; if (is_file($path2Handlers.$file) && strtoupper(substr($file, strlen($file)-4))==".PHP") { $name = $title = $icon_url_template = ""; $sort = 0; include($path2Handlers.$file); if (strlen($name) > 0) { $arHandlers[$name] = array( "TITLE" => $title, "ICON" => $icon_url_template, "SORT" => intval($sort) ); } } } } foreach($arHandlers as $name=>$arSystem) if (strlen($arSystem["TITLE"]) > 0) $arBookmarkHandlerDropdown[$name] = $arSystem["TITLE"]; $arBookmarkHandlerDropdownTmp = $arBookmarkHandlerDropdown; if (LANGUAGE_ID != 'ru') { if (array_key_exists("vk", $arBookmarkHandlerDropdownTmp)) unset($arBookmarkHandlerDropdownTmp["vk"]); if (array_key_exists("mailru", $arBookmarkHandlerDropdownTmp)) unset($arBookmarkHandlerDropdownTmp["mailru"]); } $arBookmarkHandlerDropdownDefault = array_keys($arBookmarkHandlerDropdownTmp); } return array( "HANDLERS" => $arBookmarkHandlerDropdown, "HANDLERS_DEFAULT" => $arBookmarkHandlerDropdownDefault ); }
function IncludeComponent($componentName, $componentTemplate, $arParams = array(), $parentComponent = null, $arFunctionParams = array()) { /** @global CMain $APPLICATION */ global $APPLICATION, $USER; if (is_array($this->arComponentMatch)) { $skipComponent = true; foreach ($this->arComponentMatch as $cValue) { if (strpos($componentName, $cValue) !== false) { $skipComponent = false; break; } } if ($skipComponent) { return false; } } $componentRelativePath = CComponentEngine::MakeComponentPath($componentName); if (StrLen($componentRelativePath) <= 0) { return False; } $debug = null; $bShowDebug = $_SESSION["SESS_SHOW_INCLUDE_TIME_EXEC"] == "Y" && ($USER->CanDoOperation('edit_php') || $_SESSION["SHOW_SQL_STAT"] == "Y"); if ($bShowDebug || $APPLICATION->ShowIncludeStat) { $debug = new CDebugInfo(); $debug->Start($componentName); } if (is_object($parentComponent)) { if (!$parentComponent instanceof cfreetrixcomponent) { $parentComponent = null; } } $bDrawIcons = (!isset($arFunctionParams["HIDE_ICONS"]) || $arFunctionParams["HIDE_ICONS"] != "Y") && $APPLICATION->GetShowIncludeAreas(); if ($bDrawIcons) { echo $this->IncludeStringBefore(); } $result = null; $bComponentEnabled = !isset($arFunctionParams["ACTIVE_COMPONENT"]) || $arFunctionParams["ACTIVE_COMPONENT"] != "N"; $component = new CFreetrixComponent(); if ($component->InitComponent($componentName)) { $obAjax = null; if ($bComponentEnabled) { if ($arParams['AJAX_MODE'] == 'Y') { $obAjax = new CComponentAjax($componentName, $componentTemplate, $arParams, $parentComponent); } $result = $component->IncludeComponent($componentTemplate, $arParams, $parentComponent); } if ($bDrawIcons) { $panel = new CComponentPanel($component, $componentName, $componentTemplate, $parentComponent, $bComponentEnabled); $arIcons = $panel->GetIcons(); echo $s = $this->IncludeStringAfter($arIcons["icons"], $arIcons["parameters"]); } if ($bComponentEnabled && $obAjax) { $obAjax->Process(); } } if ($bShowDebug) { echo $debug->Output($componentName, "/freetrix/components" . $componentRelativePath . "/component.php", $arParams["CACHE_TYPE"] . $arParams["MENU_CACHE_TYPE"]); } elseif (isset($debug)) { $debug->Stop($componentName, "/freetrix/components" . $componentRelativePath . "/component.php", $arParams["CACHE_TYPE"] . $arParams["MENU_CACHE_TYPE"]); } return $result; }