From 631c6e754f1ca274507d6c5d801da69129d1f7c6 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 1 Apr 2013 22:12:10 +0000 Subject: [PATCH] common.php: - move postfixadmin_autoload() and spl_autoload_register upwards (it's needed earlier after using the Config class in more functions) - call Config::write earlier (as soon as $CONF is complete) git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1454 a1433add-5e2c-0410-b055-b7f2511e0802 --- common.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/common.php b/common.php index 4b5e262a..e52afaa7 100644 --- a/common.php +++ b/common.php @@ -35,6 +35,22 @@ $incpath = dirname(__FILE__); if(ini_get('register_globals') == 'on') { die("Please turn off register_globals; edit your php.ini"); } + +/** + * @param string $class + * __autoload implementation, for use with spl_autoload_register(). + */ +function postfixadmin_autoload($class) { + $PATH = dirname(__FILE__) . '/model/' . $class . '.php'; + + if(is_file($PATH)) { + require_once($PATH); + return true; + } + return false; +} +spl_autoload_register('postfixadmin_autoload'); + require_once("$incpath/variables.inc.php"); if(!is_file("$incpath/config.inc.php")) { @@ -48,6 +64,7 @@ if(isset($CONF['configured'])) { } } +Config::write($CONF); require_once("$incpath/languages/language.php"); require_once("$incpath/functions.inc.php"); @@ -66,23 +83,7 @@ if($CONF['language_hook'] != '' && function_exists($CONF['language_hook'])) { $PALANG = $hook_func ($PALANG, $language); } -/** - * @param string $class - * __autoload implementation, for use with spl_autoload_register(). - */ -function postfixadmin_autoload($class) { - $PATH = dirname(__FILE__) . '/model/' . $class . '.php'; - - if(is_file($PATH)) { - require_once($PATH); - return true; - } - return false; -} -spl_autoload_register('postfixadmin_autoload'); - Lang::write($PALANG); -Config::write($CONF); if (!defined('POSTFIXADMIN_CLI')) { if(!is_file("$incpath/smarty.inc.php")) {