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

110 lines
5.2KB

  1. <?php
  2. /**
  3. * 修改栏目
  4. *
  5. * @version $id:catalog_edit.php 14:31 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. require_once(DEDEINC."/typelink/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 issend='$issend',sortrank='$sortrank',typename='$typename',cnoverview='$cnoverview',enname='$enname',enoverview='$enoverview',bigpic='$bigpic',litimg='$litimg',typedir='$typedir',isdefault='$isdefault',defaultname='$defaultname',issend='$issend',ishidden='$ishidden',channeltype='$channeltype',tempindex='$tempindex',templist='$templist',temparticle='$temparticle',namerule='$namerule',namerule2='$namerule2',ispart='$ispart',corank='$corank',description='$description',keywords='$keywords',seotitle='$seotitle',moresite='$moresite',`cross`='$cross',`content`='$content',`crossid`='$crossid',`smalltypes`='$smalltypes'$uptopsql WHERE id='$id' ";
  33. if (!$dsql->ExecuteNoneQuery($upquery)) {
  34. ShowMsg("保存栏目失败,请您检查栏目字段是否存在问题", "-1");
  35. exit();
  36. }
  37. //如果选择子栏目可投稿,更新顶级栏目为可投稿
  38. if ($topid > 0 && $issend == 1) {
  39. $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
  40. }
  41. $slinks = " id IN (".GetSonIds($id).")";
  42. //修改顶级栏目时强制修改下级的多站点支持属性
  43. if ($topid == 0 && preg_match("#,#", $slinks)) {
  44. $upquery = "UPDATE `#@__arctype` SET moresite='$moresite', siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' WHERE 1=1 AND $slinks";
  45. $dsql->ExecuteNoneQuery($upquery);
  46. }
  47. //修改子栏目属性
  48. if (!empty($upnext)) {
  49. $upquery = "UPDATE `#@__arctype` SET issend='$issend',defaultname='$defaultname',channeltype='$channeltype',tempindex='$tempindex',templist='$templist',temparticle='$temparticle',namerule='$namerule',namerule2='$namerule2',ishidden='$ishidden' WHERE 1=1 AND $slinks";
  50. if (!$dsql->ExecuteNoneQuery($upquery)) {
  51. ShowMsg("修改栏目成功,但修改下级栏目属性时失败", "-1");
  52. exit();
  53. }
  54. }
  55. UpDateCatCache();
  56. ShowMsg("成功修改一个栏目", "catalog_main.php");
  57. exit();
  58. } //End Save Action
  59. else if ($dopost == "savetime") {
  60. $uptopsql = '';
  61. $slinks = " id IN (".GetSonIds($id).")";
  62. //顶级栏目二级域名根目录处理
  63. if ($topid == 0 && $moresite == 1) {
  64. $sitepath = $typedir;
  65. $uptopsql = " ,sitepath='$sitepath' ";
  66. if (preg_match("#,#", $slinks)) {
  67. $upquery = "UPDATE `#@__arctype` SET sitepath='$sitepath' WHERE $slinks";
  68. $dsql->ExecuteNoneQuery($upquery);
  69. }
  70. }
  71. //如果选择子栏目可投稿,更新顶级栏目为可投稿
  72. if ($topid > 0 && $issend == 1) {
  73. $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
  74. }
  75. $upquery = "UPDATE `#@__arctype` SET issend='$issend',sortrank='$sortrank',typedir='$typedir',typename='$typename',isdefault='$isdefault',defaultname='$defaultname',ispart='$ispart',corank='$corank' $uptopsql WHERE id='$id' ";
  76. if (!$dsql->ExecuteNoneQuery($upquery)) {
  77. ShowMsg("保存栏目失败,请您检查栏目字段是否存在输入问题", "-1");
  78. exit();
  79. }
  80. UpDateCatCache();
  81. ShowMsg("成功修改一个栏目", "catalog_main.php");
  82. exit();
  83. }
  84. //读取栏目信息
  85. $dsql->SetQuery("SELECT tp.*,ch.typename as ctypename FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id=$id");
  86. $myrow = $dsql->GetOne();
  87. $topid = $myrow['topid'];
  88. if ($topid > 0) {
  89. $toprow = $dsql->GetOne("SELECT moresite,siteurl,sitepath FROM `#@__arctype` WHERE id=$topid");
  90. foreach ($toprow as $k => $v) {
  91. if (!preg_match("#[0-9]#", $k)) {
  92. $myrow[$k] = $v;
  93. }
  94. }
  95. }
  96. $myrow['content'] = empty($myrow['content']) ? "&nbsp;" : $myrow['content'];
  97. //读取栏目模型信息
  98. $channelid = $myrow['channeltype'];
  99. $dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id");
  100. $dsql->Execute();
  101. while ($row = $dsql->GetObject()) {
  102. $channelArray[$row->id]['typename'] = $row->typename;
  103. $channelArray[$row->id]['nid'] = $row->nid;
  104. if ($row->id == $channelid) {
  105. $nid = $row->nid;
  106. }
  107. }
  108. PutCookie('lastCid', GetTopid($id), 3600 * 24, "/");
  109. include DedeInclude('templets/catalog_edit.htm');
  110. ?>