diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-08-07 11:47:44 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-08-07 11:47:44 +0200 |
commit | 57f9a96f4b64c323448dfb83ed0816a2abe727e7 (patch) | |
tree | d88eb73a5a0c1b0b0c4fd6ccd9be3e8d32c9b1a5 | |
parent | 3e52126446a286e1c22c7d5a8edf8f592c0ccb03 (diff) | |
parent | a8cb525f77059afe23629935150f8ef96e07d4f9 (diff) | |
download | forums-57f9a96f4b64c323448dfb83ed0816a2abe727e7.tar forums-57f9a96f4b64c323448dfb83ed0816a2abe727e7.tar.gz forums-57f9a96f4b64c323448dfb83ed0816a2abe727e7.tar.bz2 forums-57f9a96f4b64c323448dfb83ed0816a2abe727e7.tar.xz forums-57f9a96f4b64c323448dfb83ed0816a2abe727e7.zip |
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus:
[ticket/12836] Add event core.functions.redirect
-rw-r--r-- | phpBB/includes/functions.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3402a618b0..d7b1b56532 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2210,7 +2210,7 @@ function generate_board_url($without_script_path = false) */ function redirect($url, $return = false, $disable_cd_check = false) { - global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem, $phpbb_path_helper, $phpEx; + global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem, $phpbb_path_helper, $phpEx, $phpbb_dispatcher; $failover_flag = false; @@ -2219,11 +2219,6 @@ function redirect($url, $return = false, $disable_cd_check = false) $user->add_lang('common'); } - if (!$return) - { - garbage_collection(); - } - // Make sure no &'s are in, this will break the redirect $url = str_replace('&', '&', $url); @@ -2298,10 +2293,26 @@ function redirect($url, $return = false, $disable_cd_check = false) trigger_error('INSECURE_REDIRECT', E_USER_ERROR); } + /** + * Execute code and/or overwrite redirect() + * + * @event core.functions.redirect + * @var string url The url + * @var bool return If true, do not redirect but return the sanitized URL. + * @var bool disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. + * @since 3.1.0-RC3 + */ + $vars = array('url', 'return', 'disable_cd_check'); + extract($phpbb_dispatcher->trigger_event('core.functions.redirect', compact($vars))); + if ($return) { return $url; } + else + { + garbage_collection(); + } // Redirect via an HTML form for PITA webservers if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE'))) |