diff options
author | David King <imkingdavid@gmail.com> | 2012-02-08 00:08:17 -0500 |
---|---|---|
committer | David King <imkingdavid@gmail.com> | 2012-03-19 09:12:31 -0400 |
commit | a0131b45f56847f7e5c44a6db66cd7359967585f (patch) | |
tree | 49e5bc0079dc0336d84bf7a92c0591ca7c416de3 /phpBB/index.php | |
parent | cfd0afe4ead0c4910567d955088d4225d17d4186 (diff) | |
download | forums-a0131b45f56847f7e5c44a6db66cd7359967585f.tar forums-a0131b45f56847f7e5c44a6db66cd7359967585f.tar.gz forums-a0131b45f56847f7e5c44a6db66cd7359967585f.tar.bz2 forums-a0131b45f56847f7e5c44a6db66cd7359967585f.tar.xz forums-a0131b45f56847f7e5c44a6db66cd7359967585f.zip |
[ticket/10586] Extension front controller
Handle extension front pages
PHPBB3-10586
Diffstat (limited to 'phpBB/index.php')
-rw-r--r-- | phpBB/index.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/phpBB/index.php b/phpBB/index.php index f1243bb336..a206ed4d37 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -24,6 +24,45 @@ $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); +// If given an extension, look for a front controller +if ($ext = $request->variable('ext', '')) +{ + // The class to load + $class = "phpbb_ext_{$ext}_controller"; + + // Make sure the specified extension is enabled + // and that it has a controller class + if (!$phpbb_extension_manager->available($ext)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_DOES_NOT_EXIST', $ext)); + } + else if (!$phpbb_extension_manager->enabled($ext)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_DISABLED', $ext)); + } + else if (!file_exists("{$phpbb_root_path}ext/$ext/controller.$phpEx") || !class_exists($class)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_CONTROLLER_MISSING', $ext)); + } + + // Instantiate the extension controller + $controller = new $class; + + // But let's make sure it's actually a proper controller + if (!($controller instanceof phpbb_extension_controller_interface)) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang('EXTENSION_CLASS_WRONG_TYPE', $class)); + } + + // Let's get it started... + $controller->handle(); + exit_handler(); +} + display_forums('', $config['load_moderators']); $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; |