function __bx_share_get_handlers($template = false) { if (trim($template) == ".default") { $template = ""; } $arBookmarkHandlerDropdown = array(); $arBookmarkHandlerDropdownDefault = array(); $shareComponent = new CBitrixComponent(); $shareComponent->InitComponent("bitrix:main.share", $template); $shareComponent->InitComponentTemplate($template); 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 != '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); }
//Забираем параметры "подключения" $arParams = unserialize($arCache["CACHE"]); //18* //Добиваем теми, которые доступны "снаружи" foreach ($arParams["PAGE_PARAMS"] as $param_name) { if (!array_key_exists($param_name, $arParams)) { $arParams[$param_name] = $_REQUEST["PAGE_PARAMS"][$param_name]; } } //24* //Эта магия позволяет нам правильно определить //текущий шаблон компонента (с учетом темы) if (array_key_exists("PARENT_NAME", $arParams)) { $component = new CBitrixComponent(); $component->InitComponent($arParams["PARENT_NAME"], $arParams["PARENT_TEMPLATE_NAME"]); $component->InitComponentTemplate($arParams["PARENT_TEMPLATE_PAGE"]); } else { $component = null; } //25* //Подключаем компонент //Результат его работы (div) заменит тот, что сейчас у клиента в браузере $APPLICATION->IncludeComponent($arParams["COMPONENT_NAME"], $arParams["TEMPLATE_NAME"], $arParams, $component); } } require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php"; die; } if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; }
public function GetIcons() { /** @global CMain $APPLICATION */ global $USER, $APPLICATION; $arIcons = array(); $arPanelParams = array(); $arComponentDescription = CComponentUtil::GetComponentDescr($this->componentName); $bComponentAccess = $USER->CanDoOperation('edit_php') || $this->bSrcFound && $USER->CanDoFileOperation('fm_lpa', array(SITE_ID, $this->sSrcFile)); if ($bComponentAccess && !$this->parentComponent && $this->bSrcFound) { $url = $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/component_props.php?" . "component_name=" . urlencode(CUtil::addslashes($this->componentName)) . "&component_template=" . urlencode(CUtil::addslashes($this->componentTemplate)) . "&template_id=" . urlencode(CUtil::addslashes(SITE_TEMPLATE_ID)) . "&lang=" . urlencode(CUtil::addslashes(LANGUAGE_ID)) . "&src_path=" . urlencode(CUtil::addslashes($this->sSrcFile)) . "&src_line=" . $this->iSrcLine . "&src_page=" . urlencode(CUtil::addslashes($APPLICATION->GetCurPage())) . "&src_site=" . urlencode(CUtil::addslashes(SITE_ID)), "PARAMS" => array("min_width" => 450))); $arIcons[] = array('URL' => 'javascript:' . $url, 'TYPE' => 'components2_props', 'ICON' => "bx-context-toolbar-settings-icon", 'TITLE' => GetMessage("main_incl_file_comp_param"), 'DEFAULT' => true); $aMenuItem = array("TEXT" => $arComponentDescription["NAME"], "TITLE" => GetMessage("main_comp_button_menu_title") . ' ' . $this->componentName, "ICON" => "parameters-2", "ACTION" => $url); $APPLICATION->AddPanelButtonMenu("components", $aMenuItem); } if ($bComponentAccess) { $template = $this->component->GetTemplate(); if (is_null($template)) { if ($this->component->InitComponentTemplate()) { $template = $this->component->GetTemplate(); } } if (!is_null($template)) { $urlCopy = ''; if ($this->bSrcFound && $template->IsInTheme() == false) { //copy template dialog $urlCopy = "/bitrix/admin/template_copy.php?" . "lang=" . urlencode(CUtil::addslashes(LANGUAGE_ID)) . "&component_name=" . urlencode(CUtil::addslashes($this->componentName)) . "&component_template=" . urlencode(CUtil::addslashes($this->componentTemplate)) . "&template_id=" . urlencode(CUtil::addslashes(SITE_TEMPLATE_ID)) . "&template_site_template=" . urlencode(CUtil::addslashes($template->GetSiteTemplate())) . "&src_path=" . urlencode(CUtil::addslashes($this->sSrcFile)) . "&src_line=" . $this->iSrcLine . "&src_site=" . urlencode(CUtil::addslashes(SITE_ID)) . "&edit_file=" . urlencode($template->GetPageName()) . "&back_path=" . urlencode($_SERVER["REQUEST_URI"]); $arIcons[] = array('URL' => 'javascript:' . $APPLICATION->GetPopupLink(array('URL' => $urlCopy, "PARAMS" => array("min_width" => 450))), 'ICON' => "copy-2", 'TITLE' => GetMessage("main_comp_copy_templ"), 'IN_MENU' => true); } if ($USER->CanDoOperation('edit_php') && strlen($template->GetSiteTemplate()) > 0) { //edit template copied to site template $arIcons[] = array('URL' => 'javascript:' . $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/public_file_edit_src.php?site=" . SITE_ID . "&" . 'path=' . urlencode($template->GetFile()) . "&back_url=" . urlencode($_SERVER["REQUEST_URI"]) . "&lang=" . LANGUAGE_ID, 'PARAMS' => array('width' => 770, 'height' => 470, 'resize' => true, "dialog_type" => 'EDITOR', "min_width" => 700, "min_height" => 400))), 'ICON' => 'edit-2', 'TITLE' => GetMessage("main_comp_edit_templ"), 'IN_MENU' => true); if (strlen($template->GetFolder()) > 0) { if (file_exists($_SERVER["DOCUMENT_ROOT"] . $template->GetFolder() . "/style.css")) { //edit template CSS copied to site template $arIcons[] = array('URL' => 'javascript:' . $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/public_file_edit_src.php?site=" . SITE_ID . "&" . 'path=' . urlencode($template->GetFolder() . "/style.css") . "&back_url=" . urlencode($_SERVER["REQUEST_URI"]) . "&lang=" . LANGUAGE_ID, 'PARAMS' => array('width' => 770, 'height' => 470, 'resize' => true, "dialog_type" => 'EDITOR', "min_width" => 700, "min_height" => 400))), 'ICON' => 'edit-css', 'TITLE' => GetMessage("main_comp_edit_css"), 'IN_MENU' => true); } $bWasSep = false; if (file_exists($_SERVER["DOCUMENT_ROOT"] . $template->GetFolder() . "/result_modifier.php")) { $bWasSep = true; $arIcons[] = array('SEPARATOR' => true); $arIcons[] = array('URL' => 'javascript:' . $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/public_file_edit_src.php?site=" . SITE_ID . "&" . 'path=' . urlencode($template->GetFolder() . "/result_modifier.php") . "&back_url=" . urlencode($_SERVER["REQUEST_URI"]) . "&lang=" . LANGUAGE_ID, 'PARAMS' => array('width' => 770, 'height' => 470, 'resize' => true, "dialog_type" => 'EDITOR', "min_width" => 700, "min_height" => 400))), 'TITLE' => GetMessage("main_comp_edit_res_mod"), 'IN_MENU' => true); } if (file_exists($_SERVER["DOCUMENT_ROOT"] . $template->GetFolder() . "/component_epilog.php")) { if (!$bWasSep) { $arIcons[] = array('SEPARATOR' => true); } $arIcons[] = array('URL' => 'javascript:' . $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/public_file_edit_src.php?site=" . SITE_ID . "&" . 'path=' . urlencode($template->GetFolder() . "/component_epilog.php") . "&back_url=" . urlencode($_SERVER["REQUEST_URI"]) . "&lang=" . LANGUAGE_ID, 'PARAMS' => array('width' => 770, 'height' => 470, 'resize' => true, "dialog_type" => 'EDITOR', "min_width" => 700, "min_height" => 400))), 'TITLE' => GetMessage("main_comp_edit_epilog"), 'IN_MENU' => true); } } } elseif ($urlCopy != '') { //copy template for future editing $urlCopy .= '&system_template=Y'; $arIcons[] = array('URL' => 'javascript:' . $APPLICATION->GetPopupLink(array('URL' => $urlCopy, "PARAMS" => array("min_width" => 450))), 'ICON' => "edit-2", 'TITLE' => GetMessage("main_comp_edit_templ"), 'ALT' => GetMessage("main_comp_copy_title"), 'IN_MENU' => true); } } } $aAddIcons = array(); $arPanelParams['COMPONENT'] = $this->componentName; if ($arComponentDescription && is_array($arComponentDescription)) { $arPanelParams['COMPONENT_DESCRIPTION'] = $arComponentDescription; //component bar tooltip $arPanelParams['TOOLTIP'] = array('TITLE' => $arComponentDescription["NAME"], 'TEXT' => '(' . GetMessage('main_incl_comp_component') . ' ' . $this->componentName . ')' . (isset($arComponentDescription["DESCRIPTION"]) && $arComponentDescription["DESCRIPTION"] != "" ? '<br />' . $arComponentDescription["DESCRIPTION"] : '')); //clear cache if (array_key_exists("CACHE_PATH", $arComponentDescription) && $USER->CanDoOperation('cache_control')) { if (strlen($arComponentDescription["CACHE_PATH"]) > 0) { $arIcons[] = array("URL" => "javascript:jsComponentUtils.ClearCache('component_name=" . urlencode(CUtil::addslashes($this->componentName)) . "&site_id=" . SITE_ID . "&" . bitrix_sessid_get() . "');", "ICON" => "del-cache", "TITLE" => GetMessage("MAIN_BX_COMPONENT_CACHE_CLEAR"), 'IN_MENU' => true); $APPLICATION->aCachedComponents[] = $this->componentName; } } //additional buttons from component description if (array_key_exists("AREA_BUTTONS", $arComponentDescription)) { $componentRelativePath = CComponentEngine::MakeComponentPath($this->componentName); $localPath = getLocalPath("components" . $componentRelativePath); foreach ($arComponentDescription["AREA_BUTTONS"] as $value) { if (array_key_exists("SRC", $value)) { $value["SRC"] = $localPath . $value["SRC"]; } $aAddIcons[] = $value; } } } if (!empty($arIcons) && !empty($aAddIcons)) { $arIcons[] = array("SEPARATOR" => true); } $arIcons = array_merge($arIcons, $aAddIcons); $aAddIcons = $this->component->GetIncludeAreaIcons(); if (!empty($arIcons) && !empty($aAddIcons)) { $arIcons[] = array("SEPARATOR" => true); } $arIcons = array_merge($arIcons, $aAddIcons); // enable/disable menu item if ($bComponentAccess && !$this->parentComponent && $this->bSrcFound) { if (!empty($arIcons)) { $arIcons[] = array("SEPARATOR" => true); } $arIcons[] = array("URL" => "javascript:jsComponentUtils.EnableComponent('component_name=" . urlencode(CUtil::addslashes($this->componentName)) . "&lang=" . urlencode(CUtil::addslashes(LANGUAGE_ID)) . "&src_path=" . urlencode(CUtil::addslashes($this->sSrcFile)) . "&src_line=" . $this->iSrcLine . "&src_site=" . urlencode(CUtil::addslashes(SITE_ID)) . '&active=' . ($this->bComponentEnabled ? 'N' : 'Y') . '&' . bitrix_sessid_get() . "');", "TITLE" => $this->bComponentEnabled ? GetMessage("main_comp_disable") : GetMessage("main_comp_enable"), "ALT" => $this->bComponentEnabled ? GetMessage("main_comp_disable_title") : GetMessage("main_comp_enable_title"), 'IN_MENU' => true); } if ($this->bSrcFound) { $arPanelParams['COMPONENT_ID'] = md5($arPanelParams['COMPONENT'] . '|' . $this->sSrcFile . ':' . $this->iSrcLine); } return array("icons" => $arIcons, "parameters" => $arPanelParams); }
$_POST["USE_TEMPLATE"] = "N"; } if (CComponentUtil::CopyTemplate($arComponent["DATA"]["COMPONENT_NAME"], $arComponent["DATA"]["TEMPLATE_NAME"], strlen($templateSiteTemplate) > 0 ? $templateSiteTemplate : false, $_POST["SITE_TEMPLATE"], $sTemplateName, false)) { if ($_POST["USE_TEMPLATE"] == "Y") { $code = ($arComponent["DATA"]["VARIABLE"] ? $arComponent["DATA"]["VARIABLE"] . "=" : "") . "\$APPLICATION->IncludeComponent(\"" . $arComponent["DATA"]["COMPONENT_NAME"] . "\", " . "\"" . $sTemplateName . "\", " . "Array(\n\t" . PHPParser::ReturnPHPStr2($arComponent["DATA"]["PARAMS"], $arParameters) . "\n\t)" . ",\n\t" . (strlen($arComponent["DATA"]["PARENT_COMP"]) > 0 ? $arComponent["DATA"]["PARENT_COMP"] : "false") . (!empty($arComponent["DATA"]["FUNCTION_PARAMS"]) ? ",\n\t" . "array(\n\t" . PHPParser::ReturnPHPStr2($arComponent["DATA"]["FUNCTION_PARAMS"]) . "\n\t)" : "") . "\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 CBitrixComponent(); 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' => '/bitrix/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', "min_width" => 700, "min_height" => 400))); } } } } ?> <script> <?php echo $obJSPopup->jsPopup; ?> .Close(); //setTimeout(BX.showWait(), 30);