From 6ccbe821892296656c7a58bc6cc9b36b1ae07000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 3 Feb 2024 16:18:48 +0100 Subject: [PATCH] Fix a bunch of stuff --- README.md | 2 +- assets/scripts/home/account.js | 3 --- index.php | 4 +++- lib/account.php | 5 ++++ lib/config.php | 2 +- lib/page.php | 33 -------------------------- lib/router.php | 2 -- pages/home/domov.html | 6 ----- pages/home/index.html | 6 +++++ pages/memes/{domov.html => index.html} | 0 pages/notes/{domov.html => index.html} | 0 pages/smp/{domov.html => index.html} | 4 ++-- templates/403.html | 2 +- templates/404.html | 2 +- templates/500.html | 2 +- templates/register.html | 2 +- templates/skeleton.html | 3 +-- 17 files changed, 23 insertions(+), 55 deletions(-) delete mode 100644 assets/scripts/home/account.js delete mode 100644 pages/home/domov.html create mode 100644 pages/home/index.html rename pages/memes/{domov.html => index.html} (100%) rename pages/notes/{domov.html => index.html} (100%) rename pages/smp/{domov.html => index.html} (95%) diff --git a/README.md b/README.md index 0062c15..0d37dec 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Adlerka.Top -The code for Adlerka.top +The code for https://adlerka.top [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/) diff --git a/assets/scripts/home/account.js b/assets/scripts/home/account.js deleted file mode 100644 index b28b04f..0000000 --- a/assets/scripts/home/account.js +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/index.php b/index.php index 078d973..8789e0a 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,6 @@ -prepare("INSERT INTO Users (FirstName, LastName, Email, PasswordHash, PrivilegeLevel, isActivated, ActivationToken, RegisteredAt) VALUES (?, ?, ?, ?, ?, 1, ?, NOW())"); $privilege_level = $routerConfig["logged_in_default_permission_level"]; + /** @noinspection SpellCheckingInspection */ $stmt->bind_param("ssssis", $firstname, $lastname, $email, $passwordHash, $privilege_level, $activation_token); $stmt->execute(); if ($stmt->affected_rows > 0) { @@ -188,6 +189,7 @@ function updateUserProfile($firstName, $lastName, $nickname, $minecraft_nickname $userID = $_SESSION["ID"]; $stmt = $mysqli->prepare("UPDATE Users SET FirstName = ?, LastName = ?, Nickname = ?, MinecraftNick = ? WHERE ID = ?"); + /** @noinspection SpellCheckingInspection */ $stmt->bind_param("ssssi", $firstName, $lastName, $nickname, $minecraft_nickname, $userID); $stmt->execute(); @@ -206,6 +208,7 @@ function updateUserEmail($email): array { global $mysqli; $status = ["Status" => "Fail"]; + /** @noinspection SpellCheckingInspection */ $validmail = false; if (isLoggedIn() && !empty($email)) { @@ -221,9 +224,11 @@ function updateUserEmail($email): array if ($email != $old_email) { if (isEmailAvailable($email)) { + /** @noinspection SpellCheckingInspection */ $validmail = true; } } else { + /** @noinspection SpellCheckingInspection */ $validmail = true; } diff --git a/lib/config.php b/lib/config.php index 81f2f31..2de72eb 100644 --- a/lib/config.php +++ b/lib/config.php @@ -3,7 +3,7 @@ { global $routerConfig; - $routerConfig["default_page"] = "domov"; + $routerConfig["default_page"] = "index"; $routerConfig["default_site"] = "home"; diff --git a/lib/page.php b/lib/page.php index 6459ea5..936f3b4 100644 --- a/lib/page.php +++ b/lib/page.php @@ -111,45 +111,12 @@ function getPage($page_name = null): array|false|string $page_title = $page_name; } - $site_name = $routerRequest["subdomain"]; - - if(!empty($pageMetadata["parameters"]["page_style"])){ - $style_location = $pageMetadata["parameters"]["page_style"]; - } - else{ - $style_location = "assets/styles/$site_name/$page_name.css"; - } - - if(file_exists($style_location)) { - $style_tag = $style_location; - } - else{ - $style_tag = ""; - } - - if(!empty($pageMetadata["parameters"]["page_script"])){ - $script_location = $pageMetadata["parameters"]["page_script"]; - } - else{ - $script_location = "assets/scripts/$site_name/$page_name.js"; - } - - if(file_exists($style_location)) { - $script_tag = $script_location; - } - else{ - $script_tag = ""; - } - - $navpages = generateNavigation(); $nav = str_replace("__NAV_PAGES__", $navpages, $nav); $out = $skeleton; $out = str_replace("__TEMPLATE__NAV__", $nav, $out); - $out = str_replace("__TEMPLATE_PAGE_STYLE_TAG__", $style_tag, $out); - $out = str_replace("__TEMPLATE_PAGE_SCRIPT_TAG__", $script_tag, $out); $out = str_replace("__TEMPLATE__PAGE__", $page, $out); return str_replace("__TEMPLATE_PAGE_TITLE__", $page_title, $out); } \ No newline at end of file diff --git a/lib/router.php b/lib/router.php index 628a2b4..4223fcd 100644 --- a/lib/router.php +++ b/lib/router.php @@ -25,7 +25,6 @@ function initRouter(): bool if($routerRequest["subdomain"] == $routerConfig["default_site"]){ $routerRequest["subdomain"] = ""; $needsRedirect = true; - header("redirReasonApex: yes"); } } @@ -35,7 +34,6 @@ function initRouter(): bool // Page name is empty $needsRedirect = true; $routerRequest["page_name"] = $routerConfig["default_page"]; - header("redirReasonPage: yes"); } diff --git a/pages/home/domov.html b/pages/home/domov.html deleted file mode 100644 index cfb87d5..0000000 --- a/pages/home/domov.html +++ /dev/null @@ -1,6 +0,0 @@ - -
-

Vitaj na tejto úžasnej stránke

-

Neoficiálna študentská stránka pre adlerku

-
-
\ No newline at end of file diff --git a/pages/home/index.html b/pages/home/index.html new file mode 100644 index 0000000..e5fb4fd --- /dev/null +++ b/pages/home/index.html @@ -0,0 +1,6 @@ + +
+

Vitaj, na tejto úžasnej stránke

+

Neoficiálna študentská stránka pre Adlerku

+
+
\ No newline at end of file diff --git a/pages/memes/domov.html b/pages/memes/index.html similarity index 100% rename from pages/memes/domov.html rename to pages/memes/index.html diff --git a/pages/notes/domov.html b/pages/notes/index.html similarity index 100% rename from pages/notes/domov.html rename to pages/notes/index.html diff --git a/pages/smp/domov.html b/pages/smp/index.html similarity index 95% rename from pages/smp/domov.html rename to pages/smp/index.html index 996d81c..45192bd 100644 --- a/pages/smp/domov.html +++ b/pages/smp/index.html @@ -3,7 +3,7 @@

Vitaj na oficiálnej AdlerkaSMP stránke

Najlepší Minecraft®™ server na Adlerke


- +

Čo môžeš očakávať od AdlerkaSMP:

    @@ -31,5 +31,5 @@
- +
\ No newline at end of file diff --git a/templates/403.html b/templates/403.html index 61f0d4e..0ff5cdb 100644 --- a/templates/403.html +++ b/templates/403.html @@ -2,5 +2,5 @@

TY KÁR KAM TO DEŠ

403

Našli sme stránku ktorú hľadáš, ale nemáš práva na ňu pristupovať: __TEMPLATE_PAGE_TITLE__.

- SPÄŤ DOMOV + SPÄŤ DOMOV \ No newline at end of file diff --git a/templates/404.html b/templates/404.html index 26c6db5..6b355d6 100644 --- a/templates/404.html +++ b/templates/404.html @@ -2,5 +2,5 @@

TY KÁR KAM TO DEŠ

404

Nenašli sme stránku ktorú hľadáš: __TEMPLATE_PAGE_TITLE__.

- SPÄŤ DOMOV + SPÄŤ DOMOV \ No newline at end of file diff --git a/templates/500.html b/templates/500.html index 3b06661..065835a 100644 --- a/templates/500.html +++ b/templates/500.html @@ -2,5 +2,5 @@

Niekto to pobabral

500

Nejaký neschopný vývojár nevedel robiť túto stránku.

- SPÄŤ DOMOV + SPÄŤ DOMOV \ No newline at end of file diff --git a/templates/register.html b/templates/register.html index c648fbb..71941c9 100644 --- a/templates/register.html +++ b/templates/register.html @@ -15,7 +15,7 @@ data.append("nickname", nickname); data.append("email", email); data.append("password", password); - data.append("minecraftnick", minecraftNick); + data.append("minecraft_nick", minecraftNick); data.append("activation_token", activationToken); doRegister(data); diff --git a/templates/skeleton.html b/templates/skeleton.html index cb9f200..5e2831d 100644 --- a/templates/skeleton.html +++ b/templates/skeleton.html @@ -5,8 +5,7 @@ - __TEMPLATE_PAGE_STYLE_TAG__ - __TEMPLATE_PAGE_SCRIPT_TAG__ + Adlerka __TEMPLATE_PAGE_TITLE__