X-Git-Url: http://git.pjr.cc/?a=blobdiff_plain;f=gwvpmini%2Fgwvpmini_admin.php;h=2ba996328f07532b2ca451b145a254351579bc2f;hb=767cce5392550af03a6701b3d1826f680878d699;hp=7078542c7a4d8a2199537189e91713dc07b80171;hpb=e39e4b8b84f6f8662af51b3b57c333dff0e3945b;p=gwvp-mini.git diff --git a/gwvpmini/gwvpmini_admin.php b/gwvpmini/gwvpmini_admin.php index 7078542..2ba9963 100644 --- a/gwvpmini/gwvpmini_admin.php +++ b/gwvpmini/gwvpmini_admin.php @@ -1,17 +1,20 @@ Disable)"; @@ -75,13 +106,27 @@ function gwvpmini_AdminMainPageBody() } 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 "; + echo " Settings$register$regconfirm $usegrav $forcessl "; echo ""; + echo " Users - $totalusers"; echo "
Remove User?"; echo "Are you sure you wish to remove the user, $username ($uid) - $fullname - $email - $desc?"; @@ -265,6 +340,78 @@ function gwvpmini_RemoveUserPageBody() } +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; @@ -288,6 +435,139 @@ function gwvpmini_ConfRemoveUser() } 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_SwitchAdmin() +{ + 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($uid > 0 && $newst >= 0) { + gwvpmini_SetUserStatusAdmin($uid, $newst); + if($newst == 0) { + gwvpmini_SendMessage("info", "User is no longer an admin"); + } else { + gwvpmini_SendMessage("info", "User is now an admin"); + } + } else gwvpmini_SendMessage("error", "Invalid user id"); + + + 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 |