admincp_admingroup.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: admincp_admingroup.php 31651 2012-09-18 10:23:26Z zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. cpheader();
  12. if(!$operation) {
  13. if(submitcheck('groupsubmit') && $ids = dimplode($_GET['delete'])) {
  14. $gids = array();
  15. $query = C::t('common_usergroup')->fetch_all_by_groupid($_GET['delete']);
  16. foreach($query as $g) {
  17. $gids[] = $g['groupid'];
  18. }
  19. if($gids) {
  20. C::t('common_usergroup')->delete($gids);
  21. C::t('common_usergroup_field')->delete($gids);
  22. C::t('common_admingroup')->delete($gids);
  23. $newgroupid = C::t('common_usergroup')->fetch_new_groupid();
  24. C::t('common_member')->update_by_groupid($gids, array('groupid' => $newgroupid, 'adminid' => '0'), 'UNBUFFERED');
  25. deletegroupcache($gids);
  26. }
  27. }
  28. $grouplist = C::t('common_admingroup')->fetch_all_merge_usergroup();
  29. if(!submitcheck('groupsubmit')) {
  30. shownav('user', 'nav_admingroups');
  31. showsubmenu('nav_admingroups');
  32. showtips('admingroup_tips');
  33. showformheader('admingroup');
  34. showtableheader('', 'fixpadding');
  35. showsubtitle(array('', 'usergroups_title', '', 'type', 'admingroup_level', 'usergroups_stars', 'usergroups_color',
  36. '<input class="checkbox" type="checkbox" name="gbcmember" onclick="checkAll(\'value\', this.form, \'gbmember\', \'gbcmember\', 1)" /> <a href="javascript:;" onclick="if(getmultiids()) location.href=\''.ADMINSCRIPT.'?action=usergroups&operation=edit&multi=\' + getmultiids();return false;">'.$lang['multiedit'].'</a>',
  37. '<input class="checkbox" type="checkbox" name="gpcmember" onclick="checkAll(\'value\', this.form, \'gpmember\', \'gpcmember\', 1)" /> <a href="javascript:;" onclick="if(getmultiids()) location.href=\''.ADMINSCRIPT.'?action=admingroup&operation=edit&multi=\' + getmultiids();return false;">'.$lang['multiedit'].'</a>',
  38. ));
  39. foreach($grouplist as $gid => $group) {
  40. $adminidselect = '<select name="newradminid['.$group['groupid'].']">';
  41. for($i = 1;$i <= 3;$i++) {
  42. $adminidselect .= '<option value="'.$i.'"'.($i == $group['radminid'] ? ' selected="selected"' : '').'>'.$lang['usergroups_system_'.$i].'</option>';
  43. }
  44. $adminidselect .= '</select>';
  45. showtablerow('', array('', '', 'class="td23 lightfont"', 'class="td25"', '', 'class="td25"'), array(
  46. $group['type'] == 'system' ? '<input type="checkbox" class="checkbox" disabled="disabled" />' : "<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"$group[groupid]\">",
  47. '<span style="color:'.$group[color].'">'.$group['grouptitle'].'</span>',
  48. "(groupid:$group[groupid])",
  49. $group['type'] == 'system' ? cplang('inbuilt') : cplang('custom'),
  50. $group['type'] == 'system' ? $lang['usergroups_system_'.$group['radminid']] : $adminidselect,
  51. "<input type=\"text\" class=\"txt\" size=\"2\"name=\"group_stars[$group[groupid]]\" value=\"$group[stars]\">",
  52. "<input type=\"text\" id=\"group_color_$group[groupid]_v\" class=\"left txt\" size=\"6\" name=\"group_color[$group[groupid]]\" value=\"$group[color]\" onchange=\"updatecolorpreview('group_color_$group[groupid]')\"><input type=\"button\" id=\"group_color_$group[groupid]\" class=\"colorwd\" onclick=\"group_color_$group[groupid]_frame.location='static/image/admincp/getcolor.htm?group_color_$group[groupid]|group_color_$group[groupid]_v';showMenu({'ctrlid':'group_color_$group[groupid]'})\" /><span id=\"group_color_$group[groupid]_menu\" style=\"display: none\"><iframe name=\"group_color_$group[groupid]_frame\" src=\"\" frameborder=\"0\" width=\"210\" height=\"148\" scrolling=\"no\"></iframe></span>",
  53. "<input class=\"checkbox\" type=\"checkbox\" chkvalue=\"gbmember\" value=\"$group[groupid]\" onclick=\"multiupdate(this)\" /><a href=\"".ADMINSCRIPT."?action=usergroups&operation=edit&id={$group[admingid]}\" class=\"act\">$lang[admingroup_setting_user]</a>",
  54. "<input class=\"checkbox\" type=\"checkbox\" chkvalue=\"gpmember\" value=\"$group[groupid]\" onclick=\"multiupdate(this)\" /><a href=\"".ADMINSCRIPT."?action=admingroup&operation=edit&id=$group[admingid]\" class=\"act\">$lang[admingroup_setting_admin]</a>"
  55. ));
  56. }
  57. showtablerow('', array('class="td25"', '', '', '', 'colspan="6"'), array(
  58. cplang('add_new'),
  59. '<input type="text" class="txt" size="12" name="grouptitlenew">',
  60. '',
  61. cplang('custom'),
  62. "<select name=\"radminidnew\"><option value=\"1\">$lang[usergroups_system_1]</option><option value=\"2\">$lang[usergroups_system_2]</option><option value=\"3\" selected=\"selected\">$lang[usergroups_system_3]</option>",
  63. ));
  64. showsubmit('groupsubmit', 'submit', 'del');
  65. showtablefooter();
  66. showformfooter();
  67. } else {
  68. foreach($grouplist as $gid => $group) {
  69. $stars = intval($_GET['group_stars'][$gid]);
  70. $color = dhtmlspecialchars($_GET['group_color'][$gid]);
  71. if($group['color'] != $color || $group['stars'] != $stars || $group['icon'] != $avatar) {
  72. C::t('common_usergroup')->update($gid, array('stars' => $stars, 'color' => $color));
  73. }
  74. }
  75. $grouptitlenew = dhtmlspecialchars(trim($_GET['grouptitlenew']));
  76. $radminidnew = intval($_GET['radminidnew']);
  77. foreach($_GET['newradminid'] as $groupid => $newradminid) {
  78. C::t('common_usergroup')->update($groupid, array('radminid' => $newradminid));
  79. }
  80. if($grouptitlenew && in_array($radminidnew, array(1, 2, 3))) {
  81. $data = array();
  82. $usergroup = C::t('common_usergroup')->fetch($radminidnew);
  83. foreach ($usergroup as $key => $val) {
  84. if(!in_array($key, array('groupid', 'radminid', 'type', 'system', 'grouptitle'))) {
  85. $val = addslashes($val);
  86. $data[$key] = $val;
  87. }
  88. }
  89. $fielddata = array();
  90. $usergroup = C::t('common_usergroup_field')->fetch($radminidnew);
  91. foreach ($usergroup as $key => $val) {
  92. if(!in_array($key, array('groupid'))) {
  93. $val = addslashes($val);
  94. $fielddata[$key] = $val;
  95. }
  96. }
  97. $adata = array();
  98. $admingroup = C::t('common_admingroup')->fetch($radminidnew);
  99. foreach ($admingroup as $key => $val) {
  100. if(!in_array($key, array('admingid'))) {
  101. $val = addslashes($val);
  102. $adata[$key] = $val;
  103. }
  104. }
  105. $data['radminid'] = $radminidnew;
  106. $data['type'] = 'special';
  107. $data['grouptitle'] = $grouptitlenew;
  108. $newgroupid = C::t('common_usergroup')->insert($data, true);
  109. if($newgroupid) {
  110. $adata['admingid'] = $newgroupid;
  111. $fielddata['groupid'] = $newgroupid;
  112. C::t('common_admingroup')->insert($adata);
  113. C::t('common_usergroup_field')->insert($fielddata);
  114. }
  115. }
  116. updatecache(array('usergroups', 'groupreadaccess', 'admingroups'));
  117. cpmsg('admingroups_edit_succeed', 'action=admingroup', 'succeed');
  118. }
  119. } elseif($operation == 'edit') {
  120. $submitcheck = submitcheck('groupsubmit');
  121. $multiset = 0;
  122. if(empty($_GET['multi'])) {
  123. $gids = $_GET['id'];
  124. } else {
  125. $multiset = 1;
  126. if(is_array($_GET['multi'])) {
  127. $gids = $_GET['multi'];
  128. } else {
  129. $_GET['multi'] = explode(',', $_GET['multi']);
  130. array_walk($_GET['multi'], 'intval');
  131. $gids = $_GET['multi'];
  132. }
  133. }
  134. if(count($_GET['multi']) == 1) {
  135. $gids = $_GET['multi'][0];
  136. $multiset = 0;
  137. }
  138. if(!$submitcheck) {
  139. if(empty($gids)) {
  140. $grouplist = "<select name=\"id\" style=\"width: 150px\">\n";
  141. foreach(C::t('common_admingroup')->fetch_all_merge_usergroup() as $group) {
  142. $grouplist .= "<option value=\"$group[groupid]\">$group[grouptitle]</option>\n";
  143. }
  144. $grouplist .= '</select>';
  145. cpmsg('admingroups_edit_nonexistence', 'action=admingroup&operation=edit'.(!empty($highlight) ? "&highlight=$highlight" : ''), 'form', array(), $grouplist);
  146. }
  147. $mgroup = C::t('common_admingroup')->fetch_all_merge_usergroup($gids);
  148. if(!$mgroup) {
  149. cpmsg('usergroups_nonexistence', '', 'error');
  150. }/* else {
  151. while($group = DB::fetch($query)) {
  152. $mgroup[] = $group;
  153. }
  154. }*/
  155. $grouplist = $gutype = '';
  156. foreach(C::t('common_admingroup')->fetch_all_order() as $ggroup) {
  157. $checked = $_GET['id'] == $ggroup['groupid'] || in_array($ggroup['groupid'], $_GET['multi']);
  158. if($gutype != $ggroup['radminid']) {
  159. $grouplist .= '<em><span class="right"><input name="checkall_'.$ggroup['radminid'].'" onclick="checkAll(\'value\', this.form, \'g'.$ggroup['radminid'].'\', \'checkall_'.$ggroup['radminid'].'\')" type="checkbox" class="vmiddle checkbox" /></span>'.
  160. ($ggroup['radminid'] == 1 ? $lang['usergroups_system_1'] : ($ggroup['radminid'] == 2 ? $lang['usergroups_system_2'] : $lang['usergroups_system_3'])).'</em>';
  161. $gutype = $ggroup['radminid'];
  162. }
  163. $grouplist .= '<input class="left checkbox ck" chkvalue="g'.$ggroup['radminid'].'" name="multi[]" value="'.$ggroup['groupid'].'" type="checkbox" '.($checked ? 'checked="checked" ' : '').'/>'.
  164. '<a href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=admingroup&operation=edit&switch=yes&id='.$ggroup['groupid'].'&anchor=\'+currentAnchor+\'&scrolltop=\'+document.documentElement.scrollTop"'.($checked ? ' class="current"' : '').'>'.$ggroup['grouptitle'].'</a>';
  165. }
  166. $gselect = '<span id="ugselect" class="right popupmenu_dropmenu" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'34\'});$(\'ugselect_menu\').style.top=(parseInt($(\'ugselect_menu\').style.top)-scrollTopBody())+\'px\';$(\'ugselect_menu\').style.left=(parseInt($(\'ugselect_menu\').style.left)-document.documentElement.scrollLeft-20)+\'px\'">'.$lang['usergroups_switch'].'<em>&nbsp;&nbsp;</em></span>'.
  167. '<div id="ugselect_menu" class="popupmenu_popup" style="display:none">'.
  168. $grouplist.
  169. '<br style="clear:both" /><div class="cl"><input type="button" class="btn right" onclick="$(\'menuform\').submit()" value="'.cplang('admingroups_multiedit').'" /></div>'.
  170. '</div>';
  171. $_GET['anchor'] = in_array($_GET['anchor'], array('threadperm', 'postperm', 'modcpperm', 'portalperm', 'otherperm', 'spaceperm')) ? $_GET['anchor'] : 'threadperm';
  172. $anchorarray = array(
  173. array('admingroup_edit_threadperm', 'threadperm', $_GET['anchor'] == 'threadperm'),
  174. array('admingroup_edit_postperm', 'postperm', $_GET['anchor'] == 'postperm'),
  175. array('admingroup_edit_modcpperm', 'modcpperm', $_GET['anchor'] == 'modcpperm'),
  176. array('admingroup_edit_spaceperm', 'spaceperm', $_GET['anchor'] == 'spaceperm'),
  177. array('admingroup_edit_portalperm', 'portalperm', $_GET['anchor'] == 'portalperm'),
  178. array('admingroup_edit_otherperm', 'otherperm', $_GET['anchor'] == 'otherperm'),
  179. );
  180. showformheader('', '', 'menuform', 'get');
  181. showhiddenfields(array('action' => 'admingroup', 'operation' => 'edit'));
  182. showsubmenuanchors($lang['admingroup_edit'].(count($mgroup) == 1 ? ' - '.$mgroup[$_GET['id']]['grouptitle'].'(groupid:'.$mgroup[$_GET['id']]['groupid'].')' : ''), $anchorarray, $gselect);
  183. showformfooter();
  184. if($multiset) {
  185. showtips('setting_multi_tips');
  186. }
  187. showformheader("admingroup&operation=edit&id={$_GET['id']}");
  188. if($multiset) {
  189. $_G['showsetting_multi'] = 0;
  190. $_G['showsetting_multicount'] = count($mgroup);
  191. foreach($mgroup as $group) {
  192. $_G['showtableheader_multi'][] = '<a href="javascript:;" onclick="location.href=\''.ADMINSCRIPT.'?action=admingroup&operation=edit&id='.$group['groupid'].'&anchor=\'+$(\'cpform\').anchor.value;return false">'.$group['grouptitle'].'(groupid:'.$group['groupid'].')</a>';
  193. }
  194. }
  195. $mgids = array();
  196. foreach($mgroup as $group) {
  197. $_GET['id'] = $gid = $group['groupid'];
  198. $mgids[] = $gid;
  199. showmultititle();
  200. showtableheader();
  201. showtagheader('tbody', 'threadperm', $_GET['anchor'] == 'threadperm');
  202. showtitle('admingroup_edit_threadperm');
  203. showsetting('admingroup_edit_stick_thread', array('allowstickthreadnew', array(
  204. array(0, $lang['admingroup_edit_stick_thread_none']),
  205. array(1, $lang['admingroup_edit_stick_thread_1']),
  206. array(2, $lang['admingroup_edit_stick_thread_2']),
  207. array(3, $lang['admingroup_edit_stick_thread_3'])
  208. )), $group['allowstickthread'], 'mradio');
  209. showsetting('admingroup_edit_digest_thread', array('allowdigestthreadnew', array(
  210. array(0, $lang['admingroup_edit_digest_thread_none']),
  211. array(1, $lang['admingroup_edit_digest_thread_1']),
  212. array(2, $lang['admingroup_edit_digest_thread_2']),
  213. array(3, $lang['admingroup_edit_digest_thread_3'])
  214. )), $group['allowdigestthread'], 'mradio');
  215. showsetting('admingroup_edit_bump_thread', 'allowbumpthreadnew', $group['allowbumpthread'], 'radio');
  216. showsetting('admingroup_edit_highlight_thread', 'allowhighlightthreadnew', $group['allowhighlightthread'], 'radio');
  217. showsetting('admingroup_edit_live_thread', 'allowlivethreadnew', $group['allowlivethread'], 'radio');
  218. showsetting('admingroup_edit_recommend_thread', 'allowrecommendthreadnew', $group['allowrecommendthread'], 'radio');
  219. showsetting('admingroup_edit_stamp_thread', 'allowstampthreadnew', $group['allowstampthread'], 'radio');
  220. showsetting('admingroup_edit_stamp_list', 'allowstamplistnew', $group['allowstamplist'], 'radio');
  221. showsetting('admingroup_edit_close_thread', 'allowclosethreadnew', $group['allowclosethread'], 'radio');
  222. showsetting('admingroup_edit_move_thread', 'allowmovethreadnew', $group['allowmovethread'], 'radio');
  223. showsetting('admingroup_edit_edittype_thread', 'allowedittypethreadnew', $group['allowedittypethread'], 'radio');
  224. showsetting('admingroup_edit_copy_thread', 'allowcopythreadnew', $group['allowcopythread'], 'radio');
  225. showsetting('admingroup_edit_merge_thread', 'allowmergethreadnew', $group['allowmergethread'], 'radio');
  226. showsetting('admingroup_edit_split_thread', 'allowsplitthreadnew', $group['allowsplitthread'], 'radio');
  227. showsetting('admingroup_edit_repair_thread', 'allowrepairthreadnew', $group['allowrepairthread'], 'radio');
  228. showsetting('admingroup_edit_refund', 'allowrefundnew', $group['allowrefund'], 'radio');
  229. showsetting('admingroup_edit_edit_poll', 'alloweditpollnew', $group['alloweditpoll'], 'radio');
  230. showsetting('admingroup_edit_remove_reward', 'allowremoverewardnew', $group['allowremovereward'], 'radio');
  231. showsetting('admingroup_edit_edit_activity', 'alloweditactivitynew', $group['alloweditactivity'], 'radio');
  232. showsetting('admingroup_edit_edit_trade', 'allowedittradenew', $group['allowedittrade'], 'radio');
  233. showsetting('admingroup_edit_usertag', 'alloweditusertagnew', $group['alloweditusertag'], 'radio');
  234. showtagfooter('tbody');
  235. showtagheader('tbody', 'postperm', $_GET['anchor'] == 'postperm');
  236. showtitle('admingroup_edit_postperm');
  237. showsetting('admingroup_edit_edit_post', 'alloweditpostnew', $group['alloweditpost'], 'radio');
  238. showsetting('admingroup_edit_warn_post', 'allowwarnpostnew', $group['allowwarnpost'], 'radio');
  239. showsetting('admingroup_edit_ban_post', 'allowbanpostnew', $group['allowbanpost'], 'radio');
  240. showsetting('admingroup_edit_del_post', 'allowdelpostnew', $group['allowdelpost'], 'radio');
  241. showsetting('admingroup_edit_stick_post', 'allowstickreplynew', $group['allowstickreply'], 'radio');
  242. showsetting('admingroup_edit_manage_tag', 'allowmanagetagnew', $group['allowmanagetag'], 'radio');
  243. showtagfooter('tbody');
  244. showtagheader('tbody', 'modcpperm', $_GET['anchor'] == 'modcpperm');
  245. showtitle('admingroup_edit_modcpperm');
  246. showsetting('admingroup_edit_mod_post', 'allowmodpostnew', $group['allowmodpost'], 'radio');
  247. showsetting('admingroup_edit_mod_user', 'allowmodusernew', $group['allowmoduser'], 'radio');
  248. showsetting('admingroup_edit_ban_user', 'allowbanusernew', $group['allowbanuser'], 'radio');
  249. showsetting('admingroup_edit_ban_user_visit', 'allowbanvisitusernew', $group['allowbanvisituser'], 'radio');
  250. showsetting('admingroup_edit_ban_ip', 'allowbanipnew', $group['allowbanip'], 'radio');
  251. showsetting('admingroup_edit_edit_user', 'alloweditusernew', $group['allowedituser'], 'radio');
  252. showsetting('admingroup_edit_mass_prune', 'allowmassprunenew', $group['allowmassprune'], 'radio');
  253. showsetting('admingroup_edit_edit_forum', 'alloweditforumnew', $group['alloweditforum'], 'radio');
  254. showsetting('admingroup_edit_post_announce', 'allowpostannouncenew', $group['allowpostannounce'], 'radio');
  255. showsetting('admingroup_edit_clear_recycle', 'allowclearrecyclenew', $group['allowclearrecycle'], 'radio');
  256. showsetting('admingroup_edit_view_log', 'allowviewlognew', $group['allowviewlog'], 'radio');
  257. showtagfooter('tbody');
  258. showtagheader('tbody', 'spaceperm', $_GET['anchor'] == 'spaceperm');
  259. showtitle('admingroup_edit_spaceperm');
  260. showsetting('admingroup_edit_manage_feed', 'managefeednew', $group['managefeed'], 'radio');
  261. showsetting('admingroup_edit_manage_doing', 'managedoingnew', $group['managedoing'], 'radio');
  262. showsetting('admingroup_edit_manage_share', 'managesharenew', $group['manageshare'], 'radio');
  263. showsetting('admingroup_edit_manage_blog', 'manageblognew', $group['manageblog'], 'radio');
  264. showsetting('admingroup_edit_manage_album', 'managealbumnew', $group['managealbum'], 'radio');
  265. showsetting('admingroup_edit_manage_comment', 'managecommentnew', $group['managecomment'], 'radio');
  266. showsetting('admingroup_edit_manage_magiclog', 'managemagiclognew', $group['managemagiclog'], 'radio');
  267. showsetting('admingroup_edit_manage_report', 'managereportnew', $group['managereport'], 'radio');
  268. showsetting('admingroup_edit_manage_hotuser', 'managehotusernew', $group['managehotuser'], 'radio');
  269. showsetting('admingroup_edit_manage_defaultuser', 'managedefaultusernew', $group['managedefaultuser'], 'radio');
  270. showsetting('admingroup_edit_manage_videophoto', 'managevideophotonew', $group['managevideophoto'], 'radio');
  271. showsetting('admingroup_edit_manage_magic', 'managemagicnew', $group['managemagic'], 'radio');
  272. showsetting('admingroup_edit_manage_click', 'manageclicknew', $group['manageclick'], 'radio');
  273. showtagfooter('tbody');
  274. showtagheader('tbody', 'otherperm', $_GET['anchor'] == 'otherperm');
  275. showtitle('admingroup_edit_otherperm');
  276. showsetting('admingroup_edit_view_ip', 'allowviewipnew', $group['allowviewip'], 'radio');
  277. showsetting('admingroup_edit_manage_collection', 'allowmanagecollectionnew', $group['allowmanagecollection'], 'radio');
  278. showsetting('admingroup_edit_allow_make_html', 'allowmakehtmlnew', $group['allowmakehtml'], 'radio');
  279. showtagfooter('tbody');
  280. showtablefooter();
  281. showtagheader('div', 'portalperm', $_GET['anchor'] == 'portalperm');
  282. showtableheader();
  283. showtagheader('tbody', '', true);
  284. showtitle('admingroup_edit_portalperm');
  285. showsetting('admingroup_edit_manage_article', 'allowmanagearticlenew', $group['allowmanagearticle'], 'radio');
  286. showtagfooter('tbody');
  287. showtagheader('tbody', '', true);
  288. showsetting('admingroup_edit_add_topic', 'allowaddtopicnew', $group['allowaddtopic'], 'radio');
  289. showsetting('admingroup_edit_manage_topic', 'allowmanagetopicnew', $group['allowmanagetopic'], 'radio');
  290. showsetting('admingroup_edit_diy', 'allowdiynew', $group['allowdiy'], 'radio');
  291. showtagfooter('tbody');
  292. showtablefooter();
  293. showtagfooter('div');
  294. showsubmit('groupsubmit');
  295. $_G['showsetting_multi']++;
  296. }
  297. if($_G['showsetting_multicount'] > 1) {
  298. showhiddenfields(array('multi' => implode(',', $mgids)));
  299. showmulti();
  300. }
  301. showformfooter();
  302. } else {
  303. if(!$multiset) {
  304. $_GET['multinew'] = array(0 => array('single' => 1));
  305. }
  306. foreach($_GET['multinew'] as $k => $row) {
  307. if(empty($row['single'])) {
  308. foreach($row as $key => $value) {
  309. $_GET[''.$key] = $value;
  310. }
  311. $_GET['id'] = $_GET['multi'][$k];
  312. }
  313. $group = $mgroup[$k];
  314. $data = array(
  315. 'alloweditpost' => $_GET['alloweditpostnew'],
  316. 'alloweditpoll' => $_GET['alloweditpollnew'],
  317. 'allowedittrade' => $_GET['allowedittradenew'],
  318. 'alloweditusertag' => $_GET['alloweditusertagnew'],
  319. 'allowremovereward' => $_GET['allowremoverewardnew'],
  320. 'alloweditactivity' => $_GET['alloweditactivitynew'],
  321. 'allowstickthread' => $_GET['allowstickthreadnew'],
  322. 'allowmodpost' => $_GET['allowmodpostnew'],
  323. 'allowbanpost' => $_GET['allowbanpostnew'],
  324. 'allowdelpost' => $_GET['allowdelpostnew'],
  325. 'allowmassprune' => $_GET['allowmassprunenew'],
  326. 'allowrefund' => $_GET['allowrefundnew'],
  327. 'allowcensorword' => $_GET['allowcensorwordnew'],
  328. 'allowviewip' => $_GET['allowviewipnew'],
  329. 'allowmanagecollection' => $_GET['allowmanagecollectionnew'],
  330. 'allowbanip' => $_GET['allowbanipnew'],
  331. 'allowedituser' => $_GET['alloweditusernew'],
  332. 'allowbanuser' => $_GET['allowbanusernew'],
  333. 'allowbanvisituser' => $_GET['allowbanvisitusernew'],
  334. 'allowmoduser' => $_GET['allowmodusernew'],
  335. 'allowpostannounce' => $_GET['allowpostannouncenew'],
  336. 'allowclearrecycle' => $_GET['allowclearrecyclenew'],
  337. 'allowhighlightthread' => $_GET['allowhighlightthreadnew'],
  338. 'allowlivethread' => $_GET['allowlivethreadnew'],
  339. 'allowdigestthread' => $_GET['allowdigestthreadnew'],
  340. 'allowrecommendthread' => $_GET['allowrecommendthreadnew'],
  341. 'allowbumpthread' => $_GET['allowbumpthreadnew'],
  342. 'allowclosethread' => $_GET['allowclosethreadnew'],
  343. 'allowmovethread' => $_GET['allowmovethreadnew'],
  344. 'allowedittypethread' => $_GET['allowedittypethreadnew'],
  345. 'allowstampthread' => $_GET['allowstampthreadnew'],
  346. 'allowstamplist' => $_GET['allowstamplistnew'],
  347. 'allowcopythread' => $_GET['allowcopythreadnew'],
  348. 'allowmergethread' => $_GET['allowmergethreadnew'],
  349. 'allowsplitthread' => $_GET['allowsplitthreadnew'],
  350. 'allowrepairthread' => $_GET['allowrepairthreadnew'],
  351. 'allowwarnpost' => $_GET['allowwarnpostnew'],
  352. 'alloweditforum' => $_GET['alloweditforumnew'],
  353. 'allowviewlog' => $_GET['allowviewlognew'],
  354. 'allowmanagearticle' => $_GET['allowmanagearticlenew'],
  355. 'allowaddtopic' => $_GET['allowaddtopicnew'],
  356. 'allowmanagetopic' => $_GET['allowmanagetopicnew'],
  357. 'allowdiy' => $_GET['allowdiynew'],
  358. 'allowstickreply' => $_GET['allowstickreplynew'],
  359. 'allowmanagetag' => $_GET['allowmanagetagnew'],
  360. 'managefeed' => $_GET['managefeednew'],
  361. 'managedoing' => $_GET['managedoingnew'],
  362. 'manageshare' => $_GET['managesharenew'],
  363. 'manageblog' => $_GET['manageblognew'],
  364. 'managealbum' => $_GET['managealbumnew'],
  365. 'managecomment' => $_GET['managecommentnew'],
  366. 'managemagiclog' => $_GET['managemagiclognew'],
  367. 'managereport' => $_GET['managereportnew'],
  368. 'managehotuser' => $_GET['managehotusernew'],
  369. 'managedefaultuser' => $_GET['managedefaultusernew'],
  370. 'managevideophoto' => $_GET['managevideophotonew'],
  371. 'managemagic' => $_GET['managemagicnew'],
  372. 'manageclick' => $_GET['manageclicknew'],
  373. 'allowmakehtml' => $_GET['allowmakehtmlnew'],
  374. );
  375. C::t('common_admingroup')->update($_GET[id], array_map('intval', $data));
  376. }
  377. updatecache(array('usergroups', 'groupreadaccess', 'admingroups'));
  378. cpmsg('admingroups_edit_succeed', 'action=admingroup&operation=edit&'.($multiset ? 'multi='.implode(',', $_GET['multi']) : 'id='.$_GET['id']).'&anchor='.$_GET['anchor'], 'succeed');
  379. }
  380. }
  381. function deletegroupcache($groupidarray) {
  382. if(!empty($groupidarray) && is_array($groupidarray)) {
  383. $cachenames = array();
  384. foreach ($groupidarray as $id) {
  385. if(($id = dintval($id))) {
  386. $cachenames['usergroup_'.$id] = 'usergroup_'.$id;
  387. $cachenames['admingroup_'.$id] = 'admingroup_'.$id;
  388. }
  389. }
  390. if(!empty($cachenames)) {
  391. C::t('common_syscache')->delete($cachenames);
  392. }
  393. }
  394. }
  395. ?>