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

111 line
5.3KB

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