From 54357a05122b483c35fbbabf35e61b1256905e21 Mon Sep 17 00:00:00 2001 From: Till Schnegelsberg Date: Thu, 24 Aug 2023 15:27:28 +0200 Subject: [PATCH] feat: block users from market --- assets/css/styles.css | 11 +++++++---- case.php | 12 +++++++++--- index.php | 13 +++++++++---- php/login.inc.php | 24 ++++++++++++++++++++++++ user.php | 20 ++++++++++++++++++++ 5 files changed, 69 insertions(+), 11 deletions(-) diff --git a/assets/css/styles.css b/assets/css/styles.css index b1fc66b9..e162b186 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -80,15 +80,15 @@ body { padding: 10px 10px; } -.user-status.angenommen { +.angenommen { color: #43b581; } -.user-status.abgelehnt { +.abgelehnt { color: #f04747; } -.user-status.unprocessed { +.unprocessed { color: #e7effd; } @@ -137,7 +137,6 @@ body { } .accept-button, .reject-button { - padding: 10px 20px; font-size: 16px; border: none; border-radius: 5px; @@ -145,6 +144,10 @@ body { margin: 0 10px; } +.accept-button .offset, .reject-button .offset { + padding: 10px 20px; +} + .accept-button { background-color: #43b581; color: #e3eaf7; diff --git a/case.php b/case.php index 6de83830..62230e45 100644 --- a/case.php +++ b/case.php @@ -143,7 +143,7 @@ function getContrastColor($hexColor) User Avatar
-
getUsername(); ?>
+
getUsername(); if($as->isModerator()) { ?> (Moderator)

Discord-ID: getDiscordId(); ?>
@@ -156,6 +156,12 @@ class="accent">Everyone-Ping: pingsEveryone() ? "Ja"
Status:
+
>Nutzer-Status: isBlocked() ? "blockiert " : "nicht blockiert "; ?> + isModerator()) { ?> + +
@@ -175,10 +181,10 @@ class="accent">Status:
diff --git a/index.php b/index.php index 0301c1fd..bad9c3e3 100644 --- a/index.php +++ b/index.php @@ -9,9 +9,7 @@ $base_url = getenv("BOT_BASE_URI"); $discordInvite = getenv('GUILD_INVITE'); ?> - - DevCord - Devmarkt @@ -69,9 +67,14 @@ $unresolvedRequests = $devmarkt->getUnresolvedRequests(); $uRS = ""; + if(sizeof($unresolvedRequests) > 0) { + ?> +
Nicht bearbeitete Anfragen:
+ -
Nicht bearbeitete Anfragen:
getApplicant()->inBotGuild()) { $uRS .= "getRequestId()) . ">" . htmlentities($request->getTitle()) . "
"; + } else { + $uRS .= "getRequestId()) . ">" . htmlentities($request->getTitle()) . "
"; } } @@ -99,7 +104,7 @@ ?> -

Der Devmarkt ist zurzeit leider nicht für dich verfügbar. //

+

Der Devmarkt ist zurzeit leider nicht für dich verfügbar. Wende dich bei Fragen oder Problemen im Discord an das Administrations-Team oder schreibe uns eine E-Mail.

isBlocked; } + public function switchBlockState(): bool { + + if(!$this->exists) { + return false; + } + + if($this->isModerator()) { + return false; + } + + $mysql = new MySQL(); + $pdo = $mysql->getPDO(); + + $stmt = "UPDATE `dc_users` SET `blocked`=" . ($this->isBlocked ? "0" : "1") . " WHERE `discord_id`=:id"; + $qry = $pdo->prepare($stmt); + $qry->bindParam(":id", $this->discordId); + $qry->execute(); + + $this->isBlocked = !$this->isBlocked; + + return $this->isBlocked; + + } + public function getLastAcceptedEntry() { diff --git a/user.php b/user.php index a846efd6..511ebf2e 100644 --- a/user.php +++ b/user.php @@ -10,6 +10,26 @@ $token = new UserTokenHandler($_SESSION['token']); $login = new User($token->getDiscordID()); + if(isset($_GET['block_user'])) { + + if($login->isModerator()) { + + $blockID = testInput($_GET['block_user']); + $blockUser = new User($blockID); + + $blockUser->switchBlockState(); + + if(isset($_GET['from'])) { + + header('Location: case.php?req_id=' . $_GET['from']); + return; + + } + + } + + } + } else { (isset($_GET['user_id'])) ? header('Location: login.php?redirect=' . getenv("BOT_BASE_URI") . '/user.php?user_id=' . $_GET['user_id']) : header('Location: login.php'); }