[ Root ] [ Search ] [ Index ]

PHP Cross Reference of WordPress MU 2.9.2

Provided by Yoast

title

Body

[close]

/wp-admin/ -> wpmu-blogs.php (source)

   1  <?php
   2  require_once ('admin.php');
   3  
   4  $title = __('WordPress MU &rsaquo; Admin &rsaquo; Blogs');
   5  $parent_file = 'wpmu-admin.php';
   6  
   7  wp_enqueue_script( 'admin-forms' );
   8  
   9  require_once ('admin-header.php');
  10  if( is_site_admin() == false ) {
  11      wp_die( __('You do not have permission to access this page.') );
  12  }
  13  $id = intval( $_GET['id'] );
  14  $protocol = is_ssl() ? 'https://' : 'http://';
  15  
  16  if ( $_GET['updated'] == 'true' ) {
  17      ?>
  18      <div id="message" class="updated fade"><p>
  19          <?php
  20          switch ($_GET['action']) {
  21              case 'all_notspam':
  22                  _e('Blogs mark as not spam !');
  23              break;
  24              case 'all_spam':
  25                  _e('Blogs mark as spam !');
  26              break;
  27              case 'all_delete':
  28                  _e('Blogs deleted !');
  29              break;
  30              case 'delete':
  31                  _e('Blog deleted !');
  32              break;
  33              case 'add-blog':
  34                  _e('Blog added !');
  35              break;
  36              case 'archive':
  37                  _e('Blog archived !');
  38              break;
  39              case 'unarchive':
  40                  _e('Blog unarchived !');
  41              break;
  42              case 'activate':
  43                  _e('Blog activated !');
  44              break;
  45              case 'deactivate':
  46                  _e('Blog deactivated !');
  47              break;
  48              case 'unspam':
  49                  _e('Blog mark as not spam !');
  50              break;
  51              case 'spam':
  52                  _e('Blog mark as spam !');
  53              break;
  54              case 'umature':
  55                  _e('Blog mark as not mature !');
  56              break;
  57              case 'mature':
  58                  _e('Blog mark as mature !');
  59              break;
  60              default:
  61                  _e('Options saved !');
  62              break;
  63          }
  64          ?>
  65      </p></div>
  66      <?php
  67  }
  68  
  69  switch( $_GET['action'] ) {
  70      // Edit blog
  71      case "editblog":
  72          $blog_prefix = $wpdb->get_blog_prefix( $id );
  73          $options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '_transient_rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A );
  74          $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A );
  75          $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" );
  76          ?>
  77          <div class="wrap">
  78          <h2><?php _e('Edit Blog'); ?> - <a href='http://<?php echo $details['domain'].$details['path']; ?>'>http://<?php echo $details['domain'].$details['path']; ?></a></h2>
  79          <form method="post" action="wpmu-edit.php?action=updateblog"> 
  80              <?php wp_nonce_field('editblog'); ?>
  81              <input type="hidden" name="id" value="<?php echo $id ?>" /> 
  82              <div class='metabox-holder' style='width:49%;float:left;'>
  83              <div id="blogedit_bloginfo" class="postbox " >
  84              <h3 class='hndle'><span><?php _e('Blog info (wp_blogs)'); ?></span></h3>
  85              <div class="inside">
  86                  <table class="form-table">
  87                              <tr class="form-field form-required">
  88                                  <th scope="row"><?php _e('Domain') ?></th> 
  89                                  <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details['domain'] ?>" size="33" /></td>
  90                              </tr> 
  91                              <tr class="form-field form-required">
  92                                  <th scope="row"><?php _e('Path') ?></th> 
  93                                  <td><input name="blog[path]" type="text" id="path" value="<?php echo $details['path'] ?>" size="40" style='margin-bottom:5px;' />
  94                                  <br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>
  95                              </tr> 
  96                              <tr class="form-field">
  97                                  <th scope="row"><?php _e('Registered') ?></th> 
  98                                  <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo $details['registered'] ?>" size="40" /></td> 
  99                              </tr> 
 100                              <tr class="form-field">
 101                                  <th scope="row"><?php _e('Last Updated') ?></th> 
 102                                  <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo $details['last_updated'] ?>" size="40" /></td> 
 103                              </tr> 
 104                              <tr class="form-field">
 105                                  <th scope="row"><?php _e('Public') ?></th> 
 106                                  <td>
 107                                      <input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if( $details['public'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
 108                                      <input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
 109                                  </td> 
 110                              </tr> 
 111                              <tr class="form-field">
 112                                  <th scope="row"><?php _e( 'Archived' ); ?></th> 
 113                                  <td>
 114                                      <input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if( $details['archived'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
 115                                      <input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
 116                                  </td> 
 117                              </tr> 
 118                              <tr class="form-field">
 119                                  <th scope="row"><?php _e( 'Mature' ); ?></th> 
 120                                  <td>
 121                                      <input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if( $details['mature'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
 122                                      <input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
 123                                  </td> 
 124                              </tr> 
 125                              <tr class="form-field">
 126                                  <th scope="row"><?php _e( 'Spam' ); ?></th> 
 127                                  <td>
 128                                      <input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if( $details['spam'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
 129                                      <input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
 130                                  </td> 
 131                              </tr> 
 132                              <tr class="form-field">
 133                                  <th scope="row"><?php _e( 'Deleted' ); ?></th> 
 134                                  <td>
 135                                      <input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if( $details['deleted'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
 136                                      <input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
 137                                  </td> 
 138                              </tr> 
 139                          </table>
 140                          <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
 141              </div></div>
 142              
 143              <div id="blogedit_blogoptions" class="postbox " >
 144              <h3 class='hndle'><span><?php printf( __('Blog options (wp_%s_options)'), $id ); ?></span></h3>
 145              <div class="inside">
 146                  <table class="form-table">
 147                              <?php
 148                              $editblog_default_role = 'subscriber';
 149                              foreach ( $options as $key => $val ) {
 150                                  if( $val['option_name'] == 'default_role' ) {
 151                                      $editblog_default_role = $val['option_value'];
 152                                  }
 153                                  $disabled = '';
 154                                  if ( is_serialized($val['option_value']) ) {
 155                                      if ( is_serialized_string($val['option_value']) ) {
 156                                          $val['option_value'] = wp_specialchars(maybe_unserialize($val['option_value']), 'single');
 157                                      } else {
 158                                          $val['option_value'] = "SERIALIZED DATA";
 159                                          $disabled = ' disabled="disabled"';
 160                                      }
 161                                  }
 162                                  if ( stristr($val['option_value'], "\r") || stristr($val['option_value'], "\n") || stristr($val['option_value'], "\r\n") ) {
 163                                  ?>
 164                                      <tr class="form-field">
 165                                          <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th> 
 166                                          <td><textarea rows="5" cols="40" name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>"<?php echo $disabled ?>><?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?></textarea></td>
 167                                      </tr>
 168                                  <?php
 169                                  } else {
 170                                  ?>
 171                                      <tr class="form-field">
 172                                          <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th> 
 173                                          <td><input name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>" value="<?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?>" size="40" <?php echo $disabled ?> /></td> 
 174                                      </tr> 
 175                                  <?php
 176                                  }
 177                              } // End foreach
 178                              ?>
 179                          </table>
 180                          <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
 181              </div></div>
 182              </div>
 183              
 184              <div class='metabox-holder' style='width:49%;float:right;'>
 185              <?php
 186                      // Blog Themes
 187                      $themes = get_themes();
 188                      $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
 189                      $allowed_themes = get_site_option( "allowedthemes" );
 190                      if( $allowed_themes == false ) {
 191                          $allowed_themes = array_keys( $themes );
 192                      }
 193                      $out = '';
 194                      foreach( $themes as $key => $theme ) {
 195                          $theme_key = wp_specialchars( $theme['Stylesheet'] );
 196                          if( isset($allowed_themes[$theme_key] ) == false ) {
 197                              $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
 198                              $out .= '<tr class="form-field form-required">
 199                                      <th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th> 
 200                                      <td><input name="theme['.$theme_key.']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td> 
 201                                  </tr>';
 202                          }
 203                      }
 204                      
 205                      if ( $out != '' ) {
 206              ?>
 207              <div id="blogedit_blogthemes" class="postbox">
 208              <h3 class='hndle'><span><?php _e('Blog Themes'); ?></span></h3>
 209              <div class="inside">
 210                  <table class="form-table">
 211                      <tr><th style="font-weight:bold;"><?php _e('Theme'); ?></th></tr>
 212                      <?php echo $out; ?>
 213                  </table>
 214                  <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
 215              </div></div>
 216              <?php } ?>
 217              
 218              <?php
 219                      // Blog users
 220                      $blogusers = get_users_of_blog( $id );
 221                      if( is_array( $blogusers ) ) {
 222                          echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __('Blog Users') . '</span></h3><div class="inside">';
 223                          echo '<table class="form-table">';
 224                          echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th></tr>";
 225                          reset($blogusers);
 226                          foreach ( (array) $blogusers as $key => $val ) {
 227                              $t = @unserialize( $val->meta_value );
 228                              if( is_array( $t ) ) {
 229                                  reset( $t );
 230                                  $existing_role = key( $t );
 231                              }
 232                              echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
 233                              if( $val->user_id != $current_user->data->ID ) {
 234                                  ?>
 235                                  <td>
 236                                      <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php 
 237                                          foreach( $editblog_roles as $role => $role_assoc ){
 238                                              $name = translate_with_context($role_assoc['name']);
 239                                              $selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
 240                                              echo "<option {$selected} value=\"{$role}\">{$name}</option>";
 241                                          }
 242                                          ?>
 243                                      </select>
 244                                  </td>
 245                                  <td>
 246                                          <input type='text' name='user_password[<?php echo $val->user_id ?>]' />
 247                                  </td>
 248                                  <?php
 249                                  echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id . ']" /></td>';
 250                              } else {
 251                                  echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>";
 252                              }
 253                              echo '</tr>';
 254                          }
 255                          echo "</table>";
 256                          echo '<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="' . __('Update Options &raquo;') . '" /></p>';
 257                          echo "</div></div>";
 258                      }
 259              ?>
 260              
 261              <div id="blogedit_blogadduser" class="postbox">
 262              <h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3>
 263              <div class="inside">
 264                  <p style="margin:10px 0 0px;padding:0px 10px 10px;border-bottom:1px solid #DFDFDF;"><?php _e('Enter the username of an existing user and hit <em>Update Options</em> to add the user.') ?></p>
 265                  <table class="form-table">
 266                          <tr>
 267                              <th scope="row"><?php _e('User&nbsp;Login:') ?></th>
 268                              <td><input type="text" name="newuser" id="newuser" /></td>
 269                          </tr>
 270                          <tr>
 271                              <th scope="row"><?php _e('Role:') ?></th>
 272                              <td>
 273                                  <select name="new_role" id="new_role">
 274                                  <?php 
 275                                  reset( $editblog_roles );
 276                                  foreach( $editblog_roles as $role => $role_assoc ){
 277                                      $name = translate_with_context($role_assoc['name']);
 278                                      $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
 279                                      echo "<option {$selected} value=\"{$role}\">{$name}</option>";
 280                                  }
 281                                  ?>
 282                                  </select>
 283                              </td>
 284                          </tr>
 285                      </table>
 286                  <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
 287              </div></div>
 288              
 289              <div id="blogedit_miscoptions" class="postbox">
 290              <h3 class='hndle'><span><?php _e('Misc Blog Actions') ?></span></h3>
 291              <div class="inside">
 292                  <table class="form-table">
 293                          <?php do_action( 'wpmueditblogaction', $id ); ?>
 294                      </table>
 295                  <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
 296              </div></div>
 297              
 298              </div>
 299              
 300              <div style="clear:both;"></div>
 301          </form>
 302          </div>
 303          <?php
 304      break;
 305  
 306      // List blogs
 307      default:
 308          $apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1;
 309          $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 15;
 310          $s = wp_specialchars( trim( $_GET[ 's' ] ) );
 311  
 312          $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
 313  
 314          if( isset($_GET['blog_name']) ) {
 315              $query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$s}%' OR {$wpdb->blogs}.path LIKE '%{$s}%' ) ";
 316          } elseif( isset($_GET['blog_id']) ) {
 317              $query .= " AND   blog_id = '".intval($_GET['s'])."' ";
 318          } elseif( isset($_GET['blog_ip']) ) {
 319              $query = "SELECT *
 320                  FROM {$wpdb->blogs}, {$wpdb->registration_log}
 321                  WHERE site_id = '{$wpdb->siteid}'
 322                  AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
 323                  AND {$wpdb->registration_log}.IP LIKE ('%{$s}%')";
 324          } 
 325  
 326          if( isset( $_GET['sortby'] ) == false ) {
 327              $_GET['sortby'] = 'id';
 328          }
 329  
 330          if( $_GET['sortby'] == 'registered' ) {
 331              $query .= ' ORDER BY registered ';
 332          } elseif( $_GET['sortby'] == 'id' ) {
 333              $query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
 334          } elseif( $_GET['sortby'] == 'lastupdated' ) {
 335              $query .= ' ORDER BY last_updated ';
 336          } elseif( $_GET['sortby'] == 'blogname' ) {
 337              $query .= ' ORDER BY domain ';
 338          }
 339  
 340          $query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
 341  
 342          if( !empty($s) ) {
 343              $total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
 344          } else {
 345              $total = $wpdb->get_var( "SELECT COUNT(blog_id) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ");
 346          }
 347  
 348          $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num );
 349          $blog_list = $wpdb->get_results( $query, ARRAY_A );
 350  
 351          // Pagination
 352          $url2 = "&amp;order=" . $_GET['order'] . "&amp;sortby=" . $_GET['sortby'] . "&amp;s=";
 353          if( $_GET[ 'blog_ip' ] ) {
 354              $url2 .= "&amp;ip_address=" . urlencode( $s );
 355          } else {
 356              $url2 .= $s . "&amp;ip_address=" . urlencode( $s );
 357          }
 358          $blog_navigation = paginate_links( array(
 359              'base' => add_query_arg( 'apage', '%#%' ).$url2,
 360              'format' => '',
 361              'total' => ceil($total / $num),
 362              'current' => $apage
 363          ));
 364          ?>
 365  
 366          <div class="wrap" style="position:relative;">
 367          <h2><?php _e('Blogs') ?></h2>
 368  
 369          <form action="wpmu-blogs.php" method="get" id="wpmu-search">
 370              <input type="hidden" name="action" value="blogs" />
 371              <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo stripslashes( wp_specialchars( $s, 1 ) ); ?>" size="17" />
 372              <input type="submit" class="button" name="blog_name" value="<?php _e('Search blogs by name') ?>" />
 373              <input type="submit" class="button" name="blog_id" value="<?php _e('by blog ID') ?>" />
 374              <input type="submit" class="button" name="blog_ip" value="<?php _e('by IP address') ?>" />
 375          </form>
 376  
 377          <form id="form-blog-list" action="wpmu-edit.php?action=allblogs" method="post">
 378  
 379          <div class="tablenav">
 380              <?php if ( $blog_navigation ) echo "<div class='tablenav-pages'>$blog_navigation</div>"; ?>
 381  
 382              <div class="alignleft">
 383                  <input type="submit" value="<?php _e('Delete') ?>" name="allblog_delete" class="button-secondary delete" />
 384                  <input type="submit" value="<?php _e('Mark as Spam') ?>" name="allblog_spam" class="button-secondary" />
 385                  <input type="submit" value="<?php _e('Not Spam') ?>" name="allblog_notspam" class="button-secondary" />
 386                  <?php wp_nonce_field( 'allblogs' ); ?>
 387                  <br class="clear" />
 388              </div>
 389          </div>
 390  
 391          <br class="clear" />
 392  
 393          <?php if( isset($_GET['s']) && !empty($_GET['s']) ) : ?>
 394              <p><a href="wpmu-users.php?action=users&s=<?php echo urlencode( stripslashes( $s ) ) ?>"><?php _e('Search Users:') ?> <strong><?php echo stripslashes( $s ); ?></strong></a></p>
 395          <?php endif; ?>
 396  
 397          <?php
 398          // define the columns to display, the syntax is 'internal name' => 'display name'
 399          $blogname_columns = ( constant( "VHOST" ) == 'yes' ) ? __('Domain') : __('Path');
 400          $posts_columns = array(
 401              'id'           => __('ID'),
 402              'blogname'     => $blogname_columns,
 403              'lastupdated'  => __('Last Updated'),
 404              'registered'   => __('Registered'),
 405              'users'        => __('Users')
 406          );
 407          
 408          if( has_filter( 'wpmublogsaction' ) )
 409              $posts_columns['plugins'] = __('Actions');
 410              
 411          $posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
 412  
 413          $sortby_url = "s=";
 414          if( $_GET[ 'blog_ip' ] ) {
 415              $sortby_url .= "&ip_address=" . urlencode( $s );
 416          } else {
 417              $sortby_url .= urlencode( $s ) . "&ip_address=" . urlencode( $s );
 418          }
 419          ?>
 420  
 421          <table width="100%" cellpadding="3" cellspacing="3" class="widefat">
 422              <thead>
 423                  <tr>
 424                  <th scope="col" class="check-column"></th>
 425                  <?php foreach($posts_columns as $column_id => $column_display_name) {
 426                      $column_link = "<a href='wpmu-blogs.php?{$sortby_url}&amp;sortby={$column_id}&amp;";
 427                      if( $_GET['sortby'] == $column_id ) { 
 428                          $column_link .= $_GET[ 'order' ] == 'DESC' ? 'order=ASC&amp;' : 'order=DESC&amp;';
 429                      }
 430                      $column_link .= "apage={$apage}'>{$column_display_name}</a>";
 431  
 432                      $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;
 433                      ?>
 434                      <th scope="col"><?php echo $col_url ?></th>
 435                  <?php } ?>
 436                  </tr>
 437              </thead>
 438              <tbody id="the-list">
 439              <?php
 440              if ($blog_list) {
 441                  $bgcolor = $class = '';
 442                  $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" );
 443                  foreach ($blog_list as $blog) { 
 444                      $class = ('alternate' == $class) ? '' : 'alternate';
 445                      reset( $status_list );
 446  
 447                      $bgcolour = "";
 448                      foreach ( $status_list as $status => $col ) {
 449                          if( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
 450                              $bgcolour = "style='background: $col'";
 451                          }
 452                      }
 453                      echo "<tr $bgcolour class='$class'>";
 454  
 455                      $blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path']; 
 456                      foreach( $posts_columns as $column_name=>$column_display_name ) {
 457                          switch($column_name) {
 458                              case 'id': ?>
 459                                  <th scope="row" class="check-column">
 460                                      <input type='checkbox' id='blog_<?php echo $blog['blog_id'] ?>' name='allblogs[]' value='<?php echo $blog['blog_id'] ?>' />
 461                                  </th>
 462                                  <th scope="row">
 463                                      <?php echo $blog['blog_id'] ?>
 464                                  </th>
 465                              <?php
 466                              break;
 467   
 468                              case 'blogname': ?>
 469                                  <td valign="top">
 470                                      <a href="wpmu-blogs.php?action=editblog&amp;id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname; ?></a>
 471                                      <br/>
 472                                      <?php
 473                                      $controlActions    = array();
 474                                      $controlActions[]    = '<a href="wpmu-blogs.php?action=editblog&amp;id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';
 475                                      $controlActions[]    = "<a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'>" . __('Backend') . '</a>';
 476                                      
 477                                      if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' )
 478                                          $controlActions[]    = '<a class="delete" href="wpmu-edit.php?action=confirm&amp;action2=activateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '">' . __('Activate') . '</a>';
 479                                      else
 480                                          $controlActions[]    = '<a class="delete" href="wpmu-edit.php?action=confirm&amp;action2=deactivateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '">' . __('Deactivate') . '</a>';
 481                                      
 482                                      if( get_blog_status( $blog['blog_id'], "archived" ) == '1' )
 483                                          $controlActions[]    = '<a class="delete" href="wpmu-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' .  $blog['blog_id'] . '">' . __('Unarchive') . '</a>';
 484                                      else
 485                                          $controlActions[]    = '<a class="delete" href="wpmu-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '">' . __('Archive') . '</a>';
 486                                      
 487                                      if( get_blog_status( $blog['blog_id'], "spam" ) == '1' )
 488                                          $controlActions[]    = '<a class="delete" href="wpmu-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '">' . __('Not Spam') . '</a>';
 489                                      else
 490                                          $controlActions[]    = '<a class="delete" href="wpmu-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '">' . __("Spam") . '</a>';
 491                                      
 492                                      $controlActions[]    = '<a class="delete" href="wpmu-edit.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '">' . __("Delete") . '</a>';
 493                                      
 494                                      $controlActions[]    = "<a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'>" . __('Visit') . '</a>';
 495                                      ?>
 496                                      
 497                                      <?php if (count($controlActions)) : ?>
 498                                      <div class="row-actions">
 499                                          <?php echo implode(' | ', $controlActions); ?>
 500                                      </div>
 501                                      <?php endif; ?>
 502                                  </td>
 503                              <?php
 504                              break;
 505   
 506                              case 'lastupdated': ?>
 507                                  <td valign="top">
 508                                      <?php echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['last_updated']); ?>
 509                                  </td>
 510                              <?php
 511                              break;
 512                              case 'registered': ?>
 513                                  <td valign="top">
 514                                      <?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['registered']); ?>
 515                                  </td>
 516                              <?php
 517                              break;
 518  
 519                              case 'users': ?>
 520                                  <td valign="top">
 521                                      <?php
 522                                      $blogusers = get_users_of_blog( $blog['blog_id'] ); 
 523                                      if ( is_array( $blogusers ) ) {
 524                                          $blogusers_warning = '';
 525                                          if ( count( $blogusers ) > 5 ) {
 526                                              $blogusers = array_slice( $blogusers, 0, 5 );
 527                                              $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . $protocol . $blog[ 'domain' ] . $blog[ 'path' ] . 'wp-admin/users.php">' . __( 'More' ) . '</a>';
 528                                          }
 529                                          foreach ( $blogusers as $key => $val ) {
 530                                              echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />'; 
 531                                          }
 532                                          if( $blogusers_warning != '' ) {
 533                                              echo '<strong>' . $blogusers_warning . '</strong><br />';
 534                                          }
 535                                      }
 536                                      ?>
 537                                  </td>
 538                              <?php
 539                              break;
 540  
 541                              case 'plugins': ?>
 542                                  <?php if( has_filter( 'wpmublogsaction' ) ) { ?>
 543                                  <td valign="top">
 544                                      <?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?>
 545                                  </td>
 546                                  <?php } ?>
 547                              <?php break;
 548   
 549                              default: ?>
 550                                  <?php if( has_filter( 'manage_blogs_custom_column' ) ) { ?>
 551                                  <td valign="top">
 552                                      <?php do_action('manage_blogs_custom_column', $column_name, $blog['blog_id']); ?>
 553                                  </td>
 554                                  <?php } ?>
 555                              <?php break;
 556                          }
 557                      }
 558                      ?>
 559                      </tr>
 560                      <?php
 561                  }
 562              } else { ?>
 563                  <tr style='background-color: <?php echo $bgcolor; ?>'> 
 564                      <td colspan="8"><?php _e('No blogs found.') ?></td> 
 565                  </tr> 
 566              <?php
 567              } // end if ($blogs)
 568              ?>
 569  
 570              </tbody>
 571          </table>
 572          </form>
 573          </div>
 574  
 575          <div class="wrap">
 576              <a name="form-add-blog"></a>
 577              <h2><?php _e('Add Blog') ?></h2>
 578              <form method="post" action="wpmu-edit.php?action=addblog">
 579                  <?php wp_nonce_field('add-blog') ?>
 580                  <table class="form-table">
 581                      <tr class="form-field form-required">
 582                          <th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th>
 583                          <td>
 584                          <?php if ( constant( "VHOST" ) == 'yes' ) { ?>
 585                              <input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?> 
 586                          <?php } else {
 587                              echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>
 588                          <?php } 
 589                          echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";
 590                          ?>
 591                          </td>
 592                      </tr>
 593                      <tr class="form-field form-required">
 594                          <th style="text-align:center;" scope='row'><?php _e('Blog Title') ?></th>
 595                          <td><input name="blog[title]" type="text" size="20" title="<?php _e('Title') ?>"/></td>
 596                      </tr>
 597                      <tr class="form-field form-required">
 598                          <th style="text-align:center;" scope='row'><?php _e('Admin Email') ?></th>
 599                          <td><input name="blog[email]" type="text" size="20" title="<?php _e('Email') ?>"/></td>
 600                      </tr>
 601                      <tr class="form-field">
 602                          <td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td>
 603                      </tr>
 604                  </table>
 605                  <p class="submit">
 606                      <input class="button" type="submit" name="go" value="<?php _e('Add Blog') ?>" /></p>
 607              </form>
 608          </div>
 609          <?php
 610      break;
 611  } // end switch( $action )
 612  
 613  include ('admin-footer.php'); ?>


Generated: Mon May 3 12:25:32 2010 Cross-referenced by PHPXref 0.7