1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/10586] Extension front controller

Handle extension front pages

PHPBB3-10586
This commit is contained in:
David King
2012-02-08 00:08:17 -05:00
parent cfd0afe4ea
commit a0131b45f5
4 changed files with 96 additions and 0 deletions

View File

@@ -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';