X-Git-Url: http://git.pjr.cc/?p=gwvp.git;a=blobdiff_plain;f=gwvplib%2Fgwvpuseradmin.php;h=abe586ec5473f4d3212f405e36aa2c56fa3931de;hp=cb5f997f6e81f6e71e5df1da45331a98fa15b644;hb=507bc8f2818a42d751ed6e2e2fc68ee2bde94016;hpb=5fbec74fb853403aae33acce937847d8739fe67a
diff --git a/gwvplib/gwvpuseradmin.php b/gwvplib/gwvpuseradmin.php
index cb5f997..abe586e 100644
--- a/gwvplib/gwvpuseradmin.php
+++ b/gwvplib/gwvpuseradmin.php
@@ -11,103 +11,541 @@ function gwvp_UserAdminCallMe()
{
if(isset($_REQUEST["q"])) {
$query = $_REQUEST["q"];
- if($query == "admin/users") return "gwvp_UserAdminPage";
+ $qspl = explode("/", $query);
+ if(isset($qspl[0]) && isset($qspl[1])) {
+ if($qspl[0] == "admin" && $qspl[1] == "users") {
+ if(isset($qspl[2])) {
+ switch($qspl[2]) {
+ case "adduser":
+ return "gwvp_AddUserPage";
+ break;
+ case "groupmember":
+ return "gwvp_groupMemberChange";
+ break;
+ case "addgroup":
+ return "gwvp_AddGroupPage";
+ break;
+ case "modify":
+ return "gwvp_ModifyUserPage";
+ break;
+ case "modifygroup":
+ return "gwvp_ModifyGroupPage";
+ break;
+ default:
+ return "gwvp_UserAdminPage";
+ }
+ } else {
+ return "gwvp_UserAdminPage";
+ }
+ }
+ }
else return false;
}
return false;
}
+function gwvp_AddUserPage()
+{
+ global $BASE_URL;
+
+ $email = $_REQUEST["email"];
+ $fullname = $_REQUEST["fullname"];
+ $pass1 = $_REQUEST["pass1"];
+ $pass2 = $_REQUEST["pass2"];
+ $username = $_REQUEST["username"];
+ $desc = $_REQUEST["desc"];
+ $sendvalid = isset($_REQUEST["sendvalidation"]);
+
+ // now for some validation
+ $sendback = false;
+ $message = "";
+ if(!gwvp_checkEmail($email)) {
+ $sendback = true;
+ $message .= "EMail address invalid. ";
+ }
+
+ // function gwvp_getUser($username=null, $email=null, $id=null)
+ if(gwvp_getUser(null, $email, null)!=null) {
+ $staremail = true;
+ $sendback = true;
+ $message .= "EMail address already registered. ";
+ }
+
+ if(gwvp_getUser($username)!= null) {
+ $starusername = true;
+ $sendback = true;
+ $message .= "Username already exists. ";
+ }
+
+ if($pass1 != $pass2) {
+ $starpass = true;
+ $sendback = true;
+ $message .= "Passwords dont match. ";
+ }
+
+ if($pass1 == "" && $pass2 == "" && !$sendvalid) {
+ $starpass = true;
+ $sendback = true;
+ $message .= "Password was blank. ";
+ }
+
+ // otherwise, its all good, proceed with user creation
+ if($sendback) {
+ $_SESSION["sendback_owner"] = "users";
+ $sb["email"] = $email;
+ if($staremail) $sb["emailstar"] = true;
+ $sb["fullname"] = $fullname;
+ $sb["username"] = $username;
+ if($starusername) $sb["usernamestar"] = true;
+ $sb["desc"] = $desc;
+ if($starpass) $sb["passwordstar"] = true;
+
+ $_SESSION["sendback"] = true;
+ $_SESSION["sendback_data"] = base64_encode(serialize($sb));
+ gwvp_SendMessage("error", "$message");
+ header("Location: $BASE_URL/admin/users");
+ return;
+ }
+
+ // TODO: we need to do alot of checking here - that can come later
+ if(gwvp_createUser($email, $fullname, $pass1, $username, $desc, 0)) {
+ gwvp_SendMessage("info", "user $username, $fullname ($email) created");
+ header("Location: $BASE_URL/admin/users");
+ return;
+ } else {
+ gwvp_SendMessage("error", "error creating user for some unknown reason");
+ header("Location: $BASE_URL/admin/users");
+ return;
+ }
+
+
+ /*
+ echo "
EMail | | ";
+ echo "Full Name | |
";
+ echo "Password | | ";
+ echo "Password Confirm | |
";
+ echo "Username | | ";
+ echo "Description | |
";
+ */
+
+}
+
+function gwvp_AddGroupPage()
+{
+ /*
+ * echo "Group Name | | |
";
+ echo "Admin Group? | |
";
+ echo "Owner | |