phpdoc and cleanup. see #11644

git-svn-id: http://svn.automattic.com/wordpress/trunk@12826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-01-25 22:01:43 +00:00
parent 9469c9f02a
commit 63f9a62af6
2 changed files with 35 additions and 18 deletions

View File

@ -1,8 +1,17 @@
<?php
/**
* Determine if uploaded file exceeds space quota.
*
* @since 3.0
*
* @param array $file $_FILES array for a given file.
* @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
*/
function check_upload_size( $file ) {
if ( get_site_option( 'upload_space_check_disabled' ) ) {
if ( get_site_option( 'upload_space_check_disabled' ) )
return $file;
}
if ( $file['error'] != '0' ) // there's already an error
return $file;
@ -27,6 +36,15 @@ function check_upload_size( $file ) {
}
add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
/**
* Delete a blog
*
* @since 3.0
*
* @param int $blog_id Blog ID
* @param bool $drop True if blog's table should be dropped. Default is false.
* @return void
*/
function wpmu_delete_blog($blog_id, $drop = false) {
global $wpdb;
@ -40,9 +58,11 @@ function wpmu_delete_blog($blog_id, $drop = false) {
$users = get_users_of_blog($blog_id);
// Remove users from this blog.
if ( !empty($users) ) foreach ($users as $user) {
if ( !empty($users) ) {
foreach ($users as $user) {
remove_user_from_blog($user->user_id, $blog_id);
}
}
update_blog_status( $blog_id, 'deleted', 1 );
@ -90,10 +110,9 @@ function wpmu_delete_blog($blog_id, $drop = false) {
$blogs = get_site_option( "blog_list" );
if ( is_array( $blogs ) ) {
foreach ( $blogs as $n => $blog ) {
if ( $blog[ 'blog_id' ] == $blog_id ) {
if ( $blog[ 'blog_id' ] == $blog_id )
unset( $blogs[ $n ] );
}
}
update_site_option( 'blog_list', $blogs );
}
@ -152,9 +171,8 @@ function confirm_delete_users( $users ) {
foreach ( (array) $_POST['allusers'] as $key => $val ) {
if ( $val != '' && $val != '0' ) {
$user = new WP_User( $val );
if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) {
if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) )
wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a site admnistrator.' ), $user->user_login ) );
}
echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
$blogs = get_blogs_of_user( $val, true );
if ( !empty( $blogs ) ) {
@ -264,9 +282,8 @@ function update_profile_email() {
if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
$user->ID = $current_user->ID;
$user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) );
if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) )
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
}
wp_update_user( get_object_vars( $user ) );
delete_option( $current_user->ID . '_new_email' );
wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) );

View File

@ -1608,13 +1608,13 @@ function get_user_id_from_string( $string ) {
$user_id = 0;
if ( is_email( $string ) ) {
$user = get_user_by_email($string);
$user = get_user_by('email', $string);
if ( $user )
$user_id = $user->ID;
} elseif ( is_numeric( $string ) ) {
$user_id = $string;
} else {
$user = get_userdatabylogin($string);
$user = get_user_by('login', $string);
if ( $user )
$user_id = $user->ID;
}