From 6c6dc99cff6bf20e4196104822d624805cfe075a Mon Sep 17 00:00:00 2001 From: Lewis Milburn Date: Mon, 29 Apr 2024 16:43:15 +0100 Subject: [PATCH] Updating basic systems. --- Plugins/ControlPanel/Checksums.php | 8 ++------ Plugins/ControlPanel/Views/Include/Navigation.php | 2 +- Plugins/ControlPanel/Views/Join.php | 2 +- Plugins/ControlPanel/Views/Login.php | 2 +- Processes/DefaultViews/Error.php | 10 +++++----- .../DefaultViews}/Maintenance.php | 13 ++++++++++--- Processes/Load.php | 1 - Processes/Saturn/AccountManager/Login.php | 4 ++-- Processes/Saturn/DatabaseManager/DBMS.php | 8 ++------ Processes/Saturn/HTTP/Router.php | 8 -------- Processes/Saturn/RouteManager/RouteMain.php | 2 +- Processes/Saturn/System.php | 8 ++++++++ Settings/Settings.php | 4 ++-- Settings/Theme.php | 14 -------------- Storage/{Theme => }/Logo.webp | Bin 15 files changed, 35 insertions(+), 51 deletions(-) rename {Themes/Andromeda => Processes/DefaultViews}/Maintenance.php (77%) delete mode 100644 Settings/Theme.php rename Storage/{Theme => }/Logo.webp (100%) diff --git a/Plugins/ControlPanel/Checksums.php b/Plugins/ControlPanel/Checksums.php index 3c3b281..ae2b758 100644 --- a/Plugins/ControlPanel/Checksums.php +++ b/Plugins/ControlPanel/Checksums.php @@ -8,7 +8,6 @@ public function Validate() { $CoreSettings = hash_file('sha3-512', __DIR__.'/../../Settings/Settings.php'); $CoreDeveloper = hash_file('sha3-512', __DIR__.'/../../Settings/Developer.php'); - $CoreTheme = hash_file('sha3-512', __DIR__.'/../../Settings/Theme.php'); require_once __DIR__.'/Assets/ChkValues.php'; if ($Checksum['CoreSettings'] !== $CoreSettings) { @@ -17,17 +16,14 @@ public function Validate() if ($Checksum['CoreDeveloper'] !== $CoreDeveloper) { return false; } - if ($Checksum['CoreTheme'] !== $CoreTheme) { - return false; - } + return true; } public function Reset() { $CoreSettings = hash_file('sha3-512', __DIR__.'/../../Settings/Settings.php'); $CoreDeveloper = hash_file('sha3-512', __DIR__.'/../../Settings/Developer.php'); - $CoreTheme = hash_file('sha3-512', __DIR__.'/../../Settings/Theme.php'); - $Data = '
- Logo + Logo
diff --git a/Plugins/ControlPanel/Views/Join.php b/Plugins/ControlPanel/Views/Join.php index 163d75b..7337f41 100644 --- a/Plugins/ControlPanel/Views/Join.php +++ b/Plugins/ControlPanel/Views/Join.php @@ -19,7 +19,7 @@
- Logo + Logo
diff --git a/Plugins/ControlPanel/Views/Login.php b/Plugins/ControlPanel/Views/Login.php index 20c31d1..10587f4 100644 --- a/Plugins/ControlPanel/Views/Login.php +++ b/Plugins/ControlPanel/Views/Login.php @@ -19,7 +19,7 @@
- Logo + Logo
diff --git a/Processes/DefaultViews/Error.php b/Processes/DefaultViews/Error.php index 15b7c95..836857c 100644 --- a/Processes/DefaultViews/Error.php +++ b/Processes/DefaultViews/Error.php @@ -83,15 +83,15 @@ - - - - - + To see more advanced information please switch your website environment to development (0). + + + + diff --git a/Themes/Andromeda/Maintenance.php b/Processes/DefaultViews/Maintenance.php similarity index 77% rename from Themes/Andromeda/Maintenance.php rename to Processes/DefaultViews/Maintenance.php index dbf9936..0409a62 100644 --- a/Themes/Andromeda/Maintenance.php +++ b/Processes/DefaultViews/Maintenance.php @@ -1,4 +1,11 @@ - + <?= WEBSITE_NAME; ?> @@ -10,7 +17,7 @@
- <?= WEBSITE_NAME; ?> + <?= WEBSITE_NAME; ?>

@@ -27,4 +34,4 @@

- \ No newline at end of file + diff --git a/Processes/Load.php b/Processes/Load.php index dd348ca..1f54b42 100644 --- a/Processes/Load.php +++ b/Processes/Load.php @@ -17,7 +17,6 @@ // SETTINGS require_once __DIR__.'/../Settings/Developer.php'; require_once __DIR__.'/../Settings/Settings.php'; -require_once __DIR__.'/../Settings/Theme.php'; // TEST MANAGER require_once __DIR__.'/Saturn/TestManager/Profiler.php'; diff --git a/Processes/Saturn/AccountManager/Login.php b/Processes/Saturn/AccountManager/Login.php index ec91dfc..28d41c4 100644 --- a/Processes/Saturn/AccountManager/Login.php +++ b/Processes/Saturn/AccountManager/Login.php @@ -3,7 +3,7 @@ /** * Saturn Account Manager - Login. * - * Allows users to login to Saturn. + * Allows users to log in to Saturn. */ use Saturn\DatabaseManager\DBMS; @@ -14,7 +14,7 @@ $DB = new DBMS(); $CSRF = new CSRF(); -$Result = $DB->Select('*', 'user', "`username` = '".$DB->Escape($_POST['username'])."'", 'first:object'); +$Result = $DB->Select('*', 'user', "`username` = '" . $DB->Escape($_POST['username']) . "'", 'first:object'); if ($DB->RowCount() == 1) { if ($CSRF->Check()) { diff --git a/Processes/Saturn/DatabaseManager/DBMS.php b/Processes/Saturn/DatabaseManager/DBMS.php index 088c61a..55a58f9 100644 --- a/Processes/Saturn/DatabaseManager/DBMS.php +++ b/Processes/Saturn/DatabaseManager/DBMS.php @@ -55,15 +55,11 @@ public function Select(string $What, string $From, string|null $Where, string $A $What = '`'.$What.'`'; } - $Result = $this->Database->Select($What, DB_PREFIX.$From, $Where, $Action, $Order, $Limit); - - return $Result; + return $this->Database->Select($What, DB_PREFIX.$From, $Where, $Action, $Order, $Limit); } public function Insert(string $Into, string|null $Columns, string|null $Values): array|object|int|null { - $Result = $this->Database->Insert(DB_PREFIX.$Into, $Columns, $Values); - - return $Result; + return $this->Database->Insert(DB_PREFIX.$Into, $Columns, $Values); } } diff --git a/Processes/Saturn/HTTP/Router.php b/Processes/Saturn/HTTP/Router.php index 40e5f1a..99a857a 100644 --- a/Processes/Saturn/HTTP/Router.php +++ b/Processes/Saturn/HTTP/Router.php @@ -14,8 +14,6 @@ public function GET($Route, $IncludePath): void { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $this->route($Route, $IncludePath); - } else { - $this->BadRequest(); } } @@ -100,10 +98,4 @@ public function route($Route, $IncludePath): void require_once __DIR__.'/../../'.$IncludePath; exit; } - - public function BadRequest(): void - { - $Response = new Response(); - $Response->HTTP405(); - } } diff --git a/Processes/Saturn/RouteManager/RouteMain.php b/Processes/Saturn/RouteManager/RouteMain.php index 94d3a01..7e2d745 100644 --- a/Processes/Saturn/RouteManager/RouteMain.php +++ b/Processes/Saturn/RouteManager/RouteMain.php @@ -19,7 +19,7 @@ public function Register(): void // Homepage $this->Router->GET('/', 'DefaultViews/NoHomepage.php'); } elseif (WEBSITE_MODE == 1) { - $this->Router->GET('/', '/../Themes/'.THEME_SLUG.'/Maintenance.php'); + $this->Router->GET('/', 'DefaultViews/Maintenance.php'); } } } diff --git a/Processes/Saturn/System.php b/Processes/Saturn/System.php index 3de35d6..d434e12 100644 --- a/Processes/Saturn/System.php +++ b/Processes/Saturn/System.php @@ -5,3 +5,11 @@ const SATSYS_RECOMMENDED_PHP = 8.1; const SATSYS_DOCS_URL = 'https://docs.saturncms.net/v/'.SATSYS_VERSION; const SATSYS_DISALLOWED_PAGES = ['Assets', 'Plugins', 'Processes', 'Settings', 'Storage', 'Themes', 'panel', 'account', 'api']; + +// Website modes +const MODE_MAINT = 0; +const MODE_LIVE = 1; + +// Website environemnts +const ENV_PROD = 0; +const ENV_DEV = 1; \ No newline at end of file diff --git a/Settings/Settings.php b/Settings/Settings.php index 595229c..3094817 100644 --- a/Settings/Settings.php +++ b/Settings/Settings.php @@ -18,8 +18,8 @@ // WEBSITE const WEBSITE_NAME = 'Saturn'; const WEBSITE_LANGUAGE = 'en-gb'; -const WEBSITE_MODE = 0; -const WEBSITE_ENV = 0; +const WEBSITE_MODE = MODE_LIVE; +const WEBSITE_ENV = ENV_PROD; const WEBSITE_CHARSET = 'utf-8'; // SATURN diff --git a/Settings/Theme.php b/Settings/Theme.php deleted file mode 100644 index 5896669..0000000 --- a/Settings/Theme.php +++ /dev/null @@ -1,14 +0,0 @@ -