コード例 #1
0
ファイル: core.php プロジェクト: richard-clifford/cmsv1
$objCore->objPlugins->hook('CMSCore_classes_init', $classes);
//init these classes
$doneSetup = $objCore->setup($classes);
if (!$doneSetup) {
    msgDie('FAIL', sprintf($errorTPL, 'Fatal Error', 'Cannot load CMS Classes, make sure file structure is intact and $cmsROOT is defined properly if applicable.'));
}
//globalise the class names
foreach ($objCore->classes as $objName => $args) {
    ${$objName} =& $objCore->{$objName};
}
unset($classes, $objCore->classes);
$objPage->setVar('language', $language);
//
//--Generate a 'Template' for the Session
//
$guest['user'] = array('id' => 0, 'username' => 'Guest', 'theme' => $objCore->config('site', 'theme'), 'userkey' => doArgs('userkey', null, $_SESSION['user']), 'timezone' => doArgs('timezone', $objCore->config('time', 'timezone'), $_SESSION['user']));
//generate user stuff
$config['global'] = array('user' => isset($_SESSION['user']['id']) ? $_SESSION['user'] : $guest['user'], 'ip' => User::getIP(), 'useragent' => doArgs('HTTP_USER_AGENT', null, $_SERVER), 'browser' => getBrowser($_SERVER['HTTP_USER_AGENT']), 'language' => $language, 'secure' => $_SERVER['HTTPS'] ? true : false, 'referer' => doArgs('HTTP_REFERER', null, $_SERVER), 'rootPath' => '/' . root(), 'fullPath' => $_SERVER['REQUEST_URI'], 'rootUrl' => ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/' . root(), 'url' => ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
//hook the session template, this is the place to add some more if you want
$objPlugins->hook('CMSCore_session_tpl', $config['global']);
$objUser->setIsOnline(!($config['global']['user']['id'] == 0 ? true : false));
$objUser->initPerms();
if (!defined('NO_DB')) {
    //start the tracker, this sets out a few things so we can kill, ban etc
    $objCore->objUser->tracker();
}
$theme = !User::$IS_ONLINE || !$objCore->config('site', 'theme_override') ? $objCore->config('site', 'theme') : $objUser->grab('theme');
if (!$objPage->setTheme($theme)) {
    msgDie('FAIL', sprintf($errorTPL, 'Fatal Error', 'Cannot find template. Please make sure atleast default/ is uploaded correctly and try again.'));
}
if (is_file(cmsROOT . 'modules/core/lang.' . $language . '.php')) {