Bug #56965 - Allow redirect() to redirect across directories.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10536 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Josh Woody 2010-02-25 00:18:30 +00:00
parent 8f5155d272
commit 9e64c3bd84
2 changed files with 14 additions and 0 deletions

View file

@ -95,6 +95,7 @@
<li>[Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)</li> <li>[Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)</li>
<li>[Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)</li> <li>[Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)</li>
<li>[Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)</li> <li>[Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)</li>
<li>[Fix] Allow redirect() function to redirect across directories. (Bug #56965)</li>
<li>[Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)</li> <li>[Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)</li>
</ul> </ul>

View file

@ -2336,6 +2336,19 @@ function redirect($url, $return = false, $disable_cd_check = false)
// Relative uri // Relative uri
$pathinfo = pathinfo($url); $pathinfo = pathinfo($url);
if (!$disable_cd_check && !file_exists($pathinfo['dirname']))
{
$url = str_replace('../', '', $url);
$pathinfo = pathinfo($url);
if (!file_exists($pathinfo['dirname']))
{
// fallback to "last known user page"
$url = generate_board_url() . '/' . $user->page['page'];
break;
}
}
// Is the uri pointing to the current directory? // Is the uri pointing to the current directory?
if ($pathinfo['dirname'] == '.') if ($pathinfo['dirname'] == '.')
{ {