git-svn-id: file:///svn/phpbb/trunk@8684 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-07-27 13:42:46 +00:00
parent d5d7de4ffa
commit 036dc071e7
2 changed files with 13 additions and 6 deletions

View file

@ -1746,8 +1746,12 @@ function generate_board_url($without_script_path = false)
/** /**
* Redirects the user to another page then exits the script nicely * Redirects the user to another page then exits the script nicely
* This function is intended for urls within the board. It's not meant to redirect to cross-domains. * This function is intended for urls within the board. It's not meant to redirect to cross-domains.
*
* @param string $url The url to redirect to
* @param bool $return If true, do not redirect but return the sanitized URL. Default is no return.
* @param 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. Default is false.
*/ */
function redirect($url, $return = false) function redirect($url, $return = false, $disable_cd_check = false)
{ {
global $db, $cache, $config, $user; global $db, $cache, $config, $user;
@ -1774,8 +1778,8 @@ function redirect($url, $return = false)
} }
else if (!empty($url_parts['scheme']) && !empty($url_parts['host'])) else if (!empty($url_parts['scheme']) && !empty($url_parts['host']))
{ {
// Attention: only able to redirect within the same domain (yourdomain.com -> www.yourdomain.com will not work) // Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work)
if ($url_parts['host'] !== $user->host) if (!$disable_cd_check && $url_parts['host'] !== $user->host)
{ {
$url = generate_board_url(); $url = generate_board_url();
} }
@ -2853,7 +2857,7 @@ function phpbb_checkdnsrr($host, $type = '')
} }
// @exec('nslookup -retry=1 -timout=1 -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); // @exec('nslookup -retry=1 -timout=1 -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output);
@exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host) . '.', $output);
// If output is empty, the nslookup failed // If output is empty, the nslookup failed
if (empty($output)) if (empty($output))
@ -2879,7 +2883,8 @@ function phpbb_checkdnsrr($host, $type = '')
} }
else if (function_exists('checkdnsrr')) else if (function_exists('checkdnsrr'))
{ {
return (checkdnsrr($host, $type)) ? true : false; // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain)
return (checkdnsrr($host . '.', $type)) ? true : false;
} }
return NULL; return NULL;

View file

@ -107,7 +107,9 @@ if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'])
$db->sql_query($sql); $db->sql_query($sql);
} }
redirect($forum_data['forum_link']); // We redirect to the url. The third parameter indicates that external redirects are allowed.
redirect($forum_data['forum_link'], false, true);
exit;
} }
// Build navigation links // Build navigation links