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

107 lines
5.1KB

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