From cb6323b69dbd6e62362f12fb7f474f1707bf3f09 Mon Sep 17 00:00:00 2001 From: donncha Date: Thu, 15 May 2008 16:35:59 +0000 Subject: Whitespace cleanup. Clean up parameter filtering git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1289 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/wpmu-admin.php | 14 +++--- wp-admin/wpmu-blogs.php | 104 ++++++++++++++++++++++------------------- wp-admin/wpmu-edit.php | 74 ++++++++++++++--------------- wp-admin/wpmu-options.php | 34 +++++++------- wp-admin/wpmu-themes.php | 6 +-- wp-admin/wpmu-upgrade-site.php | 4 +- wp-admin/wpmu-users.php | 39 ++++++++-------- 7 files changed, 143 insertions(+), 132 deletions(-) diff --git a/wp-admin/wpmu-admin.php b/wp-admin/wpmu-admin.php index 61da08d..111ff49 100644 --- a/wp-admin/wpmu-admin.php +++ b/wp-admin/wpmu-admin.php @@ -27,19 +27,19 @@ $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );

- +

- +

- -

+ +

- +

@@ -47,7 +47,7 @@ $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); " />

- +

@@ -55,7 +55,7 @@ $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); " />

- +
diff --git a/wp-admin/wpmu-blogs.php b/wp-admin/wpmu-blogs.php index 48a84e4..4a22634 100644 --- a/wp-admin/wpmu-blogs.php +++ b/wp-admin/wpmu-blogs.php @@ -73,7 +73,7 @@ switch( $_GET['action'] ) { $editblog_roles = get_blog_option( $id, "{$wpdb->base_prefix}{$id}_user_roles" ); ?>
-

- '>

+

- '>

@@ -136,7 +136,7 @@ switch( $_GET['action'] ) { - +

$theme ) { $theme_key = wp_specialchars( $theme['Stylesheet'] ); if( isset($allowed_themes[$theme_key] ) == false ) { - $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; - $out .= ' + $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; + $out .= ''; } } - - + + if( $out != '' ) { echo "

" . __('Blog Themes') . "

"; - echo '
'.$key.'
'; + echo '
'; echo ''; echo $out; echo "
' . __('Theme') . '' . __('Enable') . '
"; } - + // Blog users $blogusers = get_users_of_blog( $id ); echo '

' . __('Blog Users') . '

'; @@ -244,7 +244,7 @@ switch( $_GET['action'] ) { } echo ""; } - + // New blog user echo "

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

"; ?>

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

@@ -269,14 +269,14 @@ switch( $_GET['action'] ) { - +

- +

-

+

@@ -284,16 +284,16 @@ switch( $_GET['action'] ) {
blogs} WHERE site_id = '{$wpdb->siteid}' "; - + if( isset($_GET['blog_name']) ) { - $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}' @@ -309,13 +309,13 @@ switch( $_GET['action'] ) { 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['s']."%')"; + AND {$wpdb->registration_log}.IP LIKE ('%{$s}%')"; } - + if( isset( $_GET['sortby'] ) == false ) { $_GET['sortby'] = 'id'; } - + if( $_GET['sortby'] == 'registered' ) { $query .= ' ORDER BY registered '; } elseif( $_GET['sortby'] == 'id' ) { @@ -327,20 +327,25 @@ switch( $_GET['action'] ) { } $query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC'; - + if( !empty($_GET['s']) ) { - $blog_list = $wpdb->get_results( $query, ARRAY_A ); - $total = count($blog_list); + $blog_list = $wpdb->get_results( $query, ARRAY_A ); + $total = count($blog_list); } else { - $total = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "); + $total = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "); } - + $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num ); - - $blog_list = $wpdb->get_results( $query, ARRAY_A ); + + $blog_list = $wpdb->get_results( $query, ARRAY_A ); // Pagination - $url2 = "&order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=" . $_GET['s'] . "&ip_address=" . $_GET['ip_address']; + $url2 = "&order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s="; + if( $_GET[ 'blog_ip' ] ) { + $url2 .= "&ip_address=" . urlencode( $s ); + } else { + $url2 .= $s . "&ip_address=" . urlencode( $s ); + } $blog_navigation = paginate_links( array( 'base' => add_query_arg( 'apage', '%#%' ).$url2, 'format' => '', @@ -351,19 +356,19 @@ switch( $_GET['action'] ) {

- + - - + + - - + + - +
- +
- $blog_navigation
"; ?> + $blog_navigation
"; ?>
@@ -375,10 +380,10 @@ switch( $_GET['action'] ) {

- + -

- +

+ 'display name' @@ -401,9 +406,14 @@ switch( $_GET['action'] ) { $posts_columns['control_spam'] = ''; $posts_columns['control_delete'] = ''; - $sortby_url = "s=" . $_GET['s'] . "&ip_address=" . $_GET['ip_address']; + $sortby_url = "s="; + if( $_GET[ 'blog_ip' ] ) { + $sortby_url .= "&ip_address=" . urlencode( $s ); + } else { + $sortby_url .= urlencode( $s ) . "&ip_address=" . urlencode( $s ); + } ?> - + @@ -414,7 +424,7 @@ switch( $_GET['action'] ) { $column_link .= $_GET[ 'order' ] == 'DESC' ? 'order=ASC&' : 'order=DESC&'; } $column_link .= "apage={$apage}'>{$column_display_name}"; - + $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link; ?> @@ -429,7 +439,7 @@ switch( $_GET['action'] ) { 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 ) { @@ -437,7 +447,7 @@ switch( $_GET['action'] ) { } } 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) { @@ -570,15 +580,15 @@ switch( $_GET['action'] ) {
- +
- +

- + - + diff --git a/wp-admin/wpmu-edit.php b/wp-admin/wpmu-edit.php index 26293d1..173286f 100644 --- a/wp-admin/wpmu-edit.php +++ b/wp-admin/wpmu-edit.php @@ -24,18 +24,18 @@ switch( $_GET['action'] ) { wp_die( __("You probably need to go back to the options page") ); 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'] ); + $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", $_POST['registration'] ); update_site_option( "registrationnotification", $_POST['registrationnotification'] ); @@ -49,7 +49,7 @@ switch( $_GET['action'] ) { } else { update_site_option( "limited_email_domains", '' ); } - + if( $_POST['banned_email_domains'] != '' ) { $banned_email_domains = split( "\n", stripslashes( $_POST[ 'banned_email_domains' ] ) ); foreach( (array) $banned_email_domains as $domain ) { @@ -59,7 +59,7 @@ switch( $_GET['action'] ) { } 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'] ); @@ -67,7 +67,7 @@ switch( $_GET['action'] ) { 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}'" ); @@ -88,7 +88,7 @@ switch( $_GET['action'] ) { wp_redirect( add_query_arg( "updated", "true", $_SERVER['HTTP_REFERER'] ) ); exit(); break; - + // Blogs case "addblog": check_admin_referer('add-blog'); @@ -97,12 +97,12 @@ switch( $_GET['action'] ) { $domain = strtolower( wp_specialchars( $blog['domain'] ) ); $email = wp_specialchars( $blog['email'] ); $title = stripslashes( wp_specialchars( $blog['title'] ) ); - + if ( empty($domain) || empty($email)) wp_die( __('Missing blog address or email address.') ); if( !is_email( $email ) ) wp_die( __('Invalid email address') ); - + if( constant('VHOST') == 'yes' ) { $newdomain = $domain.".".$current_site->domain; $path = $base; @@ -136,7 +136,7 @@ switch( $_GET['action'] ) { wp_die( $blog_id->get_error_message() ); } break; - + case "updateblog": check_admin_referer('editblog'); if( empty( $_POST ) ) @@ -148,7 +148,7 @@ switch( $_GET['action'] ) { } else { $_POST['option']['allowedthemes'] = ''; } - + if( is_array( $_POST['option'] ) ) { $c = 1; $count = count( $_POST['option'] ); @@ -164,10 +164,10 @@ switch( $_GET['action'] ) { if( get_blog_option( $id, 'siteurl' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ) update_blog_option( $id, 'siteurl', 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ); - + if( get_blog_option( $id, 'home' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ) update_blog_option( $id, 'home', 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ); - + // update blogs table $result = $wpdb->query("UPDATE {$wpdb->blogs} SET domain = '".$_POST['blog']['domain']."', @@ -179,9 +179,9 @@ switch( $_GET['action'] ) { 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']; @@ -242,16 +242,16 @@ switch( $_GET['action'] ) { } 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( array('updated' => 'true', 'action' => 'delete'), $_POST[ 'ref' ] ) ); exit(); break; - + case "allblogs": check_admin_referer('allblogs'); foreach ( (array) $_POST['allblogs'] as $key => $val ) { @@ -274,7 +274,7 @@ switch( $_GET['action'] ) { wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $blogfunction), $_SERVER['HTTP_REFERER'] ) ); exit(); break; - + case "archiveblog": check_admin_referer('archiveblog'); update_blog_status( $id, "archived", '1' ); @@ -282,7 +282,7 @@ switch( $_GET['action'] ) { 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 ); @@ -290,7 +290,7 @@ switch( $_GET['action'] ) { 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' ); @@ -298,7 +298,7 @@ switch( $_GET['action'] ) { 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 ); @@ -306,7 +306,7 @@ switch( $_GET['action'] ) { 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' ); @@ -314,7 +314,7 @@ switch( $_GET['action'] ) { 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' ); @@ -322,22 +322,22 @@ switch( $_GET['action'] ) { 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( 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( array('updated' => 'true', 'action' => 'umature'), $_POST['ref'] ) ); exit(); break; - + // Themes case "updatethemes": if( is_array( $_POST['theme'] ) ) { @@ -352,7 +352,7 @@ switch( $_GET['action'] ) { wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'themes'), $_SERVER['HTTP_REFERER'] ) ); exit(); break; - + // Common case "confirm": global $wp_locale; @@ -379,15 +379,15 @@ switch( $_GET['action'] ) { ' /> -

+


-

+

'true', 'action' => 'delete'), $_POST['ref'] ) ); exit(); break; - + case "allusers": check_admin_referer('allusers'); foreach ( (array) $_POST['allusers'] as $key => $val ) { @@ -424,11 +424,11 @@ switch( $_GET['action'] ) { update_user_status( $val, "spam", '0', 1 ); } } - } + } wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $userfunction), $_SERVER['HTTP_REFERER'] ) ); exit(); break; - + case "adduser": check_admin_referer('add-user'); @@ -454,10 +454,10 @@ switch( $_GET['action'] ) { 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; } ?> diff --git a/wp-admin/wpmu-options.php b/wp-admin/wpmu-options.php index ae35e90..6466071 100644 --- a/wp-admin/wpmu-options.php +++ b/wp-admin/wpmu-options.php @@ -20,7 +20,7 @@ if (isset($_GET['updated'])) {

- +

(These settings cannot be modified by blog owners)') ?>

@@ -592,7 +602,7 @@ switch( $_GET['action'] ) {
@@ -31,7 +31,7 @@ if (isset($_GET['updated'])) { - + - + - + - + - + - + - + - + - + - + - +
@@ -40,7 +40,7 @@ if (isset($_GET['updated'])) { domain ); ?>
@@ -77,7 +77,7 @@ if (isset($_GET['updated'])) {
@@ -86,7 +86,7 @@ if (isset($_GET['updated'])) {
@@ -95,7 +95,7 @@ if (isset($_GET['updated'])) {
@@ -106,7 +106,7 @@ if (isset($_GET['updated'])) {
@@ -115,24 +115,24 @@ if (isset($_GET['updated'])) {
MB
KB
- -

+ +

@@ -143,7 +143,7 @@ if (isset($_GET['updated'])) {
- +

(These settings may be overridden by blog owners)') ?>

- +

(Enable or disable WP Backend Menus)') ?>

@@ -184,7 +184,7 @@ if (isset($_GET['updated'])) {
- +

diff --git a/wp-admin/wpmu-themes.php b/wp-admin/wpmu-themes.php index 4b49f1c..8bbd41a 100644 --- a/wp-admin/wpmu-themes.php +++ b/wp-admin/wpmu-themes.php @@ -21,7 +21,7 @@ $allowed_themes = get_site_allowed_themes();

-

+

@@ -37,7 +37,7 @@ $allowed_themes = get_site_allowed_themes(); $theme_key = wp_specialchars($theme['Stylesheet']); $class = ('alt' == $class) ? '' : 'alt'; $class1 = $enabled = $disabled = ''; - + if( isset( $allowed_themes[ $theme_key ] ) == true ) { $enabled = 'checked="checked" '; $class1 = ' active'; @@ -58,7 +58,7 @@ $allowed_themes = get_site_allowed_themes();
- +

' />

diff --git a/wp-admin/wpmu-upgrade-site.php b/wp-admin/wpmu-upgrade-site.php index ac4f0c1..96d27b9 100644 --- a/wp-admin/wpmu-upgrade-site.php +++ b/wp-admin/wpmu-upgrade-site.php @@ -19,7 +19,7 @@ echo '

'.__('Upgrade Site').'

'; switch( $_GET['action'] ) { case "upgrade": $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 ) ) { echo "
    "; @@ -57,7 +57,7 @@ switch( $_GET['action'] ) { echo '

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

    '; } break; - + default: ?>

    diff --git a/wp-admin/wpmu-users.php b/wp-admin/wpmu-users.php index 1305e09..47238b9 100644 --- a/wp-admin/wpmu-users.php +++ b/wp-admin/wpmu-users.php @@ -40,18 +40,19 @@ if ( $_GET['updated'] == 'true' ) { users}"; - - if( !empty($_GET['s']) ) { - $search = '%' . trim(addslashes($_GET['s'])) . '%'; + + if( !empty( $s ) ) { + $search = '%' . trim( $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' ) { @@ -63,18 +64,18 @@ if ( $_GET['updated'] == 'true' ) { } elseif( $_GET['sortby'] == 'registered' ) { $query .= ' ORDER BY user_registered '; } - + $query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC'; - if( !empty($_GET['s'])) { + if( !empty( $s )) { $user_list = $wpdb->get_results( $query, ARRAY_A ); - $total = count($user_list); + $total = count($user_list); } else { $total = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->users}"); } - + $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num ); - + $user_list = $wpdb->get_results( $query, ARRAY_A ); // Pagination @@ -87,13 +88,13 @@ if ( $_GET['updated'] == 'true' ) { ?>

    - +
    - $user_navigation
    "; ?> + $user_navigation
"; ?>
@@ -105,9 +106,9 @@ if ( $_GET['updated'] == 'true' ) {

- + -

+

- + $column_display_name) : @@ -152,8 +153,8 @@ if ( $_GET['updated'] == 'true' ) { ' name='allusers[]' value='' /> + + case 'id': ?> - + - + -- cgit