国内流行的内容管理系统(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.

145 lines
4.9KB

  1. <?php
  2. /**
  3. * 编辑文章
  4. *
  5. * @version $Id: article_edit.php 1 13:52 2010年7月9日Z tianya $
  6. * @package DedeCMS.Member
  7. * @copyright Copyright (c) 2020, 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. /*-------------
  22. function _ShowForm(){ }
  23. --------------*/
  24. if(empty($dopost))
  25. {
  26. //读取归档信息
  27. $arcQuery = "SELECT arc.*,ch.addtable,ch.fieldset,arc.mtype as mtypeid,ch.arcsta
  28. FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel
  29. WHERE arc.id='$aid' And arc.mid='".$cfg_ml->M_ID."'; ";
  30. $row = $dsql->GetOne($arcQuery);
  31. if(!is_array($row))
  32. {
  33. ShowMsg("读取文章信息出错!","-1");
  34. exit();
  35. }
  36. else if($row['arcrank']>=0)
  37. {
  38. $dtime = time();
  39. $maxtime = $cfg_mb_editday * 24 *3600;
  40. if($dtime - $row['senddate'] > $maxtime)
  41. {
  42. ShowMsg("这篇文档已经锁定,你不能再修改它!","-1");
  43. exit();
  44. }
  45. }
  46. $addRow = $dsql->GetOne("SELECT * FROM `{$row['addtable']}` WHERE aid='$aid'; ");
  47. include(DEDEMEMBER."/templets/article_edit.htm");
  48. exit();
  49. }
  50. /*------------------------------
  51. function _SaveArticle(){ }
  52. ------------------------------*/
  53. else if($dopost=='save')
  54. {
  55. include(DEDEMEMBER.'/inc/archives_check_edit.php');
  56. //分析处理附加表数据
  57. $inadd_f = $inadd_m = '';
  58. if(!empty($dede_addonfields))
  59. {
  60. $addonfields = explode(';',$dede_addonfields);
  61. if(is_array($addonfields))
  62. {
  63. foreach($addonfields as $v)
  64. {
  65. if($v=='')
  66. {
  67. continue;
  68. }
  69. $vs = explode(',',$v);
  70. if(!isset(${$vs[0]}))
  71. {
  72. ${$vs[0]} = '';
  73. }
  74. ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$aid);
  75. $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' ";
  76. $inadd_m .= ','.$vs[0];
  77. }
  78. }
  79. // 这里对前台提交的附加数据进行一次校验
  80. $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE);
  81. if ($fontiterm != $inadd_m)
  82. {
  83. ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1");
  84. exit();
  85. }
  86. }
  87. $body = AnalyseHtmlBody($body,$description);
  88. $body = HtmlReplace($body,-1);
  89. //更新数据库的SQL语句
  90. $upQuery = "UPDATE `#@__archives` SET
  91. ismake='$ismake',
  92. arcrank='$arcrank',
  93. typeid='$typeid',
  94. title='$title',
  95. description='$description',
  96. mtype = '$mtypesid',
  97. keywords='$keywords',
  98. flag='$flag'
  99. WHERE id='$aid' AND mid='$mid'; ";
  100. if(!$dsql->ExecuteNoneQuery($upQuery))
  101. {
  102. ShowMsg("把数据保存到数据库主表时出错,请联系管理员!".$dsql->GetError(),"-1");
  103. exit();
  104. }
  105. if($addtable!='')
  106. {
  107. $upQuery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},userip='$userip' WHERE aid='$aid' ";
  108. if(!$dsql->ExecuteNoneQuery($upQuery))
  109. {
  110. ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!","javascript:;");
  111. exit();
  112. }
  113. }
  114. UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags);
  115. $artUrl = MakeArt($aid,true);
  116. if($artUrl=='')
  117. {
  118. $artUrl = $cfg_phpurl."/view.php?aid=$aid";
  119. }
  120. //返回成功信息
  121. $msg = "  请选择你的后续操作:
  122. <a href='article_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>发布新文章</a>
  123. &nbsp;&nbsp;
  124. <a href='archives_do.php?channelid=$channelid&aid=".$aid."&dopost=edit' class='btn btn-secondary btn-sm'>查看更改</a>
  125. &nbsp;&nbsp;
  126. <a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看文章</a>
  127. &nbsp;&nbsp;
  128. <a href='content_list.php?channelid=$channelid' class='btn btn-secondary btn-sm'>管理文章</a>
  129. ";
  130. $wintitle = "成功更改文章!";
  131. $wecome_info = "文章管理::更改文章";
  132. $win = new OxWindow();
  133. $win->AddTitle("成功更改文章:");
  134. $win->AddMsgItem($msg);
  135. $winform = $win->GetWindow("hand","&nbsp;",false);
  136. $win->Display();
  137. }