if (!copy($arFile["tmp_name"], $temp_path)) { $message = new CAdminMessage(array("MESSAGE" => GetMessage("FLOW_ERROR"), "DETAILS" => GetMessage("FLOW_FILEUPLOAD_FILE_CREATE_ERROR") . " \"" . $temp_path . "\"", "TYPE" => "ERROR")); } else { $arFields = array("DOCUMENT_ID" => $ID > 0 ? $ID : "null", "TIMESTAMP_X" => $DB->GetNowFunction(), "MODIFIED_BY" => "'" . $USER->GetID() . "'", "TEMP_FILENAME" => "'" . $DB->ForSql($temp_file, 255) . "'", "FILENAME" => "'" . $DB->ForSql($pathto, 255) . "'", "FILESIZE" => intval($arFile["size"])); $FILE_ID = $DB->Insert("b_workflow_file", $arFields, $err_mess . __LINE__); $arUploadedFiles[] = intval($FILE_ID); } } } } } if (!$message) { $BODY = WFToPath($BODY); $arFields = array("MODIFIED_BY" => $USER->GetID(), "TITLE" => $TITLE, "FILENAME" => $FILENAME, "SITE_ID" => $SITE_ID, "BODY" => $BODY, "BODY_TYPE" => $BODY_TYPE, "DATE_LOCK" => false, "LOCKED_BY" => false, "STATUS_ID" => $STATUS_ID, "COMMENTS" => $COMMENTS); if ($ID > 0) { CWorkflow::Update($arFields, $ID); } else { if (is_file($DOC_ROOT . $fname)) { $filesrc = $APPLICATION->GetFileContent($DOC_ROOT . $FILENAME); $arContent = ParseFileContent($filesrc); $PROLOG = $arContent["PROLOG"]; $EPILOG = $arContent["EPILOG"]; } else { for ($i = 0; $i < count($arTemplates); $i++) { if ($arTemplates[$i]["file"] == $template) { $filesrc = GetTemplateContent($arTemplates[$i]["file"]); $arContent = ParseFileContent($filesrc); $PROLOG = $arContent["PROLOG"]; $EPILOG = $arContent["EPILOG"]; $found = "Y"; break;