From: Dan Untenzu Date: Mon, 16 Jan 2017 16:54:01 +0000 (+0100) Subject: [FEATURE] Move config include into settings file X-Git-Tag: 2.0.0~10 X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/commitdiff_plain/af7e43a4a3bbcb62912eabd75537480bf696b265?ds=inline;hp=18b6e57c0091dfdd14427c940346da59298b29eb [FEATURE] Move config include into settings file Move the include of the original and the local configuration file into the settings file to reduce one includes in each file, have all settings in one place and remove unneccessary code from the config file (which makes it easier to copy and change it). --- diff --git a/admin.php b/admin.php index cb60580..d602dcd 100644 --- a/admin.php +++ b/admin.php @@ -19,7 +19,6 @@ define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); require (JIRAFEAU_ROOT . 'lib/lang.php'); diff --git a/f.php b/f.php index 0218602..a97718f 100644 --- a/f.php +++ b/f.php @@ -19,10 +19,9 @@ */ define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); -require (JIRAFEAU_ROOT . 'lib/lang.php'); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); +require (JIRAFEAU_ROOT . 'lib/lang.php'); if (!isset ($_GET['h']) || empty ($_GET['h'])) { diff --git a/index.php b/index.php index 4371e9e..2002ad7 100644 --- a/index.php +++ b/index.php @@ -20,7 +20,6 @@ */ define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); require (JIRAFEAU_ROOT . 'lib/lang.php'); diff --git a/install.php b/install.php index b96593e..51cf7b8 100644 --- a/install.php +++ b/install.php @@ -20,11 +20,9 @@ define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); define ('NL', "\n"); define ('QUOTE', "'"); - define ('JIRAFEAU_CFG', JIRAFEAU_ROOT.'lib/config.local.php'); define ('JIRAFEAU_VAR_RAND_LENGTH', 15); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); require (JIRAFEAU_ROOT . 'lib/lang.php'); diff --git a/lib/config.original.php b/lib/config.original.php index 6a5c1ba..30ec134 100644 --- a/lib/config.original.php +++ b/lib/config.original.php @@ -24,7 +24,6 @@ * To overwrite these settings copy the file, * rename it to »config.local.php« and adapt the parameters. **/ -global $cfg; /* URL of installation, with traling slash (eg. »https://exmaple.com/jirafeau/«) */ @@ -133,11 +132,4 @@ $cfg['proxy_ip'] = array(); */ $cfg['installation_done'] = false; -/* Try to include user's local configuration. */ -if ((basename (__FILE__) != 'config.local.php') - && file_exists (JIRAFEAU_ROOT.'lib/config.local.php')) -{ - require (JIRAFEAU_ROOT.'lib/config.local.php'); -} - -?> +?> \ No newline at end of file diff --git a/lib/functions.js.php b/lib/functions.js.php index 7a1c5af..31cefe3 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -21,7 +21,7 @@ header('Content-Type: text/javascript'); define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/../'); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); + require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); require (JIRAFEAU_ROOT . 'lib/lang.php'); diff --git a/lib/settings.php b/lib/settings.php index 3a9f450..3795122 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -17,6 +17,16 @@ * along with this program. If not, see . */ +global $cfg; + +// Read config files +require (JIRAFEAU_ROOT . 'lib/config.original.php'); + +if (file_exists(JIRAFEAU_ROOT . 'lib/config.local.php')) +{ + require (JIRAFEAU_ROOT . 'lib/config.local.php'); +} + /* Jirafeau constants */ define ('JIRAFEAU_PACKAGE', 'Jirafeau'); define ('JIRAFEAU_VERSION', '1.2.0'); @@ -40,4 +50,6 @@ define ('JIRAFEAU_MONTH', 2419200); // JIRAFEAU_WEEK * 4 define ('JIRAFEAU_QUARTER', 7257600); // JIRAFEAU_MONTH * 3 define ('JIRAFEAU_YEAR', 29030400); // JIRAFEAU_MONTH * 12 + + ?> diff --git a/script.php b/script.php index 5e02456..c3b722f 100644 --- a/script.php +++ b/script.php @@ -22,10 +22,8 @@ * If you don't want this feature, you can simply delete this file from your * web directory. */ - define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); require (JIRAFEAU_ROOT . 'lib/lang.php'); diff --git a/tos.php b/tos.php index 111916d..c5e4307 100644 --- a/tos.php +++ b/tos.php @@ -17,10 +17,10 @@ */ define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); require (JIRAFEAU_ROOT . 'lib/lang.php'); + require (JIRAFEAU_ROOT . 'lib/template/header.php'); $url = $cfg['web_root'] . 'tos.php'; @@ -39,5 +39,7 @@ echo $tos; echo ''; echo '

This license text is under Creative Commons - Attribution 3.0 Unported.

It has been based on this work: http://opensource.org/ToS

'; echo ''; + require (JIRAFEAU_ROOT . 'lib/template/footer.php'); -?> + +?> \ No newline at end of file