Skip to:
Content

Changeset 1868


Ignore:
Timestamp:
12/14/08 12:19:52 (5 years ago)
Author:
sambauers
Message:

Better stripping of trailing slashes from paths and URLs

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-admin/options-general.php

    r1698 r1868  
    2727            $value = stripslashes_deep( $value ); 
    2828            if ($option == 'uri' && !empty($value)) { 
    29                 $value = rtrim($value) . '/'; 
     29                $value = rtrim( $value, " \t\n\r\0\x0B/" ) . '/'; 
    3030            } 
    3131            if ( $value ) { 
  • trunk/bb-admin/options-wordpress.php

    r1821 r1868  
    2121            $value = stripslashes_deep( $value ); 
    2222            if (($option == 'wp_siteurl' || $option == 'wp_home') && !empty($value)) { 
    23                 $value = rtrim($value, '/') . '/'; 
     23                $value = rtrim($value, " \t\n\r\0\x0B/") . '/'; 
    2424            } 
    2525            if ( $value ) { 
  • trunk/bb-includes/functions.bb-core.php

    r1862 r1868  
    399399        return ''; 
    400400 
    401     $path = rtrim($request['path'], '/'); 
     401    $path = rtrim($request['path'], " \t\n\r\0\x0B/"); 
    402402    if ( !$base ) 
    403         $base = rtrim(bb_get_option('path'), '/'); 
     403        $base = rtrim(bb_get_option('path'), " \t\n\r\0\x0B/"); 
    404404    $path = preg_replace('|' . preg_quote($base, '|') . '/?|','',$path,1); 
    405405    if ( !$path ) 
     
    574574    $domain = preg_replace('/^https?/', '', $domain); 
    575575    $check = preg_replace( '|^.*' . trim($domain, ' /' ) . '|', '', $permalink, 1 ); 
    576     $uri = rtrim( $uri, '?' ); 
     576    $uri = rtrim( $uri, " \t\n\r\0\x0B?" ); 
    577577 
    578578    global $bb_log; 
     
    583583 
    584584    if ( $check != $uri && $check != str_replace(urlencode($_original_id), $_original_id, $uri) ) { 
    585         if ( $issue_404 && rtrim( $check, '/' ) !== rtrim( $uri, '/' ) ) { 
     585        if ( $issue_404 && rtrim( $check, " \t\n\r\0\x0B/" ) !== rtrim( $uri, " \t\n\r\0\x0B/" ) ) { 
    586586            status_header( 404 ); 
    587587            bb_load_template( '404.php' ); 
  • trunk/bb-settings.php

    r1867 r1868  
    444444 */ 
    445445if ( $bb->uri = bb_get_option('uri') ) { 
    446     $bb->uri = rtrim($bb->uri, '/') . '/'; 
     446    $bb->uri = rtrim($bb->uri, " \t\n\r\0\x0B/") . '/'; 
    447447     
    448448    if ( preg_match( '@^(https?://[^/]+)((?:/.*)*/{1,1})$@i', $bb->uri, $matches ) ) { 
     
    458458    // TODO: Completely remove old constants on version 1.0 
    459459    if ( isset($bb->domain) ) { 
    460         $bb->domain = rtrim( trim( $bb->domain ), '/' ); 
     460        $bb->domain = rtrim( trim( $bb->domain ), " \t\n\r\0\x0B/" ); 
    461461    } 
    462462    if ( isset($bb->path) ) { 
     
    603603$bb->wp_siteurl = bb_get_option('wp_siteurl'); 
    604604if ( $bb->wp_siteurl ) { 
    605     $bb->wp_siteurl = rtrim($bb->wp_siteurl, '/'); 
     605    $bb->wp_siteurl = rtrim( $bb->wp_siteurl, " \t\n\r\0\x0B/" ); 
    606606} 
    607607 
    608608$bb->wp_home = bb_get_option('wp_home'); 
    609609if ( $bb->wp_home ) { 
    610     $bb->wp_home = rtrim($bb->wp_home, '/'); 
     610    $bb->wp_home = rtrim( $bb->wp_home, " \t\n\r\0\x0B/" ); 
    611611} 
    612612 
     
    664664    $bb->cookiepath = $bb->wp_cookies_integrated ? preg_replace('|https?://[^/]+|i', '', $bb->wp_home ) : $bb->path; 
    665665} 
    666 $bb->cookiepath = rtrim($bb->cookiepath, '/') . '/'; 
     666$bb->cookiepath = rtrim( $bb->cookiepath, " \t\n\r\0\x0B/" ) . '/'; 
    667667 
    668668$bb->admin_cookie_path = bb_get_option('admin_cookie_path'); 
     
    670670    $bb->admin_cookie_path = $bb->path . 'bb-admin'; 
    671671} 
    672 $bb->admin_cookie_path = rtrim($bb->admin_cookie_path, '/'); 
     672$bb->admin_cookie_path = rtrim( $bb->admin_cookie_path, " \t\n\r\0\x0B/" ); 
    673673 
    674674$bb->core_plugins_cookie_path = bb_get_option('core_plugins_cookie_path'); 
     
    676676    $bb->core_plugins_cookie_path = preg_replace('|https?://[^/]+|i', '', BB_CORE_PLUGIN_URL); 
    677677} 
    678 $bb->core_plugins_cookie_path = rtrim($bb->core_plugins_cookie_path, '/'); 
     678$bb->core_plugins_cookie_path = rtrim( $bb->core_plugins_cookie_path, " \t\n\r\0\x0B/" ); 
    679679 
    680680$bb->user_plugins_cookie_path = bb_get_option('user_plugins_cookie_path'); 
     
    682682    $bb->user_plugins_cookie_path = preg_replace('|https?://[^/]+|i', '', BB_PLUGIN_URL); 
    683683} 
    684 $bb->user_plugins_cookie_path = rtrim($bb->user_plugins_cookie_path, '/'); 
     684$bb->user_plugins_cookie_path = rtrim( $bb->user_plugins_cookie_path, " \t\n\r\0\x0B/" ); 
    685685 
    686686$bb->sitecookiepath = bb_get_option('sitecookiepath'); 
     
    693693    } 
    694694} 
    695 $bb->sitecookiepath = rtrim($bb->sitecookiepath, '/') . '/'; 
     695$bb->sitecookiepath = rtrim( $bb->sitecookiepath, " \t\n\r\0\x0B/" ) . '/'; 
    696696 
    697697$bb->wp_admin_cookie_path = bb_get_option('wp_admin_cookie_path'); 
     
    699699    $bb->wp_admin_cookie_path = $_bb_sitecookiepath . '/wp-admin'; 
    700700} 
    701 $bb->wp_admin_cookie_path = rtrim($bb->wp_admin_cookie_path, '/'); 
     701$bb->wp_admin_cookie_path = rtrim( $bb->wp_admin_cookie_path, " \t\n\r\0\x0B/" ); 
    702702 
    703703$bb->wp_plugins_cookie_path = bb_get_option('wp_plugins_cookie_path'); 
     
    706706    $bb->wp_plugins_cookie_path = $_bb_sitecookiepath . '/wp-content/plugins'; 
    707707} 
    708 $bb->wp_plugins_cookie_path = rtrim($bb->wp_plugins_cookie_path, '/'); 
     708$bb->wp_plugins_cookie_path = rtrim( $bb->wp_plugins_cookie_path, " \t\n\r\0\x0B/" ); 
    709709unset($_bb_sitecookiepath); 
    710710 
Note: See TracChangeset for help on using the changeset viewer.