Changeset 1155
- Timestamp:
- 11/16/07 15:51:19 (10 months ago)
- Files:
-
- trunk/wp-admin/wpmu-blogs.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/wpmu-blogs.php
r1150 r1155 280 280 // List blogs 281 281 default: 282 $ start = isset( $_GET['start'] ) ? intval( $_GET['start'] ) : 0;283 $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 60;282 $apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1; 283 $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 30; 284 284 285 285 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; … … 308 308 $_GET['sortby'] = 'id'; 309 309 } 310 310 311 if( $_GET['sortby'] == 'registered' ) { 311 312 $query .= ' ORDER BY registered '; … … 321 322 322 323 if ( $_GET['ip_address'] == '' ) 323 $query .= " LIMIT " . intval( $start) . ", " . intval( $num );324 $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num ); 324 325 325 326 $blog_list = $wpdb->get_results( $query, ARRAY_A ); 326 327 327 $next = ( count( $blog_list ) < $num ) ? false : true; 328 328 if( !empty($_GET['s']) || !empty($_GET['blog_id']) || !empty($_GET['ip_address'])) { 329 $total = count($blog_list); 330 } else { 331 $total = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "); 332 } 333 329 334 // Pagination 330 $url2 = "order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=" . $_GET['s'] . "&ip_address=" . $_GET['ip_address']; 331 $blog_navigation = ''; 332 if( $start == 0 ) { 333 $blog_navigation .= __('Previous Blogs'); 334 } elseif( $start <= 30 ) { 335 $blog_navigation .= '<a href="wpmu-blogs.php?start=0&' . $url2 . ' ">' . __('Previous Blogs') . '</a>'; 336 } else { 337 $blog_navigation .= '<a href="wpmu-blogs.php?start=' . ( $start - $num ) . '&' . $url2 . '">' . __('Previous Blogs') . '</a>'; 338 } 339 if ( $next ) { 340 $blog_navigation .= ' || <a href="wpmu-blogs.php?start=' . ( $start + $num ) . '&' . $url2 . '">' . __('Next Blogs') . '</a>'; 341 } else { 342 $blog_navigation .= ' || ' . __('Next Blogs'); 343 } 335 $url2 = "&order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=" . $_GET['s'] . "&ip_address=" . $_GET['ip_address']; 336 $blog_navigation = paginate_links( array( 337 'base' => add_query_arg( 'apage', '%#%' ).$url2, 338 'format' => '', 339 'total' => ceil($total / $num), 340 'current' => $apage 341 )); 344 342 ?> 345 343 <script type="text/javascript"> … … 377 375 <h2><?php _e('Blogs') ?></h2> 378 376 <div style="float:right; padding:0 20px; margin-top:20px;"> 379 <h4 style="margin:0 0 4px;"><?php _e('Blog Navigation') ?></h4> 380 <?php echo $blog_navigation; ?> 377 <?php if ( $blog_navigation ) echo "<p class='pagenav'>$blog_navigation</p>"; ?> 381 378 </div> 382 379 … … 437 434 <tr> 438 435 <?php foreach($posts_columns as $column_id => $column_display_name) : ?> 439 <th scope="col"><a href="wpmu-blogs.php?<?php echo $sortby_url ?>&sortby=<?php echo $column_id ?>&<?php if( $_GET['sortby'] == $column_id ) { if( $_GET['order'] == 'DESC' ) { echo "order=ASC&" ; } else { echo "order=DESC&"; } } ?> start=<?php echo $start?>"><?php echo $column_display_name; ?></a></th>436 <th scope="col"><a href="wpmu-blogs.php?<?php echo $sortby_url ?>&sortby=<?php echo $column_id ?>&<?php if( $_GET['sortby'] == $column_id ) { if( $_GET['order'] == 'DESC' ) { echo "order=ASC&" ; } else { echo "order=DESC&"; } } ?>apage=<?php echo $apage ?>"><?php echo $column_display_name; ?></a></th> 440 437 <?php endforeach ?> 441 438 </tr> … … 595 592 596 593 <div style="float:right; padding:0 20px; margin-top:20px;"> 597 <h4 style="margin:0 0 4px;"><?php _e('Blog Navigation') ?></h4> 598 <?php echo $blog_navigation;?> 594 <?php if ( $blog_navigation ) echo "<p class='pagenav'>$blog_navigation</p>"; ?> 599 595 </div> 600 596 <input style="margin:5px 0;" id="check_all2" type="button" class="button" value="<?php _e('Check All') ?>" onclick="check_all_rows()" />
