Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function dispatchAppServer($context) {
- $_ENV = $_SERVER = $context['env'];
- @parse_str($_ENV['QUERY_STRING'], $_GET);
- $_GET['ak'] = $_ENV['PATH_INFO'];
- Ak::unsetStaticVar('AkRequestSingleton');
- Ak::unsetStaticVar('AkRouterSingleton');
- Ak::unsetStaticVar('AkUrlWriterSingleton');
- AkConfig::setOption('Request.remote_ip', '127.0.0.1');
- try{
- $this->Request = AkRequest::getInstance();
- $this->Response = new AkResponse();
- $path = ltrim(str_replace('..', '.', $context['env']['REQUEST_URI']), '/. ');
- if(!empty($path) && file_exists(AK_PUBLIC_DIR.DS.$path)){
- $Controller = new AkActionController();
- $Controller->Response = $this->Response;
- $Controller->sendFile(AK_PUBLIC_DIR.DS.$path, array('stream'=>false));
- return $Controller->Response;
- }else{
- if($this->Controller = $this->Request->recognize()){
- $this->Controller->process($this->Request, $this->Response);
- }
- return $this->Response;
- }
- }catch(Exception $e){
- if(isset($this->Controller) && method_exists($this->Controller, 'render_error')){
- $this->Controller->render_error($e);
- }else{
- $ExceptionDispatcher = new AkExceptionDispatcher();
- $ExceptionDispatcher->renderException($e);
- }
- }
- }
Add Comment
Please, Sign In to add comment