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

155 lines
5.4KB

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