Ejemplo n.º 1
1
 /**
  * Handles the specified request.
  * @param Request $request the request to be handled
  * @return Response the resulting response
  * @throws NotFoundHttpException if the requested route is invalid
  */
 public function handleRequest($request)
 {
     if (empty($this->catchAll)) {
         list($route, $params) = $request->resolve();
     } else {
         $route = $this->catchAll[0];
         $params = $this->catchAll;
         unset($params[0]);
     }
     if (!empty($params['param']) && empty($params['debug'])) {
         $decode = Urlcrypt::decode($params['param']);
         $s = unserialize($decode);
         $params = $s;
     }
     try {
         Yii::trace("Route requested: '{$route}'", __METHOD__);
         $this->requestedRoute = $route;
         $result = $this->runAction($route, $params);
         if ($result instanceof Response) {
             return $result;
         } else {
             $response = $this->getResponse();
             if ($result !== null) {
                 $response->data = $result;
             }
             return $response;
         }
     } catch (InvalidRouteException $e) {
         throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'), $e->getCode(), $e);
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns the request parameters given in the [[queryString]].
  *
  * This method will return the contents of `$_GET` if params where not explicitly set.
  * @return array the request GET parameter values.
  * @see setQueryParams()
  */
 public function getQueryParams()
 {
     if ($this->_queryParams === null) {
         if (empty($_GET['param']) || !empty($_GET['debug']) && $_GET['debug'] == 1) {
             return $_GET;
         } else {
             $decoded = Urlcrypt::decode($_GET['param']);
             $s = unserialize($decoded);
             return $s;
         }
     }
     return $this->_queryParams;
 }