super_query( "SELECT count(*) as count FROM " . USERPREFIX . "_users WHERE user_group='$id'" ); if( ! $row['count'] ) { $db->query( "DELETE FROM " . USERPREFIX . "_usergroups WHERE id = '$id'" ); $cache->delete('usergroup.php'); $cache->clear(); msg( "info", $lang['all_info'], $lang['group_del'], "$PHP_SELF?mod=usergroup" ); } else { if( $grouplevel and $grouplevel != $id ) { $db->query( "UPDATE " . USERPREFIX . "_users set user_group='$grouplevel' WHERE user_group='$id'" ); $db->query( "DELETE FROM " . USERPREFIX . "_usergroups WHERE id = '$id'" ); $cache->delete('usergroup.php' ); $cache->clear(); msg( "info", $lang['all_info'], $lang['group_del'], "$PHP_SELF?mod=usergroup" ); } else msg( "info", $lang['all_info'], "
{$lang['group_move']}
", "$PHP_SELF?mod=usergroup" ); } } elseif( $action == "doadd" or $action == "doedit" ) { if( $_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash ) {die( "Hacking attempt! User not found" );} if( ! count( $_REQUEST['allow_cats'] ) ) $_REQUEST['allow_cats'][] = "all"; if( ! count( $_REQUEST['cat_add'] ) ) $_REQUEST['cat_add'][] = "all"; $group_name = $db->safesql( strip_tags( $_REQUEST['group_name'] ) ); $group_color = $db->safesql( strip_tags( $_REQUEST['group_color'] ) ); $allow_cats = $db->safesql( implode( ',', $_REQUEST['allow_cats'] ) ); $cat_add = $db->safesql( implode( ',', $_REQUEST['cat_add'] ) ); $allow_admin = intval( $_REQUEST['allow_admin'] ); $allow_offline = intval( $_REQUEST['allow_offline'] ); $allow_main = intval( $_REQUEST['allow_main'] ); $allow_adds = intval( $_REQUEST['allow_adds'] ); $moderation = intval( $_REQUEST['moderation'] ); $allow_edit = intval( $_REQUEST['allow_edit'] ); $allow_all_edit = intval( $_REQUEST['allow_all_edit'] ); $allow_addc = intval( $_REQUEST['allow_addc'] ); $allow_editc = intval( $_REQUEST['allow_editc'] ); $allow_delc = intval( $_REQUEST['allow_delc'] ); $edit_allc = intval( $_REQUEST['edit_allc'] ); $del_allc = intval( $_REQUEST['del_allc'] ); $allow_hide = intval( $_REQUEST['allow_hide'] ); $allow_pm = intval( $_REQUEST['allow_pm'] ); $allow_files = intval( $_REQUEST['allow_files'] ); $allow_feed = intval( $_REQUEST['allow_feed'] ); $allow_search = intval( $_REQUEST['allow_search'] ); $allow_rating = intval( $_REQUEST['allow_rating'] ); $max_foto = $db->safesql( $_REQUEST['max_foto'] ); $allow_short = intval( $_REQUEST['allow_short'] ); $allow_fixed = intval( $_REQUEST['allow_fixed'] ); $allow_poll = intval( $_REQUEST['allow_poll'] ); $max_signature = intval( $_REQUEST['max_signature'] ); $max_info = intval( $_REQUEST['max_info'] ); $forum_post_edit = intval( $_REQUEST['forum_post_edit']); $forum_post_del = intval( $_REQUEST['forum_post_del']); $forum_topic_set = intval( $_REQUEST['forum_topic_set']); $forum_topic_edit = intval( $_REQUEST['forum_topic_edit']); $forum_topic_del = intval( $_REQUEST['forum_topic_del']); $admin_addnews = intval( $_REQUEST['admin_addnews'] ); $admin_editnews = intval( $_REQUEST['admin_editnews'] ); $admin_categories = intval( $_REQUEST['admin_categories'] ); $admin_editusers = intval( $_REQUEST['admin_editusers'] ); $admin_wordfilter = intval( $_REQUEST['admin_wordfilter'] ); $admin_static = intval( $_REQUEST['admin_static'] ); $admin_blockip = intval( $_REQUEST['admin_blockip'] ); $admin_iptools = intval( $_REQUEST['admin_iptools'] ); $admin_googlemap = intval( $_REQUEST['admin_googlemap'] ); $admin_table = intval( $_REQUEST['admin_table'] ); $allow_image_upload = intval( $_REQUEST['allow_image_upload'] ); $allow_file_upload = intval( $_REQUEST['allow_file_upload'] ); $allow_tor_upload = intval( $_REQUEST['allow_tor_upload'] ); $allow_signature = intval( $_REQUEST['allow_signature'] ); $allow_url = intval( $_REQUEST['allow_url'] ); $allow_image = intval( $_REQUEST['allow_image'] ); if( $group_name == "" ) msg( "error", $lang['addnews_error'], $lang['group_err1'], "$PHP_SELF?mod=usergroup&action=add" ); $cache->delete('usergroup.php' ); if( $action == "doadd" ) { $db->query( "INSERT INTO " . USERPREFIX . "_usergroups (group_name, colour, allow_cats, allow_adds, cat_add, allow_admin, allow_addc, allow_editc, allow_delc, edit_allc, del_allc, moderation, allow_all_edit, allow_edit, allow_pm, max_foto, allow_files, allow_hide, allow_short, allow_fixed, allow_feed, allow_search, allow_poll, allow_main, allow_rating, allow_offline, allow_image_upload, allow_file_upload, allow_tor_upload, allow_signature, allow_url, allow_image, max_signature, max_info, forum_post_edit, forum_post_del, forum_topic_set, forum_topic_edit, forum_topic_del, admin_addnews, admin_editnews, admin_categories, admin_editusers, admin_wordfilter, admin_static, admin_blockip, admin_iptools, admin_googlemap, admin_table) values ('$group_name', '$group_color', '$allow_cats', '$allow_adds', '$cat_add', '$allow_admin', '$allow_addc', '$allow_editc', '$allow_delc', '$edit_allc', '$del_allc', '$moderation', '$allow_all_edit', '$allow_edit', '$allow_pm', '$max_foto', '$allow_files', '$allow_hide', '$allow_short', '$allow_fixed', '$allow_feed', '$allow_search', '$allow_poll', '$allow_main', '$allow_rating', '$allow_offline', '$allow_image_upload', '$allow_file_upload', '$allow_tor_upload', '$allow_signature', '$allow_url', '$allow_image', '$max_signature', '$max_info', '$forum_post_edit', '$forum_post_del', '$forum_topic_set', '$forum_topic_edit', '$forum_topic_del', '$admin_addnews', '$admin_editnews', '$admin_categories', '$admin_editusers', '$admin_wordfilter', '$admin_static', '$admin_blockip', '$admin_iptools', '$admin_googlemap', '$admin_table')" ); msg( "info", $lang['all_info'], $lang['group_ok1'], "$PHP_SELF?mod=usergroup" ); } else { $id = intval( $_REQUEST['id'] ); $db->query( "UPDATE " . USERPREFIX . "_usergroups set group_name='$group_name', colour='$group_color', allow_cats='$allow_cats', allow_adds='$allow_adds', cat_add='$cat_add', allow_admin='$allow_admin', allow_addc='$allow_addc', allow_editc='$allow_editc', allow_delc='$allow_delc', edit_allc='$edit_allc', del_allc='$del_allc', moderation='$moderation', allow_all_edit='$allow_all_edit', allow_edit='$allow_edit', allow_pm='$allow_pm', max_foto='$max_foto', allow_files='$allow_files', allow_hide='$allow_hide', allow_short='$allow_short', allow_fixed='$allow_fixed', allow_feed='$allow_feed', allow_search='$allow_search', allow_poll='$allow_poll', allow_main='$allow_main', allow_rating='$allow_rating', allow_offline='$allow_offline', allow_image_upload='$allow_image_upload', allow_file_upload='$allow_file_upload', allow_tor_upload='$allow_tor_upload', allow_signature='$allow_signature', allow_url='$allow_url', allow_image='$allow_image', max_signature='$max_signature', max_info='$max_info', forum_post_edit='$forum_post_edit', forum_post_del='$forum_post_del', forum_topic_set='$forum_topic_set', forum_topic_edit='$forum_topic_edit', forum_topic_del='$forum_topic_del', admin_addnews='$admin_addnews', admin_editnews='$admin_editnews', admin_categories='$admin_categories', admin_editusers='$admin_editusers', admin_wordfilter='$admin_wordfilter', admin_static='$admin_static', admin_blockip='$admin_blockip', admin_iptools='$admin_iptools', admin_googlemap='$admin_googlemap', admin_table='$admin_table' WHERE id='{$id}'" ); msg( "info", $lang['all_info'], $lang['group_ok2'], "$PHP_SELF?mod=usergroup" ); } $cache->clear(); } elseif( $action == "add" or $action == "edit" ) { echoheader( "", "" ); if( $action == "add" ) { $group_name_value = ""; $group_color_value = ""; $allow_admin_no = "checked"; $allow_offline_no = "checked"; $allow_adds_yes = "checked"; $allow_short_yes = "checked"; $moderation_no = "checked"; $allow_edit_no = "checked"; $allow_all_edit_no = "checked"; $allow_image_upload_yes = "checked"; $allow_file_upload_yes = "checked"; $allow_tor_upload_yes = "checked"; $allow_addc_yes = "checked"; $allow_editc_yes = "checked"; $allow_delc_yes = "checked"; $edit_allc_no = "checked"; $del_allc_no = "checked"; $allow_hide_yes = "checked"; $allow_pm_yes = "checked"; $allow_files_yes = "checked"; $allow_feed_yes = "checked"; $allow_search_yes = "checked"; $allow_rating_yes = "checked"; $allow_fixed_no = "checked"; $allow_poll_yes = "checked"; $allow_main_yes = "checked"; $allow_signature_yes = "checked"; $allow_url_yes = "checked"; $allow_image_no = "checked"; $forum_post_edit_no = "checked"; $forum_post_del_no = "checked"; $forum_topic_set_no = "checked"; $forum_topic_edit_no = "checked"; $forum_topic_del_no = "checked"; $admin_addnews_no = "checked"; $admin_editnews_no = "checked"; $admin_categories_no = "checked"; $admin_editusers_no = "checked"; $admin_wordfilter_no = "checked"; $admin_static_no = "checked"; $admin_blockip_no = "checked"; $admin_iptools_no = "checked"; $admin_googlemap_no = "checked"; $admin_table_no = "checked"; $max_foto_value = "100"; $max_signature_value = "500"; $max_info_value = "1000"; $submit_value = $lang['group_new']; $form_title = $lang['group_new1']; $form_action = "$PHP_SELF?mod=usergroup&action=doadd"; $group_list = get_groups( 4 ); $cat_add_value = "selected"; $allow_cats_value = "selected"; $categories_list = CategoryNewsSelection( 0, 0, false ); $cat_add_list = CategoryNewsSelection( 0, 0, false ); } else { $id = intval( $_REQUEST['id'] ); $group_name_value = htmlspecialchars( stripslashes( $user_group[$id]['group_name'] ) ); $group_color_value = htmlspecialchars( stripslashes( $user_group[$id]['colour'] ) ); if( $user_group[$id]['allow_offline'] ) $allow_offline_yes = "checked"; else $allow_offline_no = "checked"; if( $user_group[$id]['allow_admin'] ) $allow_admin_yes = "checked"; else $allow_admin_no = "checked"; if( $user_group[$id]['allow_adds'] ) $allow_adds_yes = "checked"; else $allow_adds_no = "checked"; if( $user_group[$id]['moderation'] ) $moderation_yes = "checked"; else $moderation_no = "checked"; if( $user_group[$id]['allow_edit'] ) $allow_edit_yes = "checked"; else $allow_edit_no = "checked"; if( $user_group[$id]['allow_all_edit'] ) $allow_all_edit_yes = "checked"; else $allow_all_edit_no = "checked"; if( $user_group[$id]['allow_addc'] ) $allow_addc_yes = "checked"; else $allow_addc_no = "checked"; if( $user_group[$id]['allow_editc'] ) $allow_editc_yes = "checked"; else $allow_editc_no = "checked"; if( $user_group[$id]['allow_delc'] ) $allow_delc_yes = "checked"; else $allow_delc_no = "checked"; if( $user_group[$id]['edit_allc'] ) $edit_allc_yes = "checked"; else $edit_allc_no = "checked"; if( $user_group[$id]['del_allc'] ) $del_allc_yes = "checked"; else $del_allc_no = "checked"; if( $user_group[$id]['allow_hide'] ) $allow_hide_yes = "checked"; else $allow_hide_no = "checked"; if( $user_group[$id]['allow_pm'] ) $allow_pm_yes = "checked"; else $allow_pm_no = "checked"; if( $user_group[$id]['allow_files'] ) $allow_files_yes = "checked"; else $allow_files_no = "checked"; if( $user_group[$id]['allow_feed'] ) $allow_feed_yes = "checked"; else $allow_feed_no = "checked"; if( $user_group[$id]['allow_search'] ) $allow_search_yes = "checked"; else $allow_search_no = "checked"; if( $user_group[$id]['allow_rating'] ) $allow_rating_yes = "checked"; else $allow_rating_no = "checked"; if( $user_group[$id]['allow_short'] ) $allow_short_yes = "checked"; else $allow_short_no = "checked"; if( $user_group[$id]['allow_fixed'] ) $allow_fixed_yes = "checked"; else $allow_fixed_no = "checked"; if( $user_group[$id]['allow_poll'] ) $allow_poll_yes = "checked"; else $allow_poll_no = "checked"; if( $user_group[$id]['allow_main'] ) $allow_main_yes = "checked"; else $allow_main_no = "checked"; if( $user_group[$id]['allow_image_upload'] ) $allow_image_upload_yes = "checked"; else $allow_image_upload_no = "checked"; if( $user_group[$id]['allow_file_upload'] ) $allow_file_upload_yes = "checked"; else $allow_file_upload_no = "checked"; if( $user_group[$id]['allow_tor_upload'] ) $allow_tor_upload_yes = "checked"; else $allow_tor_upload_no = "checked"; if( $user_group[$id]['allow_signature'] ) $allow_signature_yes = "checked"; else $allow_signature_no = "checked"; if( $user_group[$id]['allow_url'] ) $allow_url_yes = "checked"; else $allow_url_no = "checked"; if( $user_group[$id]['allow_image'] ) $allow_image_yes = "checked"; else $allow_image_no = "checked"; if( $user_group[$id]['forum_post_edit'] ) $forum_post_edit_yes = "checked"; else $forum_post_edit_no = "checked"; if( $user_group[$id]['forum_post_del'] ) $forum_post_del_yes = "checked"; else $forum_post_del_no = "checked"; if( $user_group[$id]['forum_topic_set'] ) $forum_topic_set_yes = "checked"; else $forum_topic_set_no = "checked"; if( $user_group[$id]['forum_topic_edit'] ) $forum_topic_edit_yes = "checked"; else $forum_topic_edit_no = "checked"; if( $user_group[$id]['forum_topic_del'] ) $forum_topic_del_yes = "checked"; else $forum_topic_del_no = "checked"; if( $user_group[$id]['admin_addnews'] ) $admin_addnews_yes = "checked"; else $admin_addnews_no = "checked"; if( $user_group[$id]['admin_editnews'] ) $admin_editnews_yes = "checked"; else $admin_editnews_no = "checked"; if( $user_group[$id]['admin_categories'] ) $admin_categories_yes = "checked"; else $admin_categories_no = "checked"; if( $user_group[$id]['admin_editusers'] ) $admin_editusers_yes = "checked"; else $admin_editusers_no = "checked"; if( $user_group[$id]['admin_wordfilter'] ) $admin_wordfilter_yes = "checked"; else $admin_wordfilter_no = "checked"; if( $user_group[$id]['admin_static'] ) $admin_static_yes = "checked"; else $admin_static_no = "checked"; if( $user_group[$id]['admin_blockip'] ) $admin_blockip_yes = "checked"; else $admin_blockip_no = "checked"; if( $user_group[$id]['admin_iptools'] ) $admin_iptools_yes = "checked"; else $admin_iptools_no = "checked"; if( $user_group[$id]['admin_googlemap'] ) $admin_googlemap_yes = "checked"; else $admin_googlemap_no = "checked"; if( $user_group[$id]['admin_table'] ) $admin_table_yes = "checked"; else $admin_table_no = "checked"; if( $id == 1 ) $admingroup = "disabled"; if( $id == 5 ) $gastgroup = "disabled"; if( $user_group[$id]['allow_cats'] == "all" ) $allow_cats_value = "selected"; $categories_list = CategoryNewsSelection( explode( ',', $user_group[$id]['allow_cats'] ), 0, false ); if( $user_group[$id]['cat_add'] == "all" ) $cat_add_value = "selected"; $cat_add_list = CategoryNewsSelection( explode( ',', $user_group[$id]['cat_add'] ), 0, false ); $max_foto_value = $user_group[$id]['max_foto']; $max_signature_value = $user_group[$id]['max_signature']; $max_info_value = $user_group[$id]['max_info']; $submit_value = $lang['group_edit']; $form_title = $lang['group_edit1'] . $group_name_value; $form_action = "$PHP_SELF?mod=usergroup&action=doedit&id=" . $id; } echo <<
HTML; echofooter(); } else { echoheader( "", "" ); $db->query( "SELECT user_group, count(*) as count FROM " . USERPREFIX . "_users GROUP BY user_group" ); while ( $row = $db->get_row() ) $count_list[$row['user_group']] = $row['count']; $db->free(); foreach ( $user_group as $group ) { $count = intval( $count_list[$group['id']] ); $entries .= "   {$group['id']} {$group['group_name']} $count "; } echo <<
{$entries}
  ID {$lang['group_name']} {$lang['group_sel4']}  
HTML; echofooter(); } ?>