Coding style
git-svn-id: http://svn.automattic.com/wordpress/trunk@12736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9bea527ac3
commit
c2873bbab3
|
@ -9,15 +9,13 @@ if ( !is_super_admin() )
|
|||
|
||||
do_action('wpmuadminedit', '');
|
||||
|
||||
if( isset($_GET[ 'id' ]) ) {
|
||||
if ( isset($_GET[ 'id' ]) )
|
||||
$id = intval( $_GET[ 'id' ] );
|
||||
} elseif( isset($_POST[ 'id' ]) ) {
|
||||
elseif ( isset($_POST[ 'id' ]) )
|
||||
$id = intval( $_POST[ 'id' ] );
|
||||
}
|
||||
|
||||
if( isset( $_POST['ref'] ) == false && !empty($_SERVER['HTTP_REFERER']) ) {
|
||||
if ( isset( $_POST['ref'] ) == false && !empty($_SERVER['HTTP_REFERER']) )
|
||||
$_POST['ref'] = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
switch ( $_GET['action'] ) {
|
||||
case "siteoptions":
|
||||
|
@ -84,9 +82,8 @@ switch( $_GET['action'] ) {
|
|||
$dashboard_blog_id = $blog_details->blog_id;
|
||||
}
|
||||
}
|
||||
if ( is_wp_error( $dashboard_blog_id ) ) {
|
||||
if ( is_wp_error( $dashboard_blog_id ) )
|
||||
wp_die( __( 'Problem creating dashboard blog: ' ) . $dashboard_blog_id->get_error_message() );
|
||||
}
|
||||
if ( $_POST[ 'dashboard_blog_orig' ] != $_POST[ 'dashboard_blog' ] ) {
|
||||
$users = get_users_of_blog( get_site_option( 'dashboard_blog' ) );
|
||||
$move_users = array();
|
||||
|
@ -132,9 +129,8 @@ switch( $_GET['action'] ) {
|
|||
case "addblog":
|
||||
check_admin_referer('add-blog');
|
||||
|
||||
if( is_array( $_POST[ 'blog' ] ) == false ) {
|
||||
if ( is_array( $_POST[ 'blog' ] ) == false )
|
||||
wp_die( "Can't create an empty blog." );
|
||||
}
|
||||
$blog = $_POST['blog'];
|
||||
$domain = sanitize_user( str_replace( '/', '', $blog[ 'domain' ] ) );
|
||||
$email = sanitize_email( $blog[ 'email' ] );
|
||||
|
@ -158,12 +154,11 @@ switch( $_GET['action'] ) {
|
|||
if ( !$user_id ) { // Create a new user with a random password
|
||||
$password = wp_generate_password();
|
||||
$user_id = wpmu_create_user( $domain, $password, $email );
|
||||
if(false == $user_id) {
|
||||
if ( false == $user_id )
|
||||
wp_die( __('There was an error creating the user') );
|
||||
} else {
|
||||
else
|
||||
wp_new_user_notification($user_id, $password);
|
||||
}
|
||||
}
|
||||
|
||||
$wpdb->hide_errors();
|
||||
$id = wpmu_create_blog($newdomain, $path, $title, $user_id , array( "public" => 1 ), $current_site->id);
|
||||
|
@ -188,11 +183,10 @@ switch( $_GET['action'] ) {
|
|||
wp_die( __('You probably need to go back to the <a href="ms-sites.php">sites page</a>') );
|
||||
|
||||
// themes
|
||||
if( is_array( $_POST[ 'theme' ] ) ) {
|
||||
if ( is_array( $_POST[ 'theme' ] ) )
|
||||
$_POST[ 'option' ][ 'allowedthemes' ] = $_POST[ 'theme' ];
|
||||
} else {
|
||||
else
|
||||
$_POST[ 'option' ][ 'allowedthemes' ] = '';
|
||||
}
|
||||
|
||||
switch_to_blog( $id );
|
||||
if ( is_array( $_POST[ 'option' ] ) ) {
|
||||
|
@ -201,11 +195,10 @@ switch( $_GET['action'] ) {
|
|||
foreach ( (array) $_POST['option'] as $key => $val ) {
|
||||
if ( $key === 0 )
|
||||
continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
|
||||
if( $c == $count ) {
|
||||
if ( $c == $count )
|
||||
update_option( $key, $val );
|
||||
} else {
|
||||
else
|
||||
update_option( $key, $val, false ); // no need to refresh blog details yet
|
||||
}
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
@ -244,13 +237,11 @@ switch( $_GET['action'] ) {
|
|||
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 = '" . $blog_prefix. "capabilities'" );
|
||||
if( false == $existing_role ) {
|
||||
if ( false == $existing_role )
|
||||
$wpdb->query( "INSERT INTO " . $wpdb->usermeta . "( `umeta_id` , `user_id` , `meta_key` , `meta_value` ) VALUES ( NULL, '$userid', '" . $blog_prefix . "capabilities', 'a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}')" );
|
||||
} elseif( $existing_role != "a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}" ) {
|
||||
elseif ( $existing_role != "a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}" )
|
||||
$wpdb->query( "UPDATE $wpdb->usermeta SET meta_value = 'a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}' WHERE user_id = '$userid' AND meta_key = '" . $blog_prefix . "capabilities'" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// remove user
|
||||
|
@ -469,13 +460,11 @@ switch( $_GET['action'] ) {
|
|||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'all_delete'), 'ms-users.php' ) );
|
||||
} else {
|
||||
foreach ( (array) $_POST['allusers'] as $key => $val ) {
|
||||
if( $val == '' || $val == '0' ) {
|
||||
if ( $val == '' || $val == '0' )
|
||||
continue;
|
||||
}
|
||||
$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 modified. The user %s is a site admnistrator.' ), $user->user_login ) );
|
||||
}
|
||||
if ( isset($_POST['alluser_spam']) ) {
|
||||
$userfunction = 'all_spam';
|
||||
$blogs = get_blogs_of_user( $val, true );
|
||||
|
@ -501,31 +490,28 @@ switch( $_GET['action'] ) {
|
|||
case "adduser":
|
||||
check_admin_referer('add-user');
|
||||
|
||||
if( is_array( $_POST[ 'user' ] ) == false ) {
|
||||
if ( is_array( $_POST[ 'user' ] ) == false )
|
||||
wp_die( __( "Cannot create an empty user." ) );
|
||||
}
|
||||
$user = $_POST['user'];
|
||||
if ( empty($user['username']) && empty($user['email']) ) {
|
||||
if ( empty($user['username']) && empty($user['email']) )
|
||||
wp_die( __('Missing username and email.') );
|
||||
} elseif ( empty($user['username']) ) {
|
||||
elseif ( empty($user['username']) )
|
||||
wp_die( __('Missing username.') );
|
||||
} elseif ( empty($user['email']) ) {
|
||||
elseif ( empty($user['email']) )
|
||||
wp_die( __('Missing email.') );
|
||||
}
|
||||
|
||||
$password = generate_random_password();
|
||||
$user_id = wpmu_create_user(wp_specialchars( strtolower( $user['username'] ) ), $password, wp_specialchars( $user['email'] ) );
|
||||
|
||||
if( false == $user_id ) {
|
||||
if ( false == $user_id )
|
||||
wp_die( __('Duplicated username or email address.') );
|
||||
} else {
|
||||
else
|
||||
wp_new_user_notification($user_id, $password);
|
||||
}
|
||||
if ( get_site_option( 'dashboard_blog' ) == false ) {
|
||||
|
||||
if ( get_site_option( 'dashboard_blog' ) == false )
|
||||
add_user_to_blog( $current_site->blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
|
||||
} else {
|
||||
else
|
||||
add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
|
||||
}
|
||||
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'add'), $_SERVER['HTTP_REFERER'] ) );
|
||||
exit();
|
||||
|
|
Loading…
Reference in New Issue