From 8115a40d0c0b751115131495545fd3e0edbeef36 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Mon, 13 Jan 2003 18:54:16 +0000 Subject: [PATCH] Fix redirect extra slash when no script_path or / specified git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3319 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9fa00a815d..f6f07bd87b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -692,7 +692,7 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', // dougk_ff7 function phpbb_realpath($path) { - return (!@function_exists('realpath') || !@realpath($phpbb_root_path . 'includes/functions.'.$phpEx)) ? $path : realpath($path); + return (!@function_exists('realpath') || !@realpath($phpbb_root_path . 'includes/functions.'.$phpEx)) ? $path : @realpath($path); } function redirect($url) @@ -705,10 +705,11 @@ function redirect($url) } $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://'; - $server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['server_name'])); - $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/'; - $script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path'])); - $url = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($url)); + $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name'])); + $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : ''; + $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path'])); + $script_name = ($script_name == '') ? $script_name : '/' . $script_name; + $url = preg_replace('#^\/?(.*?)\/?$#', '/\1', trim($url)); // Redirect via an HTML form for PITA webservers if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))