aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/event
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/event')
-rw-r--r--phpBB/includes/event/kernel_exception_subscriber.php79
-rw-r--r--phpBB/includes/event/kernel_request_subscriber.php (renamed from phpBB/includes/event/kernel_subscriber.php)64
-rw-r--r--phpBB/includes/event/kernel_terminate_subscriber.php43
3 files changed, 128 insertions, 58 deletions
diff --git a/phpBB/includes/event/kernel_exception_subscriber.php b/phpBB/includes/event/kernel_exception_subscriber.php
new file mode 100644
index 0000000000..cd6ea40c70
--- /dev/null
+++ b/phpBB/includes/event/kernel_exception_subscriber.php
@@ -0,0 +1,79 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\HttpKernel\KernelEvents;
+use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
+use Symfony\Component\HttpFoundation\Response;
+
+class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterface
+{
+ /**
+ * Template object
+ * @var phpbb_template
+ */
+ protected $template;
+
+ /**
+ * User object
+ * @var phpbb_user
+ */
+ protected $user;
+
+ /**
+ * Construct method
+ *
+ * @param phpbb_template $template Template object
+ * @param phpbb_user $user User object
+ */
+ public function __construct(phpbb_template $template, phpbb_user $user)
+ {
+ $this->template = $template;
+ $this->user = $user;
+ }
+
+ /**
+ * This listener is run when the KernelEvents::EXCEPTION event is triggered
+ *
+ * @param GetResponseForExceptionEvent $event
+ * @return null
+ */
+ public function on_kernel_exception(GetResponseForExceptionEvent $event)
+ {
+ page_header($this->user->lang('INFORMATION'));
+
+ $this->template->assign_vars(array(
+ 'MESSAGE_TITLE' => $this->user->lang('INFORMATION'),
+ 'MESSAGE_TEXT' => $event->getException()->getMessage(),
+ ));
+
+ $this->template->set_filenames(array(
+ 'body' => 'message_body.html',
+ ));
+
+ page_footer(true, false, false);
+
+ $event->setResponse(new Response($this->template->assign_display('body'), 404));
+ }
+
+ public static function getSubscribedEvents()
+ {
+ return array(
+ KernelEvents::EXCEPTION => 'on_kernel_exception',
+ );
+ }
+}
diff --git a/phpBB/includes/event/kernel_subscriber.php b/phpBB/includes/event/kernel_request_subscriber.php
index 79ee4f4dc5..98079acabb 100644
--- a/phpBB/includes/event/kernel_subscriber.php
+++ b/phpBB/includes/event/kernel_request_subscriber.php
@@ -17,28 +17,13 @@ if (!defined('IN_PHPBB'))
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
-use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
-use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
-use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\EventListener\RouterListener;
use Symfony\Component\Routing\RequestContext;
-class phpbb_event_kernel_subscriber implements EventSubscriberInterface
+class phpbb_event_kernel_request_subscriber implements EventSubscriberInterface
{
/**
- * Template object
- * @var phpbb_template
- */
- protected $template;
-
- /**
- * User object
- * @var phpbb_user
- */
- protected $user;
-
- /**
* Extension finder object
* @var phpbb_extension_finder
*/
@@ -59,13 +44,11 @@ class phpbb_event_kernel_subscriber implements EventSubscriberInterface
/**
* Construct method
*
- * @param phpbb_template $template Template object
- * @param phpbb_user $user User object
* @param phpbb_extension_finder $finder Extension finder object
* @param string $root_path Root path
* @param string $php_ext PHP extension
*/
- public function __construct(phpbb_template $template, phpbb_user $user, phpbb_extension_finder $finder, $root_path, $php_ext)
+ public function __construct(phpbb_extension_finder $finder, $root_path, $php_ext)
{
$this->template = $template;
$this->user = $user;
@@ -75,43 +58,6 @@ class phpbb_event_kernel_subscriber implements EventSubscriberInterface
}
/**
- * This listener is run when the KernelEvents::TERMINATE event is triggered
- * This comes after a Response has been sent to the server; this is
- * primarily cleanup stuff.
- *
- * @param PostResponseEvent $event
- * @return null
- */
- public function on_kernel_terminate(PostResponseEvent $event)
- {
- exit_handler();
- }
-
- /**
- * This listener is run when the KernelEvents::EXCEPTION event is triggered
- *
- * @param GetResponseForExceptionEvent $event
- * @return null
- */
- public function on_kernel_exception(GetResponseForExceptionEvent $event)
- {
- page_header($this->user->lang('INFORMATION'));
-
- $this->template->assign_vars(array(
- 'MESSAGE_TITLE' => $this->user->lang('INFORMATION'),
- 'MESSAGE_TEXT' => $event->getException()->getMessage(),
- ));
-
- $this->template->set_filenames(array(
- 'body' => 'message_body.html',
- ));
-
- page_footer(true, false, false);
-
- $event->setResponse(new Response($this->template->assign_display('body'), 404));
- }
-
- /**
* This listener is run when the KernelEvents::REQUEST event is triggered
*
* This is responsible for setting up the routing information
@@ -125,6 +71,10 @@ class phpbb_event_kernel_subscriber implements EventSubscriberInterface
$context = new RequestContext();
$context->fromRequest($request);
+ if (!function_exists('phpbb_create_url_matcher'))
+ {
+ include($this->root_path . 'includes/functions_url_matcher' . $this->php_ext);
+ }
$matcher = phpbb_create_url_matcher($this->finder, $context, $this->root_path, $this->php_ext);
$router_listener = new RouterListener($matcher, $context);
@@ -135,8 +85,6 @@ class phpbb_event_kernel_subscriber implements EventSubscriberInterface
{
return array(
KernelEvents::REQUEST => 'on_kernel_request',
- KernelEvents::TERMINATE => 'on_kernel_terminate',
- KernelEvents::EXCEPTION => 'on_kernel_exception',
);
}
}
diff --git a/phpBB/includes/event/kernel_terminate_subscriber.php b/phpBB/includes/event/kernel_terminate_subscriber.php
new file mode 100644
index 0000000000..1eaf890e42
--- /dev/null
+++ b/phpBB/includes/event/kernel_terminate_subscriber.php
@@ -0,0 +1,43 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\HttpKernel\KernelEvents;
+use Symfony\Component\HttpKernel\Event\PostResponseEvent;
+
+class phpbb_event_kernel_terminate_subscriber implements EventSubscriberInterface
+{
+ /**
+ * This listener is run when the KernelEvents::TERMINATE event is triggered
+ * This comes after a Response has been sent to the server; this is
+ * primarily cleanup stuff.
+ *
+ * @param PostResponseEvent $event
+ * @return null
+ */
+ public function on_kernel_terminate(PostResponseEvent $event)
+ {
+ exit_handler();
+ }
+
+ public static function getSubscribedEvents()
+ {
+ return array(
+ KernelEvents::TERMINATE => 'on_kernel_terminate',
+ );
+ }
+}