aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-07-09 00:07:44 +0200
committerTristan Darricau <github@nicofuma.fr>2014-08-04 10:19:32 +0200
commitf3f54922be31edac5eb2924f1c7eb561e194d43c (patch)
tree494df010c46422e6fc620960aedc4880c291416c /phpBB/includes/functions.php
parent91f5d59f69f6257eed1bb86f43c35d614aa06533 (diff)
downloadforums-f3f54922be31edac5eb2924f1c7eb561e194d43c.tar
forums-f3f54922be31edac5eb2924f1c7eb561e194d43c.tar.gz
forums-f3f54922be31edac5eb2924f1c7eb561e194d43c.tar.bz2
forums-f3f54922be31edac5eb2924f1c7eb561e194d43c.tar.xz
forums-f3f54922be31edac5eb2924f1c7eb561e194d43c.zip
[ticket/12836] Add event core.functions.redirect
PHPBB3-12836
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 9d5770069d..df1a9a58b9 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 &amp;'s are in, this will break the redirect
$url = str_replace('&amp;', '&', $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')))