From 9600451f925b0f619ec67e56a79c9afb91c66de9 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 24 Nov 2021 01:35:40 -0500 Subject: [PATCH] usermoderationmanager moderation abilities --- html/MCP/user-management/ban.php | 51 +++++++ html/MCP/user-management/banlist.php | 50 +++++++ html/MCP/user-management/index.php | 196 +++++++++++++++++++++++++++ html/MCP/user-management/unban.php | 28 ++++ 4 files changed, 325 insertions(+) create mode 100644 html/MCP/user-management/ban.php create mode 100644 html/MCP/user-management/banlist.php create mode 100644 html/MCP/user-management/index.php create mode 100644 html/MCP/user-management/unban.php diff --git a/html/MCP/user-management/ban.php b/html/MCP/user-management/ban.php new file mode 100644 index 0000000..82d0612 --- /dev/null +++ b/html/MCP/user-management/ban.php @@ -0,0 +1,51 @@ +isStaff()) { + redirect("/"); +} + +//headers +header('Content-Type: application/json'); +header("Access-Control-Allow-Origin: https://www.alphaland.cc"); +header("access-control-allow-credentials: true"); + +$modmanager = new Alphaland\Moderation\UserModerationManager(); + +$data = json_decode(file_get_contents('php://input')); + +$ban = false; +if ($data) { + $username = $data->username; + $reason = $data->reason; + $expiration = $data->expiration; + $type = $data->type; + + if($username && $reason && $type) { + $userid = getID($username); + $reason = cleanInput($reason); + switch ($type) { + case "warn": + $ban = $modmanager::BanUser($userid, $reason, $expiration, 0); //0 warning type + break; + case "temp": + $ban = $modmanager::BanUser($userid, $reason, $expiration, 1); //1 temp type + break; + case "perm": + $ban = $modmanager::BanUser($userid, $reason, $expiration, 2); //2 perm type + break; + case "poison": + $ban = $modmanager::PoisonBan($userid, $reason); + break; + case "limb": + $ban = $modmanager::ReferralLimbBan($userid, $reason); + break; + default: + break; + } + } +} +die(json_encode(array("success" => $ban))); \ No newline at end of file diff --git a/html/MCP/user-management/banlist.php b/html/MCP/user-management/banlist.php new file mode 100644 index 0000000..736dad1 --- /dev/null +++ b/html/MCP/user-management/banlist.php @@ -0,0 +1,50 @@ +isStaff()) { + redirect("/MCP"); +} + +$bans = $GLOBALS['pdo']->prepare("SELECT * FROM user_bans WHERE valid = 1"); +$bans->execute(); +if ($bans->rowCount() == 0) { + die(json_encode(["alert"=>"No bans found"])); +} + +$jsonData = array(); + +foreach($bans as $ban) { + $type = $ban['banType']; + $banexpire = ""; + + //bantypes to exp + if ($type == 0) { + $banexpire = "Warning"; + } else if ($type == 1) { + $banexpire = date("m/d/Y", $ban['banExpiration']); + } else if ($type == 2) { + $banexpire = "Permanent"; + } else { + $banexpire = "NULL"; + } + + $banData = array( + "banType" => $type, + "banReason" => cleanOutput($ban['banReason']), + "bannedUser" => cleanOutput(getUsername($ban['uid'])), + "whoBannedUser" => $ban['whoBanned'], + "whenBanned" => date("m/d/Y", $ban['whenBanned']), + "banExpiration" => $banexpire + ); + + array_push($jsonData, $banData); +} + +die(json_encode($jsonData)); \ No newline at end of file diff --git a/html/MCP/user-management/index.php b/html/MCP/user-management/index.php new file mode 100644 index 0000000..bfcc784 --- /dev/null +++ b/html/MCP/user-management/index.php @@ -0,0 +1,196 @@ +isStaff())) { + redirect("/"); //u not admin nigga +} + +$body = << + + +
User Management
+
+
+
+
+
+ + +
+ +
+
+
+
+
+
PLEASE MAKE SURE YOU READ THE DISCORD CHANNEL "staff-resources"
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+ +
+
+
+
+
+
+

+ +

+
+ + + + + + + + + + + +
DateUsernameReasonExpiration
+
+
+
+
+ + +EOT; + +pageHandler(); +$ph->pageTitle("User Manage"); +$ph->body = $body; +$ph->output(); \ No newline at end of file diff --git a/html/MCP/user-management/unban.php b/html/MCP/user-management/unban.php new file mode 100644 index 0000000..c22b6f5 --- /dev/null +++ b/html/MCP/user-management/unban.php @@ -0,0 +1,28 @@ +isStaff()) { + redirect("/"); +} + +//headers +header('Content-Type: application/json'); +header("Access-Control-Allow-Origin: https://www.alphaland.cc"); +header("access-control-allow-credentials: true"); + +$modmanager = new Alphaland\Moderation\UserModerationManager(); + +$data = json_decode(file_get_contents('php://input')); + +$unban = false; +if ($data) { + $username = $data->username; + + if($username) { + $unban = $modmanager::UnbanUser(getID($username)); + } +} +die(json_encode(array("success" => $unban))); \ No newline at end of file