Merge branch 'develop-ascraeus' into develop

This commit is contained in:
Joas Schilling 2014-11-22 15:52:34 +01:00
commit 0c4a0cac61
2 changed files with 22 additions and 1 deletions

View file

@ -282,10 +282,16 @@ class path_helper
$referer_dir = dirname($referer_dir); $referer_dir = dirname($referer_dir);
} }
while (strpos($absolute_board_url, $referer_dir) !== 0) while (($dir_position = strpos($absolute_board_url, $referer_dir)) !== 0)
{ {
$fixed_root_path .= '../'; $fixed_root_path .= '../';
$referer_dir = dirname($referer_dir); $referer_dir = dirname($referer_dir);
// Just return phpbb_root_path if we reach the top directory
if ($referer_dir === '.')
{
return $this->phpbb_root_path;
}
} }
$fixed_root_path .= substr($absolute_board_url, strlen($referer_dir) + 1); $fixed_root_path .= substr($absolute_board_url, strlen($referer_dir) + 1);

View file

@ -411,6 +411,21 @@ class phpbb_path_helper_test extends phpbb_test_case
'http://www.phpbb.com/community', 'http://www.phpbb.com/community',
'../community/', '../community/',
), ),
array(
'http://www.phpbb.com/foobar',
'http://www.phpbb.com',
'',
),
array(
'http://www.foobar.com',
'http://www.phpbb.com',
'/www.phpbb.com/',
),
array(
'foobar',
'http://www.phpbb.com/community',
'',
)
); );
} }