Skip to content

Commit

Permalink
Introducing wp_redirect(), first cut. http://mosquito.wordpress.org/v…
Browse files Browse the repository at this point in the history
…iew.php?id=592  Props: Toby Simmons

git-svn-id: http://core.svn.wordpress.org/trunk@2436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Mar 13, 2005
1 parent 8062b3b commit 866ca7b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions wp-admin/link-manager.php
Expand Up @@ -243,7 +243,7 @@ function category_dropdown($fieldname, $selected = 0) {
WHERE link_id=$link_id");
} // end if save
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
header('Location: ' . $this_file);
wp_redirect($this_file);
break;
} // end Save

Expand All @@ -267,7 +267,7 @@ function category_dropdown($fieldname, $selected = 0) {
}
$links_show_cat_id = $cat_id;
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
header('Location: '.$this_file);
wp_redirect($this_file);
break;
} // end Delete

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/options.php
Expand Up @@ -84,7 +84,7 @@
$referred = remove_query_arg('updated' , $_SERVER['HTTP_REFERER']);
$goback = add_query_arg('updated', 'true', $_SERVER['HTTP_REFERER']);
$goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
header('Location: ' . $goback);
wp_redirect($goback);
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/profile.php
Expand Up @@ -86,7 +86,7 @@

$result = $wpdb->query("UPDATE $wpdb->users SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description', user_nicename = '$newuser_nicename' WHERE ID = $user_ID");

header('Location: profile.php?updated=true');
wp_redirect('profile.php?updated=true');
break;

case 'IErightclick':
Expand Down
3 changes: 1 addition & 2 deletions wp-comments-post.php
Expand Up @@ -52,6 +52,5 @@

$location = (empty($_POST['redirect_to'])) ? $_SERVER["HTTP_REFERER"] : $_POST['redirect_to'];

header("Location: $location");

wp_redirect($location);
?>
13 changes: 13 additions & 0 deletions wp-includes/functions.php
Expand Up @@ -1711,6 +1711,19 @@ function auth_redirect() {
}
endif;

// Cookie safe redirect. Works around IIS Set-Cookie bug.
// http://support.microsoft.com/kb/q176113/
if ( !function_exists('wp_redirect') ) :
function wp_redirect($location) {
global $is_IIS;

if ($is_IIS)
header("Refresh: 0;url=$location");
else
header("Location: $location");
}
endif;

function is_plugin_page() {
global $plugin_page;

Expand Down
1 change: 1 addition & 0 deletions wp-includes/vars.php
Expand Up @@ -35,6 +35,7 @@

// Server detection
$is_apache = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? 1 : 0;
$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;

// if the config file does not provide the smilies array, let's define it here
if (!isset($wpsmiliestrans)) {
Expand Down
2 changes: 1 addition & 1 deletion wp-login.php
Expand Up @@ -184,7 +184,7 @@ function focusit() {
wp_setcookie($user_login, $user_pass);
}
do_action('wp_login', $user_login);
header("Location: $redirect_to");
wp_redirect($redirect_to);
exit();
} else {
if ($using_cookie)
Expand Down
3 changes: 1 addition & 2 deletions wp-pass.php
Expand Up @@ -7,6 +7,5 @@
// 10 days
setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH);

header('Location: ' . $_SERVER['HTTP_REFERER']);

wp_redirect($_SERVER['HTTP_REFERER']);
?>

0 comments on commit 866ca7b

Please sign in to comment.