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

290 lines
11KB

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