} if (isset($arTemplateParameters) && is_array($arTemplateParameters)) { $arParameters = $arParameters + $arTemplateParameters; } $arComponentTemplates = CComponentUtil::GetTemplatesList($_GET["component_name"], $_GET["template_id"]); /* save parameters to file */ if ($_SERVER["REQUEST_METHOD"] == "POST" && $_GET["action"] == "save" && $arComponent !== false && $arComponentDescription !== false) { if (!check_bitrix_sessid()) { $strWarning .= GetMessage("comp_prop_err_save") . "<br>"; } else { $aPostValues = $_POST; unset($aPostValues["__closed_sections"]); unset($aPostValues["sessid"]); unset($aPostValues["bxpiheight"]); unset($aPostValues["bxpiwidth"]); CComponentUtil::PrepareVariables($aPostValues); foreach ($aPostValues as $name => $value) { if (is_array($value) && count($value) == 1 && isset($value[0]) && $value[0] == "") { $aPostValues[$name] = array(); } elseif ($bLimitPhpAccess && substr($value, 0, 2) == '={' && substr($value, -1) == '}') { $aPostValues[$name] = $arValues[$name]; } } //check template name $sTemplateName = ""; foreach ($arComponentTemplates as $templ) { if ($templ["NAME"] == $_POST["NEW_COMPONENT_TEMPLATE"]) { $sTemplateName = $templ["NAME"]; break; } }
// Get array with description of component params $arCompParams = CComponentUtil::GetComponentProps($comp_name); $arTemplParams = CComponentUtil::GetTemplateProps($comp_name, $template_name, $template); $arParameters = array(); if (isset($arCompParams["PARAMETERS"]) && is_array($arCompParams["PARAMETERS"])) { $arParameters = $arParameters + $arCompParams["PARAMETERS"]; } if (is_array($arTemplParams)) { $arParameters = $arParameters + $arTemplParams; } // Replace values from 'DEFAULT' for ($e = 0; $e < $len; $e++) { $par_name = $arPHPparams[$e]; $arParams[$par_name] = isset($arParameters[$par_name]['DEFAULT']) ? $arParameters[$par_name]['DEFAULT'] : ''; } CComponentUtil::PrepareVariables($arParams); //ReturnPHPStr $params = PHPParser::ReturnPHPStr2($arParams, $arParameters); $code .= "\t" . 'Array(' . $br . "\t" . $params . $br . "\t" . ')' . $br . ');'; } else { $code .= "\t" . 'Array()' . $br . ');'; } $code = '<?' . $code . '?>'; $new_content .= $code; } } } $new_content .= CMain::EncodePHPTags(substr($content_, $end)); $CONTENT = $new_content; } else { $CONTENT = CMain::EncodePHPTags($new_content);