Started phasing out $opt['rootpath']. Replaced by Config class. Also optimized some class files (cookie, template). Minor changes.
This commit is contained in:
@ -13,6 +13,10 @@
|
||||
// load Composer autoloader, if not yet done
|
||||
require_once __DIR__ . '/../lib/core.php';
|
||||
|
||||
if (!isset($opt)) {
|
||||
$opt = array();
|
||||
}
|
||||
|
||||
// check for broken browsers
|
||||
$useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
|
||||
$useragent_msie = preg_match('/MSIE ([1-9]+).[0-9]+/',$useragent,$ua_matches) && !strpos($useragent,"Opera");
|
||||
@ -27,9 +31,9 @@ require_once __DIR__ . '/../lib/core.php';
|
||||
fix_magic_quotes_gpc();
|
||||
|
||||
// set options
|
||||
require_once($opt['rootpath'] . 'config2/settings-dist.inc.php');
|
||||
require_once($opt['rootpath'] . 'config2/settings.inc.php');
|
||||
require_once($opt['rootpath'] . 'config2/verify-settings.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/config2/settings-dist.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/config2/settings.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/config2/verify-settings.inc.php');
|
||||
|
||||
foreach ($opt['page']['banned_user_agents'] as $ua)
|
||||
if (strpos($useragent, $ua) !== false)
|
||||
@ -48,10 +52,9 @@ require_once __DIR__ . '/../lib/core.php';
|
||||
$opt['debug'] = $opt['debug'] & ~DEBUG_TRANSLATE;
|
||||
}
|
||||
|
||||
require_once($opt['rootpath'] . 'lib2/errorhandler.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/errorhandler.inc.php');
|
||||
configure_php();
|
||||
|
||||
require($opt['rootpath'] . 'lib2/cookie.class.php');
|
||||
normalize_settings();
|
||||
set_language();
|
||||
set_usercountry();
|
||||
@ -68,26 +71,24 @@ require_once __DIR__ . '/../lib/core.php';
|
||||
}
|
||||
else
|
||||
$opt['template']['style'] = $opt['template']['default']['style'];
|
||||
$opt['stylepath'] = $opt['rootpath'] . 'templates2/' . $opt['template']['style'] . '/';
|
||||
$opt['stylepath'] = $GLOBALS['container']->get('ocde.config')->getBaseDir() . '/templates2/' . $opt['template']['style'] . '/';
|
||||
|
||||
check_useragent();
|
||||
|
||||
/* setup smarty
|
||||
*
|
||||
*/
|
||||
require($opt['rootpath'] . 'lib2/OcSmarty.class.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/OcSmarty.class.php');
|
||||
$tpl = new OcSmarty();
|
||||
|
||||
// include all we need
|
||||
require_once($opt['rootpath'] . 'lib2/logic/const.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib2/logic/geomath.class.php');
|
||||
require_once($opt['rootpath'] . 'lib2/error.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib2/util.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib2/db.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib2/login.class.php');
|
||||
require_once($opt['rootpath'] . 'lib2/menu.class.php');
|
||||
require_once($opt['rootpath'] . 'lib2/logic/labels.inc.php');
|
||||
// require_once($opt['rootpath'] . 'lib2/throttle.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/logic/const.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/error.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/util.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/db.inc.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/login.class.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/menu.class.php');
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/logic/labels.inc.php');
|
||||
|
||||
// apply post configuration
|
||||
if (function_exists('post_config'))
|
||||
@ -194,6 +195,10 @@ function set_language()
|
||||
{
|
||||
global $opt, $cookie;
|
||||
|
||||
if ($cookie === null) {
|
||||
$cookie = new cookie();
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['locale']))
|
||||
$opt['template']['locale'] = strtoupper($_REQUEST['locale']);
|
||||
else
|
||||
@ -213,7 +218,7 @@ function set_language()
|
||||
|
||||
$cookie->set('locale', $opt['template']['locale'], $opt['template']['default']['locale']);
|
||||
|
||||
bindtextdomain('messages', $opt['rootpath'] . 'cache2/translate');
|
||||
bindtextdomain('messages', $GLOBALS['container']->get('ocde.config')->getBaseDir() . '/cache2/translate');
|
||||
|
||||
// setup the PHP locale
|
||||
setlocale(LC_MONETARY, $opt['locale'][$opt['template']['locale']]['locales']);
|
||||
@ -349,6 +354,11 @@ function helppagelink($ocpage, $title='Instructions')
|
||||
{
|
||||
global $opt, $translate;
|
||||
|
||||
if ($translate === null) {
|
||||
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/translate.inc.php');
|
||||
$translate = createTranslate();
|
||||
}
|
||||
|
||||
$helppage = sql_value("SELECT `helppage` FROM `helppages`
|
||||
WHERE `ocpage`='&1' AND `language`='&2'",
|
||||
"", $ocpage, $opt['template']['locale']);
|
||||
|
Reference in New Issue
Block a user