Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

kernel_exception_subscriber.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 1.96 KiB


01  <?php
02  /**
03  *
04  * This file is part of the phpBB Forum Software package.
05  *
06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
07  * @license GNU General Public License, version 2 (GPL-2.0)
08  *
09  * For full copyright and license information, please see
10  * the docs/CREDITS.txt file.
11  *
12  */
13   
14  namespace phpbb\event;
15   
16  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17  use Symfony\Component\HttpKernel\KernelEvents;
18  use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
19  use Symfony\Component\HttpKernel\Exception\HttpException;
20  use Symfony\Component\HttpFoundation\Response;
21   
22  class kernel_exception_subscriber implements EventSubscriberInterface
23  {
24      /**
25      * Template object
26      * @var \phpbb\template\template
27      */
28      protected $template;
29   
30      /**
31      * User object
32      * @var \phpbb\user
33      */
34      protected $user;
35   
36      /**
37      * Construct method
38      *
39      * @param \phpbb\template\template $template Template object
40      * @param \phpbb\user $user User object
41      */
42      public function __construct(\phpbb\template\template $template, \phpbb\user $user)
43      {
44          $this->template = $template;
45          $this->user = $user;
46      }
47   
48      /**
49      * This listener is run when the KernelEvents::EXCEPTION event is triggered
50      *
51      * @param GetResponseForExceptionEvent $event
52      * @return null
53      */
54      public function on_kernel_exception(GetResponseForExceptionEvent $event)
55      {
56          page_header($this->user->lang('INFORMATION'));
57   
58          $exception = $event->getException();
59   
60          $this->template->assign_vars(array(
61              'MESSAGE_TITLE'        => $this->user->lang('INFORMATION'),
62              'MESSAGE_TEXT'        => $exception->getMessage(),
63          ));
64   
65          $this->template->set_filenames(array(
66              'body'    => 'message_body.html',
67          ));
68   
69          page_footer(true, false, false);
70   
71          $status_code = $exception instanceof HttpException ? $exception->getStatusCode() : 500;
72          $response = new Response($this->template->assign_display('body'), $status_code);
73          $event->setResponse($response);
74      }
75   
76      public static function getSubscribedEvents()
77      {
78          return array(
79              KernelEvents::EXCEPTION        => 'on_kernel_exception',
80          );
81      }
82  }
83