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

139 lines
5.2KB

  1. <?php
  2. /**
  3. * 文档编辑器
  4. *
  5. * @version $Id: archives_edit.php 1 13:52 2010年7月9日Z tianya $
  6. * @package DedeBIZ.Member
  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. /*-------------
  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. $cInfos = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='{$row['channel']}'; ");
  43. include(DEDEMEMBER."/templets/archives_edit.htm");
  44. exit();
  45. }
  46. /*------------------------------
  47. function _SaveArticle(){ }
  48. ------------------------------*/ else if ($dopost == 'save') {
  49. include(DEDEMEMBER.'/inc/archives_check_edit.php');
  50. //分析处理附加表数据
  51. $inadd_f = $inadd_m = '';
  52. if (!empty($dede_addonfields)) {
  53. $addonfields = explode(';', $dede_addonfields);
  54. if (is_array($addonfields)) {
  55. foreach ($addonfields as $v) {
  56. if ($v == '') {
  57. continue;
  58. }
  59. $vs = explode(',', $v);
  60. if (!isset(${$vs[0]})) {
  61. ${$vs[0]} = '';
  62. }
  63. //自动摘要和远程图片本地化
  64. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
  65. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]);
  66. }
  67. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid);
  68. $inadd_m .= ','.$vs[0];
  69. $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' ";
  70. }
  71. }
  72. //这里对前台提交的附加数据进行一次校验
  73. $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE);
  74. if ($fontiterm != $inadd_m) {
  75. ShowMsg("提交表单同系统配置不相符,请重新提交", "-1");
  76. exit();
  77. }
  78. }
  79. //处理图片文档的自定义属性
  80. if ($litpic != '') $flag = 'p';
  81. //更新数据库的SQL语句
  82. $upQuery = "UPDATE `#@__archives` SET
  83. ismake='$ismake',
  84. arcrank='$arcrank',
  85. typeid='$typeid',
  86. title='$title',
  87. litpic='$litpic',
  88. description='$description',
  89. keywords='$keywords',
  90. mtype = '$mtypesid',
  91. flag='$flag'
  92. WHERE id='$aid' And mid='$mid'; ";
  93. if (!$dsql->ExecuteNoneQuery($upQuery)) {
  94. ShowMsg("把数据保存到数据库主表时出错,请联系管理员".$dsql->GetError(), "-1");
  95. exit();
  96. }
  97. if ($addtable != '') {
  98. $upQuery = "UPDATE `$addtable` SET typeid='$typeid'{$inadd_f}, userip='$userip' WHERE aid='$aid' ";
  99. if (!$dsql->ExecuteNoneQuery($upQuery)) {
  100. ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员", "javascript:;");
  101. exit();
  102. }
  103. }
  104. $arcrank = empty($arcrank) ? 0 : $arcrank;
  105. $sortrank = empty($sortrank) ? 0 : $sortrank;
  106. UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags);
  107. $artUrl = MakeArt($aid, TRUE);
  108. if ($artUrl == '') $artUrl = $cfg_phpurl."/view.php?aid=$aid";
  109. //返回成功信息
  110. $msg = "  请选择您的后续操作:
  111. <a href='archives_add.php?cid=$typeid&channelid=$channelid' class='btn btn-secondary btn-sm'>发布新内容</a>
  112. &nbsp;&nbsp;
  113. <a href='archives_edit.php?channelid=$channelid&aid=".$aid."' class='btn btn-secondary btn-sm'>查看修改</a>
  114. &nbsp;&nbsp;
  115. <a href='$artUrl' target='_blank'>查看内容</a>
  116. &nbsp;&nbsp;
  117. <a href='content_list.php?channelid=$channelid' class='btn btn-secondary btn-sm'>管理内容</a>
  118. ";
  119. $wintitle = "成功修改内容";
  120. $wecome_info = "内容管理::修改内容";
  121. $win = new OxWindow();
  122. $win->AddTitle("成功修改内容:");
  123. $win->AddMsgItem($msg);
  124. $winform = $win->GetWindow("hand", "&nbsp;", false);
  125. $win->Display();
  126. }