Make WordPress Core


Ignore:
Timestamp:
04/04/2010 12:41:39 AM (16 years ago)
Author:
nacin
Message:

Don't allow # in custom permalink structures and cat/tag bases. Improve some MS branching. fixes #12271

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-permalink.php

    r13750 r13980  
    7979        check_admin_referer('update-permalink');
    8080
    81         if ( isset($_POST['permalink_structure']) ) {
     81        if ( isset( $_POST['permalink_structure'] ) ) {
    8282                $permalink_structure = $_POST['permalink_structure'];
    83                 if (! empty($permalink_structure) )
    84                         $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
    85                 if ( is_multisite() && !is_subdomain_install()  && $permalink_structure != '' && is_main_site() ) {
    86                         $permalink_structure = '/blog' . $permalink_structure;
     83                if ( ! empty( $permalink_structure ) ) {
     84                        $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
     85                        if ( is_multisite() && ! is_subdomain_install() && is_main_site() )
     86                                $permalink_structure = '/blog' . $permalink_structure;
    8787                }
    88                 $wp_rewrite->set_permalink_structure($permalink_structure);
    89         }
    90 
    91         if ( isset($_POST['category_base']) ) {
     88                $wp_rewrite->set_permalink_structure( $permalink_structure );
     89        }
     90
     91        if ( isset( $_POST['category_base'] ) ) {
    9292                $category_base = $_POST['category_base'];
    93                 if (! empty($category_base) )
    94                         $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
    95                 if ( is_multisite() && !is_subdomain_install() && $category_base != '' && is_main_site() ) {
    96                         $category_base = '/blog' . $category_base;
     93                if (! empty( $category_base ) ) {
     94                        $category_base = preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
     95                        if ( is_multisite() && ! is_subdomain_install() && is_main_site() )
     96                                $category_base = '/blog' . $category_base;
    9797                }
    98                 $wp_rewrite->set_category_base($category_base);
    99         }
    100 
    101         if ( isset($_POST['tag_base']) ) {
     98                $wp_rewrite->set_category_base( $category_base );
     99        }
     100
     101        if ( isset( $_POST['tag_base'] ) ) {
    102102                $tag_base = $_POST['tag_base'];
    103                 if (! empty($tag_base) )
    104                         $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']);
    105                 if ( is_multisite() && !is_subdomain_install() && $tag_base != '' && is_main_site() ) {
    106                         $tag_base = '/blog' . $tag_base;
     103                if ( ! empty( $tag_base ) ) {
     104                        $tag_base = preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
     105                        if ( is_multisite() && ! is_subdomain_install() && is_main_site() )
     106                                $tag_base = '/blog' . $tag_base;
    107107                }
    108                 $wp_rewrite->set_tag_base($tag_base);
     108                $wp_rewrite->set_tag_base( $tag_base );
    109109        }
    110110}
Note: See TracChangeset for help on using the changeset viewer.