Skip to content

Commit

Permalink
Updating hibernate system & control panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
lewmilburn committed Apr 29, 2024
1 parent 0180c64 commit 472e749
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
12 changes: 6 additions & 6 deletions Plugins/ControlPanel/CPRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public function Register(Router $Router): void
private function Account(bool $Authenticated): void
{
if ($Authenticated) {
$this->Router->GET(CPURL_ACCOUNT, '../Plugins/ControlPanel/Views/Account.php');
$this->Router->GET(CPURL_ACCOUNT.CPURL_JOIN, '../Plugins/ControlPanel/Views/Account.php');
$this->Router->GET(CPURL_ACCOUNT.CPURL_LOGOUT, '../Processes/Saturn/AccountManager/Logout.php');
$this->Router->GET(CPURL_ACCOUNT, CPPAGE_ACCOUNT);
$this->Router->GET(CPURL_ACCOUNT.CPURL_JOIN, CPPAGE_ACCOUNT);
$this->Router->GET(CPURL_ACCOUNT.CPURL_LOGOUT, CPPAGE_LOGOUT);
} else {
$this->Router->GET('/account', CPPAGE_LOGIN);
$this->Router->GET('/account/join', '../Plugins/ControlPanel/Views/Join.php');
$this->Router->GET('/account/logout', '../Processes/Saturn/AccountManager/Logout.php');
$this->Router->GET(CPURL_ACCOUNT, CPPAGE_LOGIN);
$this->Router->GET(CPURL_ACCOUNT.CPURL_JOIN, CPPAGE_REGISTER);
$this->Router->GET(CPURL_ACCOUNT.CPURL_LOGOUT, CPPAGE_LOGOUT);
}
}

Expand Down
4 changes: 4 additions & 0 deletions Plugins/ControlPanel/CPURLs.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
const CPURL_EDIT = '/edit';
const CPURL_PLUGINS = '/plugins';
const CPURL_USERS = '/users';

const CPPAGE_NOACCESS = '../Plugins/ControlPanel/Views/NoAccess.php';
const CPPAGE_LOGIN = '../Plugins/ControlPanel/Views/Login.php';
const CPPAGE_REGISTER = '../Plugins/ControlPanel/Views/Join.php';
const CPPAGE_LOGOUT = '../Plugins/ControlPanel/Views/Logout.php';
const CPPAGE_ACCOUNT = '../Plugins/ControlPanel/Views/Account.php';
2 changes: 1 addition & 1 deletion Processes/DefaultViews/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<?= __('Maintenance_Mode_Message_2'); ?>
</p>

<a class="navigation-item dark:text-white" href="<?= SATURN_ROOT; ?>/account">
<a class="navigation-item dark:text-white" href="<?= SATURN_ROOT; ?>/panel">
<?= __('Admin_Login'); ?>
</a>
</div>
Expand Down
13 changes: 2 additions & 11 deletions Processes/Saturn/PluginManager/Hibernate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,9 @@

class Hibernate
{
public function Hibernate($Manifest): bool
public function IsHibernating($Manifest): bool
{
foreach ($Manifest->Hibernate as $Hibernate) {
return $this->URL($Hibernate);
}

return false;
}

public function URL($URL): bool
{
if (str_contains($_SERVER['REQUEST_URI'], $URL)) {
if (in_array($_SERVER['REQUEST_URI'], $Manifest->Hibernate)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion Processes/Saturn/PluginManager/PluginLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function Load(): void

if ($Manifest->Hibernate !== false) {
$Hibernate = new Hibernate();
if ($Hibernate->Hibernate($Manifest)) {
if ($Hibernate->IsHibernating($Manifest)) {
$this->LoadStatus($Plugin, false, 'Plugin is hibernating. It will load and be ready to use when needed.');
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions Processes/Saturn/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
const SATSYS_DISALLOWED_PAGES = ['Assets', 'Plugins', 'Processes', 'Settings', 'Storage', 'Themes', 'panel', 'account', 'api'];

// Website modes
const MODE_MAINT = 0;
const MODE_LIVE = 1;
const MODE_MAINT = 1;
const MODE_LIVE = 0;

// Website environemnts
const ENV_PROD = 0;
Expand Down
2 changes: 2 additions & 0 deletions Processes/Start.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ function __(string $Text): string

$Actions->Run('Saturn.PostStart');

var_dump($SaturnPlugins);

// ROUTER
require_once __DIR__.'/Router.php';

Expand Down

0 comments on commit 472e749

Please sign in to comment.