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

273 lines
12KB

  1. <?php
  2. /**
  3. * 栏目编辑
  4. *
  5. * @version $Id: catalog_edit.php 1 14:31 2010年7月12日Z tianya $
  6. * @package DedeBIZ.Administrator
  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. require_once(DEDEINC . "/typelink.class.php");
  13. if (empty($dopost)) $dopost = '';
  14. $id = isset($id) ? intval($id) : 0;
  15. //检查权限许可
  16. CheckPurview('t_Edit,t_AccEdit');
  17. //检查栏目操作许可
  18. CheckCatalog($id, '你无权更改本栏目!');
  19. /*-----------------------
  20. function action_save()
  21. ----------------------*/
  22. if ($dopost == "save") {
  23. $description = Html2Text($description, 1);
  24. $keywords = Html2Text($keywords, 1);
  25. $uptopsql = $smalltypes = '';
  26. if (isset($smalltype) && is_array($smalltype)) $smalltypes = join(',', $smalltype);
  27. if ($topid == 0) {
  28. $sitepath = $typedir;
  29. $uptopsql = " ,siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' ";
  30. }
  31. if ($ispart != 0) $cross = 0;
  32. $upquery = "UPDATE `#@__arctype` SET
  33. issend='$issend',
  34. sortrank='$sortrank',
  35. typename='$typename',
  36. typedir='$typedir',
  37. isdefault='$isdefault',
  38. defaultname='$defaultname',
  39. issend='$issend',
  40. ishidden='$ishidden',
  41. channeltype='$channeltype',
  42. tempindex='$tempindex',
  43. templist='$templist',
  44. temparticle='$temparticle',
  45. namerule='$namerule',
  46. namerule2='$namerule2',
  47. ispart='$ispart',
  48. corank='$corank',
  49. description='$description',
  50. keywords='$keywords',
  51. seotitle='$seotitle',
  52. moresite='$moresite',
  53. `cross`='$cross',
  54. `content`='$content',
  55. `crossid`='$crossid',
  56. `smalltypes`='$smalltypes'
  57. $uptopsql
  58. WHERE id='$id' ";
  59. if (!$dsql->ExecuteNoneQuery($upquery)) {
  60. ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1");
  61. exit();
  62. }
  63. //如果选择子栏目可投稿,更新顶级栏目为可投稿
  64. if ($topid > 0 && $issend == 1) {
  65. $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
  66. }
  67. $slinks = " id IN (" . GetSonIds($id) . ")";
  68. //修改顶级栏目时强制修改下级的多站点支持属性
  69. if ($topid == 0 && preg_match("#,#", $slinks)) {
  70. $upquery = "UPDATE `#@__arctype` SET moresite='$moresite', siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' WHERE 1=1 AND $slinks";
  71. $dsql->ExecuteNoneQuery($upquery);
  72. }
  73. //更改子栏目属性
  74. if (!empty($upnext)) {
  75. $upquery = "UPDATE `#@__arctype` SET
  76. issend='$issend',
  77. defaultname='$defaultname',
  78. channeltype='$channeltype',
  79. tempindex='$tempindex',
  80. templist='$templist',
  81. temparticle='$temparticle',
  82. namerule='$namerule',
  83. namerule2='$namerule2',
  84. ishidden='$ishidden'
  85. WHERE 1=1 AND $slinks";
  86. if (!$dsql->ExecuteNoneQuery($upquery)) {
  87. ShowMsg("更改当前栏目成功,但更改下级栏目属性时失败!", "-1");
  88. exit();
  89. }
  90. }
  91. UpDateCatCache();
  92. ShowMsg("成功更改一个分类!", "catalog_main.php");
  93. exit();
  94. } //End Save Action
  95. else if ($dopost == "savetime") {
  96. $uptopsql = '';
  97. $slinks = " id IN (" . GetSonIds($id) . ")";
  98. //顶级栏目二级域名根目录处理
  99. if ($topid == 0 && $moresite == 1) {
  100. $sitepath = $typedir;
  101. $uptopsql = " ,sitepath='$sitepath' ";
  102. if (preg_match("#,#", $slinks)) {
  103. $upquery = "UPDATE `#@__arctype` SET sitepath='$sitepath' WHERE $slinks";
  104. $dsql->ExecuteNoneQuery($upquery);
  105. }
  106. }
  107. //如果选择子栏目可投稿,更新顶级栏目为可投稿
  108. if ($topid > 0 && $issend == 1) {
  109. $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
  110. }
  111. $upquery = "UPDATE `#@__arctype` SET
  112. issend='$issend',
  113. sortrank='$sortrank',
  114. typedir='$typedir',
  115. typename='$typename',
  116. isdefault='$isdefault',
  117. defaultname='$defaultname',
  118. ispart='$ispart',
  119. corank='$corank' $uptopsql
  120. WHERE id='$id' ";
  121. if (!$dsql->ExecuteNoneQuery($upquery)) {
  122. ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1");
  123. exit();
  124. }
  125. UpDateCatCache();
  126. ShowMsg("成功更改一个分类!", "catalog_main.php");
  127. exit();
  128. }
  129. //读取栏目信息
  130. $dsql->SetQuery("SELECT tp.*,ch.typename as ctypename FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id=$id");
  131. $myrow = $dsql->GetOne();
  132. $topid = $myrow['topid'];
  133. if ($topid > 0) {
  134. $toprow = $dsql->GetOne("SELECT moresite,siteurl,sitepath FROM `#@__arctype` WHERE id=$topid");
  135. foreach ($toprow as $k => $v) {
  136. if (!preg_match("#[0-9]#", $k)) {
  137. $myrow[$k] = $v;
  138. }
  139. }
  140. }
  141. $myrow['content'] = empty($myrow['content']) ? "&nbsp;" : $myrow['content'];
  142. //读取频道模型信息
  143. $channelid = $myrow['channeltype'];
  144. $dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id");
  145. $dsql->Execute();
  146. while ($row = $dsql->GetObject()) {
  147. $channelArray[$row->id]['typename'] = $row->typename;
  148. $channelArray[$row->id]['nid'] = $row->nid;
  149. if ($row->id == $channelid) {
  150. $nid = $row->nid;
  151. }
  152. }
  153. PutCookie('lastCid', GetTopid($id), 3600 * 24, "/");
  154. if ($dopost == 'time') {
  155. ?>
  156. <form name="form1" action="catalog_edit.php" method="post" onSubmit="return checkSubmit();">
  157. <input type="hidden" name="dopost" value="savetime" />
  158. <input type="hidden" name="id" value="<?php echo $id; ?>" />
  159. <input type="hidden" name="topid" value="<?php echo $myrow['topid']; ?>" />
  160. <input type="hidden" name="moresite" value="<?php echo $myrow['moresite']; ?>" />
  161. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  162. <tr>
  163. <td class='bline' height="26" align="center" colspan="2">
  164. <a href='catalog_edit.php?id=<?php echo $id; ?>'><u>当前是快捷编辑模式,如果您要修改更详细的参数,请使用高级模式&gt;&gt;</u></a>
  165. </td>
  166. </tr>
  167. <tr>
  168. <td width="150" class='bline' height="26" align="center">是否支持投稿:</td>
  169. <td class='bline'>
  170. <label><input type='radio' name='issend' value='0' class='np' <?php if ($myrow['issend'] == "0") echo " checked='1' "; ?> />
  171. 不支持</label>&nbsp;
  172. <label><input type='radio' name='issend' value='1' class='np' <?php if ($myrow['issend'] == "1") echo " checked='1' "; ?> />
  173. 支持</label></td>
  174. </tr>
  175. <!-- 在快速修改更改内容模型后,因为模板没改变,会导致错误,因此去除些选择框。 -->
  176. <tr>
  177. <td class='bline' height="26" align="center">
  178. <font color='red'>内容模型:</font>
  179. </td>
  180. <td class='bline'>
  181. <?php
  182. foreach ($channelArray as $k => $arr) {
  183. if ($k == $channelid) echo "{$arr['typename']} | {$arr['nid']}";
  184. }
  185. ?>
  186. <a href='catalog_edit.php?id=<?php echo $id; ?>'><u>[修改]</u></a>
  187. </td>
  188. </tr>
  189. <tr>
  190. <td class='bline' height="26" align="center">
  191. <font color='red'>栏目名称:</font>
  192. </td>
  193. <td class='bline'><input name="typename" type="text" id="typename" size="30" value="<?php echo $myrow['typename'] ?>" class="iptxt" /></td>
  194. </tr>
  195. <tr>
  196. <td class='bline' height="26" align="center"> 排列顺序: </td>
  197. <td class='bline'> <input name="sortrank" size="6" type="text" value="<?php echo $myrow['sortrank'] ?>" class="iptxt" />
  198. (由低 -&gt; 高) </td>
  199. </tr>
  200. <tr>
  201. <td class='bline' height="26" align="center">浏览权限:</td>
  202. <td class='bline'> <select name="corank" id="corank" style="width:100">
  203. <?php
  204. $dsql->SetQuery("SELECT * FROM #@__arcrank WHERE rank >= 0");
  205. $dsql->Execute();
  206. while ($row = $dsql->GetObject()) {
  207. if ($myrow['corank'] == $row->rank)
  208. echo "<option value='" . $row->rank . "' selected>" . $row->membername . "</option>\r\n";
  209. else
  210. echo "<option value='" . $row->rank . "'>" . $row->membername . "</option>\r\n";
  211. }
  212. ?>
  213. </select>
  214. (仅限制栏目里的文档浏览权限) </td>
  215. </tr>
  216. <tr>
  217. <td class='bline' height="26" align="center">文件保存目录:</td>
  218. <td class='bline'><input name="typedir" type="text" id="typedir" value="<?php echo $myrow['typedir'] ?>" style="width:300px" class="iptxt" /></td>
  219. </tr>
  220. <tr>
  221. <td height="26" align="center" class='bline'>栏目列表选项:</td>
  222. <td class='bline'>
  223. <label><input type='radio' name='isdefault' value='1' class='np' <?php if ($myrow['isdefault'] == 1) echo " checked='1' "; ?> />
  224. 链接到默认页</label>
  225. <label><input type='radio' name='isdefault' value='0' class='np' <?php if ($myrow['isdefault'] == 0) echo " checked='1' "; ?> />
  226. 链接到列表第一页</label>
  227. <label><input type='radio' name='isdefault' value='-1' class='np' <?php if ($myrow['isdefault'] == -1) echo " checked='1' "; ?> />
  228. 使用动态页</label> </td>
  229. </tr>
  230. <tr>
  231. <td class='bline' height="26" align="center">默认页的名称: </td>
  232. <td class='bline'><input name="defaultname" type="text" value="<?php echo $myrow['defaultname'] ?>" class="iptxt" /></td>
  233. </tr>
  234. <tr>
  235. <td height="26" class='bline' align="center">栏目属性:</td>
  236. <td class='bline'>
  237. <label><input name="ispart" type="radio" id="radio" value="0" class='np' <?php if ($myrow['ispart'] == 0) echo " checked='1' "; ?> />
  238. 最终列表栏目(允许在本栏目发布文档,并生成文档列表)</label><br>
  239. <label><input name="ispart" type="radio" id="radio2" value="1" class='np' <?php if ($myrow['ispart'] == 1) echo " checked='1' "; ?> />
  240. 频道封面(栏目本身不允许发布文档)</label><br>
  241. <label><input name="ispart" type="radio" id="radio3" value="2" class='np' <?php if ($myrow['ispart'] == 2) echo " checked='1' "; ?> />
  242. 外部连接(在"文件保存目录"处填写网址) </label> </td>
  243. </tr>
  244. <tr>
  245. <td align="center" colspan="2" height="54" bgcolor='#FAFEE0'>
  246. <input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np" />
  247. &nbsp;&nbsp;&nbsp;
  248. <a title='关闭' onclick='CloseMsg()'><img src="images/button_back.gif" width="60" height="22" border="0"></a>
  249. </td>
  250. </tr>
  251. </table>
  252. </form>
  253. <?php
  254. exit();
  255. } else {
  256. include DedeInclude('templets/catalog_edit.htm');
  257. }
  258. ?>