X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..refs/tags/wordpress-4.4:/wp-admin/includes/ms.php diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index ffed184b..534bc552 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -28,13 +28,18 @@ function check_upload_size( $file ) { $space_left = get_upload_space_available(); $file_size = filesize( $file['tmp_name'] ); - if ( $space_left < $file_size ) - $file['error'] = sprintf( __( 'Not enough space to upload. %1$s KB needed.' ), number_format( ($file_size - $space_left) /1024 ) ); - if ( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) - $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s KB in size.'), get_site_option( 'fileupload_maxk', 1500 ) ); + if ( $space_left < $file_size ) { + $file['error'] = sprintf( __( 'Not enough space to upload. %1$s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) ); + } + + if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) { + $file['error'] = sprintf( __( 'This file is too big. Files must be less than %1$s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) ); + } + if ( upload_is_user_over_quota( false ) ) { $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); } + if ( $file['error'] != '0' && ! isset( $_POST['html-upload'] ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { wp_die( $file['error'] . ' ' . __( 'Back' ) . '' ); } @@ -47,7 +52,7 @@ function check_upload_size( $file ) { * * @since 3.0.0 * - * @global wpdb $wpdb + * @global wpdb $wpdb WordPress database abstraction object. * * @param int $blog_id Blog ID. * @param bool $drop True if blog's table should be dropped. Default is false. @@ -158,7 +163,7 @@ function wpmu_delete_blog( $blog_id, $drop = false ) { } $stack = array_reverse( $stack ); // Last added dirs are deepest - foreach( (array) $stack as $dir ) { + foreach ( (array) $stack as $dir ) { if ( $dir != $top_dir) @rmdir( $dir ); } @@ -177,7 +182,7 @@ function wpmu_delete_blog( $blog_id, $drop = false ) { * * @todo Merge with wp_delete_user() ? * - * @global wpdb $wpdb + * @global wpdb $wpdb WordPress database abstraction object. * * @param int $id The user ID. * @return bool True if the user was deleted, otherwise false. @@ -185,6 +190,10 @@ function wpmu_delete_blog( $blog_id, $drop = false ) { function wpmu_delete_user( $id ) { global $wpdb; + if ( ! is_numeric( $id ) ) { + return false; + } + $id = (int) $id; $user = new WP_User( $id ); @@ -313,8 +322,8 @@ All at ###SITENAME### * * @since 3.0.0 * - * @global object $errors WP_Error object. - * @global object $wpdb WordPress database object. + * @global WP_Error $errors WP_Error object. + * @global wpdb $wpdb WordPress database object. */ function send_confirmation_on_profile_email() { global $errors, $wpdb; @@ -413,9 +422,9 @@ function upload_is_user_over_quota( $echo = true ) { return false; $space_allowed = get_space_allowed(); - if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) ) + if ( ! is_numeric( $space_allowed ) ) { $space_allowed = 10; // Default space allowed is 10 MB - + } $space_used = get_space_used(); if ( ( $space_allowed - $space_used ) < 0 ) { @@ -439,7 +448,7 @@ function display_space_usage() { $percent_used = ( $space_used / $space_allowed ) * 100; if ( $space_allowed > 1000 ) { - $space = number_format( $space_allowed / 1024 ); + $space = number_format( $space_allowed / KB_IN_BYTES ); /* translators: Gigabytes */ $space .= __( 'GB' ); } else { @@ -501,7 +510,7 @@ function upload_space_setting( $id ) { * * @since 3.0.0 * - * @global wpdb $wpdb + * @global wpdb $wpdb WordPress database abstraction object. * * @param int $id The user ID. * @param string $pref The column in the wp_users table to update the user's status @@ -802,7 +811,7 @@ function choose_primary_blog() { $found = false; ?> + ID ) . '">' . $current_user->user_login . ''; ?> + + ID ) ) { + wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) ); + } + + if ( in_array( $delete_user->user_login, $site_admins ) ) { + wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), '' . $delete_user->user_login . '' ) ); + } + ?> + + + + "; + } else { + ?> + + +
user_login; ?> + ' . "\n"; ?> +

' . $delete_user->user_login . '' + ); ?>

+ $details ) { + $blog_users = get_users( array( 'blog_id' => $details->userblog_id, 'fields' => array( 'ID', 'user_login' ) ) ); + if ( is_array( $blog_users ) && !empty( $blog_users ) ) { + $user_site = "{$details->blogname}"; + $user_dropdown = ''; + $user_dropdown .= "\n"; + ?> +
    +
  • +
  • +
  • +
  • +
+

+ +
+ +

+ +

+ + + + +