}
}
if (isset($_GET['usersearch']) && strlen(trim($_GET['usersearch'])) > 0) {
    $usersearch = trim($_GET['usersearch']);
} else {
    if (isset($_POST['usersearch']) && strlen(trim($_POST['usersearch'])) > 0) {
        $usersearch = trim($_POST['usersearch']);
    } else {
        $usersearch = "";
    }
}
if (isset($_POST['add'])) {
    if (isset($_POST['add_user']) && is_array($_POST['add_user'])) {
        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));
                }
Exemplo n.º 2
0
                            if ($valid) {
                                $success_html = gettext("Updates saved successfully");
                            }
                        } else {
                            if (isset($_POST['remove_group']) && is_array($_POST['remove_group'])) {
                                $group_ids = array_filter(array_keys($_POST['remove_group']), 'is_numeric');
                                if (sizeof($group_ids) > 0) {
                                    foreach ($group_ids as $gid) {
                                        perm_remove_user_from_group($uid, $gid);
                                    }
                                    header_redirect("admin_user.php?webtag={$webtag}&uid={$uid}&group_removed=true");
                                    exit;
                                }
                            } else {
                                if (isset($_POST['add_group']) && is_numeric($_POST['add_group'])) {
                                    if (perm_add_user_to_group($uid, $_POST['add_group'])) {
                                        header_redirect("admin_user.php?webtag={$webtag}&uid={$uid}&group_added=true");
                                        exit;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
if (isset($_GET['action']) && strlen(trim($_GET['action'])) > 0) {
    $action = trim($_GET['action']);
} else {
Exemplo n.º 3
0
 public static function start($uid)
 {
     if (!($forum_fid = get_forum_fid())) {
         $forum_fid = 0;
     }
     if (!($user = user_get($uid))) {
         $user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => '');
     }
     unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER'], $user['PEER_NICKNAME']);
     $_SESSION = array_merge($_SESSION, $user);
     $_SESSION['FID'] = $forum_fid;
     $_SESSION['IPADDRESS'] = get_ip_address();
     if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) {
         $_SESSION = array_merge($_SESSION, $user_prefs);
     } else {
         $_SESSION = array_merge($_SESSION, user_get_pref_names(array('STYLE')));
     }
     if ($user_perms = session::get_perm_array($uid, $forum_fid)) {
         $_SESSION['PERMS'] = $user_perms;
     }
     if (!isset($_SESSION['RAND_HASH'])) {
         $_SESSION['RAND_HASH'] = md5(uniqid(mt_rand()));
     }
     if ($uid > 0 && !forum_get_last_visit($uid) && ($gid = perm_get_default_group())) {
         perm_add_user_to_group($uid, $gid);
     }
 }
Exemplo n.º 4
0
function perm_user_apply_email_confirmation($uid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($uid)) {
        return false;
    }
    $perm = USER_PERM_EMAIL_CONFIRM;
    if ($gid = perm_get_user_gid($uid)) {
        $sql = "INSERT INTO GROUP_PERMS (GID, FORUM, FID, PERM) ";
        $sql .= "VALUES ('{$gid}', '0', '0', '{$perm}') ON DUPLICATE KEY ";
        $sql .= "UPDATE PERM = PERM | VALUES(PERM)";
        if (!$db->query($sql)) {
            return false;
        }
    } else {
        $sql = "INSERT INTO GROUP_PERMS (FORUM, FID, PERM) ";
        $sql .= "VALUES ('0', '0', '{$perm}')";
        if ($db->query($sql)) {
            $new_gid = $db->insert_id;
            return perm_add_user_to_group($uid, $new_gid);
        }
    }
    return false;
}