X-Git-Url: http://git.pjr.cc/?p=gwvp-mini.git;a=blobdiff_plain;f=gwvpmini%2Fgwvpmini_admin.php;h=e19a2684b5d4c558d44adc477d40ade6c015273d;hp=7078542c7a4d8a2199537189e91713dc07b80171;hb=979dc6190296b0c7ffdfe17031f2d32318da7e2b;hpb=e39e4b8b84f6f8662af51b3b57c333dff0e3945b diff --git a/gwvpmini/gwvpmini_admin.php b/gwvpmini/gwvpmini_admin.php index 7078542..e19a268 100644 --- a/gwvpmini/gwvpmini_admin.php +++ b/gwvpmini/gwvpmini_admin.php @@ -1,17 +1,20 @@ Disable)"; @@ -75,10 +103,24 @@ 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 ""; + else echo ""; } @@ -142,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 "
"; echo "

Users - $totalusers

"; - echo "$register
$regconfirm
"; + echo "$register
$regconfirm
$usegrav
$forcessl
"; echo "
"; echo "Address emails are sent from
"; echo "
"; @@ -94,6 +136,8 @@ function gwvpmini_AdminMainPageBody() $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"; @@ -101,8 +145,12 @@ function gwvpmini_AdminMainPageBody() $status = ""; if($st_t[0] == "1") { $status = ", disabled"; - } - if($st_t[0] == "2") { + $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)"; @@ -111,7 +159,9 @@ function gwvpmini_AdminMainPageBody() $st = "$level$status"; $unlval = "$un"; - echo "
$unlval$em$fn$ds$stRemove Disable
$unlval$em$fn$ds$stRemove "; + if ($st_t[0] == "0"||$st_t[0] == "1") echo "$cstat
$rn$ds$owRemove Disable
$rn$ds$owlRemove $cstat
"; } @@ -265,6 +332,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 +427,108 @@ 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_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