From aade61c6261e9e03225777e428546cd063dd2279 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 14 May 2007 13:56:26 +0000 Subject: [PATCH] Fix regression where $wgActionPaths were not respected when parsing info out of REQUEST_URI. There may still be bugs with alternate/compatibility URLs, investigate further... --- includes/WebRequest.php | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 6e9836e590..1a59766e7b 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -51,17 +51,10 @@ class WebRequest { // So we will use REQUEST_URI if possible. $title = ''; if ( !empty( $_SERVER['REQUEST_URI'] ) ) { - global $wgArticlePath; - $url = $_SERVER['REQUEST_URI']; - if ( !preg_match( '!^https?://!', $url ) ) { - $url = 'http://unused' . $url; - } - $a = parse_url( $url ); - // Find the part after $wgArticlePath - $base = str_replace( '$1', '', $wgArticlePath ); - if ( $a && substr( $a['path'], 0, strlen( $base ) ) == $base ) { - $title = urldecode( substr( $a['path'], strlen( $base ) ) ); - } + global $wgArticlePath, $wgActionPaths; + $paths["view"] = $wgArticlePath; + $paths = array_merge( $paths, $wgActionPaths ); + $title = $this->extractActionPaths( $paths ); } elseif ( isset( $_SERVER['ORIG_PATH_INFO'] ) && $_SERVER['ORIG_PATH_INFO'] != '' ) { # Mangled PATH_INFO # http://bugs.php.net/bug.php?id=31892 @@ -76,6 +69,21 @@ class WebRequest { } } + private function extractActionPaths( $paths ) { + $url = $_SERVER['REQUEST_URI']; + if ( !preg_match( '!^https?://!', $url ) ) { + $url = 'http://unused' . $url; + } + $a = parse_url( $url ); + foreach( $paths as $action => $path ) { + // Find the part after $wgArticlePath + $base = str_replace( '$1', '', $path ); + if ( $a && substr( $a['path'], 0, strlen( $base ) ) == $base ) { + return urldecode( substr( $a['path'], strlen( $base ) ) ); + } + } + } + private $_response; /** -- 2.20.1