From 59cd40235bf4746a119421609b25d7e9b7f65f83 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Mon, 15 May 2023 18:15:37 +0300 Subject: refactoring framework defaults --- core/auth/env.example | 36 ------- core/classes/Database.php | 2 +- core/config/anom_settings.php | 209 -------------------------------------- core/config/constants.php | 28 ----- core/config/init.php | 11 +- core/config/xx--anom_settings.php | 66 ++++++++++++ core/config/xx--constants.php | 28 +++++ core/helpers/autoload.php | 2 +- 8 files changed, 99 insertions(+), 283 deletions(-) delete mode 100644 core/auth/env.example delete mode 100644 core/config/anom_settings.php delete mode 100644 core/config/constants.php create mode 100644 core/config/xx--anom_settings.php create mode 100644 core/config/xx--constants.php (limited to 'core') diff --git a/core/auth/env.example b/core/auth/env.example deleted file mode 100644 index fd47dd8..0000000 --- a/core/auth/env.example +++ /dev/null @@ -1,36 +0,0 @@ -ENVIRONMENT='development' - -# MySQL connection -# --- -- -- - - - -DB_NAME= -DB_USER= -DB_PASS= -PDO_HOST= - -# mailhog -# == testting/fake email service -# --- -- -- - - - -# MAIL_HOST=mailhog_server -# MAIL_PORT=1025 -# MAIL_USERNAME= -# MAIL_PASSWORD= -# MAIL_ENCRYPTION= - -# SMTP setup -# == read mail server -# --- -- -- - - - -MAIL_MAILER=smtp -MAIL_HOST= -MAIL_PORT=465 -MAIL_USERNAME= -MAIL_PASSWORD= -MAIL_ENCRYPTION=ssl -NO_REPLY_EMAIL=noreply@... -REPLY_TO_EMAIL=webmaster@r... -MAIL_FROM_NAME=Classroom - -# redis cache server -# --- -- -- - - - -# REDIS_HOST=redis -# REDIS_PASSWORD= -# REDIS_PORT=6379 \ No newline at end of file diff --git a/core/classes/Database.php b/core/classes/Database.php index 0a8a10a..9de9872 100644 --- a/core/classes/Database.php +++ b/core/classes/Database.php @@ -125,7 +125,7 @@ class Database { } // keep rowCount (valid for INSERT, UPDATE, DELETE) - $this->rowCount = $stmt->rowCount(); + $this->rowCount = $stmt->rowCount(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); diff --git a/core/config/anom_settings.php b/core/config/anom_settings.php deleted file mode 100644 index 03e4cc5..0000000 --- a/core/config/anom_settings.php +++ /dev/null @@ -1,209 +0,0 @@ - 'text/html; charset=UTF-8', - 'html' => 'text/html; charset=UTF-8', - 'json' => 'application/json; charset=utf-8', - 'js' => 'application/javascript; charset=utf-8', - 'css' => 'text/css', - 'png' => 'image/png', - 'jpeg' => 'image/jpeg', - 'webp' => 'image/web' - ) -); - - -// PROXY_FLAGS -// ----------------------------------------------------------------------------- -// These options represend altered/non-default behaviour -// and will be resolved bitwise, so use powers of 2 -// ----------------------------------------------------------------------------- -define('PROXY_CACHE_ERRORS', 1); // cache result even if error -define('PROXY_IGNORE_CACHE', 2); // ignore cache if exist -define('PROXY_DO_NOT_CACHE', 4); // do not cache result diff --git a/core/config/init.php b/core/config/init.php index 589a486..40624d3 100644 --- a/core/config/init.php +++ b/core/config/init.php @@ -18,14 +18,9 @@ // setup error-handliing // ----------------------------------------------------------------------------- -require_once '../core/helpers/error_handling.php'; +require_once APP_ROOT.'/core/helpers/error_handling.php'; -// depricated: -/// // Load rendering sub-system -/// // ----------------------------------------------------------------------------- -/// require_once RENDERING_SYSTEM; - // Setup Application Engiine // ----------------------------------------------------------------------------- @@ -55,10 +50,10 @@ Registry::set('REQUEST', new Request()); // (these patterns use some of the project's central objects (Registry, // Cache, Database), so laod them after. // ----------------------------------------------------------------------------- -require_once '../core/helpers/design_patterns.php'; +require_once APP_ROOT.'/core/helpers/design_patterns.php'; // Add Routes // ----------------------------------------------------------------------------- -require_once 'app/config/init_routes.php'; // initialize routes +require_once WEB_ROOT.'/app/config/init_routes.php'; // initialize routes diff --git a/core/config/xx--anom_settings.php b/core/config/xx--anom_settings.php new file mode 100644 index 0000000..06fe5af --- /dev/null +++ b/core/config/xx--anom_settings.php @@ -0,0 +1,66 @@ + 'text/html; charset=UTF-8', + 'html' => 'text/html; charset=UTF-8', + 'json' => 'application/json; charset=utf-8', + 'js' => 'application/javascript; charset=utf-8', + 'css' => 'text/css', + 'png' => 'image/png', + 'jpeg' => 'image/jpeg', + 'webp' => 'image/web' + ) +); + + +// PROXY_FLAGS +// ----------------------------------------------------------------------------- +// These options represend altered/non-default behaviour +// and will be resolved bitwise, so use powers of 2 +// ----------------------------------------------------------------------------- +define('PROXY_CACHE_ERRORS', 1); // cache result even if error +define('PROXY_IGNORE_CACHE', 2); // ignore cache if exist +define('PROXY_DO_NOT_CACHE', 4); // do not cache result diff --git a/core/helpers/autoload.php b/core/helpers/autoload.php index c4359c6..c72c335 100644 --- a/core/helpers/autoload.php +++ b/core/helpers/autoload.php @@ -18,7 +18,7 @@ spl_autoload_register( // check all possible classPaths for class foreach(CLASSPATHS as $key => $basePath) { - $file = APP_ROOT . $basePath . $classPath .'.php'; + $file = WEB_ROOT . $basePath . $classPath .'.php'; // if class-file exist, include it if (file_exists($file)) { -- cgit v1.2.3