[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).
This commit is contained in:
Dan Untenzu 2017-01-16 17:54:01 +01:00 committed by Jerome Jutteau
parent 18b6e57c00
commit af7e43a4a3
9 changed files with 19 additions and 20 deletions

View File

@ -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');

3
f.php
View File

@ -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']))
{

View File

@ -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');

View File

@ -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');

View File

@ -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');
}
?>
?>

View File

@ -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');

View File

@ -17,6 +17,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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
?>

View File

@ -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');

View File

@ -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 '</textarea>';
echo '<p>This license text is under <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons - Attribution 3.0 Unported</a>.</p><p>It has been based on this work: <a href="http://opensource.org/ToS">http://opensource.org/ToS</a></p>';
echo '</div>';
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
?>
?>