private static function init() { // include path $path = str_replace('\\', '/', substr(dirname(__FILE__), 0, -6)); set_include_path($path); defined('FULL_PATH') or define('FULL_PATH', $path); // autoload require 'vendor/autoload.php'; require_once FULL_PATH . 'Rebond/Util/Autoloader.php'; $loader = new Util\Autoloader('Rebond', FULL_PATH); $loader->register(); // error reporting error_reporting(E_ALL); ini_set('display_errors', 1); set_exception_handler(array('\\Rebond\\Util\\Error', 'exception')); set_error_handler(array('\\Rebond\\Util\\Error', 'error')); // session + cookie $siteUrl = str_replace('admin.', '', $_SERVER['HTTP_HOST']); session_set_cookie_params(0, '/', '.' . Util\Nav::removePort($siteUrl)); session_start('rebond'); date_default_timezone_set('Europe/Oslo'); }
private function initSiteConfig() { // lang $langs = Config::getLang(); $currentLang = isset($langs[0]) ? $langs : $this->lang; $langGet = Util\Converter::string('lang'); if (isset($langGet)) { $currentLang = $langGet; } else { if (isset($_COOKIE['lang'])) { $currentLang = $_COOKIE['lang']; } } $validLang = false; if (isset($langs[$currentLang])) { $validLang = true; } if (!$validLang) { $currentLang = $this->lang; } $this->lang = $currentLang; if (!isset($_COOKIE['lang']) || $_COOKIE['lang'] != $this->lang) { // 7 days $expire = time() + 60 * 60 * 24 * 7; setcookie('lang', $this->lang, $expire, '/', Util\Nav::removePort($this->siteUrl)); } setlocale(LC_ALL, $langs[$this->lang]); // site $this->site = \Rebond\Core\Site\Data::loadById(1); $this->env = $this->site->getEnvironment(); $this->skin = $this->site->getSkin(); if ($this->env == Config::ENV_PROD) { $this->setLogLevel(Config::ENV_PROD); } $this->timezone = $this->site->getTimezone(); date_default_timezone_set($this->timezone); }