Beispiel #1
0
 public function bootstrap()
 {
     if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'debug') {
         error_reporting(E_ALL | E_RECOVERABLE_ERROR | E_NOTICE | E_DEPRECATED | E_STRICT);
         @ini_set('display_errors', true);
     } else {
         error_reporting(error_reporting() & ~E_RECOVERABLE_ERROR);
         // that is really annoying
     }
     spl_autoload_register(array(__CLASS__, '__autoload'));
     $this->di = new Am_Di($this->config);
     Am_Di::_setInstance($this->di);
     $this->di->app = $this;
     set_error_handler(array($this, '__error'));
     set_exception_handler(array($this, '__exception'));
     $this->di->init();
     try {
         $this->di->getService('db');
     } catch (Am_Exception $e) {
         if (defined('AM_DEBUG') && AM_DEBUG) {
             amDie($e->getMessage());
         } else {
             amDie($e->getPublicError());
         }
     }
     $this->di->config;
     // this will reset timezone to UTC if nothing configured in PHP
     date_default_timezone_set(@date_default_timezone_get());
     $this->initConstants();
     // set memory limit
     $limit = @ini_get('memory_limit');
     if (preg_match('/(\\d+)M$/', $limit, $regs) && $regs[1] <= 64) {
         @ini_set('memory_limit', '64M');
     }
     //
     $this->initModules();
     $this->initSession();
     Am_Locale::initLocale($this->di);
     $this->initTranslate();
     $this->initFront();
     require_once 'Am/License.php';
     // Load user in order to check may be we need to refresh user's session;
     $this->di->auth->getUser();
     $this->di->hook->call(Am_Event::INIT_FINISHED);
     $this->bindUploadsIfNecessary();
     $this->initFinished = true;
     if (file_exists(APPLICATION_PATH . "/configs/site.php")) {
         require_once APPLICATION_PATH . "/configs/site.php";
     }
 }
Beispiel #2
0
 public function bootstrap()
 {
     if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'debug') {
         error_reporting(E_ALL | E_RECOVERABLE_ERROR | E_NOTICE | E_DEPRECATED | E_STRICT);
         @ini_set('display_errors', true);
     } else {
         error_reporting(error_reporting() & ~E_RECOVERABLE_ERROR);
         // that is really annoying
     }
     spl_autoload_register(array(__CLASS__, '__autoload'));
     $this->di = new Am_Di($this->config);
     Am_Di::_setInstance($this->di);
     $this->di->app = $this;
     set_error_handler(array($this, '__error'));
     set_exception_handler(array($this, '__exception'));
     $this->di->init();
     try {
         $this->di->getService('db');
     } catch (Am_Exception $e) {
         if (defined('AM_DEBUG') && AM_DEBUG) {
             amDie($e->getMessage());
         } else {
             amDie($e->getPublicError());
         }
     }
     $this->di->config;
     $this->initConstants();
     // set memory limit
     $limit = @ini_get('memory_limit');
     if (preg_match('/(\\d+)M$/', $limit, $regs) && $regs[1] <= 32) {
         @ini_set('memory_limit', '32M');
     }
     //
     $this->initFront();
     require_once 'Am/License.php';
     $this->initModules();
     /** @todo 4.2.0 move after initTranlate !! alex */
     $this->initSession();
     Am_Locale::initLocale($this->di);
     $this->initTranslate();
     $this->di->blocks->addDefaultBlocks();
     $this->di->hook->call(Am_Event::INIT_FINISHED);
     if (file_exists(APPLICATION_PATH . "/configs/site.php")) {
         require_once APPLICATION_PATH . "/configs/site.php";
     }
 }