国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
4.7KB

  1. <?php
  2. /**
  3. * 修改文档
  4. *
  5. * @version $id:article_edit.php 13:52 2010年7月9日 tianya $
  6. * @package DedeBIZ.User
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckRank(0, 0);
  13. require_once(DEDEINC."/dedetag.class.php");
  14. require_once(DEDEINC."/customfields.func.php");
  15. require_once(DEDEMEMBER."/inc/inc_catalog_options.php");
  16. require_once(DEDEMEMBER."/inc/inc_archives_functions.php");
  17. $channelid = isset($channelid) && is_numeric($channelid) ? $channelid : 1;
  18. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  19. $mtypesid = isset($mtypesid) && is_numeric($mtypesid) ? $mtypesid : 0;
  20. $menutype = 'content';
  21. if ($cfg_ml->IsSendLimited()) {
  22. ShowMsg("文档发布失败,投稿已经超出投稿限制次数:{$cfg_ml->M_SendMax}次", "-1", "0", 5000);
  23. exit();
  24. }
  25. /*-------------
  26. function _ShowForm(){ }
  27. --------------*/
  28. if (empty($dopost)) {
  29. //读取归档信息
  30. $arcQuery = "SELECT arc.*,ch.addtable,ch.fieldset,arc.mtype as mtypeid,ch.arcsta FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel WHERE arc.id='$aid' And arc.mid='".$cfg_ml->M_ID."'; ";
  31. $row = $dsql->GetOne($arcQuery);
  32. if (!is_array($row)) {
  33. ShowMsg("读取文档信息出错", "-1");
  34. exit();
  35. } else if ($row['arcrank'] >= 0) {
  36. $dtime = time();
  37. $maxtime = $cfg_mb_editday * 24 * 3600;
  38. if ($dtime - $row['senddate'] > $maxtime) {
  39. ShowMsg("这篇文档已经锁定,暂时无法修改", "-1");
  40. exit();
  41. }
  42. }
  43. $addRow = $dsql->GetOne("SELECT * FROM `{$row['addtable']}` WHERE aid='$aid'; ");
  44. include(DEDEMEMBER."/templets/article_edit.htm");
  45. exit();
  46. }
  47. /*------------------------------
  48. function _SaveArticle(){ }
  49. ------------------------------*/
  50. else if ($dopost == 'save') {
  51. include(DEDEMEMBER.'/inc/archives_check_edit.php');
  52. //分析处理附加表数据
  53. $inadd_f = $inadd_m = '';
  54. if (!empty($dede_addonfields)) {
  55. $addonfields = explode(';', $dede_addonfields);
  56. if (is_array($addonfields)) {
  57. foreach ($addonfields as $v) {
  58. if ($v == '') {
  59. continue;
  60. }
  61. $vs = explode(',', $v);
  62. if (!isset(${$vs[0]})) {
  63. ${$vs[0]} = '';
  64. }
  65. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid);
  66. $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' ";
  67. $inadd_m .= ','.$vs[0];
  68. }
  69. }
  70. //这里对前台提交的附加数据进行一次校验
  71. $fontiterm = PrintAutoFieldsAdd(stripslashes($cInfos['fieldset']), 'autofield', FALSE);
  72. if ($fontiterm != $inadd_m) {
  73. ShowMsg("提交表单同系统配置不相符,请重新提交", "-1");
  74. exit();
  75. }
  76. }
  77. $body = AnalyseHtmlBody($body, $description);
  78. $body = HtmlReplace($body, -1);
  79. //更新数据库的SQL语句
  80. $upQuery = "UPDATE `#@__archives` SET ismake='$ismake',arcrank='$arcrank',typeid='$typeid',title='$title',description='$description',mtype='$mtypesid',keywords='$keywords',flag='$flag' WHERE id='$aid' AND mid='$mid'; ";
  81. if (!$dsql->ExecuteNoneQuery($upQuery)) {
  82. ShowMsg("数据保存到数据库主表`#@__archives`时出错,请联系管理员".$dsql->GetError(), "-1");
  83. exit();
  84. }
  85. if ($addtable != '') {
  86. $upQuery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},userip='$userip' WHERE aid='$aid' ";
  87. if (!$dsql->ExecuteNoneQuery($upQuery)) {
  88. ShowMsg("数据保存到数据库附加表时出错,请联系管理员", "javascript:;");
  89. exit();
  90. }
  91. }
  92. UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags);
  93. $artUrl = MakeArt($aid, true);
  94. if ($artUrl == '') {
  95. $artUrl = $cfg_phpurl."/view.php?aid=$aid";
  96. }
  97. //返回成功信息
  98. $msg = "请选择您的后续操作:<a href='article_add.php?cid=$typeid' class='btn btn-success'>发布新文档</a><a href='archives_do.php?channelid=$channelid&aid=".$aid."&dopost=edit' class='btn btn-success'>查看修改</a><a href='$artUrl' target='_blank' class='btn btn-success'>查看文档</a><a href='content_list.php?channelid=$channelid' class='btn btn-success'>管理文档</a>";
  99. $wintitle = "成功修改文档";
  100. $wecome_info = "文档管理::修改文档";
  101. $win = new OxWindow();
  102. $win->AddTitle("成功修改文档");
  103. $win->AddMsgItem($msg);
  104. $winform = $win->GetWindow("hand", "&nbsp;", false);
  105. $win->Display(DEDEMEMBER."/templets/win_templet.htm");
  106. }
  107. ?>