From d2bd94baf9b13c930cd07119c5875750f7bd3a2b Mon Sep 17 00:00:00 2001 From: donncha Date: Wed, 17 Oct 2007 17:10:45 +0000 Subject: Facelift for wpmu-* courtesy of momo360modena, fixes #446 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1092 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/wpmu-admin.php | 59 +-- wp-admin/wpmu-blogs.php | 1140 +++++++++++++++++++++------------------- wp-admin/wpmu-edit.php | 424 ++++++++------- wp-admin/wpmu-options.php | 355 +++++++------ wp-admin/wpmu-themes.php | 91 ++-- wp-admin/wpmu-upgrade-site.php | 69 ++- wp-admin/wpmu-users.php | 608 +++++++++------------ 7 files changed, 1404 insertions(+), 1342 deletions(-) (limited to 'wp-admin') 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 @@ You do not have permission to access this page.

') ); + wp_die( __('

You do not have permission to access this page.

') ); } + if (isset($_GET['updated'])) { - ?>

+

+ -
- -
-

- - -" type="submit" /> -

-
-
-

- - -" /> -

-
- +
+

+ + +
+

+ + + " /> +

+
+ +
+

+ + + " /> +

+
- + + \ 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 @@ You do not have permission to access this page.

') ); -} -if (isset($_GET['updated'])) { - ?>

You do not have permission to access this page.

') ); } -print '
'; -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 "

" . __('Edit Blog') . "

"; - print "{$details[ 'domain' ]}"; - ?> -
- - - + +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

+ -

- - - - + 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" ); ?> - - - - +
+

+ '> + + + +
http://
>    - >    -
>    - >    -
>    - >    -
>    - >    -
>    - >    -
-
-
-
/>
+ + + + + + '; + } + } + + if( $out != '' ) { + echo "

" . __('Blog Themes') . "

"; + echo '
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $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") ) { + ?> + + + + + + + + + + +
http://
+ /> + /> +
+ /> + /> +
+ /> + /> +
+ /> + /> +
+ /> + /> +


/>
+

+

+
+
+ $theme ) { + $theme_key = wp_specialchars( $theme['Stylesheet'] ); + if( isset($allowed_themes[$theme_key] ) == false ) { + $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; + $out .= '
'.$key.'
'; + echo ''; + echo $out; + echo "
' . __('Theme') . '' . __('Enable') . '
"; + } + + // Blog users + $blogusers = get_users_of_blog( $id ); + echo '

' . __('Blog Users') . '

'; + if( is_array( $blogusers ) ) { + echo ''; + echo ""; + reset($blogusers); + foreach ( (array) $blogusers as $key => $val ) { + $t = @unserialize( $val->meta_value ); + if( is_array( $t ) ) { + reset( $t ); + $existing_role = key( $t ); + } + echo ""; + if( $val->user_id != $current_user->data->ID ) { + ?> + + + '; + } else { + echo ""; + } + echo '"; + } + echo "
' . __('Current Users') . '
" . __('User') . "" . __('Role') . "" . __('Password') . "" . __('Remove') . "
" . $val->user_login . " + + + + " . __ ('N/A') . "" . __ ('N/A') . "" . __('N/A') . "' . __('Edit') . "
"; + } + + // New blog user + echo "

" . __('Add a new user') . "

"; + ?> +

Click them to select and hit Update Options to add the user.') ?>

+ + + + + + + + + +
+ +
+
+ +
+ +

+
+ +

+

+
+
+
- -

- -

-
- - - $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 .= ' - - '.$key.' - - '; - } - } - if( $out != '' ) { - print "

" . __('Blog Themes') . "

"; - print ''; - print ''; - print $out; - print "
' . __('Theme') . '' . __('Enable') . '
"; - } - $blogusers = get_users_of_blog( $id ); - print '

' . __('Blog Users') . '

'; - if( is_array( $blogusers ) ) { - print ''; - print ""; - reset( $blogusers ); - while( list( $key, $val ) = each( $blogusers ) ) - { - $t = @unserialize( $val->meta_value ); - if( is_array( $t ) ) { - reset( $t ); - $existing_role = key( $t ); - } - print ""; - if( $val->user_id != $current_user->data->ID ) { - ?> - '; - } else { - print ""; - } - print '"; - } - print "
' . __('Current Users') . '
" . __('User') . "" . __('Role') . "" . __('Password') . "" . __('Remove') . "
" . $val->user_login . "" . __ ('N/A') . "" . __ ('N/A') . "" . __('N/A') . "' . __('Edit') . "
"; - } - print "

" . __('Add a new user') . "

"; - ?> -

Click them to select and hit Update Options to add the user.') ?>

- - - - - - - -
-
-
-

-
-

- -

- - - - 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 .= '' . __('Previous Blogs') . ''; } else { - $next = true; + $blog_navigation .= '' . __('Previous Blogs') . ''; + } + if ( $next ) { + $blog_navigation .= ' || ' . __('Next Blogs') . ''; + } else { + $blog_navigation .= ' || ' . __('Next Blogs'); } -?> - - -

-
-
-
- - -  
-  
-
- -
- -
-
- - ' . __('Previous Blogs') . ''; - } else { - $blog_navigation .= '' . __('Previous Blogs') . ''; - } - if ( $next ) { - $blog_navigation .= ' || ' . __('Next Blogs') . ''; - } else { - $blog_navigation .= ' || ' . __('Next Blogs'); - } - echo $blog_navigation; - ?> -
-
-
- -
- - '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' ]; -?> - -
- - - - - $column_display_name) { ?> - - - - - "#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'"; + ?> + +
+

+
+

+ +
+ + + +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + +
+ + +

+ - case 'id': - ?> -
- - - - - - - - - - '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']; ?> - - - - - - - - - + + + +
start=">
' name='allblogs[]' value=''> - 10 ) - $blogusers = array_slice( $blogusers, 0, 10 ); - while( list( $key, $val ) = each( $blogusers ) ) - print '' . $val->user_login . ' ('.$val->user_email.')
'; - } - ?>
" . __('Edit') . ""; ?>" . __('Backend') . ""; ?>">">">
+ + + $column_display_name) : ?> + + + + + - + 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 ""; + + $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': ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + +
start=">
">
+ ' name='allblogs[]' value='' /> + + + + g:i:s a'), $blog['last_updated']); ?> + + g:i:s a'), $blog['registered']); ?> + + 10 ) { + $blogusers = array_slice( $blogusers, 0, 10 ); + } + foreach ( $blogusers as $key => $val ) { + echo '' . $val->user_login . ' ('.$val->user_email.')
'; + } + } + ?> +
+ + + " . __('Edit') . ""; ?> + + " . __('Backend') . ""; ?> + + " onclick="return deleteSomething( 'blog', , '' );"> + + " onclick="return deleteSomething( 'blog', , '' );"> + + " onclick="return deleteSomething( 'blog', , '' );"> + + " onclick="return deleteSomething( 'blog', , '' );"> + + " onclick="return deleteSomething( 'blog', , '' );"> + + " onclick="return deleteSomething( 'blog', , '' );"> + + " onclick="return deleteSomething( 'blog', , '' );"> + + + + +
">">">
+ +
+

+ +
+ + +

+ + +

+ + ' /> + ' />

+ + + +
+

+
+ + + + + + + + + +
+ + .domain;?> + domain . $current_site->path ?> + +
+ +
+
- - - - - - - - - -
- -

    -
  • -
  • - -
-'> -'>

- -
-
- - -
-
- -
-

-
- - -domain . $current_site->path ?> - - - -
.domain;?>
- -
-
- - - +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 @@ You do not have permission to access this page.

') ); + wp_die( __('

You do not have permission to access this page.

') ); } -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 ""; - } - 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 ""; - } 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( __("

There was an error creating the user

") ); - } 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( __("

Invalid email address

") ); + 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( __("

There was an error creating the user

") ); + wp_die( __("

There was an error creating the user

") ); } 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": - ?> - Please confirm your action

Please Confirm

' method='POST'>'>'>'>

- + + > + + <?php _e("WordPress MU › Confirm your action"); ?> + + + + text_direction) ) : ?> + + + + +

WordPress

+
' method='post'> + ' /> + + ' /> + +

+
+

+
+ + + '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( __("

Missing username and email.

") ); + } + $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( __("

There was an error creating the user

") ); + } 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 @@ You do not have permission to access this page.

') ); + wp_die( __('

You do not have permission to access this page.

') ); } if (isset($_GET['updated'])) { - ?>

+

+ +

-
- -
- (These settings cannot be modified by blog owners)') ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- domain ); ?>
/> Disabled
- /> Enabled for all. Blogs and user accounts can be created.
- /> Enabled for users only. Only user account can be created.
- /> Enabled for blogs only. Only logged in users can create new blogs.
-
/> Yes
- /> No
-
/> Yes
- /> No
- blog clients like Ecto, Flock and Microsoft Live Writer and by Flickr to post pictures to blogs. Unfortunately it is also extensively used by spammers. Disabled by Default') ?>
-
-
-
-
" size="45" /> -
-
" size="45" /> -
-
-
-
MB -
-
KB -
-
-
- - - - - - -
" size="45" /> -
-
-
-
- (These settings may be overridden by blog owners)') ?> - - - - - + + + +
+ (These settings cannot be modified by blog owners)') ?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ domain ); ?> +
+ />
+ />
+ />
+ />
+ +
+ />
+ />
+ +
+ />
+ />
+ blog clients like Ecto, Flock and Microsoft Live Writer and by Flickr to post pictures to blogs. Unfortunately it is also extensively used by spammers. Disabled by Default') ?> +
+ +
+ +
+ +
+ +
+ " size="45" /> +
+ +
+ " size="45" /> +
+ +
+ +
+ +
MB
KB
+
+ +
+ + + + + + +
+ +
+ +
+
+ +
+ (These settings may be overridden by blog owners)') ?> + + + + + + + +
+ +
+
+ +
+ (Enable or disable WP Backend Menus)') ?> + + + + + -
-
-
- (Enable or disable WP Backend Menus)') ?> - - - "; - } - ?> -
" . ucfirst( $val ) . "
-
-
-
-

- -

+ $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 "" . ucfirst( $val ) . ""; + } + ?> + + + +

+

- + + \ 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 @@ You do not have permission to access this page.

') ); + wp_die( __('

You do not have permission to access this page.

') ); } + if (isset($_GET['updated'])) { - ?>

+

+
- -
-

- - - - $theme ) { - $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); - $i++; - $enabled = ''; - $disabled = ''; - if( isset( $allowed_themes[ $theme_key ] ) == true ) { - $enabled = 'checked '; - } else { - $disabled = 'checked '; - } -?> - - - - - - - -
- -    - -
-

-' /> -

-
- +
+

+

+ + + + + + + + + + $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" '; + } + ?> + + + + + + + +
+ +     + +
+ +

+ ' />

+
- + + \ 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( __('

You do not have permission to access this page.

') ); -} -if (isset($_GET['updated'])) { - ?>

You do not have permission to access this page.

') ); } -print '
'; -switch( $_GET[ 'action' ] ) { + +echo '
'; +echo '

'.__('Upgrade Site').'

'; +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 "
    "; - 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 "
  • $siteurl
  • "; - if($http_fopen) { + echo "
      "; + 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 "
    • $siteurl
    • "; + 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 "
    "; + echo "
"; ?> -

- '.__('All Done!').'

'; } break; - default: - ?> + + default: ?>

- + + \ 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 @@ You do not have permission to access this page.

') ); + wp_die( __('

You do not have permission to access this page.

') ); } -switch( $_GET[ 'action' ] ) { - case "confirm": +if ( $_GET['updated'] == 'true' ) { ?> -
' method='POST'>'>'>

- You do not have permission to access this page.

') ); - } - 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 ); - } - } - } +

+ You do not have permission to access this page.

') ); -} -if (isset($_GET['updated'])) { - ?>

+

+ -print '
'; -switch( $_GET[ 'action' ] ) { - case "edit": - print "

".__('Edit User')."

"; - $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 ); - ?> - -
-
- - - - - - - - - - -
-
- - - - - - - - - -
]'>
-
+
+ - -

- 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; + ?> +

+
+

+ '.__('Previous Users').''; } 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 ''.__('Previous Users').''; + } + if ( $next ) { + echo ' || '.__('Next Users').''; } else { - $next = true; + echo ' || '.__('Next Users'); } -?> -

- -
-
- - - - -
- -
-
- - '.__('Previous Users').''; - } else { - echo ''.__('Previous Users').''; - } - if ( $next ) { - echo ' || '.__('Next Users').''; - } else { - echo ' || '.__('Next Users'); - } - ?> -
-
- - -
- - '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'] = ''; - -?> - + ?> +
+ +
+
+ + +
+ +
-
- - +
+ + +

+ - $column_display_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'] = ''; - + -foreach($posts_columns as $column_name=>$column_display_name) { + +
start=">
+ + + $column_display_name) { ?> + + + + + + + + + $column_display_name) : + switch($column_name) { + case 'id': ?> + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - -
+ + start="> + +
' name='allusers[]' value='' /> ' name='allusers[]' value='' /> - g:i:s a'), $user['user_registered']); ?> + $val ) { + echo '' . str_replace( '.' . $current_site->domain, '', $val->domain . $val->path ) . ' (userblog_id, 'spam' ) == 1 ) + echo 'style="background-color: #f66" '; + echo 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . ')
'; + } + } + ?> +
userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $val->path ) . ' (userblog_id, 'spam' ) == 1 ) - print 'style="background-color: #f66" '; - print 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . ')
'; - } ?>
&id=&redirect=" class="delete" onclick="return deleteSomething( 'user', , '' );">" . __('Edit') . ""; ?>" . __('Delete') . ""; ?>
-

-

-
    - -
  • -
  • -
  • -
- -

'>

-
- - + default: ?> + + + + + + + + + + + +

+ +

+
    +
  • +
  • +
  • +
+ +

+ + + ' />

+
-
+
-

- - - - -
- - +
+

+ + + + + + + + + + +
+

+ +

+
- + + \ No newline at end of file -- cgit