diff --git a/src/admin/system.php b/src/admin/system.php index 71a50a7..fadd2a5 100644 --- a/src/admin/system.php +++ b/src/admin/system.php @@ -19,115 +19,122 @@ // if post request if (Util::securevar($_SERVER["REQUEST_METHOD"]) === "POST") { - if (isset($_POST["SystemStatus"])) { - $Systemstatus = Util::securevar($_POST["SystemStatus"]); - } - if (isset($_POST["SystemMaint"])) { - $SystemMaint = Util::securevar($_POST["SystemMaint"]); - } - if (isset($_POST["SystemVersion"])) { - $SystemVersion = Util::securevar($_POST["SystemVersion"]); - } - if (isset($_POST["invite"])) { - $invite = Util::securevar($_POST["invite"]); - } - if (isset($_POST['Systemfreeze'])) { - $Systemfreeze = Util::securevar($_POST['Systemfreeze']); - } - if (isset($_POST['flushchat'])) { - $flushchat = Util::securevar($_POST['flushchat']); - } - if (isset($_POST['shoutbox'])) { - $shoutbox = Util::securevar($_POST['shoutbox']); - } - if (isset($_POST['setnews'])) { - $news = Util::securevar($_POST['setnews']); - } - if (isset($_POST['invwave'])) { - $invwave = Util::securevar($_POST['invwave']); - } - if (isset($_POST['discordlinking'])) { - $discordlinking = Util::securevar($_POST['discordlinking']); - } - if (isset($_POST['discordrelinking'])) { - $discordrelinking = Util::securevar($_POST['discordrelinking']); - } - if (isset($_POST['discordlogging'])) { - $discordlogging = Util::securevar($_POST['discordlogging']); - } - - if (isset($_POST['service'])) { - $service = Util::securevar($_POST['service']); - } - - if (isset($_POST['setkey'])) { - $key = Util::securevar($_POST['site_key']); - } - - if (isset($_POST['setsecret'])) { - $secret = Util::securevar($_POST['site_secret']); - } - - - Util::adminCheck(); - - if (isset($Systemstatus)) { - $admin->setSystemStatus(); - } - - if (isset($SystemMaint)) { - $admin->setSystemMaint(); - } - - if (isset($SystemVersion)) { - $ver = floatval(Util::securevar($_POST["version"])); - $admin->setSystemVersion($ver); - } - - if (isset($invite)) { - $admin->setinvite(); - } - - if (isset($news)) { - $news = Util::securevar($_POST["msg"]); - $admin->setnews($news); - } - - if (isset($Systemfreeze)) { - $admin->setSystemfreeze(); - } - - if (isset($flushchat)) { - $admin->flushchat(); - } - - if (isset($shoutbox)) { - $admin->setshoutbox(); - } - - if (isset($invwave)) { - $admin->invwave(); - } - if (isset($discordlinking)) { - $admin->setDiscordLink(); - } - if (isset($discordrelinking)) { - $admin->setDiscordReLink(); - } - if (isset($discordlogging)) { - $admin->setDiscordLogging(); - } - if(isset($service)) { - $admin->setCaptchaSystem($service); - } - if(isset($key)) { - $admin->setCaptchaKey($key); - } - if(isset($secret)) { - $admin->setCaptchaSecret($secret); - } - - header("location: system.php"); + if (isset($_POST["SystemStatus"])) { + $Systemstatus = Util::securevar($_POST["SystemStatus"]); + } + if (isset($_POST["SystemMaint"])) { + $SystemMaint = Util::securevar($_POST["SystemMaint"]); + } + if (isset($_POST["SystemVersion"])) { + $SystemVersion = Util::securevar($_POST["SystemVersion"]); + } + if (isset($_POST["invite"])) { + $invite = Util::securevar($_POST["invite"]); + } + if (isset($_POST['Systemfreeze'])) { + $Systemfreeze = Util::securevar($_POST['Systemfreeze']); + } + if (isset($_POST['flushchat'])) { + $flushchat = Util::securevar($_POST['flushchat']); + } + if (isset($_POST['shoutbox'])) { + $shoutbox = Util::securevar($_POST['shoutbox']); + } + if (isset($_POST['setnews'])) { + $news = Util::securevar($_POST['setnews']); + } + if (isset($_POST['invwave'])) { + $invwave = Util::securevar($_POST['invwave']); + } + if (isset($_POST['discordlinking'])) { + $discordlinking = Util::securevar($_POST['discordlinking']); + } + if (isset($_POST['discordrelinking'])) { + $discordrelinking = Util::securevar($_POST['discordrelinking']); + } + if (isset($_POST['discordlogging'])) { + $discordlogging = Util::securevar($_POST['discordlogging']); + } + + if (isset($_POST['service'])) { + $service = Util::securevar($_POST['service']); + } + + if (isset($_POST['setkey'])) { + $key = Util::securevar($_POST['site_key']); + } + + if (isset($_POST['setsecret'])) { + $secret = Util::securevar($_POST['site_secret']); + } + + if (isset($_POST['setcolor'])) { + $embed = Util::securevar($_POST['embed_color']); + } + + + Util::adminCheck(); + + if (isset($Systemstatus)) { + $admin->setSystemStatus(); + } + + if (isset($SystemMaint)) { + $admin->setSystemMaint(); + } + + if (isset($SystemVersion)) { + $ver = floatval(Util::securevar($_POST["version"])); + $admin->setSystemVersion($ver); + } + + if (isset($invite)) { + $admin->setinvite(); + } + + if (isset($news)) { + $news = Util::securevar($_POST["msg"]); + $admin->setnews($news); + } + + if (isset($Systemfreeze)) { + $admin->setSystemfreeze(); + } + + if (isset($flushchat)) { + $admin->flushchat(); + } + + if (isset($shoutbox)) { + $admin->setshoutbox(); + } + + if (isset($invwave)) { + $admin->invwave(); + } + if (isset($discordlinking)) { + $admin->setDiscordLink(); + } + if (isset($discordrelinking)) { + $admin->setDiscordReLink(); + } + if (isset($discordlogging)) { + $admin->setDiscordLogging(); + } + if (isset($service)) { + $admin->setCaptchaSystem($service); + } + if (isset($key)) { + $admin->setCaptchaKey($key); + } + if (isset($secret)) { + $admin->setCaptchaSecret($secret); + } + if (isset($embed)) { + $admin->changeEmbedColor($embed); + } + + header("location: system.php"); } @@ -188,11 +195,11 @@

getSystemData()->maintenance == "-" + $System->getSystemData()->maintenance == "-" ) : ?>
No
getSystemData()->maintenance == "UNDER" + $System->getSystemData()->maintenance == "UNDER" ) : ?>
Yes
@@ -212,11 +219,11 @@

getSystemData()->invites == "0" + $System->getSystemData()->invites == "0" ) : ?>
Disabled
getSystemData()->invites == "1" + $System->getSystemData()->invites == "1" ) : ?>
Enabled
@@ -236,9 +243,9 @@

getSystemData()->frozen == 1) { - Util::display("Frozen"); + Util::display("Frozen"); } else { - Util::display("Normal"); + Util::display("Normal"); } ?>

sub-status
@@ -254,9 +261,9 @@

getSystemData()->shoutbox == 1) { - Util::display("Enabled"); + Util::display("Enabled"); } else { - Util::display("Disabled"); + Util::display("Disabled"); } ?>

shoutbox-status
@@ -273,9 +280,9 @@

getSystemData()->discordlinking == 1) { - Util::display("Enabled"); + Util::display("Enabled"); } else { - Util::display("Disabled"); + Util::display("Disabled"); } ?>

discord-linking
@@ -292,9 +299,9 @@

getSystemData()->relinkdiscord == 1) { - Util::display("Enabled"); + Util::display("Enabled"); } else { - Util::display("Disabled"); + Util::display("Disabled"); } ?>

discord-re-linking
@@ -311,9 +318,9 @@

getSystemData()->discordlogging == 1) { - Util::display("Enabled"); + Util::display("Enabled"); } else { - Util::display("Disabled"); + Util::display("Disabled"); } ?>

discord-logging
@@ -330,16 +337,16 @@

getSystemData()->cap_service; -if ($service == 1) { - Util::display("Turnstile"); -} elseif ($service == 2) { - Util::display("hCaptcha"); -} elseif ($service == 3) { - Util::display("reCaptcha"); -} elseif ($service == 0) { - Util::display("None"); -} -?> + if ($service == 1) { + Util::display("Turnstile"); + } elseif ($service == 2) { + Util::display("hCaptcha"); + } elseif ($service == 3) { + Util::display("reCaptcha"); + } elseif ($service == 0) { + Util::display("None"); + } + ?>

captcha-service
@@ -409,23 +416,23 @@
"> -
-
-
- +
+
+
+ +
-
-
-
- +
+
+ +
-
- +
">
@@ -437,7 +444,7 @@
"> -
+
@@ -446,8 +453,21 @@
+
"> +
+
+
+ + +
+
+ +
+
+
+
\ No newline at end of file diff --git a/src/app/controllers/AdminController.php b/src/app/controllers/AdminController.php index 1805d42..a680710 100644 --- a/src/app/controllers/AdminController.php +++ b/src/app/controllers/AdminController.php @@ -235,4 +235,12 @@ public function setCaptchaSecret($secret) { return $this->cahngeCaptchaSecret($secret); } + + public function changeEmbedColor($color) + { + + $color = ltrim($color, '#'); + return $this->setEmbedColor($color); + } + } diff --git a/src/app/controllers/UserController.php b/src/app/controllers/UserController.php index 826cef0..0256ef0 100644 --- a/src/app/controllers/UserController.php +++ b/src/app/controllers/UserController.php @@ -730,4 +730,9 @@ public function downloadAvatarWithAccessToken($userId, $uid) return false; } + + public function getEmbedColor() + { + return $this->getCurrentColor(); + } } diff --git a/src/app/models/AdminModel.php b/src/app/models/AdminModel.php index 1b816f2..a862979 100644 --- a/src/app/models/AdminModel.php +++ b/src/app/models/AdminModel.php @@ -834,4 +834,12 @@ protected function cahngeCaptchaSecret($secret) $this->statement->execute([$secret]); } } + + protected function setEmbedColor($color) + { + if ($this->checkadmin()) { + $this->prepare('UPDATE `system` SET `embed_color` = ?'); + $this->statement->execute([$color]); + } + } } diff --git a/src/app/models/UsersModel.php b/src/app/models/UsersModel.php index 3c54184..ea6ce3b 100644 --- a/src/app/models/UsersModel.php +++ b/src/app/models/UsersModel.php @@ -2,7 +2,6 @@ // Extends to class Database // Only Protected methods -// Only interats with 'users' table require_once SITE_ROOT . "/app/core/Database.php"; require_once SITE_ROOT . "/app/controllers/SystemController.php"; @@ -537,7 +536,7 @@ protected function sendlog($username, $action, $webhook) "title" => $title, "description" => SITE_NAME, "timestamp" => $timestamp, - "color" => hexdec("F03BEA"), + "color" => hexdec($this->getCurrentColor()), "fields" => [ [ "name" => "User:", @@ -902,6 +901,14 @@ protected function hasLinkedDiscord() } } + protected function getCurrentColor() + { + $this->prepare('SELECT * FROM `system`'); + $this->statement->execute(); + $data = $this->statement->fetch(); + + return $data->embed_color; + } protected function get_user_Browser()