Exemplo n.º 1
0
 public function configure()
 {
     parent::configure();
     // automatic redirect on the correct language
     $this->addRoute('', [$this, 'routeIndex']);
     // proxy images
     $this->addRoute('guild/{id}.png', [$this, 'routeImageGuild'])->assert('id', '[A-F0-9-]{35,40}');
     $this->addRoute('proxy/{id}.png', [$this, 'routeImageProxy'])->assert('id', '[A-F0-9]+/[0-9]+');
 }
Exemplo n.º 2
0
 protected function renderPage($template, $context = array())
 {
     try {
         $context['request'] = $this->getService()->getRequest();
         $context['lang'] = $this->getLang();
         return parent::renderPage($template, $context);
     } catch (\Twig_Error_Runtime $e) {
         $previous = $e->getPrevious();
         if (empty($previous) || get_class($previous) !== MissingPermissionException::class) {
             throw $e;
         }
         return $this->renderPage('error-no-permission.twig', ['permission' => $previous->getMessage()]);
     }
 }