Skip to content

Commit

Permalink
Updating basic systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
lewmilburn committed Apr 29, 2024
1 parent 6776a64 commit 6c6dc99
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 51 deletions.
8 changes: 2 additions & 6 deletions Plugins/ControlPanel/Checksums.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 = '<?php $Checksum[\'CoreSettings\'] = \''.$CoreSettings.'\'; $Checksum[\'CoreDeveloper\'] = \''.$CoreDeveloper.'\'; $Checksum[\'CoreTheme\'] = \''.$CoreTheme.'\';';
$Data = '<?php $Checksum[\'CoreSettings\'] = \''.$CoreSettings.'\'; $Checksum[\'CoreDeveloper\'] = \''.$CoreDeveloper.'\';';
file_put_contents(__DIR__.'/Assets/ChkValues.php', $Data);
}
}
2 changes: 1 addition & 1 deletion Plugins/ControlPanel/Views/Include/Navigation.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nav class="navigation">
<div class="flex-grow self-center">
<a href="<?= SATURN_ROOT; ?>">
<img src="<?= SATURN_ROOT; ?>/Storage/Theme/Logo.webp" alt="Logo" width="125px">
<img src="<?= SATURN_ROOT; ?>../../../../Storage/Logo.webp" alt="Logo" width="125px">
</a>
</div>
<a href="<?= SATURN_ROOT; ?>/panel" class="navigation-item"><?= __CP('ControlPanel'); ?></a>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/ControlPanel/Views/Join.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<body class="body">

<main class="main">
<img src="<?= SATURN_ROOT; ?>/Storage/Theme/Logo.webp" class="w-1/4 mx-auto" alt="Logo">
<img src="<?= SATURN_ROOT; ?>../../../Storage/Logo.webp" class="w-1/4 mx-auto" alt="Logo">

<div class="pb-8">
<form action="<?= SATURN_ROOT; ?>/API/Join" method="POST" class="flex">
Expand Down
2 changes: 1 addition & 1 deletion Plugins/ControlPanel/Views/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<body class="body">

<main class="main">
<img src="<?= SATURN_ROOT; ?>/Storage/Theme/Logo.webp" class="w-1/4 mx-auto" alt="Logo">
<img src="<?= SATURN_ROOT; ?>../../../Storage/Logo.webp" class="w-1/4 mx-auto" alt="Logo">

<div class="pb-8">
<form action="<?= SATURN_ROOT; ?>/API/Login" method="POST" class="flex">
Expand Down
10 changes: 5 additions & 5 deletions Processes/DefaultViews/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@
<td class="td"><?= __('Request_IP'); ?></td>
<td class="td"><?= Out($_SERVER['REMOTE_ADDR']); ?></td>
</tr>
<tr>
<td class="td"><?= __('Software_Version'); ?></td>
<td class="td"><?= Out(SATSYS_VERSION); ?></td>
</tr>
<?php if (WEBSITE_ENV != 0) { ?>
<?php if (WEBSITE_ENV === ENV_PROD) { ?>
<tr>
<td class="td" colspan="2">To see more advanced information please switch your website environment to development (0).</td>
</tr>
<?php } else { ?>
<tr>
<td class="td"><?= __('Software_Version'); ?></td>
<td class="td"><?= Out(SATSYS_VERSION); ?></td>
</tr>
<tr>
<td class="td"><?= __('PHP_Version'); ?></td>
<td class="td"><?= Out(PHP_VERSION); ?></td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<!DOCTYPE html>
<?php

/**
* Saturn View Manager - Maintenance.
*
* This file is used when maintenance mode is activated.
*/
?><!DOCTYPE html>
<html lang="<?= WEBSITE_LANGUAGE; ?>">
<head>
<title><?= WEBSITE_NAME; ?></title>
Expand All @@ -10,7 +17,7 @@
</nav>

<main class="main">
<img src="<?= SATURN_ROOT; ?>/Storage/Theme/Logo.webp" class="w-1/4 mx-auto" alt="<?= WEBSITE_NAME; ?>">
<img src="<?= SATURN_ROOT; ?>../../Storage/Logo.webp" class="w-1/4 mx-auto" alt="<?= WEBSITE_NAME; ?>">

<div class="pb-8">
<h1 class="text-header">
Expand All @@ -27,4 +34,4 @@
</div>
</main>
</body>
</html>
</html>
1 change: 0 additions & 1 deletion Processes/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions Processes/Saturn/AccountManager/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()) {
Expand Down
8 changes: 2 additions & 6 deletions Processes/Saturn/DatabaseManager/DBMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
8 changes: 0 additions & 8 deletions Processes/Saturn/HTTP/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public function GET($Route, $IncludePath): void
{
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$this->route($Route, $IncludePath);
} else {
$this->BadRequest();
}
}

Expand Down Expand Up @@ -100,10 +98,4 @@ public function route($Route, $IncludePath): void
require_once __DIR__.'/../../'.$IncludePath;
exit;
}

public function BadRequest(): void
{
$Response = new Response();
$Response->HTTP405();
}
}
2 changes: 1 addition & 1 deletion Processes/Saturn/RouteManager/RouteMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
8 changes: 8 additions & 0 deletions Processes/Saturn/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions Settings/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions Settings/Theme.php

This file was deleted.

File renamed without changes.

0 comments on commit 6c6dc99

Please sign in to comment.