Ticket #17177: 17177.3.diff
| File 17177.3.diff, 3.2 KB (added by , 15 years ago) |
|---|
-
wp-includes/class-wp.php
185 185 186 186 // Look for matches. 187 187 $request_match = $request; 188 foreach ( (array) $rewrite as $match => $query) { 189 // Don't try to match against AtomPub calls 190 if ( $req_uri == 'wp-app.php' ) 191 break; 188 if ( empty( $req_uri ) ) { 189 if ( isset( $rewrite['$'] ) ) { 190 $this->matched_rule = '$'; 191 $query = $rewrite['$']; 192 $matches = array(''); 193 } 194 } else if ( $req_uri != 'wp-app.php' ) { 195 foreach ( (array) $rewrite as $match => $query ) { 196 // If the requesting file is the anchor of the match, prepend it to the path info. 197 if ( ! empty($req_uri) && strpos($match, $req_uri) === 0 && $req_uri != $request ) 198 $request_match = $req_uri . '/' . $request; 192 199 193 // If the requesting file is the anchor of the match, prepend it 194 // to the path info. 195 if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) ) 196 $request_match = $req_uri . '/' . $request; 200 if ( preg_match("#^$match#", $request_match, $matches) || 201 preg_match("#^$match#", urldecode($request_match), $matches) ) { 202 // Got a match. 203 $this->matched_rule = $match; 204 break; 205 } 206 } 207 } 197 208 198 if ( preg_match("#^$match#", $request_match, $matches) || 199 preg_match("#^$match#", urldecode($request_match), $matches) ) { 200 // Got a match. 201 $this->matched_rule = $match; 209 if ( isset( $this->matched_rule ) ) { 210 // Trim the query of everything up to the '?'. 211 $query = preg_replace("!^.+\?!", '', $query); 202 212 203 // Trim the query of everything up to the '?'.204 $query = preg_replace("!^.+\?!", '', $query);213 // Substitute the substring matches into the query. 214 $query = addslashes(WP_MatchesMapRegex::apply($query, $matches)); 205 215 206 // Substitute the substring matches into the query. 207 $query = addslashes(WP_MatchesMapRegex::apply($query, $matches)); 216 $this->matched_query = $query; 208 217 209 $this->matched_query = $query; 218 // Parse the query. 219 parse_str($query, $perma_query_vars); 210 220 211 // Parse the query. 212 parse_str($query, $perma_query_vars); 213 214 // If we're processing a 404 request, clear the error var 215 // since we found something. 216 if ( isset($_GET['error']) ) 217 unset($_GET['error']); 218 219 if ( isset($error) ) 220 unset($error); 221 222 break; 223 } 221 // If we're processing a 404 request, clear the error var 222 // since we found something. 223 unset( $_GET['error'] ); 224 unset( $error ); 224 225 } 225 226 226 227 // If req_uri is empty or if it is a request for ourself, unset error. 227 228 if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) { 228 if ( isset($_GET['error']) )229 unset($_GET['error']);229 unset( $_GET['error'] ); 230 unset( $error ); 230 231 231 if ( isset($error) )232 unset($error);233 234 232 if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) 235 unset( $perma_query_vars);233 unset( $perma_query_vars ); 236 234 237 235 $this->did_permalink = false; 238 236 }