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

130 lines
4.9KB

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