Ejemplo n.º 1
0
        echo GetMessage('FILEMAN_HEIGHT');
        ?>
&nbsp;</font></td>
			<td><input class="typeinput" type="text" size="5"  name="imgheight" readonly></td>
		</tr>
	</table>
	</font>
</td>
<?php 
    }
    ?>
</tr>
</table>
<?php 
    if ($WF_CONVERT == "Y" && intval($DOCUMENT_ID) > 0 && CModule::IncludeModule("workflow")) {
        $doc_files = CWorkflow::GetFileList(intval($DOCUMENT_ID));
        $doc_files->NavStart();
        if ($doc_files->SelectedRowsCount() > 0) {
            ?>
<br>
<table border="0" cellspacing="0" cellpadding="0" width="450">
	<tr>
		<td colspan="2" align="left"><font class="tableheadtext"><b><?php 
            echo GetMessage('FILEMAN_UPLOADED_FILES');
            ?>
</b></font> </td>
	</tr>
	<tr>
		<td align="center" colspan="2" width="0%">
			<table border="0" cellspacing="0" cellpadding="0" class="tableborder" width="100%">
				<tr>
Ejemplo n.º 2
0
                break;
            }
        }
    }
    if ($get_content != "Y") {
        $filesrc = GetTemplateContent($arTemplates[0]["file"]);
        $arContent = ParseFileContent($filesrc);
        $str_TITLE = $arContent["TITLE"];
        $str_BODY = $arContent["CONTENT"];
    }
    $str_FILENAME = strlen($fname) ? htmlspecialcharsbx($fname) : "/untitled.php";
    $str_SITE_ID = htmlspecialcharsbx($site);
    $str_BODY_TYPE = "html";
    $str_TITLE = htmlspecialcharsbx($str_TITLE);
} else {
    $doc_files = CWorkflow::GetFileList($ID);
    while ($zr = $doc_files->GetNext()) {
        $arDocFiles[] = $zr;
    }
    $str_BODY = htmlspecialcharsback($str_BODY);
}
if ($message) {
    $DB->InitTableVarsForEdit("b_workflow_document", "", "str_");
}
if ($USER->CanDoFileOperation('fm_lpa', array($str_SITE_ID, $str_FILENAME)) && !$USER->CanDoOperation('edit_php')) {
    $content = $str_BODY;
    $arPHP = PHPParser::ParseFile($content);
    $l = count($arPHP);
    if ($l > 0) {
        $str_BODY = '';
        $end = 0;
Ejemplo n.º 3
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();
 }