Beispiel #1
0
         $arPageTemplates = GetFileTemplates($site, array($templateID));
         if (!empty($arPageTemplates) && isset($arPageTemplates[0]['file'])) {
             $template_file = $arPageTemplates[0]['file'];
         }
     }
     if ($template_file != '') {
         $fileContent = GetTemplateContent($template_file, $site, array($templateID));
     }
 }
 if (!$fileContent) {
     $fileContent = '<' . '?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");?' . '>' . GetMessage("PAGE_NEW_CONTENT") . '<' . '?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>';
 }
 //Title
 $strSectionName = "";
 if (strlen($pageTitle) > 0) {
     $fileContent = SetPrologTitle($fileContent, $pageTitle);
     if ($createNewFolder) {
         $strSectionName = "\$sSectionName = \"" . EscapePHPString($pageTitle) . "\";\n";
     }
 }
 //Properties
 $strDirProperties = "";
 if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"])) {
     $bNeedComma = false;
     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"])) {
             if ($createNewFolder && strlen($arProperty["VALUE"]) > 0) {
                 if ($bNeedComma) {
                     $strDirProperties .= ",\n";
Beispiel #2
0
 function SetTitle($prolog, $title)
 {
     return SetPrologTitle($prolog, $title);
 }
Beispiel #3
0
	public static function SetTitle($prolog, $title)
	{
		return SetPrologTitle($prolog, $title);
	}
Beispiel #4
0
    }
    // one more little hack to avoid warning from compression module
    ob_start();
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
    die;
}
$fileContent = $APPLICATION->GetFileContent($absoluteFilePath);
/************************** GET/POST processing ***************************************/
$strWarning = '';
if (!check_bitrix_sessid()) {
    CUtil::JSPostUnescape();
    $strWarning = GetMessage("MAIN_SESSION_EXPIRED");
} elseif (!$bReadOnly && $_SERVER["REQUEST_METHOD"] == "POST" && isset($_REQUEST["save"])) {
    //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"]);
            }
        }
Beispiel #5
0
 public static function SetStatus($DOCUMENT_ID, $STATUS_ID, $OLD_STATUS_ID, $history = true)
 {
     $err_mess = CAllWorkflow::err_mess() . "<br>Function: SetStatus<br>Line: ";
     global $DB, $APPLICATION, $USER, $strError;
     //$arMsg = Array();
     $DOCUMENT_ID = intval($DOCUMENT_ID);
     $STATUS_ID = intval($STATUS_ID);
     $OLD_STATUS_ID = intval($OLD_STATUS_ID);
     if ($STATUS_ID == 1) {
         // get all files associated with the document
         $files = CWorkflow::GetFileList($DOCUMENT_ID);
         while ($file = $files->Fetch()) {
             $path = $file["FILENAME"];
             $DOC_ROOT = CSite::GetSiteDocRoot($file["SITE_ID"]);
             $pathto = $DOC_ROOT . $path;
             $pathfrom = CWorkflow::GetTempDir() . $file["TEMP_FILENAME"];
             if ($USER->CanDoFileOperation('fm_edit_in_workflow', array($file["SITE_ID"], $path)) && $USER->CanDoFileOperation('fm_edit_existent_file', array($file["SITE_ID"], $path)) && $USER->CanDoFileOperation('fm_create_new_file', array($file["SITE_ID"], $path))) {
                 if (!copy($pathfrom, $pathto)) {
                     $str = GetMessage("FLOW_CAN_NOT_WRITE_FILE", array("#FILENAME#" => $path));
                     $strError .= $str . "<br>";
                 }
             } else {
                 $str = GetMessage("FLOW_ACCESS_DENIED_FOR_FILE_WRITE", array("#FILENAME#" => $path));
                 $strError .= $str . "<br>";
             }
         }
         // still good
         if (strlen($strError) <= 0) {
             // publish the document
             $y = CWorkflow::GetByID($DOCUMENT_ID);
             $yr = $y->Fetch();
             if ($USER->CanDoFileOperation('fm_edit_in_workflow', array($yr["SITE_ID"], $yr["FILENAME"])) && $USER->CanDoFileOperation('fm_edit_existent_file', array($yr["SITE_ID"], $yr["FILENAME"])) && $USER->CanDoFileOperation('fm_create_new_file', array($yr["SITE_ID"], $yr["FILENAME"]))) {
                 // save file
                 $prolog = $yr["PROLOG"];
                 if (strlen($prolog) > 0) {
                     $title = $yr["TITLE"];
                     $prolog = SetPrologTitle($prolog, $title);
                 }
                 $content = $yr["BODY_TYPE"] == "text" ? TxtToHTML($yr["BODY"]) : $yr["BODY"];
                 $content = WFToPath($content);
                 $epilog = $yr["EPILOG"];
                 $filesrc = $prolog . $content . $epilog;
                 global $BX_WORKFLOW_PUBLISHED_PATH, $BX_WORKFLOW_PUBLISHED_SITE;
                 $BX_WORKFLOW_PUBLISHED_PATH = $yr["FILENAME"];
                 $BX_WORKFLOW_PUBLISHED_SITE = $yr["SITE_ID"];
                 $DOC_ROOT = CSite::GetSiteDocRoot($yr["SITE_ID"]);
                 $APPLICATION->SaveFileContent($DOC_ROOT . $yr["FILENAME"], $filesrc);
                 $BX_WORKFLOW_PUBLISHED_PATH = "";
                 $BX_WORKFLOW_PUBLISHED_SITE = "";
             } else {
                 // throw error
                 $str = GetMessage("FLOW_ACCESS_DENIED_FOLDER", array("#FILENAME#" => $yr["FILENAME"]));
                 $strError .= GetMessage("FLOW_ERROR") . htmlspecialcharsbx($str) . "<br>";
             }
         }
     }
     if (strlen($strError) <= 0) {
         // update db
         $arFields = array("DATE_MODIFY" => $DB->GetNowFunction(), "MODIFIED_BY" => $USER->GetID(), "STATUS_ID" => intval($STATUS_ID));
         $DB->Update("b_workflow_document", $arFields, "WHERE ID='" . $DOCUMENT_ID . "'", $err_mess . __LINE__);
         if ($history === true) {
             $LOG_ID = CWorkflow::SetHistory($DOCUMENT_ID);
             CWorkflow::SetMove($DOCUMENT_ID, $STATUS_ID, $OLD_STATUS_ID, $LOG_ID);
         }
     } else {
         $strError = GetMessage("FLOW_DOCUMENT_NOT_PUBLISHED") . "<br>" . $strError;
     }
     CWorkflow::CleanUpPublished();
 }
     require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
     $aMenu = array(array("ICON" => "btn_list", "TEXT" => GetMessage("FLOW_RECORDS_LIST"), "LINK" => "workflow_list.php?lang=" . LANGUAGE_ID, "TITLE" => GetMessage("FLOW_RECORDS_LIST")));
     $context = new CAdminContextMenu($aMenu);
     $context->Show();
     CAdminMessage::ShowMessage(GetMessage("FLOW_DOCUMENT_NOT_FOUND"));
     require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
     die;
 } else {
     $filename = CWorkflow::GetUniquePreview($ID);
     // save preview file
     $z = CWorkflow::GetByID($ID);
     $zr = $z->Fetch();
     $prolog = $zr["PROLOG"];
     if (strlen($prolog) > 0) {
         $title = $zr["TITLE"];
         $prolog = SetPrologTitle($prolog, $title);
     }
     $content = $zr["BODY_TYPE"] == "text" ? TxtToHTML($zr["BODY"]) : $zr["BODY"];
     $epilog = $zr["EPILOG"];
     $filesrc = $prolog . PathToWF($content, $ID) . $epilog;
     SavePreviewContent($_SERVER["DOCUMENT_ROOT"] . $filename, $filesrc);
     // store file to database
     $arFields = array("DOCUMENT_ID" => $ID, "TIMESTAMP_X" => $DB->GetNowFunction(), "FILENAME" => "'" . $DB->ForSql($filename, 255) . "'");
     $DB->Insert("b_workflow_preview", $arFields, $err_mess . __LINE__);
     // redirect to preview saved
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . $filename)) {
         LocalRedirect($filename);
     } else {
         LocalRedirect("/bitrix/admin/workflow_list.php?lang=" . LANG);
     }
 }