Example #1
1
 public function run()
 {
     $request = Request::capture();
     $config = $this->app->get("config");
     $action = $request->input($config->get('app.request_action'), '/');
     $responseContent = $this->runActionController($action);
     if (!$responseContent) {
         return;
     }
     $response = new Response($responseContent);
     $response->send();
     die;
 }
 /**
  * @param Response $response
  * @param string $mimeType
  */
 protected function sendResponse(Response $response, $mimeType)
 {
     if (empty($mimeType)) {
         $mimeType = 'text/html';
     }
     $response->header('Content-type', $mimeType);
     $response->setStatusCode(404);
     $response->send();
     exit;
 }
Example #3
0
 public function symfonyAction()
 {
     $ua = Request::header('User-Agent');
     //Redirect to static Masarap page if no User Agent HTTP header was found
     if (!preg_match("@Masarap/@", $ua)) {
         return File::get(public_path() . '/masarap-symfony/index.html');
     }
     // end if no Masarap User Agent
     $status_code = FORCE_UPDATE_STATUS_CODE;
     $data = array('status_code' => $status_code, 'message' => "[{$status_code}] Force Update.", 'app_version' => APP_VERSION, 'app_store' => APP_STORE_LINK, 'google_play' => PLAY_STORE_LINK);
     $response = new Response(json_encode($data));
     $response->setStatusCode($status_code, "Force Update");
     $response->headers->set('Content-Type', 'application/json');
     $response->send();
     exit;
 }
Example #4
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     //check Server Status
     if (SERVER_STATUS === 1) {
         $response = new Response();
         $status_code = SERVER_MAINTENANCE_STATUS_CODE;
         $response->setStatusCode($status_code, "Under Maintenance");
         $response->send();
         exit;
     }
     //end of SERVER STATUS CHECK
     $ua = $request->headers;
     $accept = $request->headers->get('Accept');
     $bypass = $request->query("bypass");
     if (!$bypass && BYPASS_USER_AGENT_CHECK == 0) {
         //Redirect to static Masarap page if no User Agent HTTP header was found
         if (!preg_match("@Masarap/@", $ua)) {
             return File::get(public_path() . '/masarap-symfony/index.html');
         }
         // end if no Masarap User Agent
         //Check the version in the User Agent for FORCE UPDATE
         //Use in Version 1.1 and Up
         if (!preg_match("@Masarap/" . APP_VERSION . "@", $ua) && !preg_match("@version=" . SERVER_VERSION . "@", $accept)) {
             $status_code = FORCE_UPDATE_STATUS_CODE;
             $data = array('status_code' => $status_code, 'message' => "[{$status_code}] Force Update.", 'app_version' => APP_VERSION, 'app_store' => APP_STORE_LINK, 'google_play' => PLAY_STORE_LINK);
             $response = new Response(json_encode($data));
             $response->setStatusCode($status_code, "Force Update");
             $response->headers->set('Content-Type', 'application/json');
             $response->send();
             exit;
         }
         // end of pregmatch
     }
     // end of bypass if
     return $next($request);
 }
Example #5
0
 /**
  *
  * Final output render
  *
  **/
 public function render()
 {
     $response = new Response($this->getCache());
     //send the response and exit the script
     $response->send();
     exit;
 }
Example #6
0
 /**
  * @param Request $request
  * @return \Illuminate\Http\Response
  */
 public function handle(Request $request)
 {
     try {
         $response = $this->router->dispatch($request);
     } catch (NotFoundHttpException $e) {
         // parse request to return an error according to protocol
         $response = new Response('Page not found', 404);
     } catch (MethodNotAllowedHttpException $e) {
         $response = new Response('Page not found', 404);
     }
     $response->sendHeaders();
     $response->send();
     return $response;
 }