コード例 #1
1
 /**
  * Return 404s for missing files and redirect to index.html for directories
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // File path requested
     $path = $request->decodedPath();
     // Remove any repeated slashes
     $path = preg_replace('#//+#', '/', $path);
     // If user requested / explicitly redirect them to index.html
     if ($path == '/') {
         return redirect('index.html', 301);
     }
     // Handle requests for missing files
     if (!$this->fs->has($path)) {
         $this->logger->warning('File not found (cache miss)', array('path' => $path));
         abort(404);
     }
     // If request is for directory, redirect to index.html in that directory
     $metaData = $this->fs->getMetadata($path);
     if ($metaData['type'] == 'dir') {
         $path .= '/index.html';
         return redirect($path, 301);
     }
     // Forward to Controller for content & modified time
     return $next($request);
 }
コード例 #2
0
ファイル: Permission.php プロジェクト: amanullah-1/Laraguard
 private function denyRequest()
 {
     // Store return path to allow redirect after auth, ...
     \Session::put('laraguard_lastDenied', $this->request->decodedPath());
     \Session::put('laraguard_lastDeniedLifetime', $this->permissionParser->getDeniedUrlLifetime());
     // Redirect to permissionDenied method of controller
     if ($this->requestParser->hasControllerPermissionDeniedMethod()) {
         // Modify request action to direct to method 'permissionDenied'
         $action = $this->request->route()->getAction();
         $controllerPath = $this->requestParser->getControllerPath();
         $action['uses'] = $controllerPath . '@permissionDenied';
         $action['controller'] = $controllerPath . '@permissionDenied';
         // Set new action
         $this->request->route()->setAction($action);
         if ($this->permissionParser->debugging()) {
             \Log::info('[Laraguard] DENY - with permissionDenied(): ' . $action['uses']);
         }
         return \Route::dispatch($this->request);
     } else {
         if ($this->permissionParser->hasNoPermissionRoute()) {
             $noPermissionRoute = $this->permissionParser->getNoPermissionRoute();
             if ($this->permissionParser->debugging()) {
                 \Log::info('[Laraguard] DENY - with defaultNoPermissionRoute: ' . $noPermissionRoute);
             }
             return redirect($noPermissionRoute);
         } else {
             if ($this->permissionParser->debugging()) {
                 \Log::info('[Laraguard] DENY - with 501 Error');
             }
             return $this->returnError(['Permission denied']);
         }
     }
 }
コード例 #3
0
ファイル: _ide_helper.php プロジェクト: satriashp/tour
 /**
  * Get the current encoded path info for the request.
  *
  * @return string 
  * @static 
  */
 public static function decodedPath()
 {
     return \Illuminate\Http\Request::decodedPath();
 }
コード例 #4
0
ファイル: Route.php プロジェクト: joshe091/buscadorapps
 /**
  * Get the parameter matches for the path portion of the URI.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return array
  */
 protected function bindPathParameters(Request $request)
 {
     preg_match($this->compiled->getRegex(), '/' . $request->decodedPath(), $matches);
     return $matches;
 }
コード例 #5
0
 /**
  * get error email datas
  *
  * @param \Illuminate\Http\Request $request
  * @param Exception $e
  * @return array
  */
 private function getEmailDatas($request, $e)
 {
     return ['date' => Carbon::now()->format('d.m.Y H:i:s'), 'rUser' => $request->user(), 'rSessionOld' => $request->session()->all()['flash']['old'], 'rSessionNew' => $request->session()->all()['flash']['new'], 'rAll' => $request->all(), 'rIp' => $request->ip(), 'rDecodedPath' => $request->decodedPath(), 'rPath' => $request->path(), 'rFullUrl' => $request->fullUrl(), 'rUrl' => $request->url(), 'rRoot' => $request->root(), 'rMethod' => $request->method(), 'eMessage' => method_exists($e, 'getMessage') ? $e->getMessage() : '', 'eCode' => method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 200, 'eFile' => method_exists($e, 'getFile') ? $e->getFile() : '', 'eLine' => method_exists($e, 'getLine') ? $e->getLine() : '', 'ePrevious' => is_string($e->getPrevious()) ? $e->getPrevious() : '', 'eTrace' => nl2br($e->getTraceAsString())];
 }
コード例 #6
0
ファイル: Controller.php プロジェクト: vtl3000/rest
 public function index(Request $request)
 {
     print_r($request->all());
     print_r($request->decodedPath());
 }