From: Meik S. <acy...@ph...> - 2009-08-01 13:52:57
|
Author: acydburn Date: Sat Aug 1 14:52:37 2009 New Revision: 9907 Log: Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535) Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html branches/phpBB-3_0_0/phpBB/includes/functions.php Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original) --- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Sat Aug 1 14:52:37 2009 *************** *** 185,190 **** --- 185,191 ---- <li>[Fix] Correctly log action when users request to join a group (Bug #37585 - Patch by nickvergessen)</li> <li>[Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)</li> <li>[Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)</li> + <li>[Fix] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535)</li> <li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li> <li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li> <li>[Change] Template engine now permits to a limited extent variable includes.</li> Modified: branches/phpBB-3_0_0/phpBB/includes/functions.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/functions.php (original) --- branches/phpBB-3_0_0/phpBB/includes/functions.php Sat Aug 1 14:52:37 2009 *************** *** 2284,2290 **** $url = str_replace('&', '&', $url); // Determine which type of redirect we need to handle... ! $url_parts = parse_url($url); if ($url_parts === false) { --- 2284,2290 ---- $url = str_replace('&', '&', $url); // Determine which type of redirect we need to handle... ! $url_parts = @parse_url($url); if ($url_parts === false) { *************** *** 2497,2502 **** --- 2497,2514 ---- $redirect .= ($query) ? '?' . $query : ''; } + // We need to be cautious here. + // On some situations, the redirect path is an absolute URL, sometimes a relative path + // For a relative path, let's prefix it with $phpbb_root_path to point to the correct location, + // else we use the URL directly. + $url_parts = @parse_url($redirect); + + // URL + if ($url_parts !== false && !empty($url_parts['scheme']) && !empty($url_parts['host'])) + { + return str_replace('&', '&', $redirect); + } + return $phpbb_root_path . str_replace('&', '&', $redirect); } *************** *** 3596,3602 **** exit_handler(); break; ! // PHP4 comptibility case E_DEPRECATED: return true; --- 3608,3614 ---- exit_handler(); break; ! // PHP4 comptibility case E_DEPRECATED: return true; |