$bNeedComma = true; } else { $fileContent = SetPrologProperty($fileContent, $arProperty["CODE"], $arProperty["VALUE"]); } } } } if ($createNewFolder) { $sectionFileContent = "<" . "?\n" . $strSectionName . "\$arDirProperties = Array(\n" . $strDirProperties . "\n);\n" . "?" . ">"; $sectionPath = substr($path, 1) . $fileName; $success = BXCreateSection($fileContent, $sectionFileContent, $absoluteFilePath, $sectionPath); $arUndoParams = array('module' => 'fileman', 'undoType' => 'new_section', 'undoHandler' => 'CFileman::UndoNewSection', 'arContent' => array('absPath' => $absoluteFilePath, 'path' => rtrim($path, "/") . "/" . $fileName, 'site' => $site)); } else { //Tags only for pages if ($pageTags !== false && IsModuleInstalled("search")) { $fileContent = SetPrologProperty($fileContent, COption::GetOptionString("search", "page_tag_property", "tags"), $pageTags); } $arUndoParams = array('module' => 'fileman', 'undoType' => 'new_file', 'undoHandler' => 'CFileman::UndoNewFile', 'arContent' => array('absPath' => $absoluteFilePath, 'path' => rtrim($path, "/") . "/" . $fileName, 'site' => $site, 'public' => 'Y')); $success = $APPLICATION->SaveFileContent($absoluteFilePath, $fileContent); } if ($success === false && ($exception = $APPLICATION->GetException())) { $strWarning = $exception->msg; } else { if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") { $res_log['path'] = substr($arUndoParams['arContent']['path'], 1); if (!$createNewFolder) { CEventLog::Log("content", "PAGE_ADD", "main", "", serialize($res_log)); } else { CEventLog::Log("content", "SECTION_ADD", "main", "", serialize($res_log)); } }
function SetProperty($prolog, $property_key, $property_val) { return SetPrologProperty($prolog, $property_key, $property_val); }
$arProperty["CODE"] = (isset($arProperty["CODE"]) ? trim($arProperty["CODE"]) : ""); $arProperty["VALUE"] = (isset($arProperty["VALUE"]) ? trim($arProperty["VALUE"]) : ""); if (preg_match("/[a-zA-Z_-~]+/i", $arProperty["CODE"])) { $fileContent = SetPrologProperty($fileContent, $arProperty["CODE"], $arProperty["VALUE"]); } } } $prop_code = COption::GetOptionString('seo', 'property_internal_keywords', 'keywords_inner'); if ($arProperty = explode(",", $_POST["property_".$prop_code."_local"])) { array_walk($arProperty, 'trim'); $fileContent = SetPrologProperty($fileContent, $prop_code, implode(', ', $arProperty)); } $success = $APPLICATION->SaveFileContent($absoluteFilePath, $fileContent); if ($success) { if (isset($_POST["property_".$prop_code."_section"])) { $arProperty = explode(",", $_POST["property_".$prop_code."_section"]); if (!is_array($arProperty)) $arProperty = array(); array_walk($arProperty, 'trim'); $arDirProperties = array(); $sSectionName = '';
//Title if (isset($_POST["pageTitle"]) && strlen($_POST["pageTitle"]) > 0) { $fileContent = SetPrologTitle($fileContent, $_POST["pageTitle"]); } //Title $prop_code = COption::GetOptionString('seo', 'property_window_title', 'title'); if (isset($_POST["property_" . $prop_code])) { $fileContent = SetPrologProperty($fileContent, $prop_code, $_POST["property_" . $prop_code]); } //Properties if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"])) { foreach ($_POST["PROPERTY"] as $arProperty) { $arProperty["CODE"] = isset($arProperty["CODE"]) ? trim($arProperty["CODE"]) : ""; $arProperty["VALUE"] = isset($arProperty["VALUE"]) ? trim($arProperty["VALUE"]) : ""; if (preg_match("/[a-zA-Z_-~]+/i", $arProperty["CODE"])) { $fileContent = SetPrologProperty($fileContent, $arProperty["CODE"], $arProperty["VALUE"]); } } } $success = $APPLICATION->SaveFileContent($absoluteFilePath, $fileContent); if ($success === false && ($exception = $APPLICATION->GetException())) { $strWarning = $exception->msg; } else { if (isset($_POST['internal_keywords'])) { CSeoKeywords::Update(array('URL' => $back_url, 'SITE_ID' => $site, 'KEYWORDS' => $_POST['internal_keywords'])); } LocalRedirect("/" . ltrim($original_backurl, "/")); } die; } if ($strWarning != "") {
//Properties if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"])) { foreach ($_POST["PROPERTY"] as $arProperty) { $arProperty["CODE"] = (isset($arProperty["CODE"]) ? trim($arProperty["CODE"]) : ""); $arProperty["VALUE"] = (isset($arProperty["VALUE"]) ? trim($arProperty["VALUE"]) : ""); if (preg_match("/[a-zA-Z_-~]+/i", $arProperty["CODE"])) $fileContent = SetPrologProperty($fileContent, $arProperty["CODE"], $arProperty["VALUE"]); } } //Tags if (isset($_POST["TAGS"]) && IsModuleInstalled("search")) $fileContent = SetPrologProperty($fileContent, COption::GetOptionString("search", "page_tag_property","tags"), $_POST["TAGS"]); $f = $io->GetFile($absoluteFilePath); $arUndoParams = array( 'module' => 'fileman', 'undoType' => 'edit_file', 'undoHandler' => 'CFileman::UndoEditFile', 'arContent' => array( 'absPath' => $absoluteFilePath, 'content' => $f->GetContents() ) ); $success = $APPLICATION->SaveFileContent($absoluteFilePath, $fileContent); if ($success === false && ($exception = $APPLICATION->GetException()))