Exemple #1
0
 public function when(Request $request, $params)
 {
     $valid = parent::when($request, $params);
     if (!$valid) {
         header('HTTP/1.1 406');
     }
     return $valid;
 }
 protected function authorize($requested, $provided)
 {
     if ($requested === $provided || $requested === '*/*') {
         return $provided;
     }
     if (false !== strpos($requested, '/')) {
         list($requestedA, $requestedB) = explode('/', $requested);
         list($providedA, ) = explode('/', $provided);
         if ($providedA === $requestedA && $requestedB === '*') {
             return $providedA;
         }
     }
     return parent::authorize($requested, $provided);
 }
 protected function authorize($requested, $provided)
 {
     $requested = preg_replace('/^x\\-/', '', $requested);
     $provided = preg_replace('/^x\\-/', '', $provided);
     if ($requested == $provided) {
         return $provided;
     }
     if (stripos($requested, '-') || !stripos($provided, '-')) {
         return false;
     }
     list($providedA, ) = explode('-', $provided);
     if ($requested === $providedA) {
         return $providedA;
     }
     return parent::authorize($requested, $provided);
 }