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

148 lines
4.2KB

  1. <?php
  2. /**
  3. * 编辑圈子
  4. *
  5. * @version $Id: group_edit.php 1 15:34 2011-1-21 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."/oxwindow.class.php");
  13. require_once(DEDEADMIN."/inc/inc_archives_functions.php");
  14. CheckPurview('group_Edit');
  15. $id = preg_replace("#[^0-9]#", "", $id);
  16. $action = isset($action) ? trim($action) : '';
  17. if($id < 1)
  18. {
  19. ShowMsg("含有非法操作!.","-1");
  20. exit();
  21. }
  22. //取出圈子信息
  23. $row = $db->GetOne("SELECT * FROM #@__groups WHERE groupid='{$id}'");
  24. $groupsname = $row['groupname'];
  25. $groupstoreid = $row['storeid'];
  26. $groupishidden = $row['ishidden'];
  27. $groupissystem = $row['issystem'];
  28. $groupcreater = $row['creater'];
  29. $groupimg = $row['groupimg'];
  30. $ismaster = $row['ismaster'];
  31. $groupdes = dede_htmlspecialchars($row['des']);
  32. $groupisindex = $row['isindex'];
  33. $groupsmalltype = $row['smalltype'];
  34. //编译小分类成数组
  35. $smalltypes = $row['smalltype'];
  36. $lists = array();
  37. $smalltypes = @explode(",", $smalltypes);
  38. foreach($smalltypes as $k)
  39. {
  40. $kk = @explode("|",$k);
  41. @array_push($lists,$kk[1]);
  42. }
  43. //====保存圈子信息=====//
  44. if($action=="save")
  45. {
  46. $groupname = cn_substr($groupname,75);
  47. $storeid = preg_replace("#[^0-9]#", "", $store);
  48. $issystem = preg_replace("#[^0-1]#", "", $issystem);
  49. $ishidden = preg_replace("#[^0-1]#", "", $ishidden);
  50. if(!isset($isindex))
  51. {
  52. $isindex = $groupisindex;
  53. }
  54. $isindex = preg_replace("#[^0-1]#", "", $isindex);
  55. $creater = cn_substr($creater, 15);
  56. $master = cn_substr($master, 70);
  57. $description = cn_substr($des, 100);
  58. $row = $db->GetOne("SELECT tops FROM #@__store_groups WHERE storeid='{$storeid}'");
  59. if($row['tops'] >0 )
  60. {
  61. $rootstoreid = $row['tops'];
  62. }
  63. else
  64. {
  65. $rootstoreid = $storeid;
  66. }
  67. //处理上传的缩略图
  68. if(empty($ddisremote))
  69. {
  70. $ddisremote = 0;
  71. }
  72. $litpic = GetDDImage('litpic', $picname, $ddisremote);
  73. if(empty($litpic))
  74. {
  75. $litpic = $groupimg;
  76. }
  77. if($isindex < 1)
  78. {
  79. $isindex = 0;
  80. }
  81. $inQuery = "UPDATE #@__groups SET groupname='".$groupname."',des='".$description."',groupimg='".$litpic."',rootstoreid='{$rootstoreid}',storeid='{$storeid}',creater='".$creater."',ismaster='".$master."',issystem='{$issystem}',ishidden='{$ishidden}',isindex='".$isindex."' WHERE groupid='{$id}'";
  82. if(!$db->ExecuteNoneQuery($inQuery))
  83. {
  84. ShowMsg("把数据更新到数据库groups表时出错,请检查!","-1");
  85. exit();
  86. }
  87. else
  88. {
  89. ShowMsg("成功更改圈子设置!","-1");
  90. exit();
  91. }
  92. }
  93. //更新数据完毕
  94. if(!$groupimg||empty($groupimg))
  95. {
  96. $groupimg = "img/pview.gif";
  97. }
  98. //类目递归
  99. $db->SetQuery("SELECT * FROM #@__store_groups WHERE tops=0 ORDER BY orders ASC");
  100. $db->Execute(1);
  101. $option = '';
  102. while($rs = $db->GetArray(1))
  103. {
  104. $selected = "";
  105. if($rs['storeid']==$groupstoreid)
  106. {
  107. $selected = "selected='selected'";
  108. }
  109. $option .= "<option value='".$rs['storeid']."' ".$selected.">".$rs['storename']."</option>\n";
  110. $v = $rs['storeid'];
  111. $db->SetQuery("SELECT * FROM #@__store_groups WHERE tops='{$v}' ORDER BY orders ASC");
  112. $db->Execute(2);
  113. while($rs = $db->GetArray(2))
  114. {
  115. $selected = "";
  116. if($rs['storeid']==$groupstoreid)
  117. {
  118. $selected = "selected='selected'";
  119. }
  120. $option .= "<option value='".$rs['storeid']."' ".$selected.">--".$rs['storename']."</option>\n";
  121. }
  122. }
  123. $db->SetQuery("SELECT * FROM #@__group_smalltypes ORDER BY disorder ASC");
  124. $db->Execute();
  125. $smalltypes_option = '';
  126. while($rs = $db->GetArray())
  127. {
  128. $selected = "";
  129. if(in_array($rs['id'],$lists))
  130. {
  131. $selected = "selected='selected'";
  132. }
  133. $smalltypes_option .= "<option value='".$rs['name']."|".$rs['id']."' ".$selected.">".$rs['name']."</option>\n";
  134. }
  135. require_once(DEDEADMIN."/templets/group_edit.htm");
  136. ?>