Make WordPress Core

Ticket #8837: 8837.patch

File 8837.patch, 1.3 KB (added by Viper007Bond, 18 years ago)
  • wp-admin/categories.php

     
    2525        if ( !current_user_can('manage_categories') )
    2626                wp_die(__('Cheatin’ uh?'));
    2727
    28         if( wp_insert_category($_POST ) ) {
    29                 wp_redirect('categories.php?message=1#addcat');
    30         } else {
    31                 wp_redirect('categories.php?message=4#addcat');
    32         }
     28        if ( wp_insert_category($_POST ) )
     29                wp_safe_redirect( add_query_arg( 'message', 1, wp_get_referer() ) . '#addcat' );
     30        else
     31                wp_safe_redirect( add_query_arg( 'message', 4, wp_get_referer() ) . '#addcat' );
     32
    3333        exit;
    3434break;
    3535
     
    4343        $cat_name = get_catname($cat_ID);
    4444
    4545        // Don't delete the default cats.
    46     if ( $cat_ID == get_option('default_category') )
     46        if ( $cat_ID == get_option('default_category') )
    4747                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    4848
    4949        wp_delete_category($cat_ID);
    5050
    51         wp_redirect('categories.php?message=2');
     51        wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) );
    5252        exit;
    5353
    5454break;
     
    6969                wp_delete_category($cat_ID);
    7070        }
    7171
    72         $sendback = wp_get_referer();
    73 
    74         wp_redirect($sendback);
     72        wp_safe_redirect( wp_get_referer() );
    7573        exit();
    7674
    7775break;