From a459b86169c5df782d9193b1c446bb74a1b0f349 Mon Sep 17 00:00:00 2001 From: Nick Yeoman Date: Fri, 7 Nov 2025 14:45:13 -0800 Subject: [PATCH] added sitemap and docs --- README.md | 20 +++++++++++++++ config/routes.php | 5 +++- controllers/sitemap.php | 42 +++++++++++++++++++++++++++++++ docs/ConfigurationFile.md | 52 +++++++++++++++++++++++++++++++++++++++ docs/Logs.md | 4 +-- src/novaconium.php | 2 +- 6 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 controllers/sitemap.php create mode 100644 docs/ConfigurationFile.md diff --git a/README.md b/README.md index 3d9dfcb..6f978f1 100644 --- a/README.md +++ b/README.md @@ -33,3 +33,23 @@ docker compose up -d * [Novaconiumm Official Repo](https://git.4lt.ca/4lt/novaconium) * [CORXN Apache and PHP Container for Novaconium](https://git.4lt.ca/4lt/CORXN) + + +### How it works + +#### htaccess + +htaccess ensures that all requests are sent to index.php + +#### index.php + +index.php does two things: +1. Allows you to turn on error reporting (off by default) +2. Loads the novaconium bootstrap file novaconium.php + +#### novaconium.php + +What happens here: + +1. Autoload composer +1. Loads configurations \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 43b8428..9ed7073 100644 --- a/config/routes.php +++ b/config/routes.php @@ -40,5 +40,8 @@ $framework_routes = [ '/novaconium/logout' => [ 'post' => 'NOVACONIUM/logout', 'get' => 'NOVACONIUM/logout' - ] + ], + '/novaconium/sitemap.xml' => [ + 'get' => 'NOVACONIUM/sitemap' + ], ]; \ No newline at end of file diff --git a/controllers/sitemap.php b/controllers/sitemap.php new file mode 100644 index 0000000..045304b --- /dev/null +++ b/controllers/sitemap.php @@ -0,0 +1,42 @@ + 0 + AND draft = 0 + ORDER BY updated DESC; +EOSQL; +$thepages = $db->getRows($query); + +// Start the view +echo ''; +echo ''; + +// Loop through the pages +if ( ! empty($thepages) ) { + foreach( $thepages as $v) { + + $date = (new \DateTime($v['updated']))->format('Y-m-d'); + + echo ""; + + if ( empty($v['path']) ) + echo "" . $config['base_url'] . '/page/' . $v['slug'] . ""; + else + echo "" . $config['base_url'] . $v['path'] . ""; + + echo "" . $date . ""; + echo "" . $v['changefreq'] . ""; + echo "" . sprintf("%.1f", $v['priority']) . ""; + echo ""; + + } +} else { + echo "no pages added yet"; +} + +echo ""; diff --git a/docs/ConfigurationFile.md b/docs/ConfigurationFile.md new file mode 100644 index 0000000..e8629d2 --- /dev/null +++ b/docs/ConfigurationFile.md @@ -0,0 +1,52 @@ +# Configuration File + +## App/config.php + +The configuration file holds a php multi dimentional array for configuration. + +#### database + +This is the connection setting for mariadb. + +``` +'database' => [ + 'host' => 'ny-db', + 'name' => 'nydb', + 'user' => 'nydbu', + 'pass' => 'as7!d5fLKJ2DLKJS5', + 'port' => 3306 + ], +``` + +#### base_url + +Defines the url to use +``` +'base_url' => 'https://www.nickyeoman.com', +``` + +#### secure_key + +The security key is used to verify admin account and salt encrpytion functions. +You can generate a key with ```pwgen -cnsB1v 64``` +but if you don't set one, novaconium will generate one for you to use (you have to explicily set it though). + +``` +'secure_key' => '', +``` + +#### logfile + +sets the path of the log file. + +``` +'logfile' => '/logs/novaconium.log', +``` + +#### loglevel + +Sets the logging level for the app. + +``` +'loglevel' => 'ERROR' // 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'NONE' +``` diff --git a/docs/Logs.md b/docs/Logs.md index 30fddbe..6c520aa 100644 --- a/docs/Logs.md +++ b/docs/Logs.md @@ -3,7 +3,7 @@ You can use the logging class to output to a file. -use ```$log->info(The Message');```1 +use ```$log->info(The Message');``` Logging levels are: ``` @@ -16,4 +16,4 @@ Logging levels are: It's recommended that production is set to ERROR. You set the log level in /App/config.php under 'loglevel' => 'ERROR' -If you are using CORXN a health check is run every 30 seconds which would fill the log file with info. + diff --git a/src/novaconium.php b/src/novaconium.php index 1bc5a9e..aaffae0 100644 --- a/src/novaconium.php +++ b/src/novaconium.php @@ -7,7 +7,7 @@ require_once(BASEPATH . '/vendor/autoload.php'); if (file_exists(BASEPATH . '/App/config.php')) { require_once(BASEPATH . '/App/config.php'); } else { - require_once(FRAMEWORKPATH . '/defaults/App/config.php'); + require_once(FRAMEWORKPATH . '/skeleton/novaconium/App/config.php'); } // Logging