diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-17 17:10:45 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-17 17:10:45 +0000 |
commit | d2bd94baf9b13c930cd07119c5875750f7bd3a2b (patch) | |
tree | af0f9b594df80d30dd24054084e756992f54c690 /wp-admin | |
parent | b414235e0076d3325c4e7cb916f2a210f5389e9f (diff) | |
download | wordpress-mu-d2bd94baf9b13c930cd07119c5875750f7bd3a2b.tar.gz wordpress-mu-d2bd94baf9b13c930cd07119c5875750f7bd3a2b.tar.xz wordpress-mu-d2bd94baf9b13c930cd07119c5875750f7bd3a2b.zip |
Facelift for wpmu-* courtesy of momo360modena, fixes #446
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1092 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin')
-rw-r--r-- | wp-admin/wpmu-admin.php | 59 | ||||
-rw-r--r-- | wp-admin/wpmu-blogs.php | 1140 | ||||
-rw-r--r-- | wp-admin/wpmu-edit.php | 424 | ||||
-rw-r--r-- | wp-admin/wpmu-options.php | 355 | ||||
-rw-r--r-- | wp-admin/wpmu-themes.php | 91 | ||||
-rw-r--r-- | wp-admin/wpmu-upgrade-site.php | 69 | ||||
-rw-r--r-- | wp-admin/wpmu-users.php | 608 |
7 files changed, 1404 insertions, 1342 deletions
diff --git a/wp-admin/wpmu-admin.php b/wp-admin/wpmu-admin.php index 3b0e9ae..3079ea0 100644 --- a/wp-admin/wpmu-admin.php +++ b/wp-admin/wpmu-admin.php @@ -1,43 +1,40 @@ <?php require_once('admin.php'); -$title = __('WPMU Admin'); +$title = __('WordPress MU › Admin'); $parent_file = 'wpmu-admin.php'; require_once('admin-header.php'); + if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); + wp_die( __('<p>You do not have permission to access this page.</p>') ); } + if (isset($_GET['updated'])) { - ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php + ?> + <div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div> + <?php } ?> -<div class="wrap"> -<?php - -do_action( "wpmuadminresult", "" ); - -switch( $_GET[ 'action' ] ) { - default: - ?> -<form name="searchform" action="wpmu-users.php" method="get"> -<p> -<input name="action" value="users" type="hidden" /> -<input name="s" value="" size="17" type="text" /> -<input name="submit" value="<?php _e("Search Users »"); ?>" type="submit" /> -</p> -</form> -<form name="searchform" action="wpmu-blogs.php" method="get"> -<p> -<input type='hidden' name='action' value='blogs' /> -<input type="text" name="s" value="" size="17" /> -<input type="submit" name="submit" value="<?php _e("Search Blogs »"); ?>" /> -</p> -</form> -<?php - break; -} - -?> +<div class="wrap"> + <h2><?php _e('WordPress MU : Admin') ?></h2> + <?php do_action('wpmuadminresult', ''); ?> + + <form name="searchform" action="wpmu-users.php" method="get"> + <p> + <input type="hidden" name="action" value="users" /> + <input type="text" name="s" value="" size="17" /> + <input type="submit" name="submit" value="<?php _e("Search Users »"); ?>" /> + </p> + </form> + + <form name="searchform" action="wpmu-blogs.php" method="get"> + <p> + <input type="hidden" name="action" value="blogs" /> + <input type="text" name="s" value="" size="17" /> + <input type="submit" name="submit" value="<?php _e("Search Blogs »"); ?>" /> + </p> + </form> </div> -<?php include('admin-footer.php'); ?> + +<?php include('admin-footer.php'); ?>
\ No newline at end of file diff --git a/wp-admin/wpmu-blogs.php b/wp-admin/wpmu-blogs.php index 09660d4..04b7511 100644 --- a/wp-admin/wpmu-blogs.php +++ b/wp-admin/wpmu-blogs.php @@ -1,570 +1,642 @@ <?php require_once('admin.php'); -$title = __('WPMU Admin: Blogs'); +$title = __('WordPress MU › Admin › Blogs'); $parent_file = 'wpmu-admin.php'; +wp_enqueue_script( 'listman' ); require_once('admin-header.php'); + if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); -} -if (isset($_GET['updated'])) { - ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php + wp_die( __('<p>You do not have permission to access this page.</p>') ); } -print '<div class="wrap">'; -switch( $_GET[ 'action' ] ) { - case "editblog": - $id = intval( $_GET[ 'id' ] ); - $options_table_name = "$wpmuBaseTablePrefix{$id}_options"; - $options = $wpdb->get_results( "SELECT * FROM {$options_table_name} WHERE option_name NOT LIKE 'rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A ); - $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A ); - $editblog_roles = get_blog_option( $id, "$wpmuBaseTablePrefix{$id}_user_roles" ); +$id = intval( $_GET['id'] ); - print "<h2>" . __('Edit Blog') . "</h2>"; - print "<a href='http://{$details[ 'domain' ]}/'>{$details[ 'domain' ]}</a>"; - ?> - <form name="form1" method="post" action="wpmu-edit.php?action=updateblog"> - <?php wp_nonce_field( "editblog" ); ?> - <input type="hidden" name="id" value="<?php echo $id ?>" /> - <table><td valign='top'> - <div class="wrap"> - <table width="100%" border='0' cellspacing="2" cellpadding="5" class="editform"> - <tr valign="top"> - <th scope="row"><?php _e('URL') ?></th> - <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details[ 'domain' ] ?>" size="33" /></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Path') ?></th> - <td><input name="blog[path]" type="text" id="path" value="<?php echo $details[ 'path' ] ?>" size="40" /></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Registered') ?></th> - <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo $details[ 'registered' ] ?>" size="40" /></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Last Updated') ?></th> - <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo $details[ 'last_updated' ] ?>" size="40" /></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Public') ?></th> - <td><input type='radio' name='blog[public]' value='1' <?php if( $details[ 'public' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?> - <input type='radio' name='blog[public]' value='0' <?php if( $details[ 'public' ] == '0' ) echo " checked"?>> <?php _e('No') ?> - </td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e( 'Archived' ); ?></th> - <td><input type='radio' name='blog[archived]' value='1' <?php if( $details[ 'archived' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?> - <input type='radio' name='blog[archived]' value='0' <?php if( $details[ 'archived' ] == '0' ) echo " checked"?>> <?php _e('No') ?> - </td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e( 'Mature' ); ?></th> - <td><input type='radio' name='blog[mature]' value='1' <?php if( $details[ 'mature' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?> - <input type='radio' name='blog[mature]' value='0' <?php if( $details[ 'mature' ] == '0' ) echo " checked"?>> <?php _e('No') ?> - </td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e( 'Spam' ); ?></th> - <td><input type='radio' name='blog[spam]' value='1' <?php if( $details[ 'spam' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?> - <input type='radio' name='blog[spam]' value='0' <?php if( $details[ 'spam' ] == '0' ) echo " checked"?>> <?php _e('No') ?> - </td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e( 'Deleted' ); ?></th> - <td><input type='radio' name='blog[deleted]' value='1' <?php if( $details[ 'deleted' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?> - <input type='radio' name='blog[deleted]' value='0' <?php if( $details[ 'deleted' ] == '0' ) echo " checked"?>> <?php _e('No') ?> - </td> - </tr> - <tr><td colspan='2'> - <br /> - <br /> - </td></tr> - <?php - $editblog_default_role = 'subscriber'; - while( list( $key, $val ) = each( $options ) ) { - if( $val[ 'option_name' ] == 'default_role' ) - $editblog_default_role = $val[ 'option_value' ]; - $disabled = ''; - if ( is_serialized($val[ 'option_value' ]) ) { - if ( is_serialized_string($val[ 'option_value' ]) ) { - $val[ 'option_value' ] = wp_specialchars(maybe_unserialize($val[ 'option_value' ]), 'single'); - } else { - $val[ 'option_value' ] = "SERIALIZED DATA"; - $disabled = ' disabled="disabled"'; - } +if ( $_GET['updated'] == 'true' ) { + ?> + <div id="message" class="updated fade"><p> + <?php + switch ($_GET['action']) { + case 'all_spam': + _e('Blogs mark as spam !'); + break; + case 'all_delete': + _e('Blogs deleted !'); + break; + case 'delete': + _e('Blog deleted !'); + break; + case 'add-blog': + _e('Blog added !'); + break; + case 'archive': + _e('Blog archived !'); + break; + case 'unarchive': + _e('Blog unarchived !'); + break; + case 'activate': + _e('Blog activated !'); + break; + case 'deactivate': + _e('Blog deactivated !'); + break; + case 'unspam': + _e('Blog mark as not spam !'); + break; + case 'spam': + _e('Blog mark as spam !'); + break; + case 'umature': + _e('Blog mark as not mature !'); + break; + case 'mature': + _e('Blog mark as mature !'); + break; + default: + _e('Options saved !'); + break; } - if ( stristr($val[ 'option_value' ], "\r") or stristr($val[ 'option_value' ], "\n") or stristr($val[ 'option_value' ], "\r\n") ) { ?> - <tr valign="top"> - <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th> - <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> - </tr> - <?php - } else { + </p></div> + <?php +} + +switch( $_GET['action'] ) { + // Edit blog + case "editblog": + $options = $wpdb->get_results( "SELECT * FROM {$wpmuBaseTablePrefix}{$id}_options WHERE option_name NOT LIKE 'rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A ); + $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A ); + $editblog_roles = get_blog_option( $id, "{$wpmuBaseTablePrefix}{$id}_user_roles" ); ?> - <tr valign="top"> - <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th> - <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> - </tr> + <div class="wrap"> + <h2><?php _e('Edit Blog'); ?></h2> + <a href='http://<?php echo $details['domain'].$details['path']; ?>'><?php echo $details['domain'].$details['path']; ?></a> + <form method="post" action="wpmu-edit.php?action=updateblog"> + <?php wp_nonce_field('editblog'); ?> + <input type="hidden" name="id" value="<?php echo $id ?>" /> + <table> + <tr> + <td valign="top"> + <div class="wrap"> + <table style="border:0; width:100%;" cellspacing="2" cellpadding="5" class="editform"> + <tr valign="top"> + <th scope="row"><?php _e('URL') ?></th> + <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details['domain'] ?>" size="33" /></td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e('Path') ?></th> + <td><input name="blog[path]" type="text" id="path" value="<?php echo $details['path'] ?>" size="40" /></td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e('Registered') ?></th> + <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo $details['registered'] ?>" size="40" /></td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e('Last Updated') ?></th> + <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo $details['last_updated'] ?>" size="40" /></td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e('Public') ?></th> + <td> + <input type='radio' name='blog[public]' value='1' <?php if( $details['public'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> + <input type='radio' name='blog[public]' value='0' <?php if( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> + </td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e( 'Archived' ); ?></th> + <td> + <input type='radio' name='blog[archived]' value='1' <?php if( $details['archived'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> + <input type='radio' name='blog[archived]' value='0' <?php if( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> + </td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e( 'Mature' ); ?></th> + <td> + <input type='radio' name='blog[mature]' value='1' <?php if( $details['mature'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> + <input type='radio' name='blog[mature]' value='0' <?php if( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> + </td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e( 'Spam' ); ?></th> + <td> + <input type='radio' name='blog[spam]' value='1' <?php if( $details['spam'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> + <input type='radio' name='blog[spam]' value='0' <?php if( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> + </td> + </tr> + <tr valign="top"> + <th scope="row"><?php _e( 'Deleted' ); ?></th> + <td> + <input type='radio' name='blog[deleted]' value='1' <?php if( $details['deleted'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> + <input type='radio' name='blog[deleted]' value='0' <?php if( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> + </td> + </tr> + <tr> + <td colspan="2"><br /><br /></td> + </tr> + <?php + $editblog_default_role = 'subscriber'; + foreach ( $options as $key => $val ) { + if( $val['option_name'] == 'default_role' ) { + $editblog_default_role = $val['option_value']; + } + $disabled = ''; + if ( is_serialized($val['option_value']) ) { + if ( is_serialized_string($val['option_value']) ) { + $val['option_value'] = wp_specialchars(maybe_unserialize($val['option_value']), 'single'); + } else { + $val['option_value'] = "SERIALIZED DATA"; + $disabled = ' disabled="disabled"'; + } + } + if ( stristr($val['option_value'], "\r") || stristr($val['option_value'], "\n") || stristr($val['option_value'], "\r\n") ) { + ?> + <tr valign="top"> + <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th> + <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> + </tr> + <?php + } else { + ?> + <tr valign="top"> + <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th> + <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> + </tr> + <?php + } + } // End foreach + ?> + </table> + <p class="submit"> + <input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p> + </div> + </td> + <td valign="top"> + <?php + // Blog Themes + $themes = get_themes(); + $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id ); + $allowed_themes = get_site_option( "allowedthemes" ); + if( $allowed_themes == false ) { + $allowed_themes = array_keys( $themes ); + } + $out = ''; + foreach( $themes as $key => $theme ) { + $theme_key = wp_specialchars( $theme['Stylesheet'] ); + if( isset($allowed_themes[$theme_key] ) == false ) { + $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; + $out .= '<tr valign="top"> + <th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th> + <td><input name="theme['.$theme_key.']" type="checkbox" value="on" '.$checked.'/></td> + </tr>'; + } + } + + if( $out != '' ) { + echo "<div class='wrap'><h3>" . __('Blog Themes') . "</h3>"; + echo '<table width="100%" border="0" cellspacing="2" cellpadding="5" class="editform">'; + echo '<tr><th>' . __('Theme') . '</th><th>' . __('Enable') . '</th></tr>'; + echo $out; + echo "</table></div>"; + } + + // Blog users + $blogusers = get_users_of_blog( $id ); + echo '<div class="wrap"><h3>' . __('Blog Users') . '</h3>'; + if( is_array( $blogusers ) ) { + echo '<table width="100%"><caption>' . __('Current Users') . '</caption>'; + echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th><th></th></tr>"; + reset($blogusers); + foreach ( (array) $blogusers as $key => $val ) { + $t = @unserialize( $val->meta_value ); + if( is_array( $t ) ) { + reset( $t ); + $existing_role = key( $t ); + } + echo "<tr><td>" . $val->user_login . "</td>"; + if( $val->user_id != $current_user->data->ID ) { + ?> + <td> + <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php + foreach( $editblog_roles as $role => $role_assoc ){ + $selected = ( $role == $existing_role ) ? 'selected="selected"' : ''; + echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>"; + } + ?> + </select> + </td> + <td> + <input type='text' name='user_password[<?php echo $val->user_id ?>]' /> + </td> + <?php + echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id . ']" /></td>'; + } else { + echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>"; + } + echo '<td><a href="user-edit.php?user_id=' . $val->user_id . '">' . __('Edit') . "</a></td></tr>"; + } + echo "</table>"; + } + + // New blog user + echo "<h3>" . __('Add a new user') . "</h3>"; + ?> + <p><?php _e('As you type WordPress will offer you a choice of usernames.<br /> Click them to select and hit <em>Update Options</em> to add the user.') ?></p> + <table> + <tr> + <th scope="row"><?php _e('User Login:') ?></th> + <td><input type="text" name="newuser" id="newuser" /></td> + </tr> + <tr> + <th scope="row"><?php _e('Role:') ?></th> + <td> + <select name="new_role" id="new_role"> + <?php + reset( $editblog_roles ); + foreach( $editblog_roles as $role => $role_assoc ){ + $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : ''; + echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>"; + } + ?> + </select> + </td> + </tr> + </table> + </div> + + <div class="wrap"> + <strong><?php _e('Misc Blog Actions') ?></strong> + <p><?php do_action( 'wpmueditblogaction', $id ); ?></p> + </div> + + <p class="submit"> + <input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p> + </td> + </tr> + </table> + </form> + </div> <?php - } - } - ?> - </table> - <p class="submit"> - <input type="submit" name="Submit" value="<?php _e('Update Options') ?> »" /> - </p> - </div> - </td> - <td valign='top'> - <?php - $themes = get_themes(); - $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id ); - $allowed_themes = get_site_option( "allowedthemes" ); - if( $allowed_themes == false ) { - $allowed_themes = array_keys( $themes ); - } - $out = ''; - foreach( $themes as $key => $theme ) { - $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); - if( isset( $allowed_themes[ $theme_key ] ) == false ) { - if( isset( $blog_allowed_themes[ $theme_key ] ) == true ) { - $checked = 'checked '; - } else { - $checked = ''; - } - - $out .= ' - <tr valign="top"> - <th title="' . htmlspecialchars( $theme[ "Description" ] ) . '" scope="row">'.$key.'</th> - <td><input name="theme['.$theme_key.']" type="checkbox" id="'.$key.'" value="on" '.$checked.'/></td> - </tr> '; - } - } - if( $out != '' ) { - print "<div class='wrap'><h3>" . __('Blog Themes') . "</h3>"; - print '<table width="100%" border="0" cellspacing="2" cellpadding="5" class="editform">'; - print '<tr><th>' . __('Theme') . '</th><th>' . __('Enable') . '</th></tr>'; - print $out; - print "</table></div>"; - } - $blogusers = get_users_of_blog( $id ); - print '<div class="wrap"><h3>' . __('Blog Users') . '</h3>'; - if( is_array( $blogusers ) ) { - print '<table width="100%"><caption>' . __('Current Users') . '</caption>'; - print "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th><th></th></tr>"; - reset( $blogusers ); - while( list( $key, $val ) = each( $blogusers ) ) - { - $t = @unserialize( $val->meta_value ); - if( is_array( $t ) ) { - reset( $t ); - $existing_role = key( $t ); - } - print "<tr><td>" . $val->user_login . "</td>"; - if( $val->user_id != $current_user->data->ID ) { - ?> - <td><select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php - foreach( $editblog_roles as $role => $role_assoc ){ - $selected = ''; - if( $role == $existing_role ) - $selected = 'selected="selected"'; - echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>"; - } - ?></select></td><td><input type='text' name='user_password[<?php echo $val->user_id ?>]'></td><?php - print '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id . ']"></td>'; - } else { - print "<td><b>" . __ ('N/A') . "</b></td><td><b>" . __ ('N/A') . "</b></td><td><b>" . __('N/A') . "</b></td>"; - } - print '<td><a href="user-edit.php?user_id=' . $val->user_id . '">' . __('Edit') . "</td></tr>"; - } - print "</table>"; - } - print "<h3>" . __('Add a new user') . "</h3>"; - ?> -<p><?php _e('As you type WordPress will offer you a choice of usernames.<br /> Click them to select and hit <em>Update Options</em> to add the user.') ?></p> -<table> -<tr><th scope="row"><?php _e('User Login:') ?> </th><td><input type="text" name="newuser" id="newuser"></td></tr> -<tr><td></td><td></td> </tr> - <tr> - <th scope="row"><?php _e('Role:') ?></th> - <td><select name="new_role" id="new_role"><?php - reset( $editblog_roles ); - foreach( $editblog_roles as $role => $role_assoc ){ - $selected = ''; - if( $role == $editblog_default_role ) - $selected = 'selected="selected"'; - echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>"; - } - ?></select></td> - </tr> -</table> -</div> -<div class='wrap'><strong><?php _e('Misc Blog Actions') ?></strong> -<p><?php do_action( "wpmueditblogaction", intval( $_GET[ 'id' ] ) ); ?></p> -</div> -<p class="submit"> -<input type="submit" name="Submit" value="<?php _e('Update Options') ?> »" /> -</p> - - </td> - </table> - <?php - break; - default: - if( isset( $_GET[ 'start' ] ) == false ) { - $start = 0; - } else { - $start = intval( $_GET[ 'start' ] ); - } - if( isset( $_GET[ 'num' ] ) == false ) { - $num = 60; - } else { - $num = intval( $_GET[ 'num' ] ); - } - - $query = "SELECT * - FROM ".$wpdb->blogs." - WHERE site_id = '".$wpdb->siteid."' "; - if( $_GET[ 's' ] != '' ) { + break; + + // List blogs + default: + $start = isset( $_GET['start'] ) ? intval( $_GET['start'] ) : 0; + $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 60; + + $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; + + if( !empty($_GET['s']) ) { + $s = trim($_GET['s']); $query = "SELECT blog_id, {$wpdb->blogs}.domain, {$wpdb->blogs}.path, registered, last_updated - FROM $wpdb->blogs, $wpdb->site - WHERE site_id = '$wpdb->siteid' - AND {$wpdb->blogs}.site_id = {$wpdb->site}.id - AND ( {$wpdb->blogs}.domain LIKE '%". trim( $_GET[ 's' ] )."%' OR {$wpdb->blogs}.path LIKE '%". trim( $_GET[ 's' ] )."%' )"; - } elseif( $_GET[ 'blog_id' ] != '' ) { - $query = "SELECT * - FROM $wpdb->blogs - WHERE site_id = '$wpdb->siteid' - AND blog_id = '".intval($_GET[ 'blog_id' ])."'"; - } elseif( $_GET[ 'ip_address' ] != '' ) { + FROM {$wpdb->blogs}, {$wpdb->site} + WHERE site_id = '{$wpdb->siteid}' + AND {$wpdb->blogs}.site_id = {$wpdb->site}.id + AND ( {$wpdb->blogs}.domain LIKE '%{$s}%' OR {$wpdb->blogs}.path LIKE '%{$s}%' )"; + } elseif( !empty($_GET['blog_id']) ) { $query = "SELECT * - FROM $wpdb->blogs, wp_registration_log - WHERE site_id = '$wpdb->siteid' - AND {$wpdb->blogs}.blog_id = wp_registration_log.blog_id - AND wp_registration_log.IP LIKE ('%".$_GET[ 'ip_address' ]."%')"; + FROM {$wpdb->blogs} + WHERE site_id = '{$wpdb->siteid}' + AND blog_id = '".intval($_GET['blog_id'])."'"; + } elseif( !empty($_GET['ip_address']) ) { + $query = "SELECT * + FROM {$wpdb->blogs}, {$wpdb->registration_log} + WHERE site_id = '{$wpdb->siteid}' + AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id + AND {$wpdb->registration_log}.IP LIKE ('%".$_GET['ip_address']."%')"; } - if( isset( $_GET[ 'sortby' ] ) == false ) { - $_GET[ 'sortby' ] = 'id'; + + if( isset( $_GET['sortby'] ) == false ) { + $_GET['sortby'] = 'id'; } - if( $_GET[ 'sortby' ] == 'registered' ) { + if( $_GET['sortby'] == 'registered' ) { $query .= ' ORDER BY registered '; - } elseif( $_GET[ 'sortby' ] == 'id' ) { + } elseif( $_GET['sortby'] == 'id' ) { $query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id '; - } elseif( $_GET[ 'sortby' ] == 'lastupdated' ) { + } elseif( $_GET['sortby'] == 'lastupdated' ) { $query .= ' ORDER BY last_updated '; - } elseif( $_GET[ 'sortby' ] == 'blogname' ) { + } elseif( $_GET['sortby'] == 'blogname' ) { $query .= ' ORDER BY domain '; } - if( $_GET[ 'order' ] == 'DESC' ) { - $query .= "DESC"; - } else { - $query .= "ASC"; - } - if ( $_GET[ 'ip_address' ] == '' ) + $query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC'; + + if ( $_GET['ip_address'] == '' ) $query .= " LIMIT " . intval( $start ) . ", " . intval( $num ); - $blog_list = $wpdb->get_results( $query, ARRAY_A ); - if( count( $blog_list ) < $num ) { - $next = false; + + $blog_list = $wpdb->get_results( $query, ARRAY_A ); + + $next = ( count( $blog_list ) < $num ) ? false : true; + + // Pagination + $url2 = "order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=" . $_GET['s'] . "&ip_address=" . $_GET['ip_address']; + $blog_navigation = ''; + if( $start == 0 ) { + $blog_navigation .= __('Previous Blogs'); + } elseif( $start <= 30 ) { + $blog_navigation .= '<a href="wpmu-blogs.php?start=0&' . $url2 . ' ">' . __('Previous Blogs') . '</a>'; } else { - $next = true; + $blog_navigation .= '<a href="wpmu-blogs.php?start=' . ( $start - $num ) . '&' . $url2 . '">' . __('Previous Blogs') . '</a>'; + } + if ( $next ) { + $blog_navigation .= ' || <a href="wpmu-blogs.php?start=' . ( $start + $num ) . '&' . $url2 . '">' . __('Next Blogs') . '</a>'; + } else { + $blog_navigation .= ' || ' . __('Next Blogs'); } -?> -<script language="javascript"> -<!-- -var checkflag = "false"; -function check_all_rows() { - field = document.formlist; - if (checkflag == "false") { - for (i = 0; i < field.length; i++) { - if( field[i].name == 'allblogs[]' ) - field[i].checked = true;} - checkflag = "true"; - return "<?php _e('Uncheck All') ?>"; - } else { - for (i = 0; i < field.length; i++) { - if( field[i].name == 'allblogs[]' ) - field[i].checked = false; } - checkflag = "false"; - return "<?php _e('Check All') ?>"; - } -} - -// --> -</script> - -<h2><?php _e('Blogs') ?></h2> -<form name="searchform" action="wpmu-blogs.php" method="get" style="float: left; margin-right: 3em;"> - <table><td> - <fieldset> - <legend><?php _e('Search Blogs…') ?></legend> - <input type='hidden' name='action' value='blogs'> - <?php _e('Name:') ?> <input type="text" name="s" value="<?php if (isset($_GET[ 's' ])) echo wp_specialchars($_GET[ 's' ], 1); ?>" size="17" /><br /> - <?php _e('Blog ID:') ?> <input type="text" name="blog_id" value="<?php if (isset($_GET[ 'blog_id' ])) echo wp_specialchars($_GET[ 'blog_id' ], 1); ?>" size="10" /><br /> - <?php _e('IP Address:') ?> <input type="text" name="ip_address" value="<?php if (isset($_GET[ 'ip_address' ])) echo wp_specialchars($_GET[ 'ip_address' ], 1); ?>" size="10" /><br /> - <input type="submit" name="submit" value="<?php _e('Search') ?>" /> - </fieldset> - <?php - if( isset($_GET[ 's' ]) && $_GET[ 's' ] != '' ) { - ?><a href="/wp-admin/wpmu-users.php?action=users&s=<?php echo wp_specialchars($_GET[ 's' ], 1) ?>"><?php _e('Search Users:') ?> <?php echo wp_specialchars($_GET[ 's' ], 1) ?></a><?php - } - ?> - </td><td valign='top'> - <fieldset> - <legend><?php _e('Blog Navigation') ?></legend> - <?php - - $url2 = "order=" . $_GET[ 'order' ] . "&sortby=" . $_GET[ 'sortby' ] . "&s=" . $_GET[ 's' ] . "&ip_address=" . $_GET[ 'ip_address' ]; - - $blog_navigation = ''; - if( $start == 0 ) { - $blog_navigation .= __('Previous Blogs'); - } elseif( $start <= 30 ) { - $blog_navigation .= '<a href="wpmu-blogs.php?start=0&' . $url2 . ' ">' . __('Previous Blogs') . '</a>'; - } else { - $blog_navigation .= '<a href="wpmu-blogs.php?start=' . ( $start - $num ) . '&' . $url2 . '">' . __('Previous Blogs') . '</a>'; - } - if ( $next ) { - $blog_navigation .= ' || <a href="wpmu-blogs.php?start=' . ( $start + $num ) . '&' . $url2 . '">' . __('Next Blogs') . '</a>'; - } else { - $blog_navigation .= ' || ' . __('Next Blogs'); - } - echo $blog_navigation; - ?> - </fieldset> - </td></table> -</form> - -<br style="clear:both;" /> - -<?php - -// define the columns to display, the syntax is 'internal name' => 'display name' -$posts_columns = array( - 'id' => __('ID'), - 'blogname' => __('Blog Name'), - 'lastupdated' => __('Last Updated'), - 'registered' => __('Registered'), - 'users' => __('Users'), - 'plugins' => __('Actions') -); -$posts_columns = apply_filters('manage_posts_columns', $posts_columns); - -// you can not edit these at the moment -$posts_columns['control_view'] = ''; -$posts_columns['control_edit'] = ''; -$posts_columns['control_backend'] = ''; -$posts_columns['control_deactivate'] = ''; -$posts_columns['control_archive'] = ''; -$posts_columns['control_spam'] = ''; -$posts_columns['control_delete'] = ''; - -$sortby_url = "s=" . $_GET[ 's' ] . "&ip_address=" . $_GET[ 'ip_address' ]; -?> - -<form name='formlist' action='wpmu-edit.php?action=allblogs' method='POST'> -<input type=button value="<?php _e('Check All') ?>" onClick="this.value=check_all_rows()"> -<table width="100%" cellpadding="3" cellspacing="3"> - <tr> - -<?php foreach($posts_columns as $column_id => $column_display_name) { ?> - <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> -<?php } ?> - - </tr> -<?php -if ($blog_list) { - $bgcolor = ''; - $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" ); - foreach ($blog_list as $blog) { - $class = ('alternate' == $class) ? '' : 'alternate'; - reset( $status_list ); - $bgcolour = ""; - while( list( $status, $col ) = each( $status_list ) ) { - if( get_blog_status( $blog[ 'blog_id' ], $status ) == 1 ) { - $bgcolour = "style='background: $col'"; + ?> + <script type="text/javascript"> + <!-- + var checkflag = "false"; + + function check_all_rows() { + var button1 = document.getElementById('check_all1'); + var button2 = document.getElementById('check_all2'); + + field = document.formlist; + if (checkflag == "false") { + for (i = 0; i < field.length; i++) { + if( field[i].name == 'allblogs[]' ) { + field[i].checked = true; + } + } + checkflag = "true"; + button1.value = "<?php _e('Uncheck All') ?>"; + button2.value = "<?php _e('Uncheck All') ?>"; + } else { + for (i = 0; i < field.length; i++) { + if( field[i].name == 'allblogs[]' ) { + field[i].checked = false; + } + } + checkflag = "false"; + button1.value = "<?php _e('Check All') ?>"; + button2.value = "<?php _e('Check All') ?>" } - } - print "<tr $bgcolour class='$class'>"; - if( constant( "VHOST" ) == 'yes' ) { - $blogname = str_replace( '.' . $current_site->domain, '', $blog[ 'domain' ] ); - } else { - $blogname = $blog[ 'path' ]; - } - -foreach($posts_columns as $column_name=>$column_display_name) { - - switch($column_name) { + } + // --> + </script> + <div class="wrap"> + <h2><?php _e('Blogs') ?></h2> + <div style="float:right; padding:0 20px; margin-top:20px;"> + <h4 style="margin:0 0 4px;"><?php _e('Blog Navigation') ?></h4> + <?php echo $blog_navigation; ?> + </div> + + <form id="searchform" action="wpmu-blogs.php" method="get"> + <input type="hidden" name="action" value="blogs" /> + <fieldset> + <legend><?php _e('Search blogs by name…') ?></legend> + <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo stripslashes(wp_specialchars($_GET['s'], 1)); ?>" size="17" /> + </fieldset> + + <fieldset> + <legend><?php _e('by blog ID…') ?></legend> + <input type="text" name="blog_id" value="<?php if (isset($_GET['blog_id'])) echo wp_specialchars($_GET['blog_id'], 1); ?>" size="10" /> + </fieldset> + + <fieldset> + <legend><?php _e('by IP address…') ?></legend> + <input type="text" name="ip_address" value="<?php if (isset($_GET['ip_address'])) echo wp_specialchars($_GET['ip_address'], 1); ?>" size="10" /> + </fieldset> + <input type="submit" name="submit" id="post-query-submit" value="<?php _e('Search') ?>" class="button" /> + </form> + + + <br style="clear:both;" /> + + <?php if( isset($_GET['s']) && !empty($_GET['s']) ) : ?> + <p><a href="wpmu-users.php?action=users&s=<?php echo stripslashes(wp_specialchars($_GET['s'], 1)) ?>"><?php _e('Search Users:') ?> <strong><?php echo stripslashes(wp_specialchars($_GET['s'], 1)); ?></strong></a></p> + <?php endif; ?> - case 'id': - ?> - <th scope="row"><input type='checkbox' id='<?php echo $blog[ 'blog_id' ] ?>' name='allblogs[]' value='<?php echo $blog[ 'blog_id' ] ?>'> <label for='<?php echo $blog[ 'blog_id' ] ?>'><?php echo $blog[ 'blog_id' ] ?></label></th> - <?php - break; - - case 'blogname': - ?> - <td valign='top'><label for='<?php echo $blog[ 'blog_id' ] ?>'><?php echo $blogname ?></label> - </td> - <?php - break; - - case 'lastupdated': - ?> - <td valign='top'><?php echo $blog[ 'last_updated' ] == '0000-00-00 00:00:00' ? __("Never") : $blog[ 'last_updated' ] ?></td> - <?php - break; - - case 'registered': - ?> - <td valign='top'><?php echo $blog[ 'registered' ] ?></td> - <?php - break; - - case 'users': - ?> - <td valign='top'><?php - $blogusers = get_users_of_blog( $blog[ 'blog_id' ] ); - if( is_array( $blogusers ) ) { - if( $blog[ 'blog_id' ] == 1 && count( $blogusers ) > 10 ) - $blogusers = array_slice( $blogusers, 0, 10 ); - while( list( $key, $val ) = each( $blogusers ) ) - print '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<BR>'; - } - ?></td> - <?php - break; - - case 'control_view': - ?> - <td valign='top'><a href="http://<?php echo $blog[ 'domain' ]. $blog[ 'path' ]; ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td> <?php - break; - - case 'control_edit': + // define the columns to display, the syntax is 'internal name' => 'display name' + $posts_columns = array( + 'id' => __('ID'), + 'blogname' => __('Blog Name'), + 'lastupdated' => __('Last Updated'), + 'registered' => __('Registered'), + 'users' => __('Users'), + 'plugins' => __('Actions') + ); + $posts_columns = apply_filters('manage_posts_columns', $posts_columns); + + // you can not edit these at the moment + $posts_columns['control_view'] = ''; + $posts_columns['control_edit'] = ''; + $posts_columns['control_backend'] = ''; + $posts_columns['control_deactivate']= ''; + $posts_columns['control_archive'] = ''; + $posts_columns['control_spam'] = ''; + $posts_columns['control_delete'] = ''; + + $sortby_url = "s=" . $_GET['s'] . "&ip_address=" . $_GET['ip_address']; ?> - <td valign='top'><?php echo "<a href='wpmu-blogs.php?action=editblog&id=".$blog[ 'blog_id' ]."' class='edit'>" . __('Edit') . "</a>"; ?></td> - <?php - break; - - case 'control_backend': - ?> - <td valign='top'><?php echo "<a href='http://" . $blog[ 'domain' ] . $blog[ 'path' ] . "wp-admin/' class='edit'>" . __('Backend') . "</a>"; ?></td> - <?php - break; - - case 'control_spam': - if( get_blog_status( $blog[ 'blog_id' ], "spam" ) == '1' ) { - ?> - <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=unspamblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) ?>"><?php _e("Not Spam") ?></a></td> - <?php - } else { - ?> - <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=spamblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) ?>"><?php _e("Spam") ?></a></td> - <?php - } - break; - - case 'control_deactivate': - if( get_blog_status( $blog[ 'blog_id' ], "deleted" ) == '1' ) { - ?> - <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=activateblog&ref=<?php echo urlencode( $_SERVER[ 'REQUEST_URI' ] ) ?>&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to activate the blog %s" ), $blogname ) ) ?>"><?php _e("Activate") ?></a></td> + <form name="formlist" action="wpmu-edit.php?action=allblogs" method="post"> + <input style="margin:5px 0;" id="check_all1" class="button" type="button" value="<?php _e('Check All') ?>" onclick="check_all_rows()" /> + + <table width="100%" cellpadding="3" cellspacing="3" class="widefat"> + <thead> + <tr> + <?php foreach($posts_columns as $column_id => $column_display_name) : ?> + <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> + <?php endforeach ?> + </tr> + </thead> + <tbody id="the-list"> <?php - } else { - ?> - <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=deactivateblog&ref=<?php echo urlencode( $_SERVER[ 'REQUEST_URI' ] ) ?>&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to deactivate the blog %s" ), $blogname ) ) ?>"><?php _e("Deactivate") ?></a></td> + if ($blog_list) { + $bgcolor = ''; + $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" ); + foreach ($blog_list as $blog) { + $class = ('alternate' == $class) ? '' : 'alternate'; + reset( $status_list ); + + $bgcolour = ""; + foreach ( $status_list as $status => $col ) { + if( get_blog_status( $blog['blog_id'], $status ) == 1 ) { + $bgcolour = "style='background: $col'"; + } + } + echo "<tr $bgcolour class='$class'>"; + + $blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path']; + foreach( $posts_columns as $column_name=>$column_display_name ) { + switch($column_name) { + case 'id': ?> + <th scope="row"> + <input type='checkbox' id='blog_<?php echo $blog['blog_id'] ?>' name='allblogs[]' value='<?php echo $blog['blog_id'] ?>' /> <label for='blog_<?php echo $blog['blog_id'] ?>'><?php echo $blog['blog_id'] ?></label> + </th> + <?php + break; + + case 'blogname': ?> + <td valign="top"> + <label for='blog_<?php echo $blog['blog_id'] ?>'><?php echo $blogname ?></label> + </td> + <?php + break; + + case 'lastupdated': ?> + <td valign="top"> + <?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']); ?> + </td> + <?php + break; + case 'registered': ?> + <td valign="top"> + <?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['registered']); ?> + </td> + <?php + break; + + case 'users': ?> + <td valign="top"> + <?php + $blogusers = get_users_of_blog( $blog['blog_id'] ); + if( is_array( $blogusers ) ) { + if( $blog['blog_id'] == 1 && count( $blogusers ) > 10 ) { + $blogusers = array_slice( $blogusers, 0, 10 ); + } + foreach ( $blogusers as $key => $val ) { + echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />'; + } + } + ?> + </td> + <?php + break; + case 'control_view': ?> + <td valign="top"> + <a href="http://<?php echo $blog['domain']. $blog['path']; ?>" rel="permalink" class="edit"><?php _e('View'); ?></a> + </td> + <?php + break; + case 'control_edit': ?> + <td valign="top"> + <?php echo "<a href='wpmu-blogs.php?action=editblog&id=".$blog['blog_id']."' class='edit'>" . __('Edit') . "</a>"; ?> + </td> + <?php + break; + case 'control_backend': + ?> + <td valign="top"> + <?php echo "<a href='http://" . $blog['domain'] . $blog['path'] . "wp-admin/' class='edit'>" . __('Backend') . "</a>"; ?> + </td> + <?php + break; + + case 'control_spam': + if( get_blog_status( $blog['blog_id'], "spam" ) == '1' ) { ?> + <td valign="top"> + <a class='delete' href="wpmu-edit.php?action=confirm&action2=unspamblog&id=<?php echo $blog['blog_id'] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to mark as not spam this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Not Spam") ?></a> + </td> + <?php } else { ?> + <td valign='top'> + <a class='delete' href="wpmu-edit.php?action=confirm&action2=spamblog&id=<?php echo $blog['blog_id'] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to mark as spam this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Spam") ?></a> + </td> + <?php } + break; + + case 'control_deactivate': + if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' ) { ?> + <td valign="top"> + <a class='delete' href="wpmu-edit.php?action=confirm&action2=activateblog&ref=<?php echo urlencode( $_SERVER['REQUEST_URI'] ) ?>&id=<?php echo $blog['blog_id'] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to activate the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to activate this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Activate") ?></a> + </td> + <?php } else { ?> + <td valign="top"> + <a class='delete' href="wpmu-edit.php?action=confirm&action2=deactivateblog&ref=<?php echo urlencode( $_SERVER['REQUEST_URI'] ) ?>&id=<?php echo $blog['blog_id'] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to deactivate the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to deactive this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Deactivate") ?></a> + </td> + <?php } + break; + + case 'control_archive': + if( get_blog_status( $blog['blog_id'], "archived" ) == '1' ) { ?> + <td valign="top"> + <a class='delete' href="wpmu-edit.php?action=confirm&action2=unarchiveblog&id=<?php echo $blog['blog_id'] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to unarchive this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Unarchive") ?></a> + </td> + <?php } else { ?> + <td valign="top"> + <a class='delete' href="wpmu-edit.php?action=confirm&action2=archiveblog&id=<?php echo $blog['blog_id'] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to archive this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Archive") ?></a> + </td> + <?php } + break; + + case 'control_delete': ?> + <td valign="top"> + <a class='delete' href="wpmu-edit.php?action=confirm&action2=deleteblog&id=<?php echo $blog['blog_id'] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to delete the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to delete this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Delete") ?></a> + </td> + <?php break; + + case 'plugins': ?> + <td valign="top"> + <?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?> + </td> + <?php break; + + default: ?> + <td valign="top"> + <?php do_action('manage_blogs_custom_column', $column_name, $blog['blog_id']); ?> + </td> + <?php break; + } + } + ?> + </tr> + <?php + } + } else { ?> + <tr style='background-color: <?php echo $bgcolor; ?>'> + <td colspan="8"><?php _e('No blogs found.') ?></td> + </tr> <?php - } - break; - - case 'control_archive': - if( get_blog_status( $blog[ 'blog_id' ], "archived" ) == '1' ) { + } // end if ($blogs) ?> - <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=unarchiveblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) ?>"><?php _e("Unarchive") ?></a></td> - <?php - } else { - ?> - <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=archiveblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) ?>"><?php _e("Archive") ?></a></td> - <?php - } - break; - - case 'control_delete': - ?> - <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=deleteblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to delete the blog %s" ), $blogname ) ) ?>"><?php _e("Delete") ?></a></td> - <?php - break; - case 'plugins': - ?> - <td valign='top'><?php do_action( "wpmublogsaction", $blog[ 'blog_id' ] ); ?></td> - <?php - break; - - default: - ?> - <td valign='top'><?php do_action('manage_blogs_custom_column', $column_name, $id); ?></td> + </tbody> + </table> + + <div style="float:right; padding:0 20px; margin-top:20px;"> + <h4 style="margin:0 0 4px;"><?php _e('Blog Navigation') ?></h4> + <?php echo $blog_navigation;?> + </div> + <input style="margin:5px 0;" id="check_all2" type="button" class="button" value="<?php _e('Check All') ?>" onclick="check_all_rows()" /> + + <h3><?php _e('Update selected blogs:') ?></h3> + <ul style="list-style:none;"> + <li><input type='radio' name='blogfunction' id='delete' value='delete' /> <label for='delete'><?php _e('Delete') ?></label></li> + <li><input type='radio' name='blogfunction' id='spam' value='spam' /> <label for='spam'><?php _e('Mark as Spam') ?></label></li> + </ul> + + <p class="submit" style="width: 220px"> + <?php wp_nonce_field( "allblogs" ); ?> + <input type='hidden' name='redirect' value='<?php echo $_SERVER['REQUEST_URI'] ?>' /> + <input type='submit' class="button" value='<?php _e('Apply Changes') ?>' /></p> + </form> + </div> + + <div class="wrap"> + <h2><?php _e('Add Blog') ?></h2> + <form method="post" action="wpmu-edit.php?action=addblog"> + <?php wp_nonce_field('add-blog') ?> + <table cellpadding="3" cellspacing="3"> + <tr> + <th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th> + <td> + <?php if( constant( "VHOST" ) == 'yes' ) : ?> + <input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?> + <?php else: + echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/> + <?php endif; ?> + </td> + </tr> + <tr><th style="text-align:center;" scope='row'><?php _e('Blog Title') ?></th><td><input name="blog[title]" type="text" size="20" title="<?php _e('Title') ?>"/></td></tr> + <tr><th style="text-align:center;" scope='row'><?php _e('Admin Email') ?></th><td><input name="blog[email]" type="text" size="20" title="<?php _e('Email') ?>"/></td></tr> + <tr><td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?></td></tr> + </table> + <input class="button" type="submit" name="go" value="<?php _e('Add Blog') ?>" /> + </form> + </div> <?php - break; - } -} -?> - </tr> -<?php -} -} else { -?> - <tr style='background-color: <?php echo $bgcolor; ?>'> - <td colspan="8"><?php _e('No blogs found.') ?></td> - </tr> -<?php -} // end if ($blogs) -?> -</table> -<table width='100%'> -<tr><td width='20%'> -<input type=button value="<?php _e('Check All') ?>" onClick="this.value=check_all_rows()"> -<p><?php _e('Selected Blogs:') ?><ul> -<li><input type='radio' name='blogfunction' id='delete' value='delete'> <label for='delete'><?php _e('Delete') ?></label></li> -<li><input type='radio' name='blogfunction' id='spam' value='spam'> <label for='spam'><?php _e('Mark as Spam') ?></label></li> -<?php wp_nonce_field( "allblogs" ); ?> -</ul> -<input type='hidden' name='redirect' value='<?php echo $_SERVER[ 'REQUEST_URI' ] ?>'> -<input type='submit' value='<?php _e('Apply Changes') ?>'></p> -</form> -</td><td> -<fieldset> -<legend><?php _e('Blog Navigation') ?></legend> -<?php -echo $blog_navigation; -?> -</fieldset> -</td></tr> -</table> -</div> -<div class="wrap"> -<h2><?php _e('Add Blog') ?></h2> -<form name="addform" method="post" action="wpmu-edit.php?action=addblog"> -<?php wp_nonce_field('add-blog') ?> -<table> -<tr><th scope='row'><?php _e('Blog Address') ?></th><td><?php -if( constant( "VHOST" ) == 'yes' ) { - ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?></td></tr><?php -} else { - echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/></td></tr><?php -} ?> -<tr><th scope='row'><?php _e('Blog Title') ?></th><td><input name="blog[title]" type="text" title="<?php _e('Title') ?>"/></td></tr> -<tr><th scope='row'><?php _e('Admin Email') ?></th><td><input name="blog[email]" type="text" title="<?php _e('Email') ?>"/></td></tr> -<tr><td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?></td></tr> -</table> -<input type="submit" name="go" value="<?php _e('Add Blog') ?>" /> -</form> -</div> -<?php - -break; + break; } // end switch( $action ) -?> -</div> -<?php include('admin-footer.php'); ?> +include('admin-footer.php'); ?> diff --git a/wp-admin/wpmu-edit.php b/wp-admin/wpmu-edit.php index 26cd97a..dab9d8e 100644 --- a/wp-admin/wpmu-edit.php +++ b/wp-admin/wpmu-edit.php @@ -1,59 +1,72 @@ <?php require_once('admin.php'); if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); + wp_die( __('<p>You do not have permission to access this page.</p>') ); } -do_action( "wpmuadminedit", "" ); +do_action('wpmuadminedit', ''); -$id = intval( $_POST[ 'id' ] ); -if( isset( $_POST[ 'ref' ] ) == false && empty( $_SERVER[ 'HTTP_REFERER' ] ) == false ) - $_POST[ 'ref' ] = $_SERVER[ 'HTTP_REFERER' ]; +if( $_GET[ 'id' ] ) { + $id = intval( $_GET[ 'id' ] ); +} elseif( $_POST[ 'id' ] ) { + $id = intval( $_POST[ 'id' ] ); +} + +if( isset( $_POST['ref'] ) == false && empty( $_SERVER['HTTP_REFERER'] ) == false ) { + $_POST['ref'] = $_SERVER['HTTP_REFERER']; +} -switch( $_GET[ 'action' ] ) { +switch( $_GET['action'] ) { + // Options case "siteoptions": check_admin_referer('siteoptions'); - update_site_option( "WPLANG", $_POST[ 'WPLANG' ] ); - if( is_email( $_POST[ 'admin_email' ] ) ) - update_site_option( "admin_email", $_POST[ 'admin_email' ] ); - $illegal_names = split( ' ', $_POST[ 'illegal_names' ] ); - foreach( $illegal_names as $name ) { + update_site_option( "WPLANG", $_POST['WPLANG'] ); + if( is_email( $_POST['admin_email'] ) ) + update_site_option( "admin_email", $_POST['admin_email'] ); + $illegal_names = split( ' ', $_POST['illegal_names'] ); + + foreach( (array) $illegal_names as $name ) { $name = trim( $name ); if( $name != '' ) $names[] = trim( $name ); } + update_site_option( "illegal_names", $names ); - update_site_option( "registration", $wpdb->escape( $_POST[ 'registration' ] ) ); - update_site_option( "xmlrpc_active", $wpdb->escape( $_POST[ 'xmlrpc_active' ] ) ); - update_site_option( "registrationnotification", $wpdb->escape( $_POST[ 'registrationnotification' ] ) ); - if( $_POST[ 'limited_email_domains' ] != '' ) { - update_site_option( "limited_email_domains", split( ' ', $_POST[ 'limited_email_domains' ] ) ); + update_site_option( "registration", $wpdb->escape( $_POST['registration'] ) ); + update_site_option( "xmlrpc_active", $wpdb->escape( $_POST[ 'xmlrpc_active' ] ) ); + update_site_option( "registrationnotification", $wpdb->escape( $_POST['registrationnotification'] ) ); + + if( $_POST['limited_email_domains'] != '' ) { + update_site_option( "limited_email_domains", split( ' ', $_POST['limited_email_domains'] ) ); } else { update_site_option( "limited_email_domains", '' ); } - if( $_POST[ 'banned_email_domains' ] != '' ) { - $banned_email_domains = split( "\n", stripslashes($_POST[ 'banned_email_domains' ]) ); - foreach( $banned_email_domains as $domain ) { + + if( $_POST['banned_email_domains'] != '' ) { + $banned_email_domains = split( "\n", stripslashes($_POST['banned_email_domains']) ); + foreach( (array) $banned_email_domains as $domain ) { $banned[] = trim( $domain ); } update_site_option( "banned_email_domains", $banned ); } else { update_site_option( "banned_email_domains", '' ); } - update_site_option( "menu_items", $_POST[ 'menu_items' ] ); - update_site_option( "blog_upload_space", $_POST[ 'blog_upload_space' ] ); - update_site_option( "upload_filetypes", $_POST[ 'upload_filetypes' ] ); - update_site_option( "site_name", $_POST[ 'site_name' ] ); - update_site_option( "first_post", $_POST[ 'first_post' ] ); - update_site_option( "welcome_email", $_POST[ 'welcome_email' ] ); - update_site_option( "fileupload_maxk", $_POST[ 'fileupload_maxk' ] ); + + update_site_option( "menu_items", $_POST['menu_items'] ); + update_site_option( "blog_upload_space", $_POST['blog_upload_space'] ); + update_site_option( "upload_filetypes", $_POST['upload_filetypes'] ); + update_site_option( "site_name", $_POST['site_name'] ); + update_site_option( "first_post", $_POST['first_post'] ); + update_site_option( "welcome_email", $_POST['welcome_email'] ); + update_site_option( "fileupload_maxk", $_POST['fileupload_maxk'] ); + $site_admins = explode( ' ', str_replace( ",", " ", $_POST['site_admins'] ) ); if ( is_array( $site_admins ) ) { $mainblog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" ); if( $mainblog_id ) { reset( $site_admins ); - foreach( $site_admins as $site_admin ) { + foreach( (array) $site_admins as $site_admin ) { $uid = $wpdb->get_var( "SELECT ID FROM {$wpdb->users} WHERE user_login='{$site_admin}'" ); if( $uid ) add_user_to_blog( $mainblog_id, $uid, 'Administrator' ); @@ -61,65 +74,22 @@ switch( $_GET[ 'action' ] ) { } update_site_option( 'site_admins' , $site_admins ); } - wp_redirect( add_query_arg( "updated", "true", $_SERVER[ 'HTTP_REFERER' ] ) ); - die(); - break; - case "searchcategories": - $search = wp_specialchars( $_POST[ 'search' ] ); - $query = "SELECT cat_name FROM " . $wpdb->sitecategories . " WHERE cat_name LIKE '%" . $search . "%' limit 0,10"; - $cats = $wpdb->get_results( $query ); - if( is_array( $cats ) ) { - print "<ul>"; - while( list( $key, $val ) = each( $cats ) ) - { - print "<li>{$val->cat_name}</li>"; - } - print "</ul>"; - } - exit; - break; - case "searchusers": - $search = wp_specialchars( $_POST[ 'search' ] ); - $query = "SELECT " . $wpdb->users . ".ID, " . $wpdb->users . ".user_login FROM " . $wpdb->users . " WHERE user_login LIKE '" . $search . "%' limit 0,10"; - $users = $wpdb->get_results( $query ); - if( is_array( $users ) ) { - print "<ul>"; - while( list( $key, $val ) = each( $users ) ) - { - print "<li>{$val->user_login}</li>"; - } - print "</ul>"; - } else { - _e('No Users Found'); - } - exit; - break; - case "adduser": - check_admin_referer('add-user'); - - if( is_array( $_POST[ 'user' ] ) == true ) { - $user = $_POST['user']; - $password = generate_random_password(); - $user_id = wpmu_create_user(wp_specialchars( strtolower( $user['username'] ) ), $password, wp_specialchars( $user['email'] ) ); - if(false == $user_id) { - die( __("<p>There was an error creating the user</p>") ); - } else { - wp_new_user_notification($user_id, $password); - } - wp_redirect( add_query_arg( "updated", "useradded", $_SERVER[ 'HTTP_REFERER' ] ) ); - die(); - } + wp_redirect( add_query_arg( "updated", "true", $_SERVER['HTTP_REFERER'] ) ); + exit(); break; + + // Blogs case "addblog": check_admin_referer('add-blog'); - if( is_array( $_POST[ 'blog' ] ) == true ) { + if( is_array( $_POST['blog'] ) == true ) { $blog = $_POST['blog']; $domain = strtolower( wp_specialchars( $blog['domain'] ) ); $email = wp_specialchars( $blog['email'] ); - if( !is_email( $email ) ) - die( "Invalid email address" ); + if( !is_email( $email ) ) + wp_die( __("<p>Invalid email address</p>") ); + if( constant( "VHOST" ) == 'yes' ) { $newdomain = $domain.".".$current_site->domain; $path = $base; @@ -129,11 +99,11 @@ switch( $_GET[ 'action' ] ) { } $user_id = email_exists($email); - if( !$user_id ) { + if( !$user_id ) { // I'm not sure what this check should be. $password = generate_random_password(); $user_id = wpmu_create_user( $domain, $password, $email ); if(false == $user_id) { - die( __("<p>There was an error creating the user</p>") ); + wp_die( __("<p>There was an error creating the user</p>") ); } else { wp_new_user_notification($user_id, $password); } @@ -146,30 +116,29 @@ switch( $_GET[ 'action' ] ) { if( get_user_option( $user_id, 'primary_blog' ) == 1 ) update_user_option( $user_id, 'primary_blog', $blog_id, true ); $content_mail = sprintf(__("New blog created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain.$path, wp_specialchars($blog['title']) ); - @wp_mail( get_site_option('admin_email'), sprintf(__('[%s] New Blog Created'), $current_site->site_name), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); - wp_redirect( add_query_arg( "updated", "blogadded", $_SERVER[ 'HTTP_REFERER' ] ) ); - die(); + wp_mail( get_site_option('admin_email'), sprintf(__('[%s] New Blog Created'), $current_site->site_name), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'add-blog'), $_SERVER['HTTP_REFERER'] ) ); + exit(); } else { die( $blog_id->get_error_message() ); } } - break; + case "updateblog": check_admin_referer('editblog'); - $options_table_name = $wpmuBaseTablePrefix . $id ."_options"; // themes - if( is_array( $_POST[ 'theme' ] ) ) { - $allowed_themes = $_POST[ 'theme' ]; - $_POST[ 'option' ][ 'allowedthemes' ] = $_POST[ 'theme' ]; + if( is_array( $_POST['theme'] ) ) { + $_POST['option']['allowedthemes'] = $_POST['theme']; } else { - $_POST[ 'option' ][ 'allowedthemes' ] = ''; + $_POST['option']['allowedthemes'] = ''; } - if( is_array( $_POST[ 'option' ] ) ) { + + if( is_array( $_POST['option'] ) ) { $c = 1; - $count = count( $_POST[ 'option' ] ); - while( list( $key, $val ) = each( $_POST[ 'option' ] ) ) { + $count = count( $_POST['option'] ); + foreach ( (array) $_POST['option'] as $key => $val ) { if( $c == $count ) { update_blog_option( $id, $key, $val ); } else { @@ -178,24 +147,26 @@ switch( $_GET[ 'action' ] ) { $c++; } } + // update blogs table - $query = "UPDATE $wpdb->blogs SET - domain = '".$_POST[ 'blog' ][ 'domain' ]."', - path = '".$_POST[ 'blog' ][ 'path' ]."', - registered = '".$_POST[ 'blog' ][ 'registered' ]."', - public = '".$_POST[ 'blog' ][ 'public' ]."', - archived = '".$_POST[ 'blog' ][ 'archived' ]."', - mature = '".$_POST[ 'blog' ][ 'mature' ]."', - deleted = '".$_POST[ 'blog' ][ 'deleted' ]."', - spam = '".$_POST[ 'blog' ][ 'spam' ]."' - WHERE blog_id = '$id'"; - $result = $wpdb->query( $query ); - update_blog_status( $id, 'spam', $_POST[ 'blog' ][ 'spam' ] ); + $result = $wpdb->query("UPDATE {$wpdb->blogs} SET + domain = '".$_POST['blog']['domain']."', + path = '".$_POST['blog']['path']."', + registered = '".$_POST['blog']['registered']."', + public = '".$_POST['blog']['public']."', + archived = '".$_POST['blog']['archived']."', + mature = '".$_POST['blog']['mature']."', + deleted = '".$_POST['blog']['deleted']."', + spam = '".$_POST['blog']['spam']."' + WHERE blog_id = '$id'"); + + update_blog_status( $id, 'spam', $_POST['blog']['spam'] ); + // user roles - if( is_array( $_POST[ 'role' ] ) == true ) { - $newroles = $_POST[ 'role' ]; + if( is_array( $_POST['role'] ) == true ) { + $newroles = $_POST['role']; reset( $newroles ); - while( list( $userid, $role ) = each( $newroles ) ) { + foreach ( (array) $newroles as $userid => $role ) { $role_len = strlen( $role ); $existing_role = $wpdb->get_var( "SELECT meta_value FROM $wpdb->usermeta WHERE user_id = '$userid' AND meta_key = '" . $wpmuBaseTablePrefix . $id . "_capabilities'" ); if( false == $existing_role ) { @@ -208,170 +179,243 @@ switch( $_GET[ 'action' ] ) { } // remove user - if( is_array( $_POST[ 'blogusers' ] ) ) { - reset( $_POST[ 'blogusers' ] ); - while( list( $key, $val ) = each( $_POST[ 'blogusers' ] ) ) { + if( is_array( $_POST['blogusers'] ) ) { + reset( $_POST['blogusers'] ); + foreach ( (array) $_POST['blogusers'] as $key => $val ) { $wpdb->query( "DELETE FROM " . $wpdb->usermeta . " WHERE meta_key = '" . $wpmuBaseTablePrefix . $id . "_capabilities' AND user_id = '" . $key . "'" ); } } // change password - if( is_array( $_POST[ 'user_password' ] ) ) { - reset( $_POST[ 'user_password' ] ); - $newroles = $_POST[ 'role' ]; - while( list( $userid, $pass ) = each( $_POST[ 'user_password' ] ) ) { - unset( $_POST[ 'role' ] ); - $_POST[ 'role' ] = $newroles[ $userid ]; + if( is_array( $_POST['user_password'] ) ) { + reset( $_POST['user_password'] ); + $newroles = $_POST['role']; + foreach ( (array) $_POST['user_password'] as $userid => $pass ) { + unset( $_POST['role'] ); + $_POST['role'] = $newroles[ $userid ]; if( $pass != '' ) { $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$wpmuBaseTablePrefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" ); $userdata = get_userdata($userid); - $_POST[ 'pass1' ] = $_POST[ 'pass2' ] = $pass; - $_POST[ 'email' ] = $userdata->user_email; - $_POST[ 'rich_editing' ] = $userdata->rich_editing; + $_POST['pass1'] = $_POST['pass2'] = $pass; + $_POST['email'] = $userdata->user_email; + $_POST['rich_editing'] = $userdata->rich_editing; edit_user( $userid ); if( $cap == null ) $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$wpmuBaseTablePrefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" ); } } - unset( $_POST[ 'role' ] ); - $_POST[ 'role' ] = $newroles; + unset( $_POST['role'] ); + $_POST['role'] = $newroles; } // add user? - if( $_POST[ 'newuser' ] != '' ) { - $newuser = $_POST[ 'newuser' ]; + if( $_POST['newuser'] != '' ) { + $newuser = $_POST['newuser']; $userid = $wpdb->get_var( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = '$newuser'" ); if( $userid ) { $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='wp_" . $id . "_capabilities'" ); if( $user == false ) - $wpdb->query( "INSERT INTO " . $wpdb->usermeta . "( `umeta_id` , `user_id` , `meta_key` , `meta_value` ) VALUES ( NULL, '$userid', '" . $wpmuBaseTablePrefix . $id . "_capabilities', 'a:1:{s:" . strlen( $_POST[ 'new_role' ] ) . ":\"" . $_POST[ 'new_role' ] . "\";b:1;}')" ); + $wpdb->query( "INSERT INTO " . $wpdb->usermeta . "( `umeta_id` , `user_id` , `meta_key` , `meta_value` ) VALUES ( NULL, '$userid', '" . $wpmuBaseTablePrefix . $id . "_capabilities', 'a:1:{s:" . strlen( $_POST['new_role'] ) . ":\"" . $_POST['new_role'] . "\";b:1;}')" ); } } - wpmu_admin_do_redirect( "wpmu-blogs.php?action=editblog&id=".$id ); + wpmu_admin_do_redirect( "wpmu-blogs.php?action=editblog&updated=true&id=".$id ); break; + case "deleteblog": check_admin_referer('deleteblog'); if( $id != '0' && $id != '1' ) wpmu_delete_blog( $id, true ); - wp_redirect( add_query_arg( "updated", "blogdeleted", $_POST[ 'ref' ] ) ); - die(); + + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST[ 'ref' ] ) ); + exit(); break; + case "allblogs": check_admin_referer('allblogs'); - if( is_array( $_POST[ 'allblogs' ] ) ) { - while( list( $key, $val ) = each( $_POST[ 'allblogs' ] ) ) { - if( $val != '0' && $val != '1' ) { - if( $_POST[ 'blogfunction' ] == 'delete' ) { - wpmu_delete_blog( $val, true ); - } elseif( $_POST[ 'blogfunction' ] == 'spam' ) { - update_blog_status( $val, "spam", '1', 0 ); - set_time_limit(60); - } + foreach ( (array) $_POST['allblogs'] as $key => $val ) { + if( $val != '0' && $val != '1' ) { + if( $_POST['blogfunction'] == 'delete' ) { + wpmu_delete_blog( $val, true ); + } elseif( $_POST['blogfunction'] == 'spam' ) { + update_blog_status( $val, "spam", '1', 0 ); + set_time_limit(60); } } } - wp_redirect( add_query_arg( "updated", "blogsupdated", $_SERVER[ 'HTTP_REFERER' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'all_'.$_POST['blogfunction']), $_SERVER['HTTP_REFERER'] ) ); + exit(); break; + case "archiveblog": check_admin_referer('archiveblog'); update_blog_status( $id, "archived", '1' ); do_action( "archive_blog", $id ); - wp_redirect( add_query_arg( "updated", "blogarchived", $_POST[ 'ref' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'archive'), $_POST['ref'] ) ); + exit(); break; + case "unarchiveblog": check_admin_referer('unarchiveblog'); do_action( "unarchive_blog", $id ); update_blog_status( $id, "archived", '0' ); - wp_redirect( add_query_arg( "updated", "blogunarchived", $_POST[ 'ref' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unarchive'), $_POST['ref'] ) ); + exit(); break; + case "activateblog": check_admin_referer('activateblog'); update_blog_status( $id, "deleted", '0' ); do_action( "activate_blog", $id ); - wp_redirect( add_query_arg( "updated", "blogactivated", $_POST[ 'ref' ] ) ); - die(); + wp_redirect( add_query_arg( "updated", array('updated' => 'true', 'action' => 'activate'), $_POST['ref'] ) ); + exit(); break; + case "deactivateblog": check_admin_referer('deactivateblog'); do_action( "deactivate_blog", $id ); update_blog_status( $id, "deleted", '1' ); - wp_redirect( add_query_arg( "updated", "blogdeactivated", $_POST[ 'ref' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'deactivate'), $_POST['ref'] ) ); + exit(); break; + case "unspamblog": check_admin_referer('unspamblog'); update_blog_status( $id, "spam", '0' ); do_action( "unspam_blog", $id ); - wp_redirect( add_query_arg( "updated", "blogunspam", $_POST[ 'ref' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unspam'), $_POST['ref'] ) ); + exit(); break; + case "spamblog": check_admin_referer('spamblog'); update_blog_status( $id, "spam", '1' ); do_action( 'make_spam_blog', $id ); - wp_redirect( add_query_arg( "updated", "blogspam", $_POST[ 'ref' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'spam'), $_POST['ref'] ) ); + exit(); break; + case "mature": update_blog_status( $id, 'mature', '1' ); do_action( 'mature_blog', $id ); - wp_redirect( add_query_arg( "updated", "blogmature", $_POST[ 'ref' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'mature'), $_POST['ref'] ) ); + exit(); break; + case "unmature": update_blog_status( $id, 'mature', '0' ); do_action( 'unmature_blog', $id ); - wp_redirect( add_query_arg( "updated", "blogunmature", $_POST[ 'ref' ] ) ); - die(); - break; - case "updateuser": - check_admin_referer('edituser'); - unset( $_POST[ 'option' ][ 'ID' ] ); - if( is_array( $_POST[ 'option' ] ) ) { - while( list( $key, $val ) = each( $_POST[ 'option' ] ) ) { - $query = "UPDATE ".$wpdb->users." SET ".$key." = '".$val."' WHERE ID = '".$id."'"; - $wpdb->query( $query ); - } - } - if( is_array( $_POST[ 'meta' ] ) ) { - while( list( $key, $val ) = each( $_POST[ 'meta' ] ) ) { - $query = "UPDATE ".$wpdb->usermeta." SET meta_key = '".$_POST[ 'metaname' ][ $key ]."', meta_value = '".$val."' WHERE umeta_id = '".$key."'"; - $wpdb->query( $query ); - } - } - if( is_array( $_POST[ 'metadelete' ] ) ) { - while( list( $key, $val ) = each( $_POST[ 'metadelete' ] ) ) { - $query = "DELETE FROM ".$wpdb->usermeta." WHERE umeta_id = '".$key."'"; - $wpdb->query( $query ); - } - } - wp_redirect( add_query_arg( "updated", "userupdated", $_SERVER[ 'HTTP_REFERER' ] ) ); - die(); + + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'umature'), $_POST['ref'] ) ); + exit(); break; - case "updatethemes": - if( is_array( $_POST[ 'theme' ] ) ) { + + // Themes + case "updatethemes": + if( is_array( $_POST['theme'] ) ) { $themes = get_themes(); reset( $themes ); - foreach( $themes as $key => $theme ) { - if( $_POST[ 'theme' ][ wp_specialchars( $theme[ 'Stylesheet' ] ) ] == 'enabled' ) - $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] = true; + foreach( (array) $themes as $key => $theme ) { + if( $_POST['theme'][ wp_specialchars( $theme['Stylesheet'] ) ] == 'enabled' ) + $allowed_themes[ wp_specialchars( $theme['Stylesheet'] ) ] = true; } update_site_option( 'allowedthemes', $allowed_themes ); } - wp_redirect( add_query_arg( "updated", "themesupdated", $_SERVER[ 'HTTP_REFERER' ] ) ); - die(); + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'themes'), $_SERVER['HTTP_REFERER'] ) ); + exit(); break; + + // Common case "confirm": - ?> - <html><head><title>Please confirm your action</title></head><body><h1>Please Confirm</h1><form action='wpmu-edit.php?action=<?php echo wp_specialchars( $_GET[ 'action2' ] ) ?>' method='POST'><input type='hidden' name='action' value='<?php echo wp_specialchars( $_GET[ 'action2' ] ) ?>'><input type='hidden' name='id' value='<?php echo wp_specialchars( $_GET[ 'id' ] ); ?>'><input type='hidden' name='ref' value='<?php if( isset( $_GET[ 'ref' ] ) ) {echo wp_specialchars( $_GET[ 'ref' ] ); } else { echo $_SERVER[ 'HTTP_REFERER' ]; } ?>'><?php wp_nonce_field( $_GET[ 'action2' ] ) ?><p><?php echo wp_specialchars( $_GET[ 'msg' ] ) ?></p><input type='submit' value='Confirm'></form></body></html> - <?php + global $wp_locale; + ?> + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists('language_attributes') ) language_attributes(); ?>> + <head> + <title><?php _e("WordPress MU › Confirm your action"); ?></title> + + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="stylesheet" href="css/install.css" type="text/css" /> + <?php if ( ( $wp_locale ) && ('rtl' == $wp_locale->text_direction) ) : ?> + <link rel="stylesheet" href="css/install-rtl.css" type="text/css" /> + <?php endif; ?> + </head> + <body> + <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1> + <form action='wpmu-edit.php?action=<?php echo wp_specialchars( $_GET[ 'action2' ] ) ?>' method='post'> + <input type='hidden' name='action' value='<?php echo wp_specialchars( $_GET['action2'] ) ?>' /> + <input type='hidden' name='id' value='<?php echo wp_specialchars( $id ); ?>' /> + <input type='hidden' name='ref' value='<?php if( isset( $_GET['ref'] ) ) {echo wp_specialchars( $_GET['ref'] ); } else { echo $_SERVER['HTTP_REFERER']; } ?>' /> + <?php wp_nonce_field( $_GET['action2'] ) ?> + <p> + <?php echo wp_specialchars( $_GET['msg'] ) ?><br /> + <input type='submit' value='<?php _e("Confirm"); ?>' /></p> + </form> + </body> + </html> + <?php + break; + + // Users + case "deleteuser": + check_admin_referer('deleteuser'); + if( $id != '0' && $id != '1' ) + wpmu_delete_user($id); + + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST['ref'] ) ); + exit(); + break; + + case "allusers": + check_admin_referer('allusers'); + foreach ( (array) $_POST['allusers'] as $key => $val ) { + if( $val != '' && $val != '0' && $val != '1' ) { + $user_details = get_userdata( $val ); + if( $_POST['userfunction'] == 'delete' ) { + wpmu_delete_user($val); + } elseif( $_POST['userfunction'] == 'spam' ) { + $blogs = get_blogs_of_user( $val, true ); + foreach ( (array) $blogs as $key => $details ) { + update_blog_status( $details->userblog_id, "spam", '1' ); + do_action( "make_spam_blog", $details->userblog_id ); + } + update_user_status( $val, "spam", '1', 1 ); + } elseif ( $_POST[ 'userfunction' ] == 'notspam' ) { + $blogs = get_blogs_of_user( $val, true ); + foreach ( (array) $blogs as $key => $details ) { + update_blog_status( $details->userblog_id, "spam", '0' ); + } + update_user_status( $val, "spam", '0', 1 ); + } + } + } + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'all_'.$_POST['userfunction']), $_SERVER['HTTP_REFERER'] ) ); + exit(); break; + + case "adduser": + check_admin_referer('add-user'); + + if( is_array( $_POST['user'] ) == true ) { + $user = $_POST['user']; + if ( empty($user['username']) || empty($user['email']) ) { + wp_die( __("<p>Missing username and email.</p>") ); + } + $password = generate_random_password(); + $user_id = wpmu_create_user(wp_specialchars( strtolower( $user['username'] ) ), $password, wp_specialchars( $user['email'] ) ); + if( false == $user_id ) { + wp_die( __("<p>There was an error creating the user</p>") ); + } else { + wp_new_user_notification($user_id, $password); + } + } + wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'add'), $_SERVER['HTTP_REFERER'] ) ); + exit(); + break; + default: wpmu_admin_do_redirect( "wpmu-admin.php" ); - break; + break; } -?> + +?>
\ No newline at end of file diff --git a/wp-admin/wpmu-options.php b/wp-admin/wpmu-options.php index bdb0acf..1a59e66 100644 --- a/wp-admin/wpmu-options.php +++ b/wp-admin/wpmu-options.php @@ -1,176 +1,215 @@ <?php require_once('admin.php'); -$title = __('Site Options'); +$title = __('WordPress MU › Admin › Site Options'); $parent_file = 'wpmu-admin.php'; include('admin-header.php'); if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); + wp_die( __('<p>You do not have permission to access this page.</p>') ); } if (isset($_GET['updated'])) { - ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php + ?> + <div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div> + <?php } - ?> + <div class="wrap"> <h2><?php _e('Site Options') ?></h2> - <form name="form1" method="POST" action="wpmu-edit.php?action=siteoptions"> - <?php wp_nonce_field( "siteoptions" ); ?> - <fieldset class="options"> - <legend><?php _e('Operational Settings <em>(These settings cannot be modified by blog owners)</em>') ?></legend> - <table width="100%" cellspacing="2" cellpadding="5" class="editform"> - <tr valign="top"> - <th scope="row"><?php _e('Site Name:') ?></th> - <td><input name="site_name" type="text" id="site_name" style="width: 95%" value="<?php echo $current_site->site_name ?>" size="45" /> - <br /> - <?php _e('What you would like to call this website.') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Site Admin Email:') ?></th> - <td><input name="admin_email" type="text" id="admin_email" style="width: 95%" value="<?php echo stripslashes( get_site_option('admin_email') ) ?>" size="45" /> - <br /> - <?php printf( __( 'Registration and support mails will come from this address. Make it generic like "support@%s"' ), $current_site->domain ); ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Allow new registrations') ?></th> - <?php - if( !get_site_option('registration') ) - update_site_option( 'registration', 'all' ); - ?> - <td><input name="registration" type="radio" id="registration1" value='none' <?php echo get_site_option('registration') == 'none' ? 'checked' : ''; ?> /> Disabled<br /> - <input name="registration" type="radio" id="registration2" value='all' <?php echo get_site_option('registration') == 'all' ? 'checked' : ''; ?> /> Enabled for all. Blogs and user accounts can be created.<br /> - <input name="registration" type="radio" id="registration3" value='user' <?php echo get_site_option('registration') == 'user' ? 'checked' : ''; ?> /> Enabled for users only. Only user account can be created.<br /> - <input name="registration" type="radio" id="registration4" value='blog' <?php echo get_site_option('registration') == 'blog' ? 'checked' : ''; ?> /> Enabled for blogs only. Only logged in users can create new blogs.<br /> - <?php _e('Disable or enable registration and who or what can be registered. (Default=all)') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Registration notification') ?></th> - <?php - if( !get_site_option('registrationnotification') ) - update_site_option( 'registrationnotification', 'yes' ); - ?> - <td><input name="registrationnotification" type="radio" id="registrationnotification1" value='yes' <?php echo get_site_option('registrationnotification') == 'yes' ? 'checked' : ''; ?> /> Yes<br /> - <input name="registrationnotification" type="radio" id="registrationnotification2" value='no' <?php echo get_site_option('registrationnotification') == 'no' ? 'checked' : ''; ?> /> No<br /> - <?php _e('Send the site admin an email notification every time someone registers a blog or user account.') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Enable posting by XMLRPC') ?></th> - <?php - if( !get_site_option('xmlrpc_active') ) - update_site_option( 'xmlrpc_active', 'no' ); - ?> - <td><input name="xmlrpc_active" type="radio" id="xmlrpc_active1" value='yes' <?php echo get_site_option('xmlrpc_active') == 'yes' ? 'checked' : ''; ?> /> Yes<br /> - <input name="xmlrpc_active" type="radio" id="xmlrpc_active2" value='no' <?php echo get_site_option('xmlrpc_active') == 'no' ? 'checked' : ''; ?> /> No<br /> - <?php _e('This is an advanced technique for making posts to blogs. It is used by <a href="http://codex.wordpress.org/Weblog_Client">blog clients</a> like Ecto, Flock and Microsoft Live Writer and by Flickr to post pictures to blogs. Unfortunately it is also extensively used by spammers. <em>Disabled by Default</em>') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Welcome Email:') ?></th> - <td><textarea name="welcome_email" id="welcome_email" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('welcome_email') ) ?></textarea> - <br /> - <?php _e('The welcome email sent to new blog owners.') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('First Post:') ?></th> - <td><textarea name="first_post" id="first_post" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('first_post') ) ?></textarea> - <br /> - <?php _e('First post on a new blog.') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Banned Names:') ?></th> - <td><input name="illegal_names" type="text" id="illegal_names" style="width: 95%" value="<?php echo implode( " ", get_site_option('illegal_names') ); ?>" size="45" /> - <br /> - <?php _e('Users are not allowed to register these blogs. Separate names by spaces.') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Limited Email Registrations:') ?></th> - <td><input name="limited_email_domains" type="text" id="limited_email_domains" style="width: 95%" value="<?php echo get_site_option('limited_email_domains') == '' ? '' : @implode( " ", get_site_option('limited_email_domains') ); ?>" size="45" /> - <br /> - <?php _e('If you want to limit blog registrations to certain domains. Separate domains by spaces.') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Banned Email Domains:') ?></th> - <td><textarea name="banned_email_domains" id="banned_email_domains" cols='40' rows='5'><?php echo get_site_option('banned_email_domains') == '' ? '' : @implode( "\n", get_site_option('banned_email_domains') ); ?></textarea> - <br /> - <?php _e('If you want to ban certain email domains from blog registrations. One domain per line.') ?></td> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Blog upload space:') ?></th> - <td><input name="blog_upload_space" type="text" id="blog_upload_space" value="<?php echo get_site_option('blog_upload_space', 10) ?>" size="3" /> MB - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Upload File Types:') ?></th> - <td><input name="upload_filetypes" type="text" id="upload_filetypes" value="<?php echo get_site_option('upload_filetypes', 'jpg jpeg png gif') ?>" size="45" /> - </tr> - <tr valign="top"> - <th scope="row"><?php _e('Max upload file size:') ?></th> - <td><input name="fileupload_maxk" type="text" id="fileupload_maxk" value="<?php echo get_site_option('fileupload_maxk', 300) ?>" size="5" /> KB - </tr> - </table> - </fieldset> - <fieldset class="options"> - <legend><?php _e('Administration Settings') ?></legend> - <table width="100%" cellspacing="2" cellpadding="5" class="editform"> - <tr valign="top"> - <th scope="row"><?php _e('Site Admins:') ?></th> - <td><input name="site_admins" type="text" id="site_admins" style="width: 95%" value="<?php echo implode( " ", get_site_option( 'site_admins', array( 'admin' ) ) ) ?>" size="45" /> - <br /> - <?php _e('These users may login to the main blog and administer the site. Space separated list of usernames.') ?></td> - </tr> - </table> - </fieldset> - <fieldset class="options"> - <legend><?php _e('Site Wide Settings <em>(These settings may be overridden by blog owners)</em>') ?></legend> - <table width="100%" cellspacing="2" cellpadding="5" class="editform"> - <?php - $lang_files = glob( ABSPATH . "wp-content/languages/*.mo" ); - $lang = get_site_option( "WPLANG" ); - if( is_array( $lang_files ) ) { - ?> - <tr valign="top"> - <th width="33%" scope="row"><?php _e('Default Language:') ?></th> - <td><select name="WPLANG" id="WPLANG"> - <?php - echo "<option value=''>".__('Default')."</option>"; - while( list( $key, $val ) = each( $lang_files ) ) { - $l = basename( $val, ".mo" ); - echo "<option value='$l'"; - echo $lang == $l ? " selected" : ""; - echo "> $l</option>"; - } - ?> - </select></td> + <form method="post" action="wpmu-edit.php?action=siteoptions"> + <?php wp_nonce_field( "siteoptions" ); ?> + + <fieldset class="options"> + <legend><?php _e('Operational Settings <em>(These settings cannot be modified by blog owners)</em>') ?></legend> + <table width="100%" cellspacing="2" cellpadding="5" class="editform"> + <tr valign="top"> + <th scope="row"><?php _e('Site Name:') ?></th> + <td> + <input name="site_name" type="text" id="site_name" style="width: 95%" value="<?php echo $current_site->site_name ?>" size="45" /> + <br /> + <?php _e('What you would like to call this website.') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Site Admin Email:') ?></th> + <td> + <input name="admin_email" type="text" id="admin_email" style="width: 95%" value="<?php echo stripslashes( get_site_option('admin_email') ) ?>" size="45" /> + <br /> + <?php printf( __( 'Registration and support mails will come from this address. Make it generic like "support@%s"' ), $current_site->domain ); ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Allow new registrations') ?></th> + <?php + if( !get_site_option('registration') ) + update_site_option( 'registration', 'all' ); + ?> + <td> + <input name="registration" type="radio" id="registration1" value='none' <?php echo get_site_option('registration') == 'none' ? 'checked="checked"' : ''; ?> /> <?php _e('Disabled'); ?><br /> + <input name="registration" type="radio" id="registration2" value='all' <?php echo get_site_option('registration') == 'all' ? 'checked="checked"' : ''; ?> /> <?php _e('Enabled for all. Blogs and user accounts can be created.'); ?><br /> + <input name="registration" type="radio" id="registration3" value='user' <?php echo get_site_option('registration') == 'user' ? 'checked="checked"' : ''; ?> /> <?php _e('Enabled for users only. Only user account can be created.'); ?><br /> + <input name="registration" type="radio" id="registration4" value='blog' <?php echo get_site_option('registration') == 'blog' ? 'checked="checked"' : ''; ?> /> <?php _e('Enabled for blogs only. Only logged in users can create new blogs.'); ?><br /> + <?php _e('Disable or enable registration and who or what can be registered. (Default=all)') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Registration notification') ?></th> + <?php + if( !get_site_option('registrationnotification') ) + update_site_option( 'registrationnotification', 'yes' ); + ?> + <td> + <input name="registrationnotification" type="radio" id="registrationnotification1" value='yes' <?php echo get_site_option('registrationnotification') == 'yes' ? 'checked="checked"' : ''; ?> /> <?php _e('Yes'); ?><br /> + <input name="registrationnotification" type="radio" id="registrationnotification2" value='no' <?php echo get_site_option('registrationnotification') == 'no' ? 'checked="checked"' : ''; ?> /> <?php _e('No'); ?><br /> + <?php _e('Send the site admin an email notification every time someone registers a blog or user account.') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Enable posting by XMLRPC') ?></th> + <?php + if( !get_site_option('xmlrpc_active') ) + update_site_option( 'xmlrpc_active', 'no' ); + ?> + <td> + <input name="xmlrpc_active" type="radio" id="xmlrpc_active1" value='yes' <?php echo get_site_option('xmlrpc_active') == 'yes' ? 'checked="checked"' : ''; ?> /> <?php _e('Yes'); ?><br /> + <input name="xmlrpc_active" type="radio" id="xmlrpc_active2" value='no' <?php echo get_site_option('xmlrpc_active') == 'no' ? 'checked="checked"' : ''; ?> /> <?php _e('No'); ?><br /> + <?php _e('This is an advanced technique for making posts to blogs. It is used by <a href="http://codex.wordpress.org/Weblog_Client">blog clients</a> like Ecto, Flock and Microsoft Live Writer and by Flickr to post pictures to blogs. Unfortunately it is also extensively used by spammers. <em>Disabled by Default</em>') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Welcome Email:') ?></th> + <td> + <textarea name="welcome_email" id="welcome_email" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('welcome_email') ) ?></textarea> + <br /> + <?php _e('The welcome email sent to new blog owners.') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('First Post:') ?></th> + <td> + <textarea name="first_post" id="first_post" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('first_post') ) ?></textarea> + <br /> + <?php _e('First post on a new blog.') ?> + </td> </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Banned Names:') ?></th> + <td> + <input name="illegal_names" type="text" id="illegal_names" style="width: 95%" value="<?php echo implode( " ", get_site_option('illegal_names') ); ?>" size="45" /> + <br /> + <?php _e('Users are not allowed to register these blogs. Separate names by spaces.') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Limited Email Registrations:') ?></th> + <td> + <input name="limited_email_domains" type="text" id="limited_email_domains" style="width: 95%" value="<?php echo get_site_option('limited_email_domains') == '' ? '' : @implode( " ", get_site_option('limited_email_domains') ); ?>" size="45" /> + <br /> + <?php _e('If you want to limit blog registrations to certain domains. Separate domains by spaces.') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Banned Email Domains:') ?></th> + <td> + <textarea name="banned_email_domains" id="banned_email_domains" cols='40' rows='5'><?php echo get_site_option('banned_email_domains') == '' ? '' : @implode( "\n", get_site_option('banned_email_domains') ); ?></textarea> + <br /> + <?php _e('If you want to ban certain email domains from blog registrations. One domain per line.') ?> + </td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Blog upload space:') ?></th> + <td><input name="blog_upload_space" type="text" id="blog_upload_space" value="<?php echo get_site_option('blog_upload_space', 10) ?>" size="3" /> MB</td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Upload File Types:') ?></th> + <td><input name="upload_filetypes" type="text" id="upload_filetypes" value="<?php echo get_site_option('upload_filetypes', 'jpg jpeg png gif') ?>" size="45" /></td> + </tr> + + <tr valign="top"> + <th scope="row"><?php _e('Max upload file size:') ?></th> + <td><input name="fileupload_maxk" type="text" id="fileupload_maxk" value="<?php echo get_site_option('fileupload_maxk', 300) ?>" size="5" /> KB</td> + </tr> + </table> + </fieldset> + + <fieldset class="options"> + <legend><?php _e('Administration Settings') ?></legend> + <table width="100%" cellspacing="2" cellpadding="5" class="editform"> + <tr valign="top"> + <th scope="row"><?php _e('Site Admins:') ?></th> + <td> + <input name="site_admins" type="text" id="site_admins" style="width: 95%" value="<?php echo implode(' ', get_site_option( 'site_admins', array( 'admin' ) ) ) ?>" size="45" /> + <br /> + <?php _e('These users may login to the main blog and administer the site. Space separated list of usernames.') ?> + </td> + </tr> + </table> + </fieldset> + + <fieldset class="options"> + <legend><?php _e('Site Wide Settings <em>(These settings may be overridden by blog owners)</em>') ?></legend> + <table width="100%" cellspacing="2" cellpadding="5" class="editform"> + <?php + $lang_files = glob( ABSPATH . LANGDIR . "/*.mo" ); + $lang = get_site_option( "WPLANG" ); + if( is_array( $lang_files ) ) { + ?> + <tr valign="top"> + <th width="33%" scope="row"><?php _e('Default Language:') ?></th> + <td> + <select name="WPLANG" id="WPLANG"> + <?php + echo "<option value=''>".__('Default')."</option>"; + foreach ( (array) $lang_files as $key => $val ) { + $l = basename( $val, ".mo" ); + echo "<option value='$l'"; + echo $lang == $l ? " selected='selected'" : ""; + echo "> $l</option>"; + } + ?> + </select> + </td> + </tr> + <?php + } // languages + ?> + </table> + </fieldset> + + <fieldset class="options"> + <legend><?php _e('Menus <em>(Enable or disable WP Backend Menus)</em>') ?></legend> + <table cellspacing="2" cellpadding="5" class="editform"> + <tr> + <th scope='row'><?php _e("Menu"); ?></th> + <th scope='row'><?php _e("Enabled"); ?></th> + </tr> <?php - } // languages - ?> - </table> - </fieldset> - <fieldset class="options"> - <legend><?php _e('Menus <em>(Enable or disable WP Backend Menus)</em>') ?></legend> - <table cellspacing="2" cellpadding="5" class="editform"> - <tr><th scope='row'><?php _e("Menu"); ?></th><th scope='row'><?php _e("Enabled"); ?></th></tr> - <?php - $menu_perms = get_site_option( "menu_items" ); - $menu_items = array( "plugins" ); - while( list( $key, $val ) = each( $menu_items ) ) - { - if( $menu_perms[ $val ] == '1' ) { - $checked = ' checked'; - } else { - $checked = ''; - } - print "<tr><th scope='row'>" . ucfirst( $val ) . "</th><td><input type='checkbox' name='menu_items[" . $val . "]' value='1'" . $checked . "></tr>"; - } - ?> - </table> - </fieldset> - <fieldset class="options"> - </fieldset> - <p class="submit"> - <input type="submit" name="Submit" value="<?php _e('Update Options') ?>" /> - </p> + $menu_perms = get_site_option( "menu_items" ); + $menu_items = array( "plugins" ); + foreach ( (array) $menu_items as $key => $val ) { + $checked = ( $menu_perms[$val] == '1' ) ? ' checked="checked"' : ''; + echo "<tr><th scope='row'>" . ucfirst( $val ) . "</th><td><input type='checkbox' name='menu_items[" . $val . "]' value='1'" . $checked . " /></td></tr>"; + } + ?> + </table> + </fieldset> + + <p class="submit"> + <input type="submit" name="Submit" value="<?php _e('Update Options') ?>" /></p> </form> </div> -<?php include('./admin-footer.php'); ?> + +<?php include('./admin-footer.php'); ?>
\ No newline at end of file diff --git a/wp-admin/wpmu-themes.php b/wp-admin/wpmu-themes.php index 24216ff..d9903f5 100644 --- a/wp-admin/wpmu-themes.php +++ b/wp-admin/wpmu-themes.php @@ -1,55 +1,64 @@ <?php require_once('admin.php'); -$title = __('WPMU Admin'); +$title = __('WordPress MU › Admin › Themes'); $parent_file = 'wpmu-admin.php'; require_once('admin-header.php'); + if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); + wp_die( __('<p>You do not have permission to access this page.</p>') ); } + if (isset($_GET['updated'])) { - ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php + ?> + <div id="message" class="updated fade"><p><?php _e('Site themes saved.') ?></p></div> + <?php } + $themes = get_themes(); $allowed_themes = get_site_allowed_themes(); ?> <div class="wrap"> - -<form action='wpmu-edit.php?action=updatethemes' method='POST'> -<h3><?php _e('Site Themes') ?></h3> -<table border="0" cellspacing="5" cellpadding="5"> -<caption><?php _e('Disable themes site-wide. You can enable themes on a blog by blog basis.') ?></caption> -<tr><th width="100"><?php _e('Active') ?></th><th><?php _e('Theme') ?></th><th><?php _e('Description') ?></th></tr> -<?php -foreach( $themes as $key => $theme ) { - $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); - $i++; - $enabled = ''; - $disabled = ''; - if( isset( $allowed_themes[ $theme_key ] ) == true ) { - $enabled = 'checked '; - } else { - $disabled = 'checked '; - } -?> - -<tr valign="top" style="<?php if ($i%2) echo 'background: #eee'; ?>"> -<td> -<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="<?php echo $theme_key ?>" value="disabled" <?php echo $disabled ?>/><?php _e('No') ?></label> - -<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="<?php echo $theme_key ?>" value="enabled" <?php echo $enabled ?>/><?php _e('Yes') ?></label> -</td> -<th scope="row" align="left"><?php echo $key ?></th> -<td><?php echo $theme[ 'Description' ] ?></td> -</tr> -<?php -} -?> -</table> -<p class="submit"> -<input type='submit' value='<?php _e('Update Themes »') ?>' /> -</p> -</form> - + <form action='wpmu-edit.php?action=updatethemes' method='post'> + <h2><?php _e('Site Themes') ?></h2> + <p><?php _e('Disable themes site-wide. You can enable themes on a blog by blog basis.') ?></p> + <table style="border:0; width:100%;" cellspacing="5" cellpadding="5"> + <thead> + <tr> + <th><?php _e('Active') ?></th> + <th><?php _e('Theme') ?></th> + <th><?php _e('Description') ?></th> + </tr> + </thead> + <tbody id="the-list"> + <?php + foreach( (array) $themes as $key => $theme ) : + $theme_key = wp_specialchars($theme['Stylesheet']); + $class = ('alternate' == $class) ? '' : 'alternate'; + $enabled = $disabled = ''; + + if( isset( $allowed_themes[ $theme_key ] ) == true ) { + $enabled = 'checked="checked" '; + } else { + $disabled = 'checked="checked" '; + } + ?> + <tr valign="top" class="<?php echo $class; ?>"> + <td style="text-align:center;"> + <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="disabled_<?php echo $theme_key ?>" value="disabled" <?php echo $disabled ?> /> <?php _e('No') ?></label> + + <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="enabled_<?php echo $theme_key ?>" value="enabled" <?php echo $enabled ?> /> <?php _e('Yes') ?></label> + </td> + <th scope="row" style="text-align:left;"><?php echo $key ?></th> + <td><?php echo $theme['Description'] ?></td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + + <p class="submit"> + <input type='submit' value='<?php _e('Update Themes »') ?>' /></p> + </form> </div> -<?php include('admin-footer.php'); ?> + +<?php include('admin-footer.php'); ?>
\ No newline at end of file diff --git a/wp-admin/wpmu-upgrade-site.php b/wp-admin/wpmu-upgrade-site.php index 67707f2..114d76c 100644 --- a/wp-admin/wpmu-upgrade-site.php +++ b/wp-admin/wpmu-upgrade-site.php @@ -2,33 +2,32 @@ require_once('admin.php'); $http_fopen = ini_get("allow_url_fopen"); -if(!$http_fopen) require_once('../wp-includes/class-snoopy.php'); +if( !$http_fopen ) { + require_once('../wp-includes/class-snoopy.php'); +} -$title = __('WPMU Admin'); +$title = __('WordPress MU › Admin › Upgrade Site'); $parent_file = 'wpmu-admin.php'; require_once('admin-header.php'); + if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); -} -if (isset($_GET['updated'])) { - ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php + wp_die( __('<p>You do not have permission to access this page.</p>') ); } -print '<div class="wrap">'; -switch( $_GET[ 'action' ] ) { + +echo '<div class="wrap">'; +echo '<h2>'.__('Upgrade Site').'</h2>'; +switch( $_GET['action'] ) { case "upgrade": - if( isset( $_GET[ 'n' ] ) == false ) { - $n = 0; - } else { - $n = intval( $_GET[ 'n' ] ); - } - $blogs = $wpdb->get_results( "SELECT * FROM $wpdb->blogs WHERE site_id = '$wpdb->siteid' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT $n, 5", ARRAY_A ); + $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0; + + $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A ); if( is_array( $blogs ) ) { - print "<ul>"; - foreach( $blogs as $details ) { - if( $details[ 'spam' ] == 0 && $details[ 'deleted' ] == 0 && $details[ 'archived' ] == 0 ) { - $siteurl = $wpdb->get_var( "SELECT option_value from {$wpmuBaseTablePrefix}{$details[ 'blog_id' ]}_options WHERE option_name = 'siteurl'" ); - print "<li>$siteurl</li>"; - if($http_fopen) { + echo "<ul>"; + foreach( (array) $blogs as $details ) { + if( $details['spam'] == 0 && $details['deleted'] == 0 && $details['archived'] == 0 ) { + $siteurl = $wpdb->get_var("SELECT option_value from {$wpmuBaseTablePrefix}{$details['blog_id']}_options WHERE option_name = 'siteurl'"); + echo "<li>$siteurl</li>"; + if( $http_fopen ) { $fp = fopen( $siteurl . "wp-admin/upgrade.php?step=1", "r" ); if( $fp ) { while( feof( $fp ) == false ) { @@ -42,32 +41,30 @@ switch( $_GET[ 'action' ] ) { } } } - print "</ul>"; + echo "</ul>"; ?> - <p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a href="?action=upgrade&n=<?php echo ($n + 5) ?>"><?php _e("Next Blogs"); ?></a> </p> - <script language='javascript'> - <!-- - - function nextpage() { - location.href="wpmu-upgrade-site.php?action=upgrade&n=<?php echo ($n + 5) ?>"; - } - setTimeout( "nextpage()", 250 ); - - //--> + <p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a href="wpmu-upgrade-site.php?action=upgrade&n=<?php echo ($n + 5) ?>"><?php _e("Next Blogs"); ?></a></p> + <script type='text/javascript'> + <!-- + function nextpage() { + location.href = "wpmu-upgrade-site.php?action=upgrade&n=<?php echo ($n + 5) ?>"; + } + setTimeout( "nextpage()", 250 ); + //--> </script> <?php } else { - _e("All Done!"); + echo '<p>'.__('All Done!').'</p>'; } break; - default: - ?> + + default: ?> <p><?php _e("You can upgrade all the blogs on your site through this page. It works by calling the upgrade script of each blog automatically. Hit the link below to upgrade."); ?></p> <p><a href="wpmu-upgrade-site.php?action=upgrade"><?php _e("Upgrade Site"); ?></a></p> <?php break; - } ?> </div> -<?php include('admin-footer.php'); ?> + +<?php include('admin-footer.php'); ?>
\ No newline at end of file diff --git a/wp-admin/wpmu-users.php b/wp-admin/wpmu-users.php index f6bf70f..410585b 100644 --- a/wp-admin/wpmu-users.php +++ b/wp-admin/wpmu-users.php @@ -1,384 +1,288 @@ <?php require_once('admin.php'); -$title = __('WPMU Admin: Users'); + +$title = __('WordPress MU › Admin › Users'); $parent_file = 'wpmu-admin.php'; +wp_enqueue_script( 'listman' ); +require_once('admin-header.php'); -if( $_GET[ 'id' ] ) { - $id = intval( $_GET[ 'id' ] ); -} elseif( $_POST[ 'id' ] ) { - $id = intval( $_POST[ 'id' ] ); -} if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); + wp_die( __('<p>You do not have permission to access this page.</p>') ); } -switch( $_GET[ 'action' ] ) { - case "confirm": +if ( $_GET['updated'] == 'true' ) { ?> -<form action='wpmu-users.php?action=<?php echo wp_specialchars( $_GET[ 'action2' ] ) ?>' method='POST'><input type='hidden' name='id' value='<?php echo wp_specialchars( $_GET[ 'id' ] ) ?>'><input type='hidden' name='ref' value='<?php if( isset( $_GET[ 'ref' ] ) ) {echo wp_specialchars( $_GET[ 'ref' ] ); } else { echo $_SERVER[ 'HTTP_REFERER' ]; } ?>'><?php wp_nonce_field( $_GET[ 'action2' ] ) ?><p><?php echo wp_specialchars( $_GET[ 'msg' ] ) ?></p><input type='submit' value='Confirm'></form> - <?php - die(); - break; - case "deleteuser": - check_admin_referer('deleteuser'); - if( $id != '0' && $id != '1' ) - wpmu_delete_user($id); - - wp_redirect( add_query_arg( "update", "userdeleted", $_POST[ 'ref' ] ) ); - die(); - break; - case "allusers": - check_admin_referer('allusers'); - if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); - } - if( is_array( $_POST[ 'allusers' ] ) ) { - while( list( $key, $val ) = each( $_POST[ 'allusers' ] ) ) { - if( $val != '' && $val != '0' && $val != '1' ) { - $user_details = get_userdata( $val ); - if( $_POST[ 'userfunction' ] == 'delete' ) { - wpmu_delete_user($val); - } elseif( $_POST[ 'userfunction' ] == 'spam' ) { - $blogs = get_blogs_of_user( $val, true ); - if( is_array( $blogs ) ) { - while( list( $key, $details ) = each( $blogs ) ) { - update_blog_status( $details->userblog_id, "spam", '1' ); - do_action( "make_spam_blog", $details->userblog_id ); - } - } - update_user_status( $val, "spam", '1', 1 ); - } elseif ( $_POST[ 'userfunction' ] == 'notspam' ) { - $blogs = get_blogs_of_user( $val, true ); - if( is_array( $blogs ) ) { - while( list( $key, $details ) = each( $blogs ) ) { - update_blog_status( $details->userblog_id, "spam", '0' ); - } - } - update_user_status( $val, "spam", '0', 1 ); - } - } - } + <div id="message" class="updated fade"><p> + <?php + switch ($_GET['action']) { + case 'delete': + _e('User deleted !'); + break; + case 'all_spam': + _e('Users mark as spam !'); + break; + case 'all_delete': + _e('Users deleted !'); + break; + case 'add': + _e('User added !'); + break; + default: + _e('Options saved !'); + break; } - wp_redirect( add_query_arg( "updated", "true", $_SERVER[ 'HTTP_REFERER' ] ) ); - die(); - break; -} - -$title = __('WPMU Admin'); -$parent_file = 'wpmu-admin.php'; -require_once('admin-header.php'); -if( is_site_admin() == false ) { - die( __('<p>You do not have permission to access this page.</p>') ); -} -if (isset($_GET['updated'])) { - ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php + ?> + </p></div> + <?php } +?> -print '<div class="wrap">'; -switch( $_GET[ 'action' ] ) { - case "edit": - print "<h2>".__('Edit User')."</h2>"; - $options_table_name = $wpmuBaseTablePrefix . $_GET[ 'id' ] ."_options"; - $query = "SELECT * - FROM ".$wpdb->users." - WHERE ID = '".$_GET[ 'id' ]."'"; - $userdetails = $wpdb->get_results( $query, ARRAY_A ); - $query = "SELECT * - FROM ".$wpdb->usermeta." - WHERE user_id = '".$_GET[ 'id' ]."'"; - $usermetadetails= $wpdb->get_results( $query, ARRAY_A ); - ?> - - <table><td valign='top'> - <form name="form1" method="post" action="wpmu-edit.php?action=updateuser"> - <input type="hidden" name="action" value="updateuser" /> - <input type="hidden" name="id" value="<?php echo intval( $_GET[ 'id' ] ) ?>" /> - <?php wp_nonce_field( "edituser" ); ?> - <table width="100%" cellspacing="2" cellpadding="5" class="editform"> - <?php - unset( $userdetails[0][ 'ID' ] ); - while( list( $key, $val ) = each( $userdetails[0] ) ) { - ?> - <tr valign="top"> - <th width="33%" scope="row"><?php echo ucwords( str_replace( "_", " ", $key ) ) ?></th> - <td><input name="option[<?php echo $key ?>]" type="text" id="<?php echo $val ?>" value="<?php echo $val ?>" size="40" /></td> - </tr> - <?php - } - ?> - </table> - </td><td valign='top'> - <table width="100%" cellspacing="2" cellpadding="5" class="editform"> - <tr><th style='text-align: left'><?php _e('Name') ?></th><th style='text-align: left'><?php _e('Value') ?></th><th style='text-align: left'><?php _e('Delete') ?></th></tr> - <?php - while( list( $key, $val ) = each( $usermetadetails ) ) { - if( substr( $val[ 'meta_key' ], -12 ) == 'capabilities' ) - return; - ?> - <tr valign="top"> - <th width="33%" scope="row"><input name="metaname[<?php echo $val[ 'umeta_id' ] ?>]" type="text" id="<?php echo $val[ 'meta_key' ] ?>" value="<?php echo $val[ 'meta_key' ] ?>"></th> - <td><input name="meta[<?php echo $val[ 'umeta_id' ] ?>]" type="text" id="<?php echo $val[ 'meta_value' ] ?>" value="<?php echo addslashes( $val[ 'meta_value' ] ) ?>" size="40" /></td> - <td><input type='checkbox' name='metadelete[<?php echo $val[ 'umeta_id' ] ?>]'></td> - </tr> - <?php - } - ?> - </table> - </td></table> +<div class="wrap"> + <?php + $start = isset( $_GET['start'] ) ? intval( $_GET['start'] ) : 0; + $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 30; - <p class="submit"> - <input type="submit" name="Submit" value="<?php _e('Update User') ?> »" /> - </p> - <?php - break; - default: - if( isset( $_GET[ 'start' ] ) == false ) { - $start = 0; - } else { - $start = intval( $_GET[ 'start' ] ); - } - if( isset( $_GET[ 'num' ] ) == false ) { - $num = 30; - } else { - $num = intval( $_GET[ 'num' ] ); - } + $query = "SELECT * FROM {$wpdb->users}"; + + if( !empty($_GET['s']) ) { + $search = '%' . trim(addslashes($_GET['s'])) . '%'; + $query .= " WHERE user_login LIKE '$search' OR user_email LIKE '$search'"; + } + + if( !isset($_GET['sortby']) ) { + $_GET['sortby'] = 'id'; + } + + if( $_GET['sortby'] == 'email' ) { + $query .= ' ORDER BY user_email '; + } elseif( $_GET['sortby'] == 'id' ) { + $query .= ' ORDER BY ID '; + } elseif( $_GET['sortby'] == 'login' ) { + $query .= ' ORDER BY user_login '; + } elseif( $_GET['sortby'] == 'name' ) { + $query .= ' ORDER BY display_name '; + } elseif( $_GET['sortby'] == 'registered' ) { + $query .= ' ORDER BY user_registered '; + } + + $query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC'; - $query = "SELECT * FROM ".$wpdb->users; - if( $_GET[ 's' ] != '' ) { - $search = '%' . addslashes( $_GET['s'] ) . '%'; - $query .= " WHERE user_login LIKE '$search' OR user_email LIKE '$search'"; - } - if( isset( $_GET[ 'sortby' ] ) == false ) { - $_GET[ 'sortby' ] = 'id'; - } - if( $_GET[ 'sortby' ] == 'email' ) { - $query .= ' ORDER BY user_email '; - } elseif( $_GET[ 'sortby' ] == 'id' ) { - $query .= ' ORDER BY ID '; - } elseif( $_GET[ 'sortby' ] == 'login' ) { - $query .= ' ORDER BY user_login '; - } elseif( $_GET[ 'sortby' ] == 'name' ) { - $query .= ' ORDER BY display_name '; - } elseif( $_GET[ 'sortby' ] == 'registered' ) { - $query .= ' ORDER BY user_registered '; - } - if( $_GET[ 'order' ] == 'DESC' ) { - $query .= "DESC"; + $query .= " LIMIT " . intval( $start ) . ", " . intval( $num ); + $user_list = $wpdb->get_results( $query, ARRAY_A ); + + $next = ( count( $user_list ) < $num ) ? false : true; + ?> + <h2><?php _e("Users"); ?></h2> + <div style="float:right; padding:0 20px; margin-top:10px;"> + <h4 style="margin:0 0 4px;"><?php _e('User Navigation') ?></h4> + <?php + $url2 = "order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=" .$_GET['s']; + if( $start == 0 ) { + _e('Previous Users'); + } elseif( $start <= 30 ) { + echo '<a href="wpmu-users.php?start=0' . $url2 . '">'.__('Previous Users').'</a>'; } else { - $query .= "ASC"; - } - $query .= " LIMIT " . intval( $start ) . ", " . intval( $num ); - $user_list = $wpdb->get_results( $query, ARRAY_A ); - if( count( $user_list ) < $num ) { - $next = false; + echo '<a href="wpmu-users.php?start=' . ( $start - $num ) . '&' . $url2 . '">'.__('Previous Users').'</a>'; + } + if ( $next ) { + echo ' || <a href="wpmu-users.php?start=' . ( $start + $num ) . '&' . $url2 . '">'.__('Next Users').'</a>'; } else { - $next = true; + echo ' || '.__('Next Users'); } -?> -<h2><?php _e("Users"); ?></h2> -<form name="searchform" action="wpmu-users.php" method="get" style="float: left; width: 16em; margin-right: 3em;"> - <table><tr><td> - <fieldset> - <legend><?php _e('Search Users…') ?></legend> - <input type='hidden' name='action' value='users' /> - <input type="text" name="s" value="<?php if (isset($_GET[ 's' ])) echo wp_specialchars($_GET[ 's' ], 1); ?>" size="17" /> - <input type="submit" name="submit" value="<?php _e('Search') ?>" /> - </fieldset> - <?php - if( isset($_GET[ 's' ]) && $_GET[ 's' ] != '' ) { - ?><a href="/wp-admin/wpmu-blogs.php?action=blogs&s=<?php echo wp_specialchars($_GET[ 's' ], 1) ?>"><?php _e('Search Blogs:') ?> <?php echo wp_specialchars($_GET[ 's' ], 1) ?></a><?php - } - ?> - </td><td> - <fieldset> - <legend><?php _e('User Navigation') ?></legend> - <?php - - $url2 = "order=" . $_GET[ 'order' ] . "&sortby=" . $_GET[ 'sortby' ] . "&s=" .$_GET[ 's' ]; - - if( $start == 0 ) { - _e('Previous Users'); - } elseif( $start <= 30 ) { - echo '<a href="wpmu-users.php?start=0' . $url2 . '">'.__('Previous Users').'</a>'; - } else { - echo '<a href="wpmu-users.php?start=' . ( $start - $num ) . '&' . $url2 . '">'.__('Previous Users').'</a>'; - } - if ( $next ) { - echo ' || <a href="wpmu-users.php?start=' . ( $start + $num ) . '&' . $url2 . '">'.__('Next Users').'</a>'; - } else { - echo ' || '.__('Next Users'); - } - ?> - </fieldset> - </td></tr></table> -</form> - -<br style="clear:both;" /> - -<?php - -// define the columns to display, the syntax is 'internal name' => 'display name' -$posts_columns = array( - 'id' => __('ID'), - 'login' => __('Login'), - 'email' => __('Email'), - 'name' => __('Name'), - 'registered' => __('Registered'), - 'blogs' => __('Blogs') -); -$posts_columns = apply_filters('manage_posts_columns', $posts_columns); - -// you can not edit these at the moment -$posts_columns['control_edit'] = ''; -$posts_columns['control_delete'] = ''; - -?> -<script language="javascript"> -<!-- -var checkflag = "false"; -function check_all_rows() { - field = document.formlist; - if (checkflag == "false") { - for (i = 0; i < field.length; i++) { - if( field[i].name == 'allusers[]' ) - field[i].checked = true;} - checkflag = "true"; - return "<?php _e('Uncheck All') ?>"; - } else { - for (i = 0; i < field.length; i++) { - if( field[i].name == 'allusers[]' ) - field[i].checked = false; } - checkflag = "false"; - return "<?php _e('Check All') ?>"; - } -} -// --> -</script> + ?> + </div> + + <form action="wpmu-users.php" method="get" id="searchform"> + <fieldset> + <legend><?php _e('Search Users…') ?></legend> + <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo stripslashes(wp_specialchars($_GET['s'], 1)); ?>" size="17" /> + </fieldset> + <input class="button" id="post-query-submit" type="submit" name="submit" value="<?php _e('Search') ?>" /> + </form> -<form name='formlist' action='wpmu-users.php' method='POST'> -<table width="100%" cellpadding="3" cellspacing="3"> - <tr> + <br style="clear:both;" /> + + <?php if( isset($_GET['s']) && $_GET['s'] != '' ) : ?> + <p><a href="wpmu-blogs.php?action=blogs&s=<?php echo stripslashes(wp_specialchars($_GET['s'], 1)); ?>"><?php _e('Search Blogs:') ?> <strong><?php echo stripslashes(wp_specialchars($_GET['s'], 1)) ?></strong></a></p> + <?php endif; ?> -<?php foreach($posts_columns as $column_id => $column_display_name) { ?> - <th scope="col"><?php if( $column_id == 'blogs' ) { _e( "Blogs" ); } else { ?><a href="wpmu-users.php?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><?php } ?> -<?php } ?> + <?php + // define the columns to display, the syntax is 'internal name' => 'display name' + $posts_columns = array( + 'id' => __('ID'), + 'login' => __('Login'), + 'email' => __('Email'), + 'name' => __('Name'), + 'registered' => __('Registered'), + 'blogs' => __('Blogs') + ); + $posts_columns = apply_filters('manage_posts_columns', $posts_columns); - </tr> -<?php -if ($user_list) { -$bgcolor = ''; -foreach ($user_list as $user) { -$class = ('alternate' == $class) ? '' : 'alternate'; -?> - <tr class='<?php echo $class; ?>'> + // you can not edit these at the moment + $posts_columns['control_edit'] = ''; + $posts_columns['control_delete'] = ''; -<?php + ?> + <script type="text/javascript"> + <!-- + var checkflag = "false"; + function check_all_rows() { + field = document.formlist; + if (checkflag == "false") { + for (i = 0; i < field.length; i++) { + if( field[i].name == 'allusers[]' ) { + field[i].checked = true; + } + } + checkflag = "true"; + return "<?php _e('Uncheck All') ?>"; + } else { + for (i = 0; i < field.length; i++) { + if( field[i].name == 'allusers[]' ) { + field[i].checked = false; + } + } + checkflag = "false"; + return "<?php _e('Check All') ?>"; + } + } + // --> + </script> -foreach($posts_columns as $column_name=>$column_display_name) { + <form name="formlist" action='wpmu-edit.php' method='post'> + <table class="widefat" cellpadding="3" cellspacing="3"> + <thead> + <tr> + <?php foreach( (array) $posts_columns as $column_id => $column_display_name) { ?> + <th scope="col"> + <?php if( $column_id == 'blogs' ) { + _e('Blogs'); + } else { ?> + <a href="wpmu-users.php?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> + <?php } ?> + </th> + <?php } ?> + </tr> + </thead> + <tbody id="the-list"> + <?php if ($user_list) { + $bgcolor = ''; + foreach ( (array) $user_list as $user) { + $class = ('alternate' == $class) ? '' : 'alternate'; + ?> + + <tr class="<?php echo $class; ?>"> + <?php + foreach( (array) $posts_columns as $column_name=>$column_display_name) : + switch($column_name) { + case 'id': ?> + <th scope="row"><input type='checkbox' id='user_<?php echo $user['ID'] ?>' name='allusers[]' value='<?php echo $user['ID'] ?>' /> <label for='user_<?php echo $user['ID'] ?>'><?php echo $user['ID'] ?></label></th> + <?php + break; - switch($column_name) { + case 'login': ?> + <td><label for='user_<?php echo $user['ID'] ?>'><?php echo $user['user_login'] ?></label></td> + <?php + break; - case 'id': - ?> - <th scope="row"><input type='checkbox' id='<?php echo $user[ 'ID' ] ?>' name='allusers[]' value='<?php echo $user[ 'ID' ] ?>' /> <label for='<?php echo $user[ 'ID' ] ?>'><?php echo $user[ 'ID' ] ?></label></th> - <?php - break; + case 'name': ?> + <td><?php echo $user['display_name'] ?></td> + <?php + break; - case 'login': - ?> - <td><label for='<?php echo $user[ 'ID' ] ?>'><?php echo $user[ 'user_login' ] ?></label> - </td> - <?php - break; + case 'email': ?> + <td><?php echo $user['user_email'] ?></td> + <?php + break; - case 'name': - ?> - <td><?php echo $user[ 'display_name' ] ?></td> - <?php - break; + case 'registered': ?> + <td><?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $user['user_registered']); ?></td> + <?php + break; - case 'email': - ?> - <td><?php echo $user[ 'user_email' ] ?></td> - <?php - break; + case 'blogs': + $blogs = get_blogs_of_user( $user['ID'], true ); + ?> + <td> + <?php + if( is_array( $blogs ) ) { + foreach ( (array) $blogs as $key => $val ) { + echo '<a href="wpmu-blogs.php?action=editblog&id=' . $val->userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $val->path ) . '</a> (<a '; + if( get_blog_status( $val->userblog_id, 'spam' ) == 1 ) + echo 'style="background-color: #f66" '; + echo 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . '</a>)<br />'; + } + } + ?> + </td> + <?php + break; - case 'registered': - ?> - <td><?php echo $user[ 'user_registered' ] ?></td> - <?php - break; + case 'control_edit': ?> + <td><a href="user-edit.php?user_id=<?php echo $user['ID']; ?>" class="edit"><?php _e('Edit'); ?></a></td> + <?php + break; - case 'blogs': - $blogs = get_blogs_of_user( $user[ 'ID' ], true ); - ?> - <td><?php if( is_array( $blogs ) ) - while( list( $key, $val ) = each( $blogs ) ) { - print '<a href="wpmu-blogs.php?action=editblog&id=' . $val->userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $val->path ) . '</a> (<a '; - if( get_blog_status( $val->userblog_id, 'spam' ) == 1 ) - print 'style="background-color: #f66" '; - print 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . '</a>)<BR>'; - } ?></td> - <?php - break; + case 'control_delete': ?> + <td><a href="wpmu-edit.php?action=confirm&action2=deleteuser&msg=<?php echo urlencode( __("You are about to delete this user.") ); ?>&id=<?php echo $user['ID']; ?>&redirect=<?php echo wpmu_admin_redirect_url(); ?>" class="delete" onclick="return deleteSomething( 'user', <?php echo $user['ID']; ?>, '<?php echo js_escape(sprintf(__("You are about to delete this user '%s'.\n'OK' to delete, 'Cancel' to stop."), $user['user_login'])); ?>' );"><?php _e('Delete'); ?></a></td> + <?php + break; - case 'control_edit': - ?> - <td><?php echo "<a href='user-edit.php?user_id=".$user[ 'ID' ]."' class='edit'>" . __('Edit') . "</a>"; ?></td> - <?php - break; - - case 'control_delete': - ?> - <td><?php echo "<a href='wpmu-users.php?action=confirm&action2=deleteuser&msg=" . urlencode( __("You are about to delete this user.") ) . "&id=".$user[ 'ID' ]."&redirect=".wpmu_admin_redirect_url()."' class='delete'\">" . __('Delete') . "</a>"; ?></td> - <?php - break; - - default: - ?> - <td><?php do_action('manage_users_custom_column', $column_name, $id); ?></td> - <?php - break; - } -} -?> - </tr> -<?php -} -} else { -?> - <tr style='background-color: <?php echo $bgcolor; ?>'> - <td colspan="8"><?php _e('No users found.') ?></td> - </tr> -<?php -} // end if ($users) -?> -</table> -<p><input type=button value="<?php _e('Check All') ?>" onClick="this.value=check_all_rows()" /> </p> -<p><?php _e('Selected Users:') ?></p> -<ul> - <?php wp_nonce_field( "allusers" ); ?> -<li><input type='radio' name='userfunction' id='delete' value='delete' /> <label for='delete'><?php _e('Delete') ?></label></li> -<li><input type='radio' name='userfunction' id='spam' value='spam' /> <label for='spam'><?php _e('Mark as Spammers') ?></label></li> -<li><input type='radio' name='userfunction' id='notspam' value='notspam' /> <label for='spam'><?php _e('Not Spam') ?></label></li> -</ul> -<input type='hidden' name='action' value='allusers'> -<p><input type='submit' value='<?php _e('Apply Changes') ?>'></p> -</form> - -<?php -} -?> + default: ?> + <td><?php do_action('manage_users_custom_column', $column_name, $user['ID']); ?></td> + <?php + break; + } + endforeach + ?> + </tr> + <?php + } + } else { + ?> + <tr style='background-color: <?php echo $bgcolor; ?>'> + <td colspan="<?php echo (int) count($posts_columns); ?>"><?php _e('No users found.') ?></td> + </tr> + <?php + } // end if ($users) + ?> + </tbody> + </table> + + <p><input class="button" type="button" value="<?php _e('Check All') ?>" onclick="this.value=check_all_rows()" /></p> + + <h3><?php _e('Selected Users:') ?></h3> + <ul style="list-style:none;"> + <li><input type='radio' name='userfunction' id='delete' value='delete' /> <label for='delete'><?php _e('Delete') ?></label></li> + <li><input type='radio' name='userfunction' id='spam' value='spam' /> <label for='spam'><?php _e('Mark as Spammers') ?></label></li> + <li><input type='radio' name='userfunction' id='notspam' value='notspam' /> <label for='spam'><?php _e('Not Spam') ?></label></li> + </ul> + + <p class="submit" style="width: 220px"> + <?php wp_nonce_field( "allusers" ); ?> + <input type='hidden' name='action' value='allusers' /> + <input class="button" type='submit' value='<?php _e('Apply Changes') ?>' /></p> + </form> </div> -<form name="addform" action="wpmu-edit.php?action=adduser" method="post"> + <div class="wrap"> -<h2><?php _e('Add User') ?></h2> -<?php wp_nonce_field('add-user') ?> -<table> -<tr><th scope='row'><?php _e('Username') ?></th><td><input type="text" name="user[username]" /></td></tr> -<tr><th scope='row'><?php _e('Email') ?></th><td><input type="text" name="user[email]" /></td></tr> -</table> -<input type="submit" name="Add user" value="<?php _e('Add user') ?>" /> -</form> + <form action="wpmu-edit.php?action=adduser" method="post"> + <h2><?php _e('Add User') ?></h2> + + <table cellpadding="3" cellspacing="3"> + <tr> + <th style="text-align:center;" scope='row'><?php _e('Username') ?></th> + <td><input type="text" name="user[username]" /></td> + </tr> + <tr> + <th style="text-align:center;" scope='row'><?php _e('Email') ?></th> + <td><input type="text" name="user[email]" /></td> + </tr> + </table> + <p> + <?php wp_nonce_field('add-user') ?> + <input class="button" type="submit" name="Add user" value="<?php _e('Add user') ?>" /></p> + </form> </div> -<?php include('admin-footer.php'); ?> + +<?php include('admin-footer.php'); ?>
\ No newline at end of file |