Ejemplo n.º 1
0
 /**
  * Loads the application.
  */
 protected function _actionLoad($context)
 {
     //already loaded
     if ($this->_application instanceof JApplication) {
         return;
     }
     //legacy register error handling
     JError::setErrorHandling(E_ERROR, 'callback', array($this, 'exception'));
     //register exception handler
     set_exception_handler(array($this, 'exception'));
     $identifier = clone $this->getIdentifier();
     $identifier->name = 'application';
     //load the JSite
     $this->getService('koowa:loader')->loadIdentifier($identifier);
     jimport('joomla.application.component.helper');
     //no need to create session when using CLI (command line interface)
     $this->_application = JFactory::getApplication($this->_application, array('session' => PHP_SAPI !== 'cli'));
     global $mainframe;
     $mainframe = $this->_application;
     $error_reporting = $this->_application->getCfg('error_reporting');
     define('JDEBUG', $this->_application->getCfg('debug'));
     //taken from nooku application dispatcher
     if ($error_reporting > 0) {
         error_reporting($error_reporting);
         ini_set('display_errors', 1);
         ini_set('display_startup_errors', 1);
     }
     $this->getService()->set($identifier, $this->_application);
     $this->getService()->setAlias('application', $identifier);
     //set the session handler to none for
     if (PHP_SAPI == 'cli') {
         JFactory::getConfig()->setValue('config.session_handler', 'none');
         JFactory::getConfig()->setValue('config.cache_handler', 'file');
     }
     //set the default timezone to UTC
     date_default_timezone_set('UTC');
     KRequest::root(str_replace('/' . $this->_application->getName(), '', KRequest::base()));
 }