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

article_edit.php 7.4KB

3 年之前
3 年之前
2 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
3 年之前
2 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
2 年之前
3 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
3 年之前
8 月之前
3 年之前
10 月之前
3 年之前
10 月之前
2 年之前
10 月之前
3 年之前
3 年之前
3 年之前
3 年之前
2 年之前
3 年之前
8 月之前
3 年之前
2 年之前
3 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
1 年之前
2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. /**
  3. * 修改文档模型
  4. *
  5. * @version $id:article_edit.php 14:12 2010年7月12日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license GNU GPL v2 (https://www.dedebiz.com/license)
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('a_Edit,a_AccEdit,a_MyEdit');
  13. require_once(DEDEINC."/customfields.func.php");
  14. require_once(DEDEADMIN."/inc/inc_archives_functions.php");
  15. if (empty($dopost)) $dopost = '';
  16. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  17. if ($dopost != 'save') {
  18. require_once(DEDEADMIN."/inc/inc_catalog_options.php");
  19. require_once(DEDEINC."/dedetag.class.php");
  20. ClearMyAddon();
  21. //读取归档信息
  22. $query = "SELECT ch.typename AS channelname,ar.membername AS rankname,arc.* FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel LEFT JOIN `#@__arcrank` ar ON ar.`rank`=arc.arcrank WHERE arc.id='$aid' ";
  23. $arcRow = $dsql->GetOne($query);
  24. if (!is_array($arcRow)) {
  25. ShowMsg("读取文档信息出错", "-1");
  26. exit();
  27. }
  28. $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
  29. $cInfos = $dsql->GetOne($query);
  30. if (!is_array($cInfos)) {
  31. ShowMsg("读取栏目信息出错", "javascript:;");
  32. exit();
  33. }
  34. $addtable = $cInfos['addtable'];
  35. $addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'");
  36. if (!is_array($addRow)) {
  37. ShowMsg("读取附加信息出错", "javascript:;");
  38. exit();
  39. }
  40. $channelid = $arcRow['channel'];
  41. $tags = GetTags($aid);
  42. include DedeInclude("templets/article_edit.htm");
  43. exit();
  44. } else if ($dopost == 'save') {
  45. require_once(DEDEINC.'/image.func.php');
  46. require_once(DEDEINC.'/libraries/oxwindow.class.php');
  47. $flag = isset($flags) ? join(',', $flags) : '';
  48. $notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
  49. if (empty($typeid2)) $typeid2 = 0;
  50. if (!isset($autokey)) $autokey = 0;
  51. if (!isset($remote)) $remote = 0;
  52. if (!isset($dellink)) $dellink = 0;
  53. if (!isset($autolitpic)) $autolitpic = 0;
  54. if (trim($title) == '') {
  55. ShowMsg("文档标题不能为空", "-1");
  56. exit();
  57. }
  58. if (empty($typeid)) {
  59. ShowMsg("请选择文档栏目", "-1");
  60. exit();
  61. }
  62. if (empty($channelid)) {
  63. ShowMsg("文档为非指定类型,请检查您发布文档是否正确", "-1");
  64. exit();
  65. }
  66. if (!CheckChannel($typeid, $channelid)) {
  67. ShowMsg("您所选择的栏目与当前模型不相符,请重新选择", "-1");
  68. exit();
  69. }
  70. if (!TestPurview('a_Edit')) {
  71. CheckCatalog($typeid, "您没有操作栏目{$typeid}文档权限");
  72. }
  73. //对保存的文档进行处理
  74. $pubdate = GetMkTime($pubdate);
  75. $senddate = GetMkTime($senddate);
  76. $sortrank = AddDay($pubdate, $sortup);
  77. $ismake = $ishtml == 0 ? -1 : 0;
  78. $autokey = 1;
  79. $title = dede_htmlspecialchars(cn_substrR($title, $cfg_title_maxlen));
  80. $shorttitle = cn_substrR($shorttitle, 255);
  81. $color = cn_substrR($color, 7);
  82. $writer = cn_substrR($writer, 255);
  83. $source = cn_substrR($source, 255);
  84. $description = cn_substrR($description, 255);
  85. $keywords = trim(cn_substrR($keywords, 255));
  86. $filename = trim(cn_substrR($filename, 50));
  87. $isremote = 0;
  88. $serviterm = empty($serviterm) ? "" : $serviterm;
  89. if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) {
  90. $arcrank = -1;
  91. }
  92. $adminid = $cuserLogin->getUserID();
  93. //处理上传的缩略图
  94. if (empty($ddisremote)) {
  95. $ddisremote = 0;
  96. }
  97. $litpic = GetDDImage('none', $picname, $ddisremote);
  98. //分析body里的文档
  99. $body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
  100. //分析处理附加表数据
  101. $inadd_f = '';
  102. $inadd_v = '';
  103. if (!empty($dede_addonfields)) {
  104. $addonfields = explode(';', $dede_addonfields);
  105. $inadd_f = '';
  106. $inadd_v = '';
  107. if (is_array($addonfields)) {
  108. foreach ($addonfields as $v) {
  109. if ($v == '') {
  110. continue;
  111. }
  112. $vs = explode(',', $v);
  113. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //网页文本特殊处理
  114. {
  115. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
  116. } else {
  117. if (!isset(${$vs[0]})) {
  118. ${$vs[0]} = '';
  119. }
  120. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
  121. }
  122. $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
  123. }
  124. }
  125. }
  126. //处理图片文档的自定义属性
  127. if ($litpic != '' && !preg_match("#p#", $flag)) {
  128. $flag = ($flag == '' ? 'p' : $flag.',p');
  129. }
  130. if ($redirecturl != '' && !preg_match("#j#", $flag)) {
  131. $flag = ($flag == '' ? 'j' : $flag.',j');
  132. }
  133. //跳转网址的文档强制为动态
  134. if (preg_match("#j#", $flag)) $ismake = -1;
  135. //更新数据库的SQL语句
  136. $query = "UPDATE `#@__archives` SET typeid='$typeid',typeid2='$typeid2',sortrank='$sortrank',flag='$flag',click='$click',ismake='$ismake',arcrank='$arcrank',money='$money',title='$title',color='$color',writer='$writer',source='$source',litpic='$litpic',pubdate='$pubdate',senddate='$senddate',notpost='$notpost',description='$description',keywords='$keywords',shorttitle='$shorttitle',filename='$filename',dutyadmin='$adminid',weight='$weight' WHERE id='$id'; ";
  137. if (!$dsql->ExecuteNoneQuery($query)) {
  138. ShowMsg('数据保存到数据库文档主表出错,请检查数据库字段', -1);
  139. exit();
  140. }
  141. $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
  142. $addtable = trim($cts['addtable']);
  143. if ($addtable != '') {
  144. $useip = GetIP();
  145. $templet = empty($templet) ? '' : $templet;
  146. $iquery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},redirecturl='$redirecturl',templet='$templet',userip='$useip' WHERE aid='$id'";
  147. if (!$dsql->ExecuteNoneQuery($iquery)) {
  148. ShowMsg("数据保存到数据库附加表出错,请检查数据库字段", "javascript:;");
  149. exit();
  150. }
  151. }
  152. //生成网页
  153. UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
  154. $artUrl = MakeArt($id, true, true, $isremote);
  155. if ($artUrl == '') {
  156. $artUrl = $cfg_phpurl."/view.php?aid=$id";
  157. }
  158. ClearMyAddon($id, $title);
  159. //自动更新关联文档
  160. if (is_array($automake)) {
  161. foreach ($automake as $key => $value) {
  162. if (isset(${$key}) && !empty(${$key})) {
  163. $ids = explode(",", ${$key});
  164. foreach ($ids as $id) {
  165. MakeArt($id, true, true, $isremote);
  166. }
  167. }
  168. }
  169. }
  170. //返回成功信息
  171. $msg = "<tr>
  172. <td align='center'><a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>浏览文档</a><a href='article_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布文档</a><a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>修改文档</a><a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>返回文档列表</a></td>
  173. </tr>";
  174. $wintitle = "成功修改文档";
  175. $win = new OxWindow();
  176. $win->AddMsgItem($msg);
  177. $winform = $win->GetWindow("hand", false);
  178. $win->Display();
  179. }
  180. ?>