Changeset 6751
- Timestamp:
- 02/07/2008 06:23:51 PM (17 years ago)
- Location:
- branches/2.0
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-includes/pluggable-functions.php
r5993 r6751 260 260 global $is_IIS; 261 261 262 $location = apply_filters('wp_redirect', $location, $status); 263 264 if ( !$location ) // allows the wp_redirect filter to cancel a redirect 265 return false; 266 267 $location = wp_sanitize_redirect($location); 268 269 if ( $is_IIS ) { 270 header("Refresh: 0;url=$location"); 271 } else { 272 if ( php_sapi_name() != 'cgi-fcgi' ) 273 status_header($status); // This causes problems on IIS and some FastCGI setups 274 header("Location: $location"); 275 } 276 } 277 endif; 278 279 if ( !function_exists('wp_sanitize_redirect') ) : 280 /** 281 * sanitizes a URL for use in a redirect 282 * @return string redirect-sanitized URL 283 **/ 284 function wp_sanitize_redirect($location) { 262 285 $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location); 286 $location = wp_kses_no_null($location); 263 287 264 288 // remove %0d and %0a from location … … 274 298 } 275 299 } 276 277 if ( $is_IIS ) { 278 header("Refresh: 0;url=$location"); 279 } else { 280 if ( php_sapi_name() != 'cgi-fcgi' ) 281 status_header($status); // This causes problems on IIS and some FastCGI setups 282 header("Location: $location"); 283 } 300 return $location; 301 } 302 endif; 303 304 if ( !function_exists('wp_safe_redirect') ) : 305 /** 306 * performs a safe (local) redirect, using wp_redirect() 307 * @return void 308 **/ 309 function wp_safe_redirect($location, $status = 302) { 310 311 // Need to look at the URL the way it will end up in wp_redirect() 312 $location = wp_sanitize_redirect($location); 313 314 // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//' 315 if ( substr($location, 0, 2) == '//' ) 316 $location = 'http:' . $location; 317 318 $lp = parse_url($location); 319 $wpp = parse_url(get_option('home')); 320 321 $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host'])); 322 323 if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) 324 $location = get_option('siteurl') . '/wp-admin/'; 325 326 wp_redirect($location, $status); 284 327 } 285 328 endif; -
branches/2.0/wp-login.php
r5023 r6751 30 30 $redirect_to = $_REQUEST['redirect_to']; 31 31 32 wp_ redirect($redirect_to);32 wp_safe_redirect($redirect_to); 33 33 exit(); 34 34 … … 199 199 wp_setcookie($user_login, $user_pass, false, '', '', $rememberme); 200 200 do_action('wp_login', $user_login); 201 wp_ redirect($redirect_to);201 wp_safe_redirect($redirect_to); 202 202 exit; 203 203 } else { -
branches/2.0/wp-pass.php
r3923 r6751 8 8 setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH); 9 9 10 wp_ redirect(wp_get_referer());10 wp_safe_redirect(wp_get_referer()); 11 11 ?>
Note: See TracChangeset
for help on using the changeset viewer.