示例#1
0
 public function setVariables()
 {
     $this->request = App::getRequest();
     $this->setRoutes();
     $this->context = new RequestContext();
     $this->context->fromRequest($this->request);
     $this->matcher = new UrlMatcher($this->routes, $this->context);
     $this->generator = new UrlGenerator($this->routes, $this->context);
     try {
         $this->route = $this->matcher->match($this->request->getPathInfo());
     } catch (\Exception $e) {
         $this->checkSSLPattern();
         $exception = new \Gekosale\Router\InvalidUrlException('Niepoprawny adres: ' . App::getUrl());
         header('HTTP/1.1 404 Not Found');
         $this->route = array('controller' => 'error', 'action' => 'index', 'param' => 404, 'mode' => $this->route['mode']);
     }
     $this->baseController = $this->route['controller'];
     $this->baseControllerFullName = 'Gekosale\\' . ucfirst($this->baseController) . 'Controller';
     $this->setAction($this->route['action']);
     $this->setParams($this->route['param']);
     $this->setAdministrativeMode($this->route['mode'] == 'admin' ? 1 : 0);
 }