From f4e8eb176f19b31176bd3a5f9284b54e9ea6fb17 Mon Sep 17 00:00:00 2001 From: Dj Padzensky Date: Wed, 13 Apr 2016 19:03:10 -0700 Subject: Fixing some pathing information, for cases where the KB source tree is not in or under the webroot. --- app/common.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/common.php') diff --git a/app/common.php b/app/common.php index da624844..c9907ce1 100644 --- a/app/common.php +++ b/app/common.php @@ -14,12 +14,12 @@ if (getenv('DATABASE_URL')) { define('DB_NAME', ltrim($dbopts["path"], '/')); } -if (file_exists('config.php')) { - require 'config.php'; +if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'config.php')) { + require __DIR__.DIRECTORY_SEPARATOR.'config.php'; } -if (file_exists('data'.DIRECTORY_SEPARATOR.'config.php')) { - require 'data'.DIRECTORY_SEPARATOR.'config.php'; +if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'config.php')) { + require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'config.php'; } require __DIR__.'/constants.php'; -- cgit v1.2.3 From cc9f3e69c61147811d2dba0828c434ed42c3c372 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 14 Apr 2016 22:08:39 -0400 Subject: Added new constant DATA_DIR --- app/common.php | 12 ++++++++---- app/constants.php | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'app/common.php') diff --git a/app/common.php b/app/common.php index c9907ce1..aed07a50 100644 --- a/app/common.php +++ b/app/common.php @@ -14,12 +14,16 @@ if (getenv('DATABASE_URL')) { define('DB_NAME', ltrim($dbopts["path"], '/')); } -if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'config.php')) { - require __DIR__.DIRECTORY_SEPARATOR.'config.php'; +$config_file = implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'config.php')); + +if (file_exists($config_file)) { + require $config_file; } -if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'config.php')) { - require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'config.php'; +$config_file = implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'data', 'config.php')); + +if (file_exists($config_file)) { + require $config_file; } require __DIR__.'/constants.php'; diff --git a/app/constants.php b/app/constants.php index a09aac19..3dd827b3 100644 --- a/app/constants.php +++ b/app/constants.php @@ -1,11 +1,17 @@