Skip to content

Commit

Permalink
feat: style changes, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
T1Il committed Aug 24, 2023
1 parent 54357a0 commit 9302969
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 22 deletions.
11 changes: 9 additions & 2 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ body {
margin-top: 20px;
}

.accept-button, .reject-button {
.accept-button, .reject-button, .delete-button {
font-size: 16px;
border: none;
border-radius: 5px;
cursor: pointer;
margin: 0 10px;
}

.accept-button .offset, .reject-button .offset {
.offset {
padding: 10px 20px;
}

Expand Down Expand Up @@ -213,4 +213,11 @@ body {

.submit-button:hover {
background-color: #5b6eae;
}

.warning-ping {
font-weight: bold;
text-transform: uppercase;
margin: 10px 10px;
color: red;
}
25 changes: 21 additions & 4 deletions case.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ function getContrastColor($hexColor)
<div class="user-submitted-date"><span class="accent">Eingesendet am:</span>
<strong><?php echo date("d.m.y - H:i:s", $request->getDate()); ?></strong></div>
<div class="user-everyone-ping"><span
class="accent">Everyone-Ping:</span> <?php echo $request->pingsEveryone() ? "Ja" : "Nein"; ?>
class="accent">Everyone-Ping:</span> <span class="<?php echo $request->pingsEveryone() ? "warning-ping" : "normal-ping"; ?>"><?php echo $request->pingsEveryone() ? "Ja" : "Nein"; ?></span>
</div>
<div class="user-status <?php echo testInput($sta[0]); ?>"><span
class="accent">Status:</span> <?php echo testInput($sta[0]); ?></div>
<div class="user-status" <?php echo testInput($sta[0]); ?>><span class="accent">Nutzer-Status: </span><?php echo $as->isBlocked() ? "blockiert " : "nicht blockiert "; ?>
<?php if(!$as->isModerator()) { ?><button onclick="window.location.href='user.php?block_user=<?php echo $as->getDiscordId(); ?>&from=<?php echo $request->getRequestId();?>';"
class="<?php echo $as->isBlocked() ? "reject" : "accept"; ?>-button"><?php echo $as->isBlocked() ? "Freigeben" : "Blockieren"; ?>
class="<?php echo $as->isBlocked() ? "reject" : "accept"; ?>-button offset"><?php echo $as->isBlocked() ? "Freigeben" : "Blockieren"; ?>
</button>
<?php } ?>
</div>
Expand All @@ -177,7 +177,21 @@ class="<?php echo $as->isBlocked() ? "reject" : "accept"; ?>-button"><?php echo
}
?>

<?php if (!$request->isProcessed()) { ?>
<?php

if(!$request->isProcessed() && !$as->inBotGuild()) {

?>

<div class="button-container offset">
<button onclick="window.location.href='process.php?action=silent-decline&req_id=<?php echo $request->getRequestId(); ?>';"
class="reject-button offset">Ablehnen (ohne Benachrichtigung)
</button>
</div>

<?php

} else if (!$request->isProcessed() && $as->inBotGuild()) { ?>

<div class="button-container">
<button onclick="window.location.href='process.php?action=accept&req_id=<?php echo $request->getRequestId(); ?>';"
Expand All @@ -194,14 +208,17 @@ class="reject-button offset">Ablehnen
$mod = $request->getProcessor();

?>



</div>
<br>
<div class="user-info-box dist">
<div class="user-avatar">
<img src="<?php echo $mod->getAvatarURL(); ?>" alt="User Avatar">
</div>
<div class="user-details">
<div class="user-name accent"><?php echo $mod->getUsername(); ?></div>
<div class="user-name accent"><?php echo $mod->getUsername(); if($as->isModerator()) { ?> <span class="angenommen">(Moderator)</span> <?php } ?></div>
<br>
<div class="user-discord-id"><span class="accent">Discord-ID:</span> <?php echo $mod->getDiscordId(); ?>
</div>
Expand Down
19 changes: 10 additions & 9 deletions php/request.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ function getDate()
return substr($haystack, 0, $length) === $needle;
}

function rejectRequest(User $login, $reason, $create_thread): bool
function rejectRequest(User $login, $reason, $create_thread, $silent): bool
{

$this->request['reason'] = $this->testInput($reason);
Expand All @@ -424,18 +424,18 @@ function rejectRequest(User $login, $reason, $create_thread): bool
$dmEmbed = $this->generateDMEmbed(false, $login);
$delete = $login->deleteMessage(getenv("GUILD_DEVMARKT_REQUEST_CHANNEL"), $this->getMessageID());

if (!$delete) {
echo 'Alte Nachricht konnte nicht gelöscht werden[ignore]';
}
if (!$this->updateRequest("abgelehnt", $login->getDiscordID(), $dateProcessed, $this->getMessageID())) {
return false;
}
if (!$at->sendDMMessage(null, $dmEmbed, false, null)) {
echo 'Nutzer nimmt keine DM-Nachrichten an. Persönlich kontaktieren! <a href="' . $this->caseUrl . '">Case</a>';
$acceptsDMs = false;
}

if($create_thread) {
if(!$silent) {

if (!$at->sendDMMessage(null, $dmEmbed, false, null)) {
echo 'Nutzer nimmt keine DM-Nachrichten an. Persönlich kontaktieren! <a href="' . $this->caseUrl . '">Case</a>';
$acceptsDMs = false;
}

if($create_thread) {

$thread_id = $this->getApplicant()->createRejectThread();

Expand All @@ -460,6 +460,7 @@ function rejectRequest(User $login, $reason, $create_thread): bool

}

}
}

$devmarktRequestEmbed = $this->generateProcessedEmbed(false, $login, $acceptsDMs);
Expand Down
17 changes: 10 additions & 7 deletions process.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
$request->acceptRequest($login);
} else if ($action == "decline") {
if (isset($_POST['reason'])) {
$request->rejectRequest($login, $_POST['reason'], true);
$request->rejectRequest($login, $_POST['reason'], true, false);
}
} else if($action == "silent-decline") {
$request->rejectRequest($login, "Nutzer nicht mehr auf dem DevCord" ,false, true);
}
}

Expand Down Expand Up @@ -89,9 +91,8 @@

$at = new User($st['by_discord_id']);

if(!$at->inBotGuild()) {
echo 'Nutzer ist nicht mehr auf dem Discord.';
exit();
if(!$at->inBotGuild() && $status == "angenommen") {
header('Location: case.php?req_id=' . $req_id . "&msg=left");
}

if ($status == 'angenommen') {
Expand All @@ -104,17 +105,19 @@
]);

if(json_decode($req->getBody())->premium_tier >= 2 || in_array("PARTNERED", json_decode($req->getBody())->features)) {
$request->rejectRequest($login, $_POST['reason'], true);
$request->rejectRequest($login, $_POST['reason'], true, false);
return;
}
$request->rejectRequest($login, $_POST['reason'], false);
$request->rejectRequest($login, $_POST['reason'], false, false);
} else {
$request->rejectRequest($login, $_POST['reason'],false);
$request->rejectRequest($login, $_POST['reason'],false, false);
}
} else {
include('reason.php');
}

} else if($status == 'silent-decline') {
$request->rejectRequest($login, "Nutzer nicht mehr auf dem Discord", false, true);
}

}
Expand Down

0 comments on commit 9302969

Please sign in to comment.