diff --git a/index.php b/index.php index 471d5f19..89578b21 100644 --- a/index.php +++ b/index.php @@ -7,7 +7,7 @@ */ session_start(); -define('VERSION', '3.1.4'); +define('VERSION', '3.2.0'); mb_internal_encoding('UTF-8'); if (defined('PHPUNIT_TESTING') === false) { @@ -27,6 +27,13 @@ class Wcms 'exists' => 'exist', ]; + /** Database main keys */ + public const DB_CONFIG = 'config'; + public const DB_MENU_ITEMS = 'menuItems'; + public const DB_MENU_ITEMS_SUBPAGE = 'subpages'; + public const DB_PAGES_KEY = 'pages'; + public const DB_PAGES_SUBPAGE_KEY = 'subpages'; + /** @var int MIN_PASSWORD_LENGTH minimum number of characters */ public const MIN_PASSWORD_LENGTH = 8; @@ -39,6 +46,9 @@ class Wcms /** @var string $currentPage - current page */ public $currentPage = ''; + /** @var array $currentPageTree - Tree hierarchy of the current page */ + public $currentPageTree = []; + /** @var bool $currentPageExists - check if current page exists */ public $currentPageExists = false; @@ -57,6 +67,9 @@ class Wcms /** @var string $themesPluginsCachePath path to cached json file with Themes/Plugins data */ protected $themesPluginsCachePath; + /** @var string $securityCachePath path to security json file with force https caching data */ + protected $securityCachePath; + /** @var string $dbPath path to database.js */ protected $dbPath; @@ -72,7 +85,7 @@ class Wcms /** @var string $headerResponse header status */ public $headerResponse = 'HTTP/1.0 200 OK'; - /** + /** * Constructor * * @param string $dataFolder @@ -108,6 +121,7 @@ public function setPaths( $this->dbPath = sprintf('%s/%s', $this->dataPath, $dbName); $this->filesPath = sprintf('%s/%s', $this->dataPath, $filesFolder); $this->themesPluginsCachePath = sprintf('%s/%s', $this->dataPath, 'cache.json'); + $this->securityCachePath = sprintf('%s/%s', $this->dataPath, 'security.json'); } /** @@ -118,8 +132,9 @@ public function setPaths( */ public function init(): void { - $this->pageStatus(); + $this->forceSSL(); $this->loginStatus(); + $this->pageStatus(); $this->logoutAction(); $this->loginAction(); $this->notFoundResponse(); @@ -132,7 +147,8 @@ public function init(): void $this->deleteFileThemePluginAction(); $this->changePageThemeAction(); $this->backupAction(); - $this->betterSecurityAction(); + $this->forceHttpsAction(); + $this->saveChangesPopupAction(); $this->deletePageAction(); $this->saveAction(); $this->updateAction(); @@ -207,16 +223,25 @@ public function alerts(): string return ''; } $output = ''; - $output .= '
Your password for editing everything is: ' . $password . '
-To install an awesome editor, open Settings -> Plugins -> Install Summernote.
' +To install an awesome editor, open Settings/Plugins and click Install Summernote.
', + self::DB_PAGES_SUBPAGE_KEY => new stdClass() ], - 'example' => [ - 'title' => 'Example', - 'keywords' => 'Keywords, are, good, for, search, engines', - 'description' => 'A short description is also good.', - 'content' => 'Click anywhere to edit, click outside the area to save. Changes are live and shown immediately.
+ 'how-to' => [ + 'title' => 'How to', + 'keywords' => 'Enter, keywords, for, this page', + 'description' => 'A page description is also good for search engines.', + 'content' => 'After logging in, click anywhere to edit and click outside to save. Changes are live and shown immediately.
-Pages can be created in the Menu above.
+Pages can be created in the Settings.
-To install, update or remove themes/plugins, visit the Settings.
-WonderCMS has been free for over 10 years.
-Click here to support us by getting a t-shirt or here to donate.
' +WonderCMS is free for over 12 years.
+Click here to support us by getting a T-shirt or with a donation.