diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index 4f4d9ccedd..cb9e07bd70 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -52,6 +52,7 @@ $module_id = request_var('i', '');
$mode = request_var('mode', '');
// Set custom template for admin area
+$template->set_ext_dir_prefix('adm/');
$template->set_custom_template($phpbb_admin_path . 'style', 'admin');
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
diff --git a/phpBB/common.php b/phpBB/common.php
index 061290dcea..a5e0de4510 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -87,13 +87,16 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
-$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
-$class_loader->register();
+$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx");
+$phpbb_class_loader_ext->register();
+$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx");
+$phpbb_class_loader->register();
// set up caching
$cache_factory = new phpbb_cache_factory($acm_type);
$cache = $cache_factory->get_service();
-$class_loader->set_cache($cache->get_driver());
+$phpbb_class_loader_ext->set_cache($cache->get_driver());
+$phpbb_class_loader->set_cache($cache->get_driver());
// Instantiate some basic classes
$request = new phpbb_request();
@@ -115,8 +118,12 @@ $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
-$template_locator = new phpbb_template_locator();
-$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator);
+// load extensions
+$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
+
+$phpbb_template_locator = new phpbb_template_locator();
+$phpbb_template_path_provider = new phpbb_template_extension_path_provider($phpbb_extension_manager, new phpbb_template_path_provider());
+$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_template_locator, $phpbb_template_path_provider);
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
@@ -129,5 +136,5 @@ foreach ($cache->obtain_hooks() as $hook)
if (!$config['use_system_cron'])
{
- $cron = new phpbb_cron_manager($phpbb_root_path . 'includes/cron/task', $phpEx, $cache->get_driver());
+ $cron = new phpbb_cron_manager(new phpbb_cron_task_provider($phpbb_extension_manager), $cache->get_driver());
}
diff --git a/phpBB/cron.php b/phpBB/cron.php
index cc5964218a..4f246048da 100644
--- a/phpBB/cron.php
+++ b/phpBB/cron.php
@@ -62,7 +62,7 @@ function do_cron($cron_lock, $run_tasks)
if ($config['use_system_cron'])
{
- $cron = new phpbb_cron_manager($phpbb_root_path . 'includes/cron/task', $phpEx, $cache->get_driver());
+ $cron = new phpbb_cron_manager(new phpbb_cron_task_provider($phpbb_extension_manager), $cache->get_driver());
}
else
{
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index a957e2c40b..1735bffef5 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1038,6 +1038,17 @@ function get_schema_struct()
),
);
+ $schema_data['phpbb_ext'] = array(
+ 'COLUMNS' => array(
+ 'ext_name' => array('VCHAR', ''),
+ 'ext_active' => array('BOOL', 0),
+ 'ext_state' => array('TEXT', ''),
+ ),
+ 'KEYS' => array(
+ 'ext_name' => array('UNIQUE', 'ext_name'),
+ ),
+ );
+
$schema_data['phpbb_extensions'] = array(
'COLUMNS' => array(
'extension_id' => array('UINT', NULL, 'auto_increment'),
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index ec15d36e08..2a9c472ca7 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -46,13 +46,16 @@ if (isset($_GET['avatar']))
require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
- $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
- $class_loader->register();
+ $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx");
+ $phpbb_class_loader_ext->register();
+ $phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx");
+ $phpbb_class_loader->register();
// set up caching
$cache_factory = new phpbb_cache_factory($acm_type);
$cache = $cache_factory->get_service();
- $class_loader->set_cache($cache->get_driver());
+ $phpbb_class_loader_ext->set_cache($cache->get_driver());
+ $phpbb_class_loader->set_cache($cache->get_driver());
$request = new phpbb_request();
$db = new $sql_db();
@@ -73,6 +76,9 @@ if (isset($_GET['avatar']))
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
+ // load extensions
+ $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
+
$filename = request_var('avatar', '');
$avatar_group = false;
$exit = false;
diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php
index bef8ae0ea9..f051781547 100644
--- a/phpBB/includes/acp/acp_captcha.php
+++ b/phpBB/includes/acp/acp_captcha.php
@@ -104,13 +104,13 @@ class acp_captcha
foreach ($captchas['available'] as $value => $title)
{
$current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
- $captcha_select .= '';
+ $captcha_select .= '';
}
foreach ($captchas['unavailable'] as $value => $title)
{
$current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
- $captcha_select .= '';
+ $captcha_select .= '';
}
$demo_captcha = phpbb_captcha_factory::get_instance($selected);
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 52033b590c..e51b440d4d 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -111,7 +111,7 @@ class acp_modules
}
break;
-
+
case 'enable':
case 'disable':
if (!$module_id)
@@ -170,7 +170,7 @@ class acp_modules
add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname']), $move_module_name);
$this->remove_cache_file();
}
-
+
break;
case 'quickadd':
@@ -207,7 +207,7 @@ class acp_modules
if (!sizeof($errors))
{
$this->remove_cache_file();
-
+
trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
}
}
@@ -231,7 +231,7 @@ class acp_modules
{
trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);
}
-
+
$module_row = $this->get_module_row($module_id);
// no break
@@ -250,7 +250,7 @@ class acp_modules
'module_auth' => '',
);
}
-
+
$module_data = array();
$module_data['module_basename'] = request_var('module_basename', (string) $module_row['module_basename']);
@@ -295,7 +295,7 @@ class acp_modules
if (!sizeof($errors))
{
$this->remove_cache_file();
-
+
trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
}
}
@@ -316,7 +316,7 @@ class acp_modules
}
// Name options
- $s_name_options .= '';
+ $s_name_options .= '';
$template->assign_block_vars('m_names', array('NAME' => $option, 'A_NAME' => addslashes($option)));
@@ -327,7 +327,7 @@ class acp_modules
{
$s_mode_options .= '';
}
-
+
$template->assign_block_vars('m_names.modes', array(
'OPTION' => $m_mode,
'VALUE' => $this->lang_name($m_values['title']),
@@ -336,7 +336,7 @@ class acp_modules
);
}
}
-
+
$s_cat_option = '';
$template->assign_vars(array_merge(array(
@@ -349,7 +349,7 @@ class acp_modules
'U_EDIT_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id,
'L_TITLE' => $user->lang[strtoupper($action) . '_MODULE'],
-
+
'MODULENAME' => $this->lang_name($module_data['module_langname']),
'ACTION' => $action,
'MODULE_ID' => $module_id,
@@ -480,7 +480,7 @@ class acp_modules
foreach ($module_infos as $option => $values)
{
// Name options
- $s_install_options .= '