国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

205 строки
8.4KB

  1. <?php
  2. /**
  3. * 专题修改
  4. *
  5. * @version $id:spec_edit.php 16:22 2010年7月20日 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 (empty($dopost)) $dopost = '';
  16. if ($dopost != 'save') {
  17. require_once(DEDEADMIN."/inc/inc_catalog_options.php");
  18. require_once(DEDEINC."/dedetag.class.php");
  19. ClearMyAddon();
  20. $aid = intval($aid);
  21. $channelid = -1;
  22. //读取归档信息
  23. $arcQuery = "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' ";
  24. $arcRow = $dsql->GetOne($arcQuery);
  25. if (!is_array($arcRow)) {
  26. ShowMsg("读取文档基本信息出错", "-1");
  27. exit();
  28. }
  29. $query = "SELECT * FROM `#@__channeltype` WHERE id='-1'";
  30. $cInfos = $dsql->GetOne($query);
  31. if (!is_array($cInfos)) {
  32. ShowMsg("读取栏目配置信息出错", "javascript:;");
  33. exit();
  34. }
  35. $addRow = $dsql->GetOne("SELECT * FROM `#@__addonspec` WHERE aid='$aid'");
  36. $tags = GetTags($aid);
  37. include DedeInclude("templets/spec_edit.htm");
  38. }
  39. /*--------------------------------
  40. function __save(){ }
  41. -------------------------------*/
  42. else if ($dopost == 'save') {
  43. require_once(DEDEINC.'/image.func.php');
  44. require_once(DEDEINC.'/libraries/oxwindow.class.php');
  45. $flag = isset($flags) ? join(',', $flags) : '';
  46. $notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
  47. if (!isset($tags)) $tags = '';
  48. $channelid = -1;
  49. //处理自定义字段会用到这些变量
  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. //对保存的文档进行处理
  55. $pubdate = GetMkTime($pubdate);
  56. $sortrank = AddDay($pubdate, $sortup);
  57. if ($ishtml == 0) $ismake = -1;
  58. else $ismake = 0;
  59. $title = cn_substrR($title, $cfg_title_maxlen);
  60. $shorttitle = cn_substrR($shorttitle, 36);
  61. $color = cn_substrR($color, 7);
  62. $writer = cn_substrR($writer, 20);
  63. $source = cn_substrR($source, 30);
  64. $description = cn_substrR($description, $cfg_auot_description);
  65. $keywords = trim(cn_substrR($keywords, 60));
  66. $filename = trim(cn_substrR($filename, 40));
  67. $isremote = 0;
  68. $serviterm = empty($serviterm) ? "" : $serviterm;
  69. if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) {
  70. $arcrank = -1;
  71. }
  72. $adminid = $cuserLogin->getUserID();
  73. //处理上传的缩略图
  74. if (empty($ddisremote)) {
  75. $ddisremote = 0;
  76. }
  77. $litpic = GetDDImage('none', $picname, $ddisremote);
  78. //分析处理附加表数据
  79. $inadd_f = '';
  80. $inadd_v = '';
  81. if (!empty($dede_addonfields)) {
  82. $addonfields = explode(';', $dede_addonfields);
  83. $inadd_f = '';
  84. $inadd_v = '';
  85. if (is_array($addonfields)) {
  86. foreach ($addonfields as $v) {
  87. if ($v == '') {
  88. continue;
  89. }
  90. $vs = explode(',', $v);
  91. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //网页文本特殊处理
  92. {
  93. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
  94. } else {
  95. if (!isset(${$vs[0]})) {
  96. ${$vs[0]} = '';
  97. }
  98. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
  99. }
  100. $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
  101. }
  102. }
  103. }
  104. //处理图片文档的自定义属性
  105. if ($litpic != '' && !preg_match('#p#', $flag)) {
  106. $flag = ($flag == '' ? 'p' : $flag.',p');
  107. }
  108. $inQuery = "UPDATE `#@__archives` SET typeid='$typeid',sortrank='$sortrank',flag='$flag',ismake='$ismake',arcrank='$arcrank',click='$click',title='$title',color='$color',writer='$writer',source='$source',litpic='$litpic',pubdate='$pubdate',notpost='$notpost',description='$description',keywords='$keywords',shorttitle='$shorttitle',filename='$filename' WHERE id='$id'; ";
  109. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  110. ShowMsg("数据保存到数据库主表`#@__archives`时出错,请检查数据库字段", "-1");
  111. exit();
  112. }
  113. //专题节点列表
  114. $arcids = array();
  115. $notelist = '';
  116. for ($i = 1; $i <= $cfg_specnote; $i++) {
  117. if (!empty(${'notename'.$i})) {
  118. $notename = str_replace("'", "", trim(${'notename'.$i}));
  119. $arcid = trim(${'arcid'.$i});
  120. $col = trim(${'col'.$i});
  121. $imgwidth = trim(${'imgwidth'.$i});
  122. $imgheight = trim(${'imgheight'.$i});
  123. $titlelen = trim(${'titlelen'.$i});
  124. $infolen = trim(${'infolen'.$i});
  125. $listtmp = trim(${'listtmp'.$i});
  126. if (isset(${'noteid'.$i})) {
  127. $noteid = trim(${'noteid'.$i});
  128. } else {
  129. $noteid = $i;
  130. }
  131. if (isset(${'isauto'.$i})) {
  132. $isauto = trim(${'isauto'.$i});
  133. } else {
  134. $isauto = 0;
  135. }
  136. if (isset(${'keywords'.$i})) {
  137. $keywords = str_replace("'", "", trim(${'keywords'.$i}));
  138. } else {
  139. $keywords = "";
  140. }
  141. if (!empty(${'typeid'.$i})) {
  142. $ttypeid = trim(${'typeid'.$i});
  143. } else {
  144. $ttypeid = 0;
  145. }
  146. if (!empty(${'rownum'.$i})) {
  147. $rownum = trim(${'rownum'.$i});
  148. } else {
  149. $rownum = 0;
  150. }
  151. $arcid = preg_replace("#[^0-9,]#", "", $arcid);
  152. $ids = explode(",", $arcid);
  153. $okids = "";
  154. if (is_array($ids)) {
  155. foreach ($ids as $mid) {
  156. $mid = trim($mid);
  157. if ($mid == "") continue;
  158. if (!isset($arcids[$mid])) {
  159. if ($okids == "") {
  160. $okids .= $mid;
  161. } else {
  162. $okids .= ",".$mid;
  163. }
  164. $arcids[$mid] = 1;
  165. }
  166. }
  167. }
  168. $notelist .= "{dede:specnote imgheight=\\'$imgheight\\' imgwidth=\\'$imgwidth\\' infolen=\\'$infolen\\' titlelen=\\'$titlelen\\' col=\\'$col\\' idlist=\\'$okids\\' name=\\'$notename\\' noteid=\\'$noteid\\' isauto=\'$isauto\' rownum=\\'$rownum\\' keywords=\\'$keywords\\' typeid=\\'$ttypeid\\'} $listtmp {/dede:specnote}\r\n";
  169. }
  170. }
  171. //更新附加表
  172. $inQuery = "UPDATE `#@__addonspec` SET typeid ='$typeid',note='$notelist'{$inadd_f},templet='$templet' WHERE aid='$id';";
  173. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  174. ShowMsg("数据保存到数据库附加表时出错,请检查数据库字段", "-1");
  175. exit();
  176. }
  177. //生成网页
  178. UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
  179. $artUrl = MakeArt($id, TRUE, TRUE, $isremote);
  180. if ($artUrl == '') {
  181. $artUrl = $cfg_phpurl."/view.php?aid=$id";
  182. }
  183. ClearMyAddon($id, $title);
  184. //自动更新关联文档
  185. if (is_array($automake)) {
  186. foreach ($automake as $key => $value) {
  187. if (isset(${$key}) && !empty(${$key})) {
  188. $ids = explode(",", ${$key});
  189. foreach ($ids as $id) {
  190. MakeArt($id, true, true, $isremote);
  191. }
  192. }
  193. }
  194. }
  195. //返回成功信息
  196. $msg = "请选择您的后续操作:<a href='spec_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='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看专题</a><a href='content_s_list.php' class='btn btn-success btn-sm'>已发布专题管理</a> ";
  197. $wintitle = "成功修改一个专题";
  198. $wecome_info = "专题管理::修改专题";
  199. $win = new OxWindow();
  200. $win->AddTitle("成功修改专题");
  201. $win->AddMsgItem($msg);
  202. $winform = $win->GetWindow("hand", "&nbsp;", FALSE);
  203. $win->Display();
  204. }
  205. ?>