Changeset 15491 for trunk/wp-admin/network/sites.php
- Timestamp:
- 08/11/2010 09:54:51 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/network/sites.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/network/sites.php
r15481 r15491 19 19 $parent_file = 'sites.php'; 20 20 21 if ( isset( $_ GET['action'] ) && 'editblog' == $_GET['action'] ) {21 if ( isset( $_REQUEST['action'] ) && 'editblog' == $_REQUEST['action'] ) { 22 22 add_contextual_help($current_screen, 23 23 '<p>' . __('This extensive list of options has five modules: Site Info, Site Options, allowing Site Themes for this given site, changing user roles and passwords for that site, adding a new user, and Miscellaneous Site Actions (upload size limits).') . '</p>' . … … 47 47 } 48 48 49 wp_enqueue_script( 'admin-forms' ); 50 51 require_once( '../admin-header.php' ); 52 53 $id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0; 54 55 if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) { 49 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 50 51 if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) { 56 52 ?> 57 53 <div id="message" class="updated"><p> 58 54 <?php 59 switch ( $_ GET['action'] ) {55 switch ( $_REQUEST['action'] ) { 60 56 case 'all_notspam': 61 57 _e( 'Sites removed from spam.' ); … … 100 96 } 101 97 102 $action = isset( $_ GET['action'] ) ? $_GET['action'] : 'list';98 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'list'; 103 99 104 100 switch ( $action ) { … … 113 109 $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" ); 114 110 $is_main_site = is_main_site( $id ); 111 112 require_once( './admin-header.php' ); 115 113 ?> 116 114 <div class="wrap"> 117 115 <?php screen_icon(); ?> 118 116 <h2><?php _e( 'Edit Site' ); ?> - <a href="<?php echo esc_url( get_home_url( $id ) ); ?>"><?php echo esc_url( get_home_url( $id ) ); ?></a></h2> 119 <form method="post" action=" edit.php?action=updateblog">117 <form method="post" action="ms-edit.php?action=updateblog"> 120 118 <?php wp_nonce_field( 'editblog' ); ?> 121 119 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> … … 351 349 case 'list': 352 350 default: 353 $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0; 354 if ( empty($pagenum) ) 355 $pagenum = 1; 356 357 $per_page = (int) get_user_option( 'ms_sites_per_page' ); 358 if ( empty( $per_page ) || $per_page < 1 ) 359 $per_page = 15; 360 361 $per_page = apply_filters( 'ms_sites_per_page', $per_page ); 362 363 $s = isset( $_GET['s'] ) ? stripslashes( trim( $_GET[ 's' ] ) ) : ''; 364 $like_s = esc_sql( like_escape( $s ) ); 365 366 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; 367 368 if ( isset( $_GET['searchaction'] ) ) { 369 if ( 'name' == $_GET['searchaction'] ) { 370 $query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$like_s}%' OR {$wpdb->blogs}.path LIKE '%{$like_s}%' ) "; 371 } elseif ( 'id' == $_GET['searchaction'] ) { 372 $query .= " AND {$wpdb->blogs}.blog_id = '{$like_s}' "; 373 } elseif ( 'ip' == $_GET['searchaction'] ) { 374 $query = "SELECT * 375 FROM {$wpdb->blogs}, {$wpdb->registration_log} 376 WHERE site_id = '{$wpdb->siteid}' 377 AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id 378 AND {$wpdb->registration_log}.IP LIKE ('%{$like_s}%')"; 379 } 380 } 381 382 $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id'; 383 if ( $order_by == 'registered' ) { 384 $query .= ' ORDER BY registered '; 385 } elseif ( $order_by == 'lastupdated' ) { 386 $query .= ' ORDER BY last_updated '; 387 } elseif ( $order_by == 'blogname' ) { 388 $query .= ' ORDER BY domain '; 389 } else { 390 $order_by = 'id'; 391 $query .= " ORDER BY {$wpdb->blogs}.blog_id "; 392 } 393 394 $order = ( isset( $_GET['order'] ) && 'DESC' == $_GET['order'] ) ? "DESC" : "ASC"; 395 $query .= $order; 396 397 $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(blog_id)', $query ) ); 398 399 $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page ); 400 $blog_list = $wpdb->get_results( $query, ARRAY_A ); 401 402 $num_pages = ceil($total / $per_page); 403 $page_links = paginate_links( array( 404 'base' => add_query_arg( 'paged', '%#%' ), 405 'format' => '', 406 'prev_text' => __( '«' ), 407 'next_text' => __( '»' ), 408 'total' => $num_pages, 409 'current' => $pagenum 410 )); 411 412 if ( empty( $_GET['mode'] ) ) 413 $mode = 'list'; 414 else 415 $mode = esc_attr( $_GET['mode'] ); 351 require_once( './includes/default-list-tables.php' ); 352 353 $table = new WP_Sites_Table; 354 355 require_once( './admin-header.php' ); 416 356 ?> 417 357 … … 420 360 <h2><?php _e('Sites') ?> 421 361 <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites' ); ?></a> 422 <?php 423 if ( isset( $_GET['s'] ) && $_GET['s'] ) 424 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); 425 ?> 362 <?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) { 363 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); 364 } ?> 426 365 </h2> 427 366 428 <form action=" sites.php" method="get" id="ms-search">367 <form action="ms-sites.php" method="get" id="ms-search"> 429 368 <p class="search-box"> 430 369 <input type="hidden" name="action" value="blogs" /> … … 439 378 </form> 440 379 441 <form id="form-site-list" action="edit.php?action=allblogs" method="post"> 442 <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" /> 443 <div class="tablenav"> 444 <div class="alignleft actions"> 445 <select name="action"> 446 <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option> 447 <option value="delete"><?php _e( 'Delete' ); ?></option> 448 <option value="spam"><?php _ex( 'Mark as Spam', 'site' ); ?></option> 449 <option value="notspam"><?php _ex( 'Not Spam', 'site' ); ?></option> 450 </select> 451 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" /> 452 <?php wp_nonce_field( 'bulk-ms-sites', '_wpnonce_bulk-ms-sites' ); ?> 453 </div> 454 455 <?php if ( $page_links ) { ?> 456 <div class="tablenav-pages"> 457 <?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', 458 number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ), 459 number_format_i18n( min( $pagenum * $per_page, $total ) ), 460 number_format_i18n( $total ), 461 $page_links 462 ); echo $page_links_text; ?> 463 </div> 464 <?php } ?> 465 466 <div class="view-switch"> 467 <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'List View' ) ?>" alt="<?php _e( 'List View' ) ?>" /></a> 468 <a href="<?php echo esc_url( add_query_arg( 'mode', 'excerpt', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'Excerpt View' ) ?>" alt="<?php _e( 'Excerpt View' ) ?>" /></a> 469 </div> 470 471 </div> 472 473 <div class="clear"></div> 474 475 <?php 476 // define the columns to display, the syntax is 'internal name' => 'display name' 477 $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' ); 478 $sites_columns = array( 479 'id' => __( 'ID' ), 480 'blogname' => $blogname_columns, 481 'lastupdated' => __( 'Last Updated'), 482 'registered' => _x( 'Registered', 'site' ), 483 'users' => __( 'Users' ) 484 ); 485 486 if ( has_filter( 'wpmublogsaction' ) ) 487 $sites_columns['plugins'] = __( 'Actions' ); 488 489 $sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns ); 490 ?> 491 492 <table class="widefat"> 493 <thead> 494 <tr> 495 <th class="manage-column column-cb check-column" id="cb" scope="col"> 496 <input type="checkbox" /> 497 </th> 498 <?php 499 $col_url = ''; 500 foreach($sites_columns as $column_id => $column_display_name) { 501 $column_link = "<a href='"; 502 $order2 = ''; 503 if ( $order_by == $column_id ) 504 $order2 = ( $order == 'DESC' ) ? 'ASC' : 'DESC'; 505 506 $column_link .= esc_url( add_query_arg( array( 'order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) ); 507 $column_link .= "'>{$column_display_name}</a>"; 508 $col_url .= '<th scope="col">' . ( ( $column_id == 'users' || $column_id == 'plugins' ) ? $column_display_name : $column_link ) . '</th>'; 509 } 510 echo $col_url ?> 511 </tr> 512 </thead> 513 <tfoot> 514 <tr> 515 <th class="manage-column column-cb check-column" id="cb1" scope="col"> 516 <input type="checkbox" /> 517 </th> 518 <?php echo $col_url ?> 519 </tr> 520 </tfoot> 521 <tbody id="the-site-list" class="list:site"> 522 <?php 523 $status_list = array( 'archived' => array( 'site-archived', __( 'Archived' ) ), 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 'mature' => array( 'site-mature', __( 'Mature' ) ) ); 524 if ( $blog_list ) { 525 $class = ''; 526 foreach ( $blog_list as $blog ) { 527 $class = ( 'alternate' == $class ) ? '' : 'alternate'; 528 reset( $status_list ); 529 530 $blog_states = array(); 531 foreach ( $status_list as $status => $col ) { 532 if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) { 533 $class = $col[0]; 534 $blog_states[] = $col[1]; 535 } 536 } 537 $blog_state = ''; 538 if ( ! empty( $blog_states ) ) { 539 $state_count = count( $blog_states ); 540 $i = 0; 541 $blog_state .= ' - '; 542 foreach ( $blog_states as $state ) { 543 ++$i; 544 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 545 $blog_state .= "<span class='post-state'>$state$sep</span>"; 546 } 547 } 548 echo "<tr class='$class'>"; 549 550 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 551 foreach ( $sites_columns as $column_name=>$column_display_name ) { 552 switch ( $column_name ) { 553 case 'id': ?> 554 <th scope="row" class="check-column"> 555 <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" /> 556 </th> 557 <th valign="top" scope="row"> 558 <?php echo $blog['blog_id'] ?> 559 </th> 560 <?php 561 break; 562 563 case 'blogname': ?> 564 <td class="column-title"> 565 <a href="<?php echo esc_url( network_admin_url( 'sites.php?action=editblog&id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a> 566 <?php 567 if ( 'list' != $mode ) 568 echo '<p>' . sprintf( _x( '%1$s – <em>%2$s</em>', '%1$s: site name. %2$s: site tagline.' ), get_blog_option( $blog['blog_id'], 'blogname' ), get_blog_option( $blog['blog_id'], 'blogdescription ' ) ) . '</p>'; 569 570 // Preordered. 571 $actions = array( 572 'edit' => '', 'backend' => '', 573 'activate' => '', 'deactivate' => '', 574 'archive' => '', 'unarchive' => '', 575 'spam' => '', 'unspam' => '', 576 'delete' => '', 577 'visit' => '', 578 ); 579 580 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'sites.php?action=editblog&id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 581 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url($blog['blog_id']) ) . "' class='edit'>" . __( 'Backend' ) . '</a></span>'; 582 if ( $current_site->blog_id != $blog['blog_id'] ) { 583 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) 584 $actions['activate'] = '<span class="activate"><a href="' . esc_url( network_admin_url( 'edit.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ) ) . '">' . __( 'Activate' ) . '</a></span>'; 585 else 586 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( network_admin_url( 'edit.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 587 588 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' ) 589 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( network_admin_url( 'edit.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 590 else 591 $actions['archive'] = '<span class="archive"><a href="' . esc_url( network_admin_url( 'edit.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 592 593 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' ) 594 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( network_admin_url( 'edit.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>'; 595 else 596 $actions['spam'] = '<span class="spam"><a href="' . esc_url( network_admin_url( 'edit.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>'; 597 598 $actions['delete'] = '<span class="delete"><a href="' . esc_url( network_admin_url( 'edit.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ) ) . '">' . __( 'Delete' ) . '</a></span>'; 599 } 600 601 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'] ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 602 $actions = array_filter( $actions ); 603 if ( count( $actions ) ) : ?> 604 <div class="row-actions"> 605 <?php echo implode( ' | ', $actions ); ?> 606 </div> 607 <?php endif; ?> 608 </td> 609 <?php 610 break; 611 612 case 'lastupdated': ?> 613 <td valign="top"> 614 <?php 615 if ( 'list' == $mode ) 616 $date = 'Y/m/d'; 617 else 618 $date = 'Y/m/d \<\b\r \/\> g:i:s a'; 619 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( __( $date ), $blog['last_updated'] ); ?> 620 </td> 621 <?php 622 break; 623 case 'registered': ?> 624 <td valign="top"> 625 <?php 626 if ( $blog['registered'] == '0000-00-00 00:00:00' ) 627 echo '—'; 628 else 629 echo mysql2date( __( $date ), $blog['registered'] ); 630 ?> 631 </td> 632 <?php 633 break; 634 case 'users': ?> 635 <td valign="top"> 636 <?php 637 $blogusers = get_users_of_blog( $blog['blog_id'] ); 638 if ( is_array( $blogusers ) ) { 639 $blogusers_warning = ''; 640 if ( count( $blogusers ) > 5 ) { 641 $blogusers = array_slice( $blogusers, 0, 5 ); 642 $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . esc_url( get_admin_url( $blog['blog_id'], 'users.php' ) ) . '">' . __( 'More' ) . '</a>'; 643 } 644 foreach ( $blogusers as $key => $val ) { 645 echo '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $val->user_id ) ) . '">' . esc_html( $val->user_login ) . '</a> '; 646 if ( 'list' != $mode ) 647 echo '(' . $val->user_email . ')'; 648 echo '<br />'; 649 } 650 if ( $blogusers_warning != '' ) 651 echo '<strong>' . $blogusers_warning . '</strong><br />'; 652 } 653 ?> 654 </td> 655 <?php 656 break; 657 658 case 'plugins': ?> 659 <?php if ( has_filter( 'wpmublogsaction' ) ) { ?> 660 <td valign="top"> 661 <?php do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> 662 </td> 663 <?php } ?> 664 <?php break; 665 666 default: ?> 667 <?php if ( has_filter( 'manage_blogs_custom_column' ) ) { ?> 668 <td valign="top"> 669 <?php do_action( 'manage_blogs_custom_column', $column_name, $blog['blog_id'] ); ?> 670 </td> 671 <?php } ?> 672 <?php break; 673 } 674 } 675 ?> 676 </tr> 677 <?php 678 } 679 } else { ?> 680 <tr> 681 <td colspan="<?php echo (int) count( $sites_columns ); ?>"><?php _e( 'No sites found.' ) ?></td> 682 </tr> 683 <?php 684 } // end if ($blogs) 685 ?> 686 687 </tbody> 688 </table> 689 <div class="tablenav"> 690 <?php 691 if ( $page_links ) 692 echo "<div class='tablenav-pages'>$page_links_text</div>"; 693 ?> 694 695 <div class="alignleft actions"> 696 <select name="action2"> 697 <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option> 698 <option value="delete"><?php _e( 'Delete' ); ?></option> 699 <option value="spam"><?php _ex( 'Mark as Spam', 'site' ); ?></option> 700 <option value="notspam"><?php _ex( 'Not Spam', 'site' ); ?></option> 701 </select> 702 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 703 </div> 704 <br class="clear" /> 705 </div> 706 380 <form id="form-site-list" action="ms-edit.php?action=allblogs" method="post"> 381 <?php $table->display(); ?> 707 382 </form> 708 383 </div> … … 710 385 <div id="form-add-site" class="wrap"> 711 386 <h3><?php _e( 'Add Site' ) ?></h3> 712 <form method="post" action=" edit.php?action=addblog">387 <form method="post" action="ms-edit.php?action=addblog"> 713 388 <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> 714 389 <table class="form-table"> … … 745 420 } // end switch( $action ) 746 421 747 include( '. ./admin-footer.php' ); ?>422 include( './admin-footer.php' ); ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)