Make WordPress Core

Changeset 12760


Ignore:
Timestamp:
01/19/2010 05:01:39 PM (17 years ago)
Author:
ryan
Message:

Formatting cleanups

Location:
trunk
Files:
5 edited

Legend:

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

    r12725 r12760  
    3030
    3131<div class="wrap">
    32         <h2><?php echo wp_specialchars( $title ); ?></h2>
     32        <h2><?php echo esc_html( $title ); ?></h2>
    3333
    3434        <ul class="subsubsub">
  • trunk/wp-admin/ms-sites.php

    r12752 r12760  
    7171}
    7272
    73 switch( $_GET['action'] ) {
     73switch ( $_GET['action'] ) {
    7474        // Edit blog
    7575        case "editblog":
     
    278278                                                                <?php
    279279                                                                reset( $editblog_roles );
    280                                                                 foreach( $editblog_roles as $role => $role_assoc ){
     280                                                                foreach ( $editblog_roles as $role => $role_assoc ){
    281281                                                                        $name = translate_with_context($role_assoc['name']);
    282282                                                                        $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
     
    374374                <form action="ms-sites.php" method="get" id="ms-search">
    375375                        <input type="hidden" name="action" value="blogs" />
    376                         <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo stripslashes( esc_attr( $s, 1 ) ); ?>" size="17" />
     376                        <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo stripslashes( esc_attr( $s ) ); ?>" size="17" />
    377377                        <input type="submit" class="button" name="blog_name" value="<?php esc_attr_e('Search blogs by name') ?>" />
    378378                        <input type="submit" class="button" name="blog_id" value="<?php esc_attr_e('by blog ID') ?>" />
     
    443443                        <tbody id="the-list">
    444444                        <?php
    445                         if ($blog_list) {
     445                        if ( $blog_list ) {
    446446                                $bgcolor = $class = '';
    447447                                $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" );
    448                                 foreach ($blog_list as $blog) {
     448                                foreach ( $blog_list as $blog ) {
    449449                                        $class = ('alternate' == $class) ? '' : 'alternate';
    450450                                        reset( $status_list );
     
    459459
    460460                                        $blogname = ( is_subdomain_install() ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path'];
    461                                         foreach( $posts_columns as $column_name=>$column_display_name ) {
     461                                        foreach ( $posts_columns as $column_name=>$column_display_name ) {
    462462                                                switch($column_name) {
    463463                                                        case 'id': ?>
  • trunk/wp-admin/ms-users.php

    r12752 r12760  
    105105        <form action="ms-users.php" method="get" class="search-form">
    106106                <p class="search-box">
    107                 <input type="text" name="s" value="<?php if (isset($_GET['s'])) esc_attr( stripslashes( $s ) ); ?>" class="search-input" id="user-search-input" />
     107                <input type="text" name="s" value="<?php if ( isset($_GET['s']) ) esc_attr( stripslashes( $s ) ); ?>" class="search-input" id="user-search-input" />
    108108                <input type="submit" id="post-query-submit" value="<?php esc_attr_e('Search Users') ?>" class="button" />
    109109                </p>
  • trunk/wp-includes/ms-functions.php

    r12733 r12760  
    445445                $ret = false;
    446446                if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
    447                         foreach( (array) $blogs as $blog_id => $blog ) {
     447                        foreach ( (array) $blogs as $blog_id => $blog ) {
    448448                                if ( $blog->site_id != $wpdb->siteid )
    449449                                        continue;
     
    875875        if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
    876876                $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
    877                 foreach( (array) $banned_names as $banned_domain ) {
     877                foreach ( (array) $banned_names as $banned_domain ) {
    878878                        if ( $banned_domain == '' )
    879879                                continue;
     
    21282128        $rows = $wpdb->get_results( "SELECT meta_key FROM {$wpdb->sitemeta} WHERE meta_key LIKE 'rss\_%\_ts' AND meta_value < unix_timestamp( date_sub( NOW(), interval 7200 second ) )" );
    21292129        if ( is_array( $rows ) ) {
    2130                 foreach( $rows as $row ) {
     2130                foreach ( $rows as $row ) {
    21312131                        $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE meta_key = %s", $row->meta_key ) );
    21322132                        $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE meta_key = %s", str_replace( '_ts', '', $row->meta_key ) ) );
  • trunk/wp-includes/ms-settings.php

    r12674 r12760  
    1515}
    1616
    17 if( isset( $current_site ) && isset( $current_blog ) )
     17if ( isset( $current_site ) && isset( $current_blog ) )
    1818        return;
    1919
     
    2222
    2323$domain = addslashes( $_SERVER['HTTP_HOST'] );
    24 if( substr( $domain, 0, 4 ) == 'www.' )
     24if ( substr( $domain, 0, 4 ) == 'www.' )
    2525        $domain = substr( $domain, 4 );
    26 if( strpos( $domain, ':' ) ) {
    27         if( substr( $domain, -3 ) == ':80' ) {
     26if ( strpos( $domain, ':' ) ) {
     27        if ( substr( $domain, -3 ) == ':80' ) {
    2828                $domain = substr( $domain, 0, -3 );
    2929                $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
    30         } elseif( substr( $domain, -4 ) == ':443' ) {
     30        } elseif ( substr( $domain, -4 ) == ':443' ) {
    3131                $domain = substr( $domain, 0, -4 );
    3232                $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
     
    3636}
    3737$domain = preg_replace('/:.*$/', '', $domain); // Strip ports
    38 if( substr( $domain, -1 ) == '.' )
     38if ( substr( $domain, -1 ) == '.' )
    3939        $domain = substr( $domain, 0, -1 );
    4040
     
    4848        if ( !$current_site->site_name ) {
    4949                $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
    50                 if( $current_site->site_name == null )
     50                if ( $current_site->site_name == null )
    5151                        $current_site->site_name = ucfirst( $current_site->domain );
    5252                wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options');
     
    5757function wpmu_current_site() {
    5858        global $wpdb, $current_site, $domain, $path, $sites;
    59         if( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
     59        if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
    6060                $current_site->id = (defined( 'SITE_ID_CURRENT_SITE' ) ? constant('SITE_ID_CURRENT_SITE') : 1);
    6161                $current_site->domain = DOMAIN_CURRENT_SITE;
    6262                $current_site->path   = $path = PATH_CURRENT_SITE;
    63                 if( defined( 'BLOGID_CURRENT_SITE' ) )
     63                if ( defined( 'BLOGID_CURRENT_SITE' ) )
    6464                        $current_site->blog_id = BLOGID_CURRENT_SITE;
    6565                return $current_site;
     
    6767
    6868        $current_site = wp_cache_get( "current_site", "site-options" );
    69         if( $current_site )
     69        if ( $current_site )
    7070                return $current_site;
    7171
    7272        $wpdb->suppress_errors();
    7373        $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
    74         if( count( $sites ) == 1 ) {
     74        if ( count( $sites ) == 1 ) {
    7575                $current_site = $sites[0];
    7676                $path = $current_site->path;
     
    8181        }
    8282        $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
    83         if( is_subdomain_install() ) {
     83        if ( is_subdomain_install() ) {
    8484                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) );
    85                 if( $current_site != null )
     85                if ( $current_site != null )
    8686                        return $current_site;
    8787                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) );
    88                 if( $current_site != null ) {
     88                if ( $current_site != null ) {
    8989                        $path = '/';
    9090                        return $current_site;
     
    9393                $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) );
    9494                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) );
    95                 if( $current_site != null )
     95                if ( $current_site != null )
    9696                        return $current_site;
    9797                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) );
    98                 if( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
    99                         if( count( $sites ) == 1 ) {
     98                if ( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
     99                        if ( count( $sites ) == 1 ) {
    100100                                $current_site = $sites[0];
    101101                                die( "That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>" );
     
    108108        } else {
    109109                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) );
    110                 if( $current_site != null )
     110                if ( $current_site != null )
    111111                        return $current_site;
    112112                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) );
    113                 if( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
    114                         if( count( $sites ) == 1 ) {
     113                if ( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
     114                        if ( count( $sites ) == 1 ) {
    115115                                $current_site = $sites[0];
    116116                                die( "That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>" );
     
    126126
    127127$current_site = wpmu_current_site();
    128 if( !isset( $current_site->blog_id ) )
     128if ( !isset( $current_site->blog_id ) )
    129129        $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
    130130
    131 if( is_subdomain_install() ) {
     131if ( is_subdomain_install() ) {
    132132        $current_blog = wp_cache_get( 'current_blog_' . $domain, 'site-options' );
    133         if( !$current_blog ) {
     133        if ( !$current_blog ) {
    134134                $current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s", $domain) );
    135                 if( $current_blog )
     135                if ( $current_blog )
    136136                        wp_cache_set( 'current_blog_' . $domain, $current_blog, 'site-options' );
    137137        }
    138         if( $current_blog != null && $current_blog->site_id != $current_site->id ) {
     138        if ( $current_blog != null && $current_blog->site_id != $current_site->id )
    139139                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE id = %d", $current_blog->site_id) );
    140         } else {
     140        else
    141141                $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
    142         }
    143142} else {
    144143        $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) );
    145         if( strpos( $blogname, '/' ) )
     144        if ( strpos( $blogname, '/' ) )
    146145                $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) );
    147         if( strpos( " ".$blogname, '?' ) )
     146        if ( strpos( " ".$blogname, '?' ) )
    148147                $blogname = substr( $blogname, 0, strpos( $blogname, '?' ) );
    149148        $reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );
    150         if ( $blogname != '' && !in_array( $blogname, $reserved_blognames ) && !is_file( $blogname ) ) {
     149        if ( $blogname != '' && !in_array( $blogname, $reserved_blognames ) && !is_file( $blogname ) )
    151150                $path = $path . $blogname . '/';
    152         }
    153151        $current_blog = wp_cache_get( 'current_blog_' . $domain . $path, 'site-options' );
    154         if( !$current_blog ) {
     152        if ( !$current_blog ) {
    155153                $current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path) );
    156                 if( $current_blog )
     154                if ( $current_blog )
    157155                        wp_cache_set( 'current_blog_' . $domain . $path, $current_blog, 'site-options' );
    158156        }
    159157}
    160158
    161 if( defined( "WP_INSTALLING" ) == false && is_subdomain_install() && !is_object( $current_blog ) ) {
    162         if( defined( 'NOBLOGREDIRECT' ) ) {
     159if ( defined( "WP_INSTALLING" ) == false && is_subdomain_install() && !is_object( $current_blog ) ) {
     160        if ( defined( 'NOBLOGREDIRECT' ) ) {
    163161                $destination = constant( 'NOBLOGREDIRECT' );
    164162                if ( $destination == '%siteurl%' )
     
    173171}
    174172
    175 if( defined( "WP_INSTALLING" ) == false ) {
    176         if( $current_site && $current_blog == null ) {
    177                 if( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) {
     173if ( defined( "WP_INSTALLING" ) == false ) {
     174        if ( $current_site && $current_blog == null ) {
     175                if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) {
    178176                        header( "Location: http://" . $current_site->domain . $current_site->path );
    179177                        exit;
     
    181179                $current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path) );
    182180        }
    183         if( $current_blog == false || $current_site == false )
     181        if ( $current_blog == false || $current_site == false )
    184182                is_installed();
    185183}
     
    188186$public  = $current_blog->public;
    189187
    190 if( $current_blog->site_id == 0 || $current_blog->site_id == '' )
     188if ( $current_blog->site_id == 0 || $current_blog->site_id == '' )
    191189        $current_blog->site_id = 1;
    192190$site_id = $current_blog->site_id;
     
    194192$current_site = get_current_site_name( $current_site );
    195193
    196 if( $blog_id == false ) {
     194if ( $blog_id == false ) {
    197195    // no blog found, are we installing? Check if the table exists.
    198196    if ( defined('WP_INSTALLING') ) {
    199         $blog_id = $wpdb->get_var( "SELECT blog_id FROM $wpdb->blogs LIMIT 0,1" );
    200         if( $blog_id == false ) {
    201             // table doesn't exist. This is the first blog
    202             $blog_id = 1;
    203         } else {
    204             // table exists
    205             // don't create record at this stage. we're obviously installing so it doesn't matter what the table vars below are like.
    206             // default to using the "main" blog.
    207             $blog_id = 1;
    208         }
    209         $current_blog->blog_id = $blog_id;
     197                $blog_id = $wpdb->get_var( "SELECT blog_id FROM $wpdb->blogs LIMIT 0,1" );
     198                if ( $blog_id == false ) {
     199                    // table doesn't exist. This is the first blog
     200                    $blog_id = 1;
     201                } else {
     202                    // table exists
     203                    // don't create record at this stage. we're obviously installing so it doesn't matter what the table vars below are like.
     204                    // default to using the "main" blog.
     205                    $blog_id = 1;
     206                }
     207                $current_blog->blog_id = $blog_id;
    210208    } else {
    211         $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
    212         if( $check == false ) {
    213             $msg = ': DB Tables Missing';
    214         } else {
    215             $msg = '';
    216         }
    217         die( "No Blog by that name on this system." . $msg );
     209                $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
     210                if ( $check == false )
     211                    $msg = ': DB Tables Missing';
     212                else
     213                    $msg = '';
     214                die( "No Blog by that name on this system." . $msg );
    218215    }
    219216}
     
    221218$wpdb->suppress_errors( false );
    222219
    223 if( '0' == $current_blog->public ) {
     220if ( '0' == $current_blog->public ) {
    224221        // This just means the blog shouldn't show up in google, etc. Only to registered members
    225222}
     
    228225        global $wpdb, $domain, $path;
    229226        $base = stripslashes( $base );
    230         if( defined( "WP_INSTALLING" ) == false ) {
     227        if ( defined( "WP_INSTALLING" ) == false ) {
    231228                $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
    232229                $msg = "If your blog does not display, please contact the owner of this site.<br /><br />If you are the owner of this site please check that MySQL is running properly and all tables are error free.<br /><br />";
    233                 if( $check == false ) {
     230                if ( $check == false ) {
    234231                        $msg .= "<strong>Database Tables Missing.</strong><br />Database tables are missing. This means that MySQL is either not running, WPMU was not installed properly, or someone deleted {$wpdb->site}. You really <em>should</em> look at your database now.<br />";
    235232                } else {
     
    248245                        </ul>";
    249246                $msg .= "If you suspect a problem please report it to the support forums but you must include the information asked for in the <a href='http://codex.wordpress.org/Debugging_WPMU'>WPMU bug reporting guidelines</a>!<br /><br />";
    250                 if( is_file( 'release-info.txt' ) ) {
     247                if ( is_file( 'release-info.txt' ) ) {
    251248                        $msg .= 'Your bug report must include the following text: "';
    252249                        $info = file( 'release-info.txt' );
Note: See TracChangeset for help on using the changeset viewer.