Make WordPress Core

Changeset 3928


Ignore:
Timestamp:
06/27/2006 05:38:56 AM (18 years ago)
Author:
ryan
Message:

Use wp_redirect().

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/categories.php

    r3804 r3928  
    3232    wp_insert_category($_POST);
    3333
    34     header('Location: categories.php?message=1#addcat');
     34    wp_redirect('categories.php?message=1#addcat');
    3535break;
    3636
     
    5353    wp_delete_category($cat_ID);
    5454
    55     header('Location: categories.php?message=2');
     55    wp_redirect('categories.php?message=2');
    5656
    5757break;
     
    7575    wp_update_category($_POST);
    7676
    77     header('Location: categories.php?message=3');
     77    wp_redirect('categories.php?message=3');
    7878break;
    7979
  • trunk/wp-admin/comment.php

    r3918 r3928  
    119119
    120120    if ((wp_get_referer() != '') && (false == $noredir)) {
    121         header('Location: ' . wp_get_referer());
    122     } else {
    123         header('Location: '. get_settings('siteurl') .'/wp-admin/edit-comments.php');
     121        wp_redirect(wp_get_referer());
     122    } else {
     123        wp_redirect(get_settings('siteurl') .'/wp-admin/edit-comments.php');
    124124    }
    125125    exit();
     
    146146
    147147    if ((wp_get_referer() != "") && (false == $noredir)) {
    148         header('Location: ' . wp_get_referer());
    149     } else {
    150         header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
     148        wp_redirect(wp_get_referer());
     149    } else {
     150        wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
    151151    }
    152152    exit();
     
    177177
    178178    if ((wp_get_referer() != "") && (false == $noredir)) {
    179         header('Location: ' . wp_get_referer());
    180     } else {
    181         header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
     179        wp_redirect(wp_get_referer());
     180    } else {
     181        wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
    182182    }
    183183    exit();
     
    195195    $referredby = $_POST['referredby'];
    196196    if (!empty($referredby)) {
    197         header('Location: ' . $referredby);
    198     } else {
    199         header ("Location: edit.php?p=$comment_post_ID&c=1#comments");
     197        wp_redirect($referredby);
     198    } else {
     199        wp_redirect("edit.php?p=$comment_post_ID&c=1#comments");
    200200    }
    201201
  • trunk/wp-admin/import/blogger.php

    r3769 r3928  
    2626    function restart() {
    2727        delete_option('import-blogger');
    28         header("Location: admin.php?import=blogger");
     28        wp_redirect("admin.php?import=blogger");
    2929        die();
    3030    }
     
    214214    // Redirects to next step
    215215    function do_next_step() {
    216         header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
     216        wp_redirect("admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
    217217        die();
    218218    }
     
    274274            }
    275275            update_option('import-blogger', $this->import);
    276             header("Location: admin.php?import=blogger&noheader=true&step=1");
     276            wp_redirect("admin.php?import=blogger&noheader=true&step=1");
    277277        }
    278278        die();
  • trunk/wp-admin/inline-uploading.php

    r3765 r3928  
    4242wp_delete_attachment($attachment);
    4343
    44 header("Location: " . basename(__FILE__) ."?post=$post&all=$all&action=view&start=$start");
     44wp_redirect(basename(__FILE__) ."?post=$post&all=$all&action=view&start=$start");
    4545die;
    4646
     
    103103}
    104104
    105 header("Location: " . basename(__FILE__) . "?post=$post&all=$all&action=view&start=0");
     105wp_redirect(basename(__FILE__) . "?post=$post&all=$all&action=view&start=0");
    106106die();
    107107
     
    142142
    143143if ( count($attachments) == 0 ) {
    144     header("Location: " . basename(__FILE__) ."?post=$post&action=upload" );
     144    wp_redirect( basename(__FILE__) ."?post=$post&action=upload" );
    145145    die;
    146146} elseif ( count($attachments) > $num ) {
  • trunk/wp-admin/link.php

    r3918 r3928  
    3838        //for each link id (in $linkcheck[]) change category to selected value
    3939        if (count($linkcheck) == 0) {
    40             header('Location: '.$this_file);
     40            wp_redirect($this_file);
    4141            exit;
    4242        }
     
    5050        }
    5151
    52         header("Location: $this_file?deleted=$deleted");
     52        wp_redirect("$this_file?deleted=$deleted");
    5353        break;
    5454
     
    6262        //for each link id (in $linkcheck[]) change category to selected value
    6363        if (count($linkcheck) == 0) {
    64             header('Location: '.$this_file);
     64            wp_redirect($this_file);
    6565            exit;
    6666        }
     
    6969        //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
    7070
    71         header('Location: '.$this_file);
     71        wp_redirect($this_file);
    7272        break;
    7373
     
    7777        add_link();
    7878
    79         header('Location: '.wp_get_referer().'?added=true');
     79        wp_redirect(wp_get_referer().'?added=true');
    8080        break;
    8181
  • trunk/wp-admin/moderation.php

    r3847 r3928  
    7171
    7272    $file = basename(__FILE__);
    73     header("Location: $file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam");
     73    wp_redirect("$file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam");
    7474    exit();
    7575
  • trunk/wp-admin/page.php

    r3918 r3928  
    5050        $location = "page.php?action=edit&post=$page_ID";
    5151
    52     header("Location: $location");
     52    wp_redirect($location);
    5353    exit();
    5454    break;
     
    113113        $location = 'page-new.php';
    114114    }
    115     header ('Location: ' . $location); // Send user on their way while we keep working
     115    wp_redirect($location); // Send user on their way while we keep working
    116116
    117117    exit();
     
    139139    elseif (strstr($sendback, 'attachments.php')) $sendback = get_settings('siteurl') .'/wp-admin/attachments.php';
    140140    $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    141     header ('Location: ' . $sendback);
     141    wp_redirect($sendback);
    142142    exit();
    143143    break;
    144144
    145145default:
    146     header('Location: edit-pages.php');
     146    wp_redirect('edit-pages.php');
    147147    exit();
    148148    break;
  • trunk/wp-admin/plugin-editor.php

    r3804 r3928  
    4545        fwrite($f, $newcontent);
    4646        fclose($f);
    47         header("Location: plugin-editor.php?file=$file&a=te");
     47        wp_redirect("plugin-editor.php?file=$file&a=te");
    4848    } else {
    49         header("Location: plugin-editor.php?file=$file");
     49        wp_redirect("plugin-editor.php?file=$file");
    5050    }
    5151
  • trunk/wp-admin/plugins.php

    r3804 r3928  
    1313            do_action('activate_' . trim( $_GET['plugin'] ));
    1414        }
    15         header('Location: plugins.php?activate=true');
     15        wp_redirect('plugins.php?activate=true');
    1616    } else if ('deactivate' == $_GET['action']) {
    1717        check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
     
    2020        update_option('active_plugins', $current);
    2121        do_action('deactivate_' . trim( $_GET['plugin'] ));
    22         header('Location: plugins.php?deactivate=true');
     22        wp_redirect('plugins.php?deactivate=true');
    2323    }
    2424    exit;
  • trunk/wp-admin/post.php

    r3918 r3928  
    5353        $location = "post.php?action=edit&post=$post_ID";
    5454
    55     header("Location: $location");
     55    wp_redirect($location);
    5656    exit();
    5757    break;
     
    120120    }
    121121
    122     header ('Location: ' . $location); // Send user on their way while we keep working
     122    wp_redirect($location); // Send user on their way while we keep working
    123123
    124124    exit();
     
    146146    elseif (strstr($sendback, 'attachments.php')) $sendback = get_settings('siteurl') .'/wp-admin/attachments.php';
    147147    $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    148     header ('Location: ' . $sendback);
     148    wp_redirect($sendback);
    149149    exit();
    150150    break;
    151151
    152152default:
    153     header('Location: edit.php');
     153    wp_redirect('edit.php');
    154154    exit();
    155155    break;
  • trunk/wp-admin/templates.php

    r3804 r3928  
    4848            fwrite($f, $newcontent);
    4949            fclose($f);
    50             header("Location: templates.php?file=$file&a=te");
     50            wp_redirect("templates.php?file=$file&a=te");
    5151        } else {
    52             header("Location: templates.php?file=$file&a=err");
     52            wp_redirect("templates.php?file=$file&a=err");
    5353        }
    5454    } else {
    55         header("Location: templates.php?file=$file&a=err");
     55        wp_redirect("templates.php?file=$file&a=err");
    5656    }
    5757
  • trunk/wp-admin/theme-editor.php

    r3804 r3928  
    5959        fwrite($f, $newcontent);
    6060        fclose($f);
    61         header("Location: theme-editor.php?file=$file&theme=$theme&a=te");
     61        wp_redirect("theme-editor.php?file=$file&theme=$theme&a=te");
    6262    } else {
    63         header("Location: theme-editor.php?file=$file&theme=$theme");
     63        wp_redirect("theme-editor.php?file=$file&theme=$theme");
    6464    }
    6565
  • trunk/wp-admin/themes.php

    r3804 r3928  
    1414        do_action('switch_theme', get_current_theme());
    1515
    16         header('Location: themes.php?activated=true');
     16        wp_redirect('themes.php?activated=true');
    1717        exit;
    1818    }
  • trunk/wp-admin/user-edit.php

    r3859 r3928  
    4848    $redirect = "user-edit.php?user_id=$user_id&updated=true";
    4949    $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
    50     header("Location: $redirect");
     50    wp_redirect($redirect);
    5151    exit;
    5252}
  • trunk/wp-admin/users.php

    r3864 r3928  
    125125
    126126    if (empty($_POST['users'])) {
    127         header('Location: ' . $redirect);
     127        wp_redirect($redirect);
    128128    }
    129129
     
    146146    }
    147147
    148     header('Location: ' . add_query_arg('update', $update, $redirect));
     148    wp_redirect(add_query_arg('update', $update, $redirect));
    149149
    150150break;
     
    155155
    156156    if ( empty($_POST['users']) ) {
    157         header('Location: ' . $redirect);
     157        wp_redirect($redirect);
    158158    }
    159159
     
    186186    $redirect = add_query_arg('delete_count', $delete_count, $redirect);
    187187
    188     header('Location: ' . add_query_arg('update', $update, $redirect));
     188    wp_redirect(add_query_arg('update', $update, $redirect));
    189189
    190190break;
     
    195195
    196196    if ( empty($_POST['users']) )
    197         header('Location: ' . $redirect);
     197        wp_redirect($redirect);
    198198
    199199    if ( !current_user_can('delete_users') )
     
    262262        $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_POST['user_login']), true));
    263263        $redirect = add_query_arg('usersearch', $new_user_login, $redirect);
    264         header('Location: ' . add_query_arg('update', $update, $redirect) . '#user-' . $user_id);
     264        wp_redirect(add_query_arg('update', $update, $redirect) . '#user-' . $user_id);
    265265        die();
    266266    }
  • trunk/wp-content/themes/default/functions.php

    r3517 r3928  
    124124            }
    125125            //print_r($_REQUEST);
    126             header("Location: themes.php?page=functions.php&saved=true");
     126            wp_redirect("themes.php?page=functions.php&saved=true");
    127127            die;
    128128        }
  • trunk/wp-includes/pluggable.php

    r3926 r3928  
    222222        nocache_headers();
    223223
    224         header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
     224        wp_redirect(get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
    225225        exit();
    226226    }
  • trunk/wp-login.php

    r3732 r3928  
    3131    $redirect_to = 'wp-login.php';
    3232    if ( isset($_REQUEST['redirect_to']) )
    33         $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_REQUEST['redirect_to']);
     33        $redirect_to = $_REQUEST['redirect_to'];
    3434
    3535    wp_redirect($redirect_to);
     
    174174    else
    175175        $redirect_to = $_REQUEST['redirect_to'];
    176     $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $redirect_to);
    177176
    178177    if( $_POST ) {
     
    241240<p class="submit">
    242241    <input type="submit" name="submit" id="submit" value="<?php _e('Login'); ?> &raquo;" tabindex="4" />
    243     <input type="hidden" name="redirect_to" value="<?php echo $redirect_to; ?>" />
     242    <input type="hidden" name="redirect_to" value="<?php echo wp_specialchars($redirect_to); ?>" />
    244243</p>
    245244</form>
  • trunk/wp-trackback.php

    r3369 r3928  
    5656if (empty($title) && empty($tb_url) && empty($blog_name)) {
    5757    // If it doesn't look like a trackback at all...
    58     header('Location: ' . get_permalink($tb_id));
     58    wp_redirect(get_permalink($tb_id));
    5959    exit;
    6060}
Note: See TracChangeset for help on using the changeset viewer.