WordPress.org

Make WordPress Core

Changeset 12800


Ignore:
Timestamp:
01/22/2010 10:14:22 PM (11 years ago)
Author:
ryan
Message:

Fix warnings

Location:
trunk
Files:
2 edited

Legend:

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

    r12782 r12800  
    316316        $apage = ( isset($_GET['apage'] ) && intval( $_GET['apage'] ) ) ? absint( $_GET['apage'] ) : 1;
    317317        $num = ( isset($_GET['num'] ) && intval( $_GET['num'] ) ) ? absint( $_GET['num'] ) : 15;
    318         $s = wp_specialchars( trim( $_GET[ 's' ] ) );
     318        $s = isset($_GET['s']) ? esc_attr( trim( $_GET[ 's' ] ) ) : '';
    319319        $like_s = like_escape($s);
    320320
     
    333333        }
    334334
    335         if ( isset( $_GET['sortby'] ) == false ) {
    336             $_GET['sortby'] = 'id';
     335        $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id';
     336
     337        if ( $order_by == 'registered' ) {
     338            $query .= ' ORDER BY registered ';
     339        } elseif ( $order_by == 'lastupdated' ) {
     340            $query .= ' ORDER BY last_updated ';
     341        } elseif ( $order_by == 'blogname' ) {
     342            $query .= ' ORDER BY domain ';
     343        } else {
     344            $order_by = 'id';
     345            $query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
    337346        }
    338347
    339         if ( $_GET['sortby'] == 'registered' ) {
    340             $query .= ' ORDER BY registered ';
    341         } elseif ( $_GET['sortby'] == 'id' ) {
    342             $query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
    343         } elseif ( $_GET['sortby'] == 'lastupdated' ) {
    344             $query .= ' ORDER BY last_updated ';
    345         } elseif ( $_GET['sortby'] == 'blogname' ) {
    346             $query .= ' ORDER BY domain ';
    347         }
    348 
    349         $query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
    350 
    351         if ( !empty($s) ) {
     348        $order = isset($_GET['order']) ? $_GET['order'] : 'ASC';
     349        $order = ( 'DESC' == $order ) ? 'DESC' : 'ASC';
     350        $query .= $order;
     351
     352        if ( !empty($s) )
    352353            $total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
    353         } else {
     354        else
    354355            $total = $wpdb->get_var( "SELECT COUNT(blog_id) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ");
    355         }
    356356
    357357        $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num );
     
    359359
    360360        // Pagination
    361         $url2 = "&order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=";
    362         if ( $_GET[ 'blog_ip' ] ) {
     361        $url2 = "&order=" . $order . "&sortby=" . $order_by . "&s=";
     362        if ( !empty($_GET[ 'blog_ip' ])  )
    363363            $url2 .= "&ip_address=" . urlencode( $s );
    364         } else {
     364        else
    365365            $url2 .= $s . "&ip_address=" . urlencode( $s );
    366         }
     366
    367367        $blog_navigation = paginate_links( array(
    368368            'base' => add_query_arg( 'apage', '%#%' ).$url2,
     
    422422
    423423        $sortby_url = "s=";
    424         if ( $_GET[ 'blog_ip' ] ) {
     424        if ( !empty($_GET[ 'blog_ip' ]) )
    425425            $sortby_url .= "&ip_address=" . urlencode( $s );
    426         } else {
     426        else
    427427            $sortby_url .= urlencode( $s ) . "&ip_address=" . urlencode( $s );
    428         }
    429428        ?>
    430429
     
    435434                <?php foreach($posts_columns as $column_id => $column_display_name) {
    436435                    $column_link = "<a href='ms-sites.php?{$sortby_url}&amp;sortby={$column_id}&amp;";
    437                     if ( $_GET['sortby'] == $column_id ) {
    438                         $column_link .= $_GET[ 'order' ] == 'DESC' ? 'order=ASC&amp;' : 'order=DESC&amp;';
     436                    if ( $order_by == $column_id ) {
     437                        $column_link .= ($order_by == 'DESC') ? 'order=ASC&amp;' : 'order=DESC&amp;';
    439438                    }
    440439                    $column_link .= "apage={$apage}'>{$column_display_name}</a>";
  • trunk/wp-includes/ms-functions.php

    r12796 r12800  
    11<?php
    2 /*
    3     Helper functions for WPMU
    4 */
     2/**
     3 * Multi-site WordPress API
     4 *
     5 * @package WordPress
     6 */
     7
    58function load_muplugin_textdomain($domain, $path = false) {
    69    $locale = get_locale();
     
    126129        $id = get_id_from_blogname( $id );
    127130
     131    $id = (int) $id;
     132
    128133    $all = $getall == true ? '' : 'short';
    129134    $details = wp_cache_get( $id . $all, 'blog-details' );
    130135
    131136    if ( $details ) {
    132         if ( $details == -1 )
     137        if ( !is_object($details) && $details == -1 )
    133138            return false;
    134139        elseif ( !is_object($details) ) // Clear old pre-serialized objects. Cache clients do better with that.
Note: See TracChangeset for help on using the changeset viewer.