+
+ Run('ControlPanel.PagesListStart'); ?>
+
+ Query('SELECT * FROM `'.DB_PREFIX.'pages` WHERE 1');
+ if ($Pages->num_rows != 0) {
+ $Pages = $Pages->fetch_all(MYSQLI_ASSOC);
+ foreach ($Pages as $Page) {
+ ?>
+
+ = $Page['title']; ?>
+
+ = $Page['url']; ?>
+
+
+
+
= __CP('NoPages'); ?>
+
+
+ Run('ControlPanel.PagesListEnd'); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/Plugins/ControlPanel/Views/Panel.php b/Plugins/ControlPanel/Views/Panel.php
index eadac3e..0a1fdbd 100644
--- a/Plugins/ControlPanel/Views/Panel.php
+++ b/Plugins/ControlPanel/Views/Panel.php
@@ -17,13 +17,16 @@
Run('ControlPanel.DashboardContentStart'); ?>
+
+ = __CP('Pages'); ?>
+
= __CP('Plugins'); ?>
diff --git a/Processes/DefaultViews/Page.php b/Processes/DefaultViews/Page.php
new file mode 100644
index 0000000..07e8ea0
--- /dev/null
+++ b/Processes/DefaultViews/Page.php
@@ -0,0 +1,14 @@
+Query("SELECT * FROM `".DB_PREFIX."pages` WHERE `url` = '".$DBMS->Escape($_SERVER['REQUEST_URI'])."';");
+$PageData = $Page->fetch_object();
+?>
+
+
+
= $PageData->title; ?>
+
+
+ = $PageData->content; ?>
+
+
\ No newline at end of file
diff --git a/Processes/Saturn/DatabaseManager/DBMS.php b/Processes/Saturn/DatabaseManager/DBMS.php
index 2e5d3b9..e409c41 100644
--- a/Processes/Saturn/DatabaseManager/DBMS.php
+++ b/Processes/Saturn/DatabaseManager/DBMS.php
@@ -58,6 +58,11 @@ public function Select(string $What, string $From, string|null $Where, string $A
return $this->Database->Select($What, DB_PREFIX.$From, $Where, $Action, $Order, $Limit);
}
+ public function Query(string $Query)
+ {
+ return $this->Database->Query($Query);
+ }
+
public function Insert(string $Into, string|null $Columns, string|null $Values): array|object|int|null
{
return $this->Database->Insert(DB_PREFIX.$Into, $Columns, $Values);
diff --git a/Processes/Saturn/DatabaseManager/MySQLiDB.php b/Processes/Saturn/DatabaseManager/MySQLiDB.php
index 541ed94..8d8f68f 100644
--- a/Processes/Saturn/DatabaseManager/MySQLiDB.php
+++ b/Processes/Saturn/DatabaseManager/MySQLiDB.php
@@ -101,4 +101,9 @@ public function Insert(string $Into, string $Columns, string $Values): array|obj
{
return $this->MySQLi->query('INSERT INTO `'.$Into.'` ('.$Columns.') VALUES ('.$Values.')');
}
+
+ public function Query($Query)
+ {
+ return $this->MySQLi->query($Query);
+ }
}
diff --git a/Processes/Saturn/RouteManager/RouteMain.php b/Processes/Saturn/RouteManager/RouteMain.php
index 7e2d745..7eef5f1 100644
--- a/Processes/Saturn/RouteManager/RouteMain.php
+++ b/Processes/Saturn/RouteManager/RouteMain.php
@@ -15,11 +15,9 @@ public function __construct(Router $Router)
public function Register(): void
{
- if (WEBSITE_MODE == 0 /*|| (WEBSITE_MODE == 1 && AUTH)*/) {
- // Homepage
- $this->Router->GET('/', 'DefaultViews/NoHomepage.php');
- } elseif (WEBSITE_MODE == 1) {
- $this->Router->GET('/', 'DefaultViews/Maintenance.php');
+ if (WEBSITE_MODE == 1) {
+ require_once __DIR__ . '/../../DefaultViews/Maintenance.php';
+ exit;
}
}
}
diff --git a/Processes/Saturn/RouteManager/RoutePages.php b/Processes/Saturn/RouteManager/RoutePages.php
new file mode 100644
index 0000000..39c2a26
--- /dev/null
+++ b/Processes/Saturn/RouteManager/RoutePages.php
@@ -0,0 +1,29 @@
+Router = $Router;
+ }
+
+ public function Register(): void
+ {
+ $DBMS = new DBMS();
+ $Page = $DBMS->Query("SELECT * FROM `".DB_PREFIX."pages` WHERE `url` = '".$DBMS->Escape($_SERVER['REQUEST_URI'])."';");
+
+ if ($Page !== NULL && $Page->num_rows !== 0) {
+ $this->Router->GET($DBMS->Escape($_SERVER['REQUEST_URI']), 'DefaultViews/Page.php');
+ } elseif ($DBMS->Escape($_SERVER['REQUEST_URI']) === '/') {
+ require_once __DIR__ . '/../../DefaultViews/NoHomepage.php';
+ exit;
+ }
+ }
+}
diff --git a/Processes/Saturn/RouteManager/Routes.php b/Processes/Saturn/RouteManager/Routes.php
index 4eb8084..919a8af 100644
--- a/Processes/Saturn/RouteManager/Routes.php
+++ b/Processes/Saturn/RouteManager/Routes.php
@@ -21,6 +21,10 @@ public function Register(): void
$RouteAPI = new RouteAPI($Router);
$RouteAPI->Register();
+ require_once __DIR__.'/RoutePages.php';
+ $RoutePages = new RoutePages($Router);
+ $RoutePages->Register();
+
echo '404 - Page not found.';
}
}
diff --git a/Settings/Settings.php b/Settings/Settings.php
index 3094817..26a99fa 100644
--- a/Settings/Settings.php
+++ b/Settings/Settings.php
@@ -34,7 +34,7 @@
const DB_PASS = '';
const DB_PORT = 3306;
const DB_CHARSET = 'utf8mb4';
-const DB_PREFIX = 'Saturn_';
+const DB_PREFIX = 'saturn_';
const DB_OPTIONS = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,