X-Git-Url: http://git.pjr.cc/?p=gwvp-mini.git;a=blobdiff_plain;f=gwvpmini%2Fgwvpmini_admin.php;h=e19a2684b5d4c558d44adc477d40ade6c015273d;hp=fcd6fa2d09d4ee13ac79fc4edc94265b6d7c9465;hb=979dc6190296b0c7ffdfe17031f2d32318da7e2b;hpb=22228c14262a4c2227f9c0ddedffee7356bf615a diff --git a/gwvpmini/gwvpmini_admin.php b/gwvpmini/gwvpmini_admin.php index fcd6fa2..e19a268 100644 --- a/gwvpmini/gwvpmini_admin.php +++ b/gwvpmini/gwvpmini_admin.php @@ -1,15 +1,20 @@ Disable)"; + } else { + $register = "Registration Disabled (Enable)"; + } + + if($reg_reqs_confirm) { + $regconfirm = "Registration Requires Confirmation (Disable)"; + } else { + $regconfirm = "Registration Doesnt Require Confirmation (Enable)"; + } + + if($use_gravatar) { + $usegrav = "Gravatars are enabled (Disable)"; + } else { + $usegrav = "Gravatars are disabled (Enable)"; + } + + if($force_ssl) { + $forcessl = "Force SSL is enabled (Disable)"; + } else { + $forcessl = "Force SSL is disabled (Enable)"; + } + $totalusers = gwvpmini_GetNUsers(); echo "
"; echo "

Users - $totalusers

"; + echo "$register
$regconfirm
$usegrav
$forcessl
"; + echo "
"; + echo "Address emails are sent from
"; + echo "
"; + echo ""; - echo ""; + echo ""; foreach(gwvpmini_GetUsers() as $key => $val) { $id = $key; $un = $val["username"]; $em = $val["email"]; $fn = $val["fullname"]; $ds = $val["desc"]; - echo ""; + $st_t = $val["status"]; + $st_l = $val["level"]; + + $astat = "0"; + $cstat = "WTF"; + $level = "WTF"; + if($st_l == 0) $level = "User"; + if($st_l == 1) $level = "Admin"; + + $status = ""; + if($st_t[0] == "1") { + $status = ", disabled"; + $astat = 0; + $cstat = "Enable"; + } else if ($st_t[0] == "0") { + $astat = 1; + $cstat = "Disable"; + } else if($st_t[0] == "2") { + $vl = explode(":", $st_t); + error_log("VL: ".print_r($vl, true)); + $status = " Awaiting Confirmation (Confirm)"; + } + + $st = "$level$status"; + + $unlval = "$un"; + echo ""; + else echo ""; } + + echo "
UsernameEmail AddressFull NameDescriptionControl
UsernameEmail AddressFull NameDescriptionStatusControl
$un$em$fn$dsRemove Disable
$unlval$em$fn$ds$stRemove "; + if ($st_t[0] == "0"||$st_t[0] == "1") echo "$cstat
"; echo "
"; echo "

Create User

"; echo "
"; echo ""; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -80,7 +192,24 @@ function gwvpmini_AdminMainPageBody() $rn = $val["name"]; $ds = $val["desc"]; $ow = $val["owner"]; - echo ""; + $st = $val["status"]; + $udet = gwvpmini_getUser(null, null, $ow); + if(!$udet) { + $owl = "Orphaned"; + } else { + $owl = $udet["username"]." (".$udet["id"].") - ".$udet["fullname"]." (".$udet["email"].") - Email Owner"; + } + + if($st == 1) { + $stat = 0; + $cstat = "Enable"; + } else { + $stat = 1; + $cstat = "Disable"; + } + + echo ""; + } echo "
Username
Password
Confirm Password
Password
Confirm Password
Full Name
Description
Email
$rn$ds$owRemove Disable
$rn$ds$owlRemove $cstat
"; } @@ -124,4 +253,282 @@ function gwvpmini_AdminUserCreate() return; } + + +function gwvpmini_ChangeRegistration() +{ + global $can_register, $BASE_URL; + + if($can_register) { + gwvpmini_setConfigVal("canregister", "0"); + gwvpmini_SendMessage("info", "Registration disabled"); + } else { + gwvpmini_setConfigVal("canregister", "1"); + gwvpmini_SendMessage("info", "Registration enabled"); + } + + header("Location: $BASE_URL/admin"); +} + + +function gwvpmini_ChangeRegConfig() +{ + global $reg_reqs_confirm, $BASE_URL; + + if($reg_reqs_confirm) { + gwvpmini_setConfigVal("registerrequiresconfirm", "0"); + gwvpmini_SendMessage("info", "Registration Confirmation disabled"); + } else { + gwvpmini_setConfigVal("registerrequiresconfirm", "1"); + gwvpmini_SendMessage("info", "Registration Confirmation enabled"); + } + + header("Location: $BASE_URL/admin"); +} + +function gwvpmini_ChangeFromAddress() +{ + global $BASE_URL; + + $newfrom = $_REQUEST["fromemail"]; + + gwvpmini_setConfigVal("eamilfromaddress", "$newfrom"); + gwvpmini_SendMessage("info", "Email from address updated to \"$newfrom\""); + + header("Location: $BASE_URL/admin"); + +} + +function gwvpmini_RemoveUserPageBody() +{ + global $BASE_URL; + + $uid = -1; + if(isset($_REQUEST["q"])) { + $query = $_REQUEST["q"]; + $qspl = explode("/", $query); + if(isset($qspl[2])) { + $uid = $qspl[2]; + } + } + + if($uid != -1) { + $details = gwvpmini_GetUsers($uid, 1); + $username = $details[$uid]["username"]; + $fullname = $details[$uid]["fullname"]; + $email = $details[$uid]["email"]; + $desc = $details[$uid]["desc"]; + + error_log("user dets:".print_r($details, true)); + + echo "

Remove User?

"; + echo "Are you sure you wish to remove the user, $username ($uid) - $fullname - $email - $desc?
"; + echo "Yes No
"; + } else { + echo "

How?

"; + echo "You got here in a weird way or the uid of the user you were trying to delete is invalid
"; + echo "Go Back"; + } + +} + +function gwvpmini_RemoveRepoPageBody() +{ + global $BASE_URL; + + $rid = -1; + $uid = -1; + if(isset($_REQUEST["q"])) { + $query = $_REQUEST["q"]; + $qspl = explode("/", $query); + if(isset($qspl[2])) { + $rid = $qspl[2]; + } + } + + $repdet = gwvpmini_getRepo(null, null, $rid); + if($repdet != false) $uid = $repdet["ownerid"]; + $usedet = gwvpmini_getUser(null, null, $uid); + + + if($rid != -1) { + $rname = $repdet["name"]; + $rdesc = $repdet["desc"]; + if($usedet == false) { + $ownedby = "which is unowned (Orphaned)"; + } else { + $ownedby = "owned by $username ($uid) - \"$fullname\""; + } + $username = $usedet["username"]; + $fullname = $usedet["fullname"]; + + + error_log("user dets:".print_r($details, true)); + + echo "

Remove User?

"; + echo "Are you sure you wish to remove the repo, $rname ($rid) - \"$rdesc\" $ownedby?
"; + echo "Yes No
"; + } else { + echo "

How?

"; + echo "You got here in a weird way or the uid of the repo you were trying to delete is invalid
"; + echo "Go Back"; + } + +} + +function gwvpmini_ConfRemoveRepo() +{ + global $BASE_URL; + + + error_log("CONF REMOVE REPO"); + + $rid = -1; + if(isset($_REQUEST["q"])) { + $query = $_REQUEST["q"]; + $qspl = explode("/", $query); + if(isset($qspl[2])) { + $rid = $qspl[2]; + } + } + + if($rid > 0) { + $details = gwvpmini_getRepo(null, null, $rid); + $rname = $details["name"]; + gwvpmini_RemoveRepo($rid); + gwvpmini_SendMessage("info", "Repo $rname ($rid) has been removed"); + } else { + gwvpmini_SendMessage("info", "Problem deleteing repo with rid $rid"); + } + + header("Location: $BASE_URL/admin"); +} + +function gwvpmini_ConfRemoveUser() +{ + global $BASE_URL; + + $uid = -1; + if(isset($_REQUEST["q"])) { + $query = $_REQUEST["q"]; + $qspl = explode("/", $query); + if(isset($qspl[2])) { + $uid = $qspl[2]; + } + } + + if($uid > 0) { + $details = gwvpmini_getUser(null, null, $uid); + $uname = $details["username"]; + gwvpmini_RemoveUser($uid); + gwvpmini_SendMessage("info", "User $uname ($uid) has been removed"); + } else { + gwvpmini_SendMessage("info", "Problem deleteing user with uid $uid"); + } + + header("Location: $BASE_URL/admin"); +} + +function gwvpmini_SwitchEnableUser() +{ + global $BASE_URL; + + $uid = -1; + $newst = -1; + if(isset($_REQUEST["q"])) { + $query = $_REQUEST["q"]; + $qspl = explode("/", $query); + if(isset($qspl[2])) { + $newst = $qspl[2]; + } + if(isset($qspl[3])) { + $uid = $qspl[3]; + } + } + + if($newst == 1) $stat = "disabled"; + else $stat = "enabled"; + + if($uid > 0 && ($newst == 1 || $newst == 0)) { + $details = gwvpmini_getUser(null, null, $uid); + $uname = $details["username"]; + if($newst == 1) gwvpmini_DisableUser($uid); + if($newst == 0) gwvpmini_EnableUser($uid); + gwvpmini_SendMessage("info", "User $uname ($uid) has been $stat"); + } else { + gwvpmini_SendMessage("info", "Problem disabling user with uid $uid"); + } + + header("Location: $BASE_URL/admin"); + +} + +function gwvpmini_SwitchEnableRepo() +{ + global $BASE_URL; + + $rid = -1; + $newst = -1; + if(isset($_REQUEST["q"])) { + $query = $_REQUEST["q"]; + $qspl = explode("/", $query); + if(isset($qspl[2])) { + $newst = $qspl[2]; + } + if(isset($qspl[3])) { + $rid = $qspl[3]; + } + } + + if($newst == 1) $stat = "disabled"; + else $stat = "enabled"; + + if($rid > 0 && ($newst == 1 || $newst == 0)) { + $details = gwvpmini_getRepo(null, null, $rid); + if($newst == 1) gwvpmini_DisableRepo($rid); + if($newst == 0) gwvpmini_EnableRepo($rid); + gwvpmini_SendMessage("info", "Repo $uname ($rid) has been $stat"); + } else { + gwvpmini_SendMessage("info", "Problem disabling repo with rid $rid"); + } + + header("Location: $BASE_URL/admin"); +} + +function gwvpmini_SwitchGravatars() +{ + global $BASE_URL, $use_gravatar; + + if($newst == 1) $stat = "disabled"; + else $stat = "enabled"; + + if($use_gravatar) { + gwvpmini_setConfigVal("gravatarenabled", "0"); + } else { + gwvpmini_setConfigVal("gravatarenabled", "1"); + } + + gwvpmini_SendMessage("info", "Gravatars $stat"); + + header("Location: $BASE_URL/admin"); +} + +function gwvpmini_SwitchForceSSL() +{ + global $BASE_URL, $force_ssl; + + if($newst == 1) $stat = "disabled"; + else $stat = "enabled"; + + if($force_ssl) { + gwvpmini_setConfigVal("forcessl", "0"); + } else { + gwvpmini_setConfigVal("forcessl", "1"); + } + + gwvpmini_SendMessage("info", "forcessl $stat"); + + header("Location: $BASE_URL/admin"); + +} ?> \ No newline at end of file