M_ID."'; ";
$row = $dsql->GetOne($arcQuery);
if (!is_array($row)) {
ShowMsg("读取文档信息出错", "-1");
exit();
} else if ($row['arcrank'] >= 0) {
$dtime = time();
$maxtime = $cfg_mb_editday * 24 * 3600;
if ($dtime - $row['senddate'] > $maxtime) {
ShowMsg("这篇文档已经锁定,您不能再修改它", "-1");
exit();
}
}
$addRow = $dsql->GetOne("SELECT * FROM `{$row['addtable']}` WHERE aid='$aid'; ");
$cInfos = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='{$row['channel']}'; ");
include(DEDEMEMBER."/templets/archives_edit.htm");
exit();
}
/*------------------------------
function _SaveArticle(){ }
------------------------------*/
else if ($dopost == 'save') {
include(DEDEMEMBER.'/inc/archives_check_edit.php');
//分析处理附加表数据
$inadd_f = $inadd_m = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$vs = explode(',', $v);
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
//自动摘要和远程图片本地化
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]);
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid);
$inadd_m .= ','.$vs[0];
$inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' ";
}
}
//这里对前台提交的附加数据进行一次校验
$fontiterm = PrintAutoFieldsAdd(stripslashes($cInfos['fieldset']), 'autofield', FALSE);
if ($fontiterm != $inadd_m) {
ShowMsg("提交表单同系统配置不相符,请重新提交", "-1");
exit();
}
}
//处理图片文档的自定义属性
if ($litpic != '') $flag = 'p';
//更新数据库的SQL语句
$upQuery = "UPDATE `#@__archives` SET ismake='$ismake',arcrank='$arcrank',typeid='$typeid',title='$title',litpic='$litpic',description='$description',keywords='$keywords',mtype='$mtypesid',flag='$flag' WHERE id='$aid' And mid='$mid'; ";
if (!$dsql->ExecuteNoneQuery($upQuery)) {
ShowMsg("数据保存到数据库主表`#@__archives`时出错,请联系管理员".$dsql->GetError(), "-1");
exit();
}
if ($addtable != '') {
$upQuery = "UPDATE `$addtable` SET typeid='$typeid'{$inadd_f}, userip='$userip' WHERE aid='$aid' ";
if (!$dsql->ExecuteNoneQuery($upQuery)) {
ShowMsg("数据保存到数据库附加表时出错,请联系管理员", "javascript:;");
exit();
}
}
$arcrank = empty($arcrank) ? 0 : $arcrank;
$sortrank = empty($sortrank) ? 0 : $sortrank;
UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags);
$artUrl = MakeArt($aid, TRUE);
if ($artUrl == '') $artUrl = $cfg_phpurl."/view.php?aid=$aid";
//返回成功信息
$msg = "请选择您的后续操作:发布新文档修改文档查看文档管理文档";
$wintitle = "成功修改文档";
$wecome_info = "内容管理::修改文档";
$win = new OxWindow();
$win->AddTitle("成功修改文档");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", " ", false);
$win->Display(DEDEMEMBER."/templets/win_templet.htm");
}
?>