From a34b190f335517565abefaf7726f37027de3a2cd Mon Sep 17 00:00:00 2001 From: khodakhah Date: Sun, 7 Aug 2022 18:31:54 +0000 Subject: [PATCH] Release v3.3.1 --- .env | 30 ++++++++++++++++++++++++++++++ public/index.php | 28 +++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..2dbab39 --- /dev/null +++ b/.env @@ -0,0 +1,30 @@ +#-------------------------------------------------------------------- +# Example Environment Configuration file +# +# This file can be used as a starting point for your own +# custom .env files, and contains most of the possible settings +# available in a default install. +# +# By default, all of the settings are commented out. If you want +# to override the setting, you must un-comment it by removing the '#' +# at the beginning of the line. +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# ENVIRONMENT +#-------------------------------------------------------------------- + +CI_ENVIRONMENT=production + +ENVIRONMENT=production +#-------------------------------------------------------------------- +# APP +#-------------------------------------------------------------------- + +# If you have trouble with NodCMS dynamic base url finder. Uncomment the bellow line and place your domain in there. +# app.baseURL='https://your-domain' +# If you have trouble with `.`, you could also use `_`. +# app_baseURL = '' +# app.forceGlobalSecureRequests=false + +# app.CSPEnabled=false diff --git a/public/index.php b/public/index.php index 197befc..d5c53c2 100644 --- a/public/index.php +++ b/public/index.php @@ -18,9 +18,6 @@ } unset($minPHPVersion); -// Acceptable values: development, testing, production -define('ENVIRONMENT', 'production'); - // Path to the front controller (this file) define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR); @@ -39,7 +36,7 @@ define("URL_PROTOCOL", $protocol_status ? "https://" : "http://"); // Find the base url -define("CONFIG_BASE_URL", URL_PROTOCOL.$_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/"); +define("CONFIG_BASE_URL", URL_PROTOCOL.$_SERVER['HTTP_HOST'] . rtrim(dirname(str_replace('index.php/', '', $_SERVER['PHP_SELF'])), '/\\') . "/"); define("DB_CONFIG_PATH", COREPATH.'Config/Database.php'); @@ -68,7 +65,27 @@ $paths = new Config\Paths(); // Location of the framework bootstrap file. -$app = require rtrim($paths->systemDirectory, '/ ') . '/bootstrap.php'; +require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php'; + + +// Load environment settings from .env files into $_SERVER and $_ENV +require_once SYSTEMPATH . 'Config/DotEnv.php'; +(new CodeIgniter\Config\DotEnv(ROOTPATH))->load(); + +/* + * --------------------------------------------------------------- + * GRAB OUR CODEIGNITER INSTANCE + * --------------------------------------------------------------- + * + * The CodeIgniter class contains the core functionality to make + * the application run, and does all of the dirty work to get + * the pieces all working together. + */ + +$app = Config\Services::codeigniter(); +$app->initialize(); +$context = is_cli() ? 'php-cli' : 'web'; +$app->setContext($context); /* *--------------------------------------------------------------- @@ -77,4 +94,5 @@ * Now that everything is setup, it's time to actually fire * up the engines and make this app do its thang. */ + $app->run();