/** * Returns an instance of LiveCart Application * * Method prevents of creating multiple application instances during one request * * @return LiveCart */ public function __construct() { ClassLoader::import('application.model.ActiveRecordModel'); ClassLoader::import('framework.renderer.SmartyRenderer'); parent::__construct(); unset($this->session, $this->config, $this->locale, $this->localeName); $dsnPath = ClassLoader::getRealPath("storage.configuration.database") . '.php'; $this->isInstalled = file_exists($dsnPath); ActiveRecordModel::setApplicationInstance($this); if ($this->isInstalled) { ActiveRecordModel::setDSN(include $dsnPath); if (!session_id()) { $session = new DatabaseSessionHandler(); if ($this->getConfig()->get('USE_DEFAULT_SESSION_HANDLER') == false) { $session->setHandlerInstance(); } $this->sessionHandler = $session; } } // LiveCart request routing rules $this->initRouter(); if (file_exists(ClassLoader::getRealPath('cache.dev'))) { $this->setDevMode(true); } if ($this->isDevMode()) { ActiveRecordModel::getLogger()->setLogFileName(ClassLoader::getRealPath("cache") . DIRECTORY_SEPARATOR . "activerecord.log"); if (phpversion() >= '5.3') { error_reporting(E_ALL & ~E_DEPRECATED); } else { error_reporting(E_ALL); } ini_set('display_errors', 'On'); } $compileDir = $this->isTemplateCustomizationMode() ? 'cache.templates_c.customize' : 'cache.templates_c'; SmartyRenderer::setCompileDir(ClassLoader::getRealPath($compileDir)); // mod_rewrite disabled? if ($this->request->get('noRewrite')) { $this->router->setBaseDir($_SERVER['baseDir'], $_SERVER['virtualBaseDir']); //$this->router->enableURLRewrite(false); } }