fetch_all_by_groupid($_GET['delete']); foreach($query as $g) { $gids[] = $g['groupid']; } if($gids) { C::t('common_usergroup')->delete($gids); C::t('common_usergroup_field')->delete($gids); C::t('common_admingroup')->delete($gids); $newgroupid = C::t('common_usergroup')->fetch_new_groupid(); C::t('common_member')->update_by_groupid($gids, array('groupid' => $newgroupid, 'adminid' => '0'), 'UNBUFFERED'); deletegroupcache($gids); } } $grouplist = C::t('common_admingroup')->fetch_all_merge_usergroup(); if(!submitcheck('groupsubmit')) { shownav('user', 'nav_admingroups'); showsubmenu('nav_admingroups'); showtips('admingroup_tips'); showformheader('admingroup'); showtableheader('', 'fixpadding'); showsubtitle(array('', 'usergroups_title', '', 'type', 'admingroup_level', 'usergroups_stars', 'usergroups_color', ' '.$lang['multiedit'].'', ' '.$lang['multiedit'].'', )); foreach($grouplist as $gid => $group) { $adminidselect = ''; showtablerow('', array('', '', 'class="td23 lightfont"', 'class="td25"', '', 'class="td25"'), array( $group['type'] == 'system' ? '' : "", ''.$group['grouptitle'].'', "(groupid:$group[groupid])", $group['type'] == 'system' ? cplang('inbuilt') : cplang('custom'), $group['type'] == 'system' ? $lang['usergroups_system_'.$group['radminid']] : $adminidselect, "", "", "$lang[admingroup_setting_user]", "$lang[admingroup_setting_admin]" )); } showtablerow('', array('class="td25"', '', '', '', 'colspan="6"'), array( cplang('add_new'), '', '', cplang('custom'), "\n"; foreach(C::t('common_admingroup')->fetch_all_merge_usergroup() as $group) { $grouplist .= "\n"; } $grouplist .= ''; cpmsg('admingroups_edit_nonexistence', 'action=admingroup&operation=edit'.(!empty($highlight) ? "&highlight=$highlight" : ''), 'form', array(), $grouplist); } $mgroup = C::t('common_admingroup')->fetch_all_merge_usergroup($gids); if(!$mgroup) { cpmsg('usergroups_nonexistence', '', 'error'); }/* else { while($group = DB::fetch($query)) { $mgroup[] = $group; } }*/ $grouplist = $gutype = ''; foreach(C::t('common_admingroup')->fetch_all_order() as $ggroup) { $checked = $_GET['id'] == $ggroup['groupid'] || in_array($ggroup['groupid'], $_GET['multi']); if($gutype != $ggroup['radminid']) { $grouplist .= ''. ($ggroup['radminid'] == 1 ? $lang['usergroups_system_1'] : ($ggroup['radminid'] == 2 ? $lang['usergroups_system_2'] : $lang['usergroups_system_3'])).''; $gutype = $ggroup['radminid']; } $grouplist .= ''. ''.$ggroup['grouptitle'].''; } $gselect = ''.$lang['usergroups_switch'].'  '. ''; $_GET['anchor'] = in_array($_GET['anchor'], array('threadperm', 'postperm', 'modcpperm', 'portalperm', 'otherperm', 'spaceperm')) ? $_GET['anchor'] : 'threadperm'; $anchorarray = array( array('admingroup_edit_threadperm', 'threadperm', $_GET['anchor'] == 'threadperm'), array('admingroup_edit_postperm', 'postperm', $_GET['anchor'] == 'postperm'), array('admingroup_edit_modcpperm', 'modcpperm', $_GET['anchor'] == 'modcpperm'), array('admingroup_edit_spaceperm', 'spaceperm', $_GET['anchor'] == 'spaceperm'), array('admingroup_edit_portalperm', 'portalperm', $_GET['anchor'] == 'portalperm'), array('admingroup_edit_otherperm', 'otherperm', $_GET['anchor'] == 'otherperm'), ); showformheader('', '', 'menuform', 'get'); showhiddenfields(array('action' => 'admingroup', 'operation' => 'edit')); showsubmenuanchors($lang['admingroup_edit'].(count($mgroup) == 1 ? ' - '.$mgroup[$_GET['id']]['grouptitle'].'(groupid:'.$mgroup[$_GET['id']]['groupid'].')' : ''), $anchorarray, $gselect); showformfooter(); if($multiset) { showtips('setting_multi_tips'); } showformheader("admingroup&operation=edit&id={$_GET['id']}"); if($multiset) { $_G['showsetting_multi'] = 0; $_G['showsetting_multicount'] = count($mgroup); foreach($mgroup as $group) { $_G['showtableheader_multi'][] = ''.$group['grouptitle'].'(groupid:'.$group['groupid'].')'; } } $mgids = array(); foreach($mgroup as $group) { $_GET['id'] = $gid = $group['groupid']; $mgids[] = $gid; showmultititle(); showtableheader(); showtagheader('tbody', 'threadperm', $_GET['anchor'] == 'threadperm'); showtitle('admingroup_edit_threadperm'); showsetting('admingroup_edit_stick_thread', array('allowstickthreadnew', array( array(0, $lang['admingroup_edit_stick_thread_none']), array(1, $lang['admingroup_edit_stick_thread_1']), array(2, $lang['admingroup_edit_stick_thread_2']), array(3, $lang['admingroup_edit_stick_thread_3']) )), $group['allowstickthread'], 'mradio'); showsetting('admingroup_edit_digest_thread', array('allowdigestthreadnew', array( array(0, $lang['admingroup_edit_digest_thread_none']), array(1, $lang['admingroup_edit_digest_thread_1']), array(2, $lang['admingroup_edit_digest_thread_2']), array(3, $lang['admingroup_edit_digest_thread_3']) )), $group['allowdigestthread'], 'mradio'); showsetting('admingroup_edit_bump_thread', 'allowbumpthreadnew', $group['allowbumpthread'], 'radio'); showsetting('admingroup_edit_highlight_thread', 'allowhighlightthreadnew', $group['allowhighlightthread'], 'radio'); showsetting('admingroup_edit_live_thread', 'allowlivethreadnew', $group['allowlivethread'], 'radio'); showsetting('admingroup_edit_recommend_thread', 'allowrecommendthreadnew', $group['allowrecommendthread'], 'radio'); showsetting('admingroup_edit_stamp_thread', 'allowstampthreadnew', $group['allowstampthread'], 'radio'); showsetting('admingroup_edit_stamp_list', 'allowstamplistnew', $group['allowstamplist'], 'radio'); showsetting('admingroup_edit_close_thread', 'allowclosethreadnew', $group['allowclosethread'], 'radio'); showsetting('admingroup_edit_move_thread', 'allowmovethreadnew', $group['allowmovethread'], 'radio'); showsetting('admingroup_edit_edittype_thread', 'allowedittypethreadnew', $group['allowedittypethread'], 'radio'); showsetting('admingroup_edit_copy_thread', 'allowcopythreadnew', $group['allowcopythread'], 'radio'); showsetting('admingroup_edit_merge_thread', 'allowmergethreadnew', $group['allowmergethread'], 'radio'); showsetting('admingroup_edit_split_thread', 'allowsplitthreadnew', $group['allowsplitthread'], 'radio'); showsetting('admingroup_edit_repair_thread', 'allowrepairthreadnew', $group['allowrepairthread'], 'radio'); showsetting('admingroup_edit_refund', 'allowrefundnew', $group['allowrefund'], 'radio'); showsetting('admingroup_edit_edit_poll', 'alloweditpollnew', $group['alloweditpoll'], 'radio'); showsetting('admingroup_edit_remove_reward', 'allowremoverewardnew', $group['allowremovereward'], 'radio'); showsetting('admingroup_edit_edit_activity', 'alloweditactivitynew', $group['alloweditactivity'], 'radio'); showsetting('admingroup_edit_edit_trade', 'allowedittradenew', $group['allowedittrade'], 'radio'); showsetting('admingroup_edit_usertag', 'alloweditusertagnew', $group['alloweditusertag'], 'radio'); showtagfooter('tbody'); showtagheader('tbody', 'postperm', $_GET['anchor'] == 'postperm'); showtitle('admingroup_edit_postperm'); showsetting('admingroup_edit_edit_post', 'alloweditpostnew', $group['alloweditpost'], 'radio'); showsetting('admingroup_edit_warn_post', 'allowwarnpostnew', $group['allowwarnpost'], 'radio'); showsetting('admingroup_edit_ban_post', 'allowbanpostnew', $group['allowbanpost'], 'radio'); showsetting('admingroup_edit_del_post', 'allowdelpostnew', $group['allowdelpost'], 'radio'); showsetting('admingroup_edit_stick_post', 'allowstickreplynew', $group['allowstickreply'], 'radio'); showsetting('admingroup_edit_manage_tag', 'allowmanagetagnew', $group['allowmanagetag'], 'radio'); showtagfooter('tbody'); showtagheader('tbody', 'modcpperm', $_GET['anchor'] == 'modcpperm'); showtitle('admingroup_edit_modcpperm'); showsetting('admingroup_edit_mod_post', 'allowmodpostnew', $group['allowmodpost'], 'radio'); showsetting('admingroup_edit_mod_user', 'allowmodusernew', $group['allowmoduser'], 'radio'); showsetting('admingroup_edit_ban_user', 'allowbanusernew', $group['allowbanuser'], 'radio'); showsetting('admingroup_edit_ban_user_visit', 'allowbanvisitusernew', $group['allowbanvisituser'], 'radio'); showsetting('admingroup_edit_ban_ip', 'allowbanipnew', $group['allowbanip'], 'radio'); showsetting('admingroup_edit_edit_user', 'alloweditusernew', $group['allowedituser'], 'radio'); showsetting('admingroup_edit_mass_prune', 'allowmassprunenew', $group['allowmassprune'], 'radio'); showsetting('admingroup_edit_edit_forum', 'alloweditforumnew', $group['alloweditforum'], 'radio'); showsetting('admingroup_edit_post_announce', 'allowpostannouncenew', $group['allowpostannounce'], 'radio'); showsetting('admingroup_edit_clear_recycle', 'allowclearrecyclenew', $group['allowclearrecycle'], 'radio'); showsetting('admingroup_edit_view_log', 'allowviewlognew', $group['allowviewlog'], 'radio'); showtagfooter('tbody'); showtagheader('tbody', 'spaceperm', $_GET['anchor'] == 'spaceperm'); showtitle('admingroup_edit_spaceperm'); showsetting('admingroup_edit_manage_feed', 'managefeednew', $group['managefeed'], 'radio'); showsetting('admingroup_edit_manage_doing', 'managedoingnew', $group['managedoing'], 'radio'); showsetting('admingroup_edit_manage_share', 'managesharenew', $group['manageshare'], 'radio'); showsetting('admingroup_edit_manage_blog', 'manageblognew', $group['manageblog'], 'radio'); showsetting('admingroup_edit_manage_album', 'managealbumnew', $group['managealbum'], 'radio'); showsetting('admingroup_edit_manage_comment', 'managecommentnew', $group['managecomment'], 'radio'); showsetting('admingroup_edit_manage_magiclog', 'managemagiclognew', $group['managemagiclog'], 'radio'); showsetting('admingroup_edit_manage_report', 'managereportnew', $group['managereport'], 'radio'); showsetting('admingroup_edit_manage_hotuser', 'managehotusernew', $group['managehotuser'], 'radio'); showsetting('admingroup_edit_manage_defaultuser', 'managedefaultusernew', $group['managedefaultuser'], 'radio'); showsetting('admingroup_edit_manage_videophoto', 'managevideophotonew', $group['managevideophoto'], 'radio'); showsetting('admingroup_edit_manage_magic', 'managemagicnew', $group['managemagic'], 'radio'); showsetting('admingroup_edit_manage_click', 'manageclicknew', $group['manageclick'], 'radio'); showtagfooter('tbody'); showtagheader('tbody', 'otherperm', $_GET['anchor'] == 'otherperm'); showtitle('admingroup_edit_otherperm'); showsetting('admingroup_edit_view_ip', 'allowviewipnew', $group['allowviewip'], 'radio'); showsetting('admingroup_edit_manage_collection', 'allowmanagecollectionnew', $group['allowmanagecollection'], 'radio'); showsetting('admingroup_edit_allow_make_html', 'allowmakehtmlnew', $group['allowmakehtml'], 'radio'); showtagfooter('tbody'); showtablefooter(); showtagheader('div', 'portalperm', $_GET['anchor'] == 'portalperm'); showtableheader(); showtagheader('tbody', '', true); showtitle('admingroup_edit_portalperm'); showsetting('admingroup_edit_manage_article', 'allowmanagearticlenew', $group['allowmanagearticle'], 'radio'); showtagfooter('tbody'); showtagheader('tbody', '', true); showsetting('admingroup_edit_add_topic', 'allowaddtopicnew', $group['allowaddtopic'], 'radio'); showsetting('admingroup_edit_manage_topic', 'allowmanagetopicnew', $group['allowmanagetopic'], 'radio'); showsetting('admingroup_edit_diy', 'allowdiynew', $group['allowdiy'], 'radio'); showtagfooter('tbody'); showtablefooter(); showtagfooter('div'); showsubmit('groupsubmit'); $_G['showsetting_multi']++; } if($_G['showsetting_multicount'] > 1) { showhiddenfields(array('multi' => implode(',', $mgids))); showmulti(); } showformfooter(); } else { if(!$multiset) { $_GET['multinew'] = array(0 => array('single' => 1)); } foreach($_GET['multinew'] as $k => $row) { if(empty($row['single'])) { foreach($row as $key => $value) { $_GET[''.$key] = $value; } $_GET['id'] = $_GET['multi'][$k]; } $group = $mgroup[$k]; $data = array( 'alloweditpost' => $_GET['alloweditpostnew'], 'alloweditpoll' => $_GET['alloweditpollnew'], 'allowedittrade' => $_GET['allowedittradenew'], 'alloweditusertag' => $_GET['alloweditusertagnew'], 'allowremovereward' => $_GET['allowremoverewardnew'], 'alloweditactivity' => $_GET['alloweditactivitynew'], 'allowstickthread' => $_GET['allowstickthreadnew'], 'allowmodpost' => $_GET['allowmodpostnew'], 'allowbanpost' => $_GET['allowbanpostnew'], 'allowdelpost' => $_GET['allowdelpostnew'], 'allowmassprune' => $_GET['allowmassprunenew'], 'allowrefund' => $_GET['allowrefundnew'], 'allowcensorword' => $_GET['allowcensorwordnew'], 'allowviewip' => $_GET['allowviewipnew'], 'allowmanagecollection' => $_GET['allowmanagecollectionnew'], 'allowbanip' => $_GET['allowbanipnew'], 'allowedituser' => $_GET['alloweditusernew'], 'allowbanuser' => $_GET['allowbanusernew'], 'allowbanvisituser' => $_GET['allowbanvisitusernew'], 'allowmoduser' => $_GET['allowmodusernew'], 'allowpostannounce' => $_GET['allowpostannouncenew'], 'allowclearrecycle' => $_GET['allowclearrecyclenew'], 'allowhighlightthread' => $_GET['allowhighlightthreadnew'], 'allowlivethread' => $_GET['allowlivethreadnew'], 'allowdigestthread' => $_GET['allowdigestthreadnew'], 'allowrecommendthread' => $_GET['allowrecommendthreadnew'], 'allowbumpthread' => $_GET['allowbumpthreadnew'], 'allowclosethread' => $_GET['allowclosethreadnew'], 'allowmovethread' => $_GET['allowmovethreadnew'], 'allowedittypethread' => $_GET['allowedittypethreadnew'], 'allowstampthread' => $_GET['allowstampthreadnew'], 'allowstamplist' => $_GET['allowstamplistnew'], 'allowcopythread' => $_GET['allowcopythreadnew'], 'allowmergethread' => $_GET['allowmergethreadnew'], 'allowsplitthread' => $_GET['allowsplitthreadnew'], 'allowrepairthread' => $_GET['allowrepairthreadnew'], 'allowwarnpost' => $_GET['allowwarnpostnew'], 'alloweditforum' => $_GET['alloweditforumnew'], 'allowviewlog' => $_GET['allowviewlognew'], 'allowmanagearticle' => $_GET['allowmanagearticlenew'], 'allowaddtopic' => $_GET['allowaddtopicnew'], 'allowmanagetopic' => $_GET['allowmanagetopicnew'], 'allowdiy' => $_GET['allowdiynew'], 'allowstickreply' => $_GET['allowstickreplynew'], 'allowmanagetag' => $_GET['allowmanagetagnew'], 'managefeed' => $_GET['managefeednew'], 'managedoing' => $_GET['managedoingnew'], 'manageshare' => $_GET['managesharenew'], 'manageblog' => $_GET['manageblognew'], 'managealbum' => $_GET['managealbumnew'], 'managecomment' => $_GET['managecommentnew'], 'managemagiclog' => $_GET['managemagiclognew'], 'managereport' => $_GET['managereportnew'], 'managehotuser' => $_GET['managehotusernew'], 'managedefaultuser' => $_GET['managedefaultusernew'], 'managevideophoto' => $_GET['managevideophotonew'], 'managemagic' => $_GET['managemagicnew'], 'manageclick' => $_GET['manageclicknew'], 'allowmakehtml' => $_GET['allowmakehtmlnew'], ); C::t('common_admingroup')->update($_GET[id], array_map('intval', $data)); } updatecache(array('usergroups', 'groupreadaccess', 'admingroups')); cpmsg('admingroups_edit_succeed', 'action=admingroup&operation=edit&'.($multiset ? 'multi='.implode(',', $_GET['multi']) : 'id='.$_GET['id']).'&anchor='.$_GET['anchor'], 'succeed'); } } function deletegroupcache($groupidarray) { if(!empty($groupidarray) && is_array($groupidarray)) { $cachenames = array(); foreach ($groupidarray as $id) { if(($id = dintval($id))) { $cachenames['usergroup_'.$id] = 'usergroup_'.$id; $cachenames['admingroup_'.$id] = 'admingroup_'.$id; } } if(!empty($cachenames)) { C::t('common_syscache')->delete($cachenames); } } } ?>