diff options
Diffstat (limited to 'phpBB/includes/functions_acp.php')
-rw-r--r-- | phpBB/includes/functions_acp.php | 84 |
1 files changed, 81 insertions, 3 deletions
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index dc61859363..2f0188289b 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -22,6 +22,7 @@ function adm_page_header($page_title) { global $config, $db, $user, $template; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID; + global $phpbb_dispatcher; if (defined('HEADER_INC')) { @@ -30,6 +31,26 @@ function adm_page_header($page_title) define('HEADER_INC', true); + // A listener can set this variable to `true` when it overrides this function + $adm_page_header_override = false; + + /** + * Execute code and/or overwrite adm_page_header() + * + * @event core.adm_page_header + * @var string page_title Page title + * @var bool adm_page_header_override Shall we return instead of + * running the rest of adm_page_header() + * @since 3.1-A1 + */ + $vars = array('page_title', 'adm_page_header_override'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_header', compact($vars))); + + if ($adm_page_header_override) + { + return; + } + // gzip_compression if ($config['gzip_compress']) { @@ -96,7 +117,27 @@ function adm_page_footer($copyright_html = true) { global $db, $config, $template, $user, $auth, $cache; global $starttime, $phpbb_root_path, $phpbb_admin_path, $phpEx; - global $request; + global $request, $phpbb_dispatcher; + + // A listener can set this variable to `true` when it overrides this function + $adm_page_footer_override = false; + + /** + * Execute code and/or overwrite adm_page_footer() + * + * @event core.adm_page_footer + * @var bool copyright_html Shall we display the copyright? + * @var bool adm_page_footer_override Shall we return instead of + * running the rest of adm_page_footer() + * @since 3.1-A1 + */ + $vars = array('copyright_html', 'adm_page_footer_override'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_footer', compact($vars))); + + if ($adm_page_footer_override) + { + return; + } // Output page creation time if (defined('DEBUG')) @@ -193,7 +234,7 @@ function h_radio($name, $input_ary, $input_default = false, $id = false, $key = */ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) { - global $user, $module; + global $user, $module, $phpbb_dispatcher; $tpl = ''; $name = 'config[' . $config_key . ']'; @@ -305,6 +346,24 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) $tpl .= $vars['append']; } + /** + * Overwrite the html code we display for the config value + * + * @event core.build_config_template + * @var array tpl_type Config type array: + * 0 => data type + * 1 [optional] => string: size, int: minimum + * 2 [optional] => string: max. length, int: maximum + * @var string key Should be used for the id attribute in html + * @var array new Array with the config values we display + * @var string name Should be used for the name attribute + * @var array vars Array with the options for the config + * @var string tpl The resulting html code we display + * @since 3.1-A1 + */ + $vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl'); + extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars))); + return $tpl; } @@ -314,7 +373,8 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) */ function validate_config_vars($config_vars, &$cfg_array, &$error) { - global $phpbb_root_path, $user; + global $phpbb_root_path, $user, $phpbb_dispatcher; + $type = 0; $min = 1; $max = 2; @@ -489,6 +549,24 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) } break; + + default: + /** + * Validate a config value + * + * @event core.validate_config_variable + * @var array cfg_array Array with config values + * @var string config_name Name of the config we validate + * @var array config_definition Array with the options for + * this config + * @var array error Array of errors, the errors should + * be strings only, language keys are + * not replaced afterwards + * @since 3.1-A1 + */ + $vars = array('cfg_array', 'config_name', 'config_definition', 'error'); + extract($phpbb_dispatcher->trigger_event('core.validate_config_variable', compact($vars))); + break; } } |