Пример #1
0
 /**
  * @exception	120x
  */
 protected function initialize()
 {
     $appConfig = Config::get('application');
     mb_internal_encoding($appConfig['encoding']);
     date_default_timezone_set($appConfig['timezone']);
     umask($appConfig['umask']);
     // это было в конфиге
     define('DEBUG', $appConfig['debug']);
     error_reporting(0xffff);
     ini_set('display_errors', DEBUG);
     set_error_handler('\\Colibri\\Application\\Engine::errorHandler', 0xffff);
     set_exception_handler('\\Colibri\\Application\\Engine::exceptionHandler');
     $this->_domainPrefix = $this->getDomainPrefix();
     new \API($this);
     // initialize API
     // identifying request type & parse params
     if (isset($_POST[self::rpcquery_POSTvarName])) {
         $this->_requestType = RequestType::callModuleMethod;
         $GLOBALS['xmlrpc_internalencoding'] = $appConfig['encoding'];
         $this->parseRpcQuery($_POST[self::rpcquery_POSTvarName]);
         unset($_POST[self::rpcquery_POSTvarName]);
         return;
     }
     //TODO: refactor to config. This is route by SEO requirements
     $requestedUri = $this->getRequestedUri();
     $routes = Config::routing('rewrite');
     foreach ($routes as $route) {
         $pattern = $route['pattern'];
         $replacement = $route['replacement'];
         $requestedUri = preg_replace($pattern, $replacement, $requestedUri);
         /*
         if (isset($route['requestType']))
         	$this->_requestType=$route['requestType'];
         if ($this->_requestType==RequestType::callModuleMethod)
         {
         	$GLOBALS['xmlrpc_internalencoding']=$appConfig['encoding'];
         	if (isset($route['parseRpcQuery']))
         	{
         		eval('$rpcQuery='.$route['parseRpcQuery']);
         		$this->parseRpcQuery($rpcQuery);
         	}
         	else
         	{
         		if (!isset($route['module']) || !isset($route['method']))
         			$this->__raiseError(1203);
         		$this->_module=$route['module'];
         		$this->_method=$route['method'];
         		$this->_params=isset($route['params'])?$route['params']:array();
         	}
         }
         */
         if (isset($route['last'])) {
             break;
         }
     }
     $this->parseRequestedFile($requestedUri);
     $this->_requestType = RequestType::getModuleView;
 }