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

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