CanDoOperation('edit_php'); if(!$edit_php && !$USER->CanDoOperation('view_other_settings') && !$USER->CanDoOperation('lpa_template_edit')) $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); $isEditingMessageThemePage = $APPLICATION->GetCurPage() == '/bitrix/admin/message_theme_edit.php'; IncludeModuleLangFile(__FILE__); $lpa = ($USER->CanDoOperation('lpa_template_edit') && !$edit_php); // Limit PHP access: for non admin users $lpa_view = !$USER->CanDoOperation('edit_other_settings') && !$USER->CanDoOperation('lpa_template_edit'); // $strError = ""; $strOK = ""; $bVarsFromForm = false; $codeEditorId = false; $ID = _normalizePath($_REQUEST["ID"] ?? ''); if($lpa && (!isset($_REQUEST['edit']) || $_REQUEST['edit'] != "Y") && $ID == '') // In lpa mode users can only edit existent templates $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); $bEdit = false; $templFields = array(); $str_ID = ''; $str_NAME = ''; $str_DESCRIPTION = ''; $str_SORT = ''; $str_TYPE = ''; $str_CONTENT = ''; $str_STYLES = ''; $str_TEMPLATE_STYLES = ''; if($ID <> '' && (!isset($_REQUEST['edit']) || $_REQUEST['edit'] != "N")) { $templ = CSiteTemplate::GetByID($ID); if(($templFields = $templ->ExtractFields("str_"))) $bEdit = true; } $aTabs = array( array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB1"), "ICON" => "template_edit", "TITLE" => ($isEditingMessageThemePage ? GetMessage("MAIN_TAB1_TITLE_THEME") : GetMessage("MAIN_TAB1_TITLE"))), array("DIV" => "edit2", "TAB" => GetMessage("MAIN_TAB2"), "ICON" => "template_edit", "TITLE" => GetMessage("MAIN_TAB2_TITLE")), array("DIV" => "edit3", "TAB" => GetMessage("MAIN_TAB4"), "ICON" => "template_edit", "TITLE" => GetMessage("MAIN_TAB4_TITLE")), ); if($bEdit) $aTabs[] = array("DIV" => "edit4", "TAB" => GetMessage("MAIN_TAB3"), "ICON" => "template_edit", "TITLE" => GetMessage("MAIN_TAB3_TITLE")); $tabControl = new CAdminTabControl("tabControl", $aTabs); if($_SERVER["REQUEST_METHOD"] == "POST" && (!empty($_POST['save']) || !empty($_POST['apply'])) && check_bitrix_sessid() && ($edit_php || $lpa)) { if ($lpa) { $CONTENT = LPA::Process($_POST["CONTENT"] ?? '', htmlspecialcharsback($str_CONTENT)); //Add ..->ShowPanel() and WORK_AREA $ucont = mb_strtolower($CONTENT); $sp = 'ShowPanel();?>'; $body = ''; $wa = '#WORK_AREA#'; $body_pos = mb_strpos($ucont, $body); $sp_pos = mb_strpos($ucont, mb_strtolower($sp)); $wa_pos = mb_strpos($ucont, mb_strtolower($wa), $body_pos); if ($body_pos !== false && $sp_pos === false) // Add $APPLICATION->ShowPanel(); $CONTENT = mb_substr($CONTENT, 0, $body_pos + mb_strlen($body)).$sp.mb_substr($CONTENT, $body_pos + mb_strlen($body)); if ($wa_pos === false) $CONTENT .= $wa; } else { $CONTENT = $_POST["CONTENT"] ?? ''; } if(class_exists('CFileMan') && method_exists("CFileMan", "CheckOnAllowedComponents")) { if (!CFileMan::CheckOnAllowedComponents($CONTENT)) { $str_err = $APPLICATION->GetException(); if($str_err && ($err = $str_err ->GetString())) $strError .= $err; $bVarsFromForm = true; } } if($strError == "") { $stylesDesc = array(); $maxind = $_POST['maxind'] ?? ''; for($i = 0; $i <= $maxind; $i++) { if(!isset($_POST["CODE_".$i]) || trim($_POST["CODE_".$i]) == '') continue; $code = ltrim($_POST["CODE_".$i], "."); $stylesDesc[$code] = $_POST["VALUE_".$i] ?? ''; } $ST = new CSiteTemplate(); $arFields = array( "ID" => $ID, "NAME" => $_POST["NAME"] ?? '', "DESCRIPTION" => $_POST["DESCRIPTION"] ?? '', "CONTENT" => $CONTENT, "STYLES" => $_POST["STYLES"] ?? '', "TEMPLATE_STYLES" => $_POST["TEMPLATE_STYLES"] ?? '', "SORT" => $_POST["SORT"] ?? '', "TYPE" => $_POST["TYPE"] ?? '', "STYLES_DESCRIPTION" => $stylesDesc, ); if (isset($_REQUEST['edit']) && $_REQUEST['edit']=="Y") $res = $ST->Update($ID, $arFields); else $res = ($ST->Add($arFields) <> ''); if(!$res) { $strError .= $ST->LAST_ERROR."
"; $bVarsFromForm = true; } else { $useeditor_param = (isset($_REQUEST["CONTENT_editor"]) && $_REQUEST["CONTENT_editor"] == 'on') ? '&usehtmled=Y' : ''; if (!empty($_POST["save"])) LocalRedirect(BX_ROOT."/admin/".($isEditingMessageThemePage ? "message_theme_admin.php" : "template_admin.php")."?lang=".LANGUAGE_ID.$useeditor_param); else LocalRedirect(BX_ROOT."/admin/".($isEditingMessageThemePage ? "message_theme_edit.php" : "template_edit.php")."?lang=".LANGUAGE_ID."&ID=".$ID."&".$tabControl->ActiveTabParam().$useeditor_param); } } } if($bVarsFromForm) { $str_ID = htmlspecialcharsbx($_POST["ID"] ?? ''); $str_NAME = htmlspecialcharsbx($_POST["NAME"] ?? ''); $str_DESCRIPTION = htmlspecialcharsbx($_POST["DESCRIPTION"] ?? ''); $str_SORT = htmlspecialcharsbx($_POST["SORT"] ?? ''); $str_TYPE = htmlspecialcharsbx($_POST["TYPE"] ?? ''); $str_CONTENT = htmlspecialcharsbx($_POST["CONTENT"] ?? ''); $str_STYLES = htmlspecialcharsbx($_POST["STYLES"] ?? ''); $str_TEMPLATE_STYLES = htmlspecialcharsbx($_POST["TEMPLATE_STYLES"] ?? ''); $usehtmled = (isset($_REQUEST["CONTENT_editor"]) && $_REQUEST["CONTENT_editor"] == 'on') ? 'Y' : 'N'; } if ($lpa || $lpa_view) { $str_CONTENT = htmlspecialcharsback($str_CONTENT); $arPHP = PHPParser::ParseFile($str_CONTENT); $l = count($arPHP); if ($l > 0) { $new_content = ''; $end = 0; $php_count = 0; for ($n = 0; $n < $l; $n++) { $start = $arPHP[$n][0]; $s_cont = mb_substr($str_CONTENT, $end, $start - $end); $end = $arPHP[$n][1]; $new_content .= $s_cont; $src = $arPHP[$n][2]; $src = mb_substr($src, (mb_substr($src, 0, 5) == "INCLUDECOMPONENT('; if (mb_strtoupper(mb_substr($src, 0, mb_strlen($comp2_begin))) == $comp2_begin) //If it's Component 2, keep the php code $new_content .= $arPHP[$n][2]; else //If it's component 1 or ordinary PHP - than replace code by #PHPXXXX# (XXXX - count of PHP scripts) $new_content .= '#PHP'.str_pad(++$php_count, 4, "0", STR_PAD_LEFT).'#'; } $new_content .= mb_substr($str_CONTENT, $end); } $str_CONTENT = htmlspecialcharsex($new_content); } $APPLICATION->AddHeadScript("/bitrix/js/main/template_edit.js"); if($bEdit) $APPLICATION->SetTitle(($isEditingMessageThemePage ? GetMessage("MAIN_T_EDIT_TITLE_EDIT_THEME") : GetMessage("MAIN_T_EDIT_TITLE_EDIT"))); else $APPLICATION->SetTitle(($isEditingMessageThemePage ? GetMessage("MAIN_T_EDIT_TITLE_NEW_THEME") : GetMessage("MAIN_T_EDIT_TITLE_NEW"))); require($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/prolog_admin_after.php"); CAdminMessage::ShowMessage($strError); CAdminMessage::ShowNote($strOK); $aMenu = array( array( "TEXT" => ($isEditingMessageThemePage ? GetMessage("MAIN_T_EDIT_TEMPL_LIST_THEME") : GetMessage("MAIN_T_EDIT_TEMPL_LIST")), "LINK" => "/bitrix/admin/".($isEditingMessageThemePage ? "message_theme_admin.php" : "template_admin.php")."?lang=".LANGUAGE_ID."&set_default=Y", "TITLE" => GetMessage("MAIN_T_EDIT_TEMPL_LIST_TITLE"), "ICON" => "btn_list" ) ); if ($ID <> '' && $edit_php) { $aMenu[] = array("SEPARATOR"=>"Y"); $aMenu[] = array( "TEXT" => GetMessage("MAIN_NEW_RECORD"), "LINK" => "/bitrix/admin/".($isEditingMessageThemePage ? "message_theme_edit.php" : "template_edit.php")."?lang=".LANGUAGE_ID, "TITLE" => GetMessage("MAIN_NEW_RECORD_TITLE"), "ICON" => "btn_new" ); $aMenu[] = array( "TEXT" => GetMessage("MAIN_COPY_RECORD"), "LINK" => "/bitrix/admin/".($isEditingMessageThemePage ? "message_theme_admin.php" : "template_admin.php")."?lang=".LANGUAGE_ID."&ID=".urlencode($ID)."&action=copy&".bitrix_sessid_get(), "TITLE" => GetMessage("MAIN_COPY_RECORD_TITLE"), "ICON" => "btn_copy" ); $aMenu[] = array( "TEXT" => GetMessage("MAIN_DELETE_RECORD"), "LINK" => "javascript:if(confirm('".GetMessage("MAIN_DELETE_RECORD_CONF")."')) window.location='/bitrix/admin/".($isEditingMessageThemePage ? "message_theme_admin.php" : "template_admin.php")."?ID=".urlencode(urlencode($ID))."&lang=".LANGUAGE_ID."&".bitrix_sessid_get()."&action=delete';", "TITLE" => GetMessage("MAIN_DELETE_RECORD_TITLE"), "ICON" => "btn_delete" ); } $context = new CAdminContextMenu($aMenu); $context->Show(); ?>

Fatal error: Uncaught Error: Call to undefined function bitrix_sessid_post() in D:\ktt\ttepla.com\public_html\bitrix\modules\main\admin\template_edit.php:252 Stack trace: #0 {main} thrown in D:\ktt\ttepla.com\public_html\bitrix\modules\main\admin\template_edit.php on line 252