Пример #1
0
    } else {
        $sort_dir = "ASC";
    }
} else {
    $sort_dir = "ASC";
}
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
    $page = $_GET['page'] > 0 ? $_GET['page'] : 1;
} else {
    $page = 1;
}
if (isset($_POST['delete'])) {
    $valid = true;
    if (isset($_POST['delete_group']) && is_array($_POST['delete_group'])) {
        foreach ($_POST['delete_group'] as $gid) {
            if ($group_name = perm_get_group_name($gid)) {
                if (perm_remove_group($gid)) {
                    admin_add_log_entry(DELETE_USER_GROUP, array($group_name));
                } else {
                    $error_msg_array[] = sprintf(gettext("Failed to delete group %s"), $group_name);
                    $valid = false;
                }
            }
        }
        if ($valid) {
            header_redirect("admin_user_groups.php?webtag={$webtag}&deleted=true");
            exit;
        }
    }
}
html_draw_top(sprintf('title=%s', gettext("Admin - User Groups")), 'class=window_title');
        foreach ($_POST['add_user'] as $uid) {
            if (!perm_user_in_group($uid, $gid)) {
                perm_add_user_to_group($uid, $gid);
                if (($user_logon = user_get_logon($uid)) && ($group_name = perm_get_group_name($gid))) {
                    admin_add_log_entry(ADD_USER_TO_GROUP, array($user_logon, $group_name));
                }
            }
        }
    }
}
if (isset($_POST['remove'])) {
    if (isset($_POST['remove_user']) && is_array($_POST['remove_user'])) {
        foreach ($_POST['remove_user'] as $uid) {
            if (perm_user_in_group($uid, $gid)) {
                perm_remove_user_from_group($uid, $gid);
                if (($user_logon = user_get_logon($uid)) && ($group_name = perm_get_group_name($gid))) {
                    admin_add_log_entry(REMOVE_USER_FROM_GROUP, array($user_logon, $group_name));
                }
            }
        }
    }
}
if (!($group = perm_get_group($gid))) {
    html_draw_error(gettext("Supplied GID is not a user group"), 'admin_user_groups.php', 'get', array('back' => gettext("Back")));
}
html_draw_top(array('title' => sprintf(gettext('Admin - Manage User Groups - %s - Add/Remove Users'), $group['GROUP_NAME']), 'class' => 'window_title', 'main_css' => 'admin.css'));
$group_users_array = perm_group_get_users($gid, $start_main);
echo "<h1>", gettext("Admin"), html_style_image('separator'), gettext("Manage User Groups"), html_style_image('separator'), "{$group['GROUP_NAME']}", html_style_image('separator'), "", gettext("Add/Remove Users"), "</h1>\n";
if (isset($_GET['added'])) {
    html_display_success_msg(gettext("Successfully added group. Add users to this group by searching for them below."), '800', 'center');
} else {
Пример #3
0
} else {
    $sort_dir = "ASC";
}
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
    $page = $_GET['page'] > 0 ? $_GET['page'] : 1;
} else {
    $page = 1;
}
$default_user_group = forum_get_setting('default_user_group');
$user_groups_array = perm_get_user_groups($page, $sort_by, $sort_dir);
$user_group_name_array = perm_get_user_group_names();
if (isset($_POST['delete'])) {
    $valid = true;
    if (isset($_POST['delete_group']) && is_array($_POST['delete_group'])) {
        foreach ($_POST['delete_group'] as $gid) {
            if (($group_name = perm_get_group_name($gid)) !== false) {
                if (perm_remove_group($gid)) {
                    admin_add_log_entry(DELETE_USER_GROUP, array($group_name));
                } else {
                    $error_msg_array[] = sprintf(gettext("Failed to delete group %s"), $group_name);
                    $valid = false;
                }
            }
        }
        if ($valid) {
            header_redirect("admin_user_groups.php?webtag={$webtag}&page={$page}&sort_by={$sort_by}&sort_dir={$sort_dir}&deleted=true");
            exit;
        }
    }
} else {
    if (isset($_GET['set_default']) && is_numeric($_GET['set_default'])) {