if ($arComponent["DATA"]["TEMPLATE_NAME"] != "" && $arTemplatesList[$i]["NAME"] == $arComponent["DATA"]["TEMPLATE_NAME"] || $arComponent["DATA"]["TEMPLATE_NAME"] == "" && $arTemplatesList[$i]["NAME"] == ".default") { $templateSiteTemplate = $arTemplatesList[$i]["TEMPLATE"]; break; } } /* save parameters to file */ if ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["action"] == "save" && $arComponent !== false && $arComponentDescription !== false && check_bitrix_sessid()) { //check template name $sTemplateName = trim($_POST["TEMPLATE_NAME"]); if ($sTemplateName == '' || !CBitrixComponentTemplate::CheckName($sTemplateName)) { $sTemplateName = '.default'; } if ($_POST["SITE_TEMPLATE"] != $_GET["template_id"] && $_POST["SITE_TEMPLATE"] != ".default") { $_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)) {