Changeset 12722 for trunk/wp-admin
- Timestamp:
- 01/14/2010 02:02:19 AM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin
-
Property
svn:ignore
set to
.themes.php.swp
.user-edit.php.swp
.user-new.php.swp
.users.php.swp
-
Property
svn:ignore
set to
-
trunk/wp-admin/plugins.php
r12673 r12722 232 232 233 233 $help = '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>'; 234 if ( !is_multisite() || is_super_admin() ) { 234 235 $help .= '<p>' . sprintf(__('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>'; 235 236 $help .= '<p>' . sprintf(__('You can find additional plugins for your site by using the new <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually. To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%2$s</code> directory. Once a plugin has been installed, you may activate it here.'), 'plugin-install.php', WP_PLUGIN_DIR) . '</p>'; 237 } 236 238 237 239 add_contextual_help('plugins', $help); … … 283 285 <div class="wrap"> 284 286 <?php screen_icon(); ?> 285 <h2><?php echo esc_html( $title ); ?> <a href="plugin-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a></h2>286 287 <?php 288 289 $all_plugins = get_plugins();287 <h2><?php echo esc_html( $title ); if ( !is_multisite() || is_super_admin() ) { ?> <a href="plugin-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a><?php } ?></h2> 288 289 <?php 290 291 $all_plugins = apply_filters( 'all_plugins', get_plugins() ); 290 292 $search_plugins = array(); 291 293 $active_plugins = array(); … … 322 324 if ( isset( $current->response[ $plugin_file ] ) ) 323 325 $upgrade_plugins[ $plugin_file ] = $plugin_data; 326 } 327 328 if ( is_multisite() && !is_super_admin() ) { 329 $upgrade_plugins = false; 324 330 } 325 331 … … 516 522 </form> 517 523 524 <?php do_action( 'pre_current_active_plugins', $all_plugins ) ?> 525 518 526 <form method="post" action="<?php echo admin_url('plugins.php') ?>"> 519 527 <?php wp_nonce_field('bulk-manage-plugins') ?> -
trunk/wp-admin/themes.php
r12673 r12722 13 13 wp_die( __( 'Cheatin’ uh?' ) ); 14 14 15 if ( is_multisite() ) { 16 $themes = get_themes(); 17 $ct = current_theme_info(); 18 $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes() ); 19 if( $allowed_themes == false ) 20 $allowed_themes = array(); 21 22 $blog_allowed_themes = wpmu_get_blog_allowedthemes(); 23 if( is_array( $blog_allowed_themes ) ) 24 $allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes ); 25 if( $blog_id != 1 ) 26 unset( $allowed_themes[ "h3" ] ); 27 28 if( isset( $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] ) == false ) 29 $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] = true; 30 31 reset( $themes ); 32 foreach( $themes as $key => $theme ) { 33 if( isset( $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] ) == false ) { 34 unset( $themes[ $key ] ); 35 } 36 } 37 reset( $themes ); 38 } 15 39 if ( isset($_GET['action']) ) { 16 40 if ( 'activate' == $_GET['action'] ) { … … 33 57 34 58 $help = '<p>' . __('Themes give your WordPress style. Once a theme is installed, you may preview it, activate it or deactivate it here.') . '</p>'; 35 if ( current_user_can('install_themes') ) {59 if ( ( !is_multisite() && current_user_can('install_themes') ) || is_super_admin() ) { 36 60 $help .= '<p>' . sprintf(__('You can find additional themes for your site by using the new <a href="%1$s">Theme Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/themes/">WordPress Theme Directory</a> directly and installing manually. To install a theme <em>manually</em>, <a href="%2$s">upload its ZIP archive with the new uploader</a> or copy its folder via FTP into your <code>wp-content/themes</code> directory.'), 'theme-install.php', 'theme-install.php?tab=upload' ) . '</p>'; 37 61 $help .= '<p>' . __('Once a theme is uploaded, you should see it on this page.') . '</p>' ; … … 44 68 45 69 require_once('admin-header.php'); 70 if( is_multisite() && is_super_admin() ) { 71 ?><div id="message0" class="updated fade"><p><?php _e('Administrator: new themes must be activated in the <a href="wpmu-themes.php">Themes Admin</a> page before they appear here.'); ?></p></div><?php 72 } 46 73 ?> 47 74 … … 59 86 60 87 <?php 61 $themes = get_themes(); 88 if ( !is_multisite() ) 89 $themes = get_themes(); 62 90 $ct = current_theme_info(); 63 91 unset($themes[$ct->name]); … … 98 126 function theme_update_available( $theme ) { 99 127 static $themes_update; 128 129 if ( is_multisite() && !is_super_admin() ) 130 return; 131 100 132 if ( !isset($themes_update) ) 101 133 $themes_update = get_site_transient('update_themes'); … … 128 160 <div class="wrap"> 129 161 <?php screen_icon(); ?> 130 <h2><?php echo esc_html( $title ); ?> <a href="theme-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a></h2>162 <h2><?php echo esc_html( $title ); if ( !is_multisite() || is_super_admin() ) { ?> <a href="theme-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } ?></h2> 131 163 132 164 <h3><?php _e('Current Theme'); ?></h3> … … 139 171 printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h4> 140 172 <p class="theme-description"><?php echo $ct->description; ?></p> 141 <?php if ( $ct->parent_theme) { ?>173 <?php if ( ( !is_multisite() || is_super_admin() ) && $ct->parent_theme ) { ?> 142 174 <p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ), $ct->title, $ct->parent_theme); ?></p> 143 175 <?php } else { ?> … … 218 250 $actions[] = '<a href="' . $activate_link . '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>'; 219 251 $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview “%s”'), $theme_name)) . '">' . __('Preview') . '</a>'; 220 if ( current_user_can('update_themes') )252 if ( ( !is_multisite() && current_user_can('update_themes') ) || is_super_admin() ) 221 253 $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "if ( confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete."), $theme_name )) . "') ) {return true;}return false;" . '">' . __('Delete') . '</a>'; 222 254 $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); … … 234 266 <p class="description"><?php echo $description; ?></p> 235 267 <span class='action-links'><?php echo $actions ?></span> 236 <?php if ( $parent_theme) {268 <?php if ( ( !is_multisite() || is_super_admin() ) && $parent_theme ) { 237 269 /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?> 238 270 <p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme); ?></p> … … 267 299 // List broken themes, if any. 268 300 $broken_themes = get_broken_themes(); 269 if ( count($broken_themes) ) {270 ?> 271 272 <h2><?php _e('Broken Themes'); ?> </h2>301 if ( ( !is_multisite() || is_super_admin() ) && count( $broken_themes ) ) { 302 ?> 303 304 <h2><?php _e('Broken Themes'); ?> <?php if ( is_multisite() ) _e( '(Site admin only)' ); ?></h2> 273 305 <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p> 274 306 -
trunk/wp-admin/upgrade.php
r12673 r12722 87 87 $backto = esc_url_raw( $backto ); 88 88 $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); 89 if( $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'" ) ) { 90 $wpdb->query( "UPDATE {$wpdb->blog_versions} SET db_version = '{$wp_db_version}' WHERE blog_id = '{$wpdb->blogid}'" ); 91 } else { 92 $wpdb->query( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" ); 93 } 89 94 ?> 90 95 <h2><?php _e( 'Upgrade Complete' ); ?></h2> -
trunk/wp-admin/user-edit.php
r12546 r12722 61 61 } 62 62 63 64 // Only allow site admins to edit every user. 65 if ( is_multisite() && !defined( "EDIT_ANY_USER" ) && !is_super_admin() && $user_id != $current_user->ID ) 66 wp_die( __( 'You do not have permission to edit this user.' ) ); 67 63 68 switch ($action) { 64 69 case 'switchposts': … … 82 87 do_action('edit_user_profile_update', $user_id); 83 88 84 $errors = edit_user($user_id); 89 if ( !is_multisite() ) { 90 $errors = edit_user($user_id); 91 } else { 92 // WPMU must delete the user from the current blog if WP added him after editing. 93 $delete_role = false; 94 $blog_prefix = $wpdb->get_blog_prefix(); 95 if( $user_id != $current_user->ID ) { 96 $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" ); 97 if( null == $cap && $_POST[ 'role' ] == '' ) { 98 $_POST[ 'role' ] = 'contributor'; 99 $delete_role = true; 100 } 101 } 102 if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) ) 103 $errors = edit_user($user_id); 104 if( $delete_role ) // stops users being added to current blog when they are edited 105 update_usermeta( $user_id, $blog_prefix . 'capabilities' , '' ); 106 } 85 107 86 108 if ( !is_wp_error( $errors ) ) { -
trunk/wp-admin/user-new.php
r11369 r12722 16 16 require_once( ABSPATH . WPINC . '/registration.php'); 17 17 18 if ( is_multisite() ) { 19 function admin_created_user_email( $text ) { 20 return sprintf( __( "Hi, 21 You've been invited to join '%s' at 22 %s as a %s. 23 If you do not want to join this blog please ignore 24 this email. This invitation will expire in a few days. 25 26 Please click the following link to activate your user account: 27 %%s" ), get_bloginfo('name'), site_url(), wp_specialchars( $_REQUEST[ 'role' ] ) ); 28 } 29 add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); 30 31 function admin_created_user_subject( $text ) { 32 return "[" . get_bloginfo('name') . "] Your blog invite"; 33 } 34 } 35 18 36 if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { 19 37 check_admin_referer('add-user'); … … 22 40 wp_die(__('You can’t create users.')); 23 41 24 $user_id = add_user(); 25 26 if ( is_wp_error( $user_id ) ) { 27 $add_user_errors = $user_id; 42 if ( !is_multisite() ) { 43 $user_id = add_user(); 44 45 if ( is_wp_error( $user_id ) ) { 46 $add_user_errors = $user_id; 47 } else { 48 $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); 49 $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add'; 50 wp_redirect( $redirect . '#user-' . $user_id ); 51 die(); 52 } 28 53 } else { 29 $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); 30 $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add'; 31 wp_redirect( $redirect . '#user-' . $user_id ); 32 die(); 54 $user_login = preg_replace( "/\s+/", '', sanitize_user( $_REQUEST[ 'user_login' ], true ) ); 55 $user_details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_login = %s AND user_email = %s", $user_login, $_REQUEST[ 'email' ] ) ); 56 if( $user_details ) { 57 // Adding an existing user to this blog 58 $new_user_email = wp_specialchars(trim($_REQUEST['email'])); 59 $redirect = 'user-new.php'; 60 $username = $user_details->user_login; 61 $user_id = $user_details->ID; 62 if( ($username != null && is_site_admin( $username ) == false ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { 63 $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' ); 64 } else { 65 if ( isset( $_POST[ 'noconfirmation' ] ) && is_site_admin() ) { 66 add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); 67 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); 68 } else { 69 $newuser_key = substr( md5( $user_id ), 0, 5 ); 70 add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); 71 $message = __("Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n"); 72 wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf($message, get_option('blogname'), site_url(), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/"))); 73 $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); 74 } 75 } 76 wp_redirect( $redirect ); 77 die(); 78 } else { 79 // Adding a new user to this blog 80 $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] ); 81 unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] ); 82 if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { 83 $add_user_errors = $user_details[ 'errors' ]; 84 } else { 85 $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); 86 if ( isset( $_POST[ 'noconfirmation' ] ) && is_site_admin() ) { 87 add_filter( 'wpmu_signup_user_notification', create_function('', '{return false;}') ); // Disable confirmation email 88 } 89 wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ); 90 if ( isset( $_POST[ 'noconfirmation' ] ) && is_site_admin() ) { 91 $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) ); 92 wpmu_activate_signup( $key ); 93 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); 94 } else { 95 $redirect = add_query_arg( array('update' => 'newuserconfimation'), 'user-new.php' ); 96 } 97 wp_redirect( $redirect ); 98 die(); 99 } 100 } 33 101 } 34 102 } … … 43 111 require_once ('admin-header.php'); 44 112 113 if ( is_multisite() ) { 114 switch( $_GET[ 'update' ] ) { 115 case "newuserconfimation": 116 $messages[] = '<div id="message" class="updated fade"><p>' . __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.') . '</p></div>'; 117 break; 118 case "add": 119 $messages[] = '<div id="message" class="updated fade"><p>' . __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your blog.') . '</p></div>'; 120 break; 121 case "addnoconfirmation": 122 $messages[] = '<div id="message" class="updated fade"><p>' . __('User has been added to your blog.') . '</p></div>'; 123 break; 124 case "addexisting": 125 $messages[] = '<div id="message" class="updated fade"><p>' . __('That user is already a member of this blog.') . '</p></div>'; 126 break; 127 } 128 } 45 129 ?> 46 130 <div class="wrap"> … … 75 159 76 160 <?php 161 if ( !is_multisite() ) { 77 162 if ( get_option('users_can_register') ) 78 163 echo '<p>' . sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), site_url('wp-register.php')) . '</p>'; 79 164 else 80 165 echo '<p>' . sprintf(__('Users cannot currently <a href="%1$s">register themselves</a>, but you can manually create users here.'), admin_url('options-general.php#users_can_register')) . '</p>'; 166 } else { 167 echo '<p>' . __( 'You can add new users to your blog in two ways:' ) . '<ol><li> ' . __( 'Enter the username and email address of an existing user on this site.' ) . '</li><li> ' . __( 'Enter the username and the email address of a person who is not already a member of this site. Choose the username carefully, it cannot be changed.' ) . '</li></ol></p>'; 168 echo '<p>' . __( 'That person will be sent an email asking them to click a link confirming the invite. New users will then be sent an email with a randomly generated password and a login link.' ) . '</p>'; 169 } 81 170 ?> 82 171 <form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate"> … … 93 182 ?> 94 183 <table class="form-table"> 184 <?php if ( !is_multisite() ) { ?> 95 185 <tr class="form-field form-required"> 96 186 <th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label> … … 131 221 </tr> 132 222 <?php endif; ?> 133 223 <?php } else { // multisite ?> 224 <tr class="form-field form-required"> 225 <th scope="row"><label for="user_login"><?php _e('Username (required)') ?></label><input name="action" type="hidden" id="action" value="adduser" /></th> 226 <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" aria-required="true" /></td> 227 </tr> 228 <tr class="form-field form-required"> 229 <th scope="row"><label for="email"><?php _e('E-mail (required)') ?></label></th> 230 <td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td> 231 </tr> 232 <?php } ?> 134 233 <tr class="form-field"> 135 234 <th scope="row"><label for="role"><?php _e('Role'); ?></label></th> … … 143 242 </td> 144 243 </tr> 244 245 <?php if ( is_multisite() && is_super_admin() ) { ?> 246 <tr class="form-field"> 247 <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> 248 <td><input name="noconfirmation" type="checkbox" id="noconfirmation" value="1" /> <label for="noconfirmation"><?php _e( 'Site administrators can add a user without sending the confirmation email.' ); ?></label></td> 249 </tr> 250 <?php } ?> 145 251 </table> 146 252 <p class="submit"> -
trunk/wp-admin/users.php
r12546 r12722 99 99 switch($_REQUEST['delete_option']) { 100 100 case 'delete': 101 wp_delete_user($id); 101 if ( !is_multisite() ) { 102 wp_delete_user($id); 103 } else { 104 remove_user_from_blog($id, $blog_id); // WPMU only remove user from blog 105 } 102 106 break; 103 107 case 'reassign': 104 wp_delete_user($id, $_REQUEST['reassign_user']); 108 if ( !is_multisite() ) { 109 wp_delete_user($id, $_REQUEST['reassign_user']); 110 } else { 111 remove_user_from_blog($id, $blog_id, $_REQUEST['reassign_user']); 112 } 105 113 break; 106 114 } … … 154 162 } 155 163 } 156 $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login"); 164 if ( !is_multisite() ) { 165 $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login"); 166 } else { 167 // WPMU only searches users of current blog 168 $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities' ORDER BY user_login"); 169 } 157 170 $user_dropdown = '<select name="reassign_user">'; 158 171 foreach ( (array) $all_logins as $login ) … … 240 253 <div class="wrap"> 241 254 <?php screen_icon(); ?> 242 <h2><?php echo esc_html( $title ); ?> <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'user'); ?></a> <?php255 <h2><?php echo esc_html( $title ); if ( !is_multisite() || get_site_option( 'add_new_users' ) ) { ?> <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'user'); ?></a><?php } 243 256 if ( isset($_GET['usersearch']) && $_GET['usersearch'] ) 244 257 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $_GET['usersearch'] ) ); ?> … … 386 399 </div> 387 400 401 <?php 402 if ( is_multisite() ) { 403 foreach ( array('user_login' => 'user_login', 'first_name' => 'user_firstname', 'last_name' => 'user_lastname', 'email' => 'user_email', 'url' => 'user_uri', 'role' => 'user_role') as $formpost => $var ) { 404 $var = 'new_' . $var; 405 $$var = isset($_REQUEST[$formpost]) ? esc_attr(stripslashes($_REQUEST[$formpost])) : ''; 406 } 407 unset($name); 408 } 409 ?> 410 388 411 <br class="clear" /> 389 412 <?php
Note: See TracChangeset
for help on using the changeset viewer.