Changeset 13918
- Timestamp:
- 04/01/2010 09:21:27 PM (14 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/ms.dev.css
r13660 r13918 1 /* Blog Switcher */2 3 #all-my-blogs-tab a.current {4 position: relative;5 padding-bottom: 10px;6 }7 8 #all-my-blogs {9 position: absolute;10 top: 30px;11 left: 0;12 right: 0;13 _width: 100%; /* IE6 Hack */14 margin: 4px 7px;15 padding: 6px 10px;16 font-size: 12px;17 }18 19 #all-my-blogs * {20 margin: 0;21 }22 23 form#all-my-blogs p, form#all-my-blogs p * {24 vertical-align: middle;25 }26 27 #all-my-blogs a {28 font-size: 10px;29 text-decoration: underline;30 margin: 0 14px;31 }32 33 #all-my-blogs a:hover, #all-my-blogs a:active {34 text-decoration: none;35 }36 37 form#wpmu-search {38 position:absolute;39 right:0;40 top:0;41 }42 43 1 /* Site Admin Menu */ 44 2 #adminmenu .menu-icon-site div.wp-menu-image { … … 50 8 } 51 9 52 /* Dashboard: M USpecific Data */10 /* Dashboard: MS Specific Data */ 53 11 #dashboard_right_now p.musub { 54 12 margin-top: 12px; … … 60 18 font-size: 16px; 61 19 } 20 21 #dashboard_right_now div.musubtable { 22 border-top: none; 23 } 24 25 /* No drag and drop on ms-sites.php */ 26 .ms-sites-php .postbox h3 { 27 cursor: auto; 28 } 29 30 .ms-sites-php .postbox .description { 31 margin:10px 0 0px; 32 padding:0px 10px 10px; 33 border-bottom:1px solid #DFDFDF; 34 } 35 36 /* Background Color for Site Status */ 62 37 tr.site-deleted { 63 background: #f55;38 background: #ff8573; 64 39 } 65 40 tr.site-spammed { 66 background: #faa;41 background: #faa; 67 42 } 68 43 tr.site-archived { 69 background:#f ee;44 background:#ffebe8; 70 45 } 46 tr.site-mature { 47 background: #fecac2; 48 } -
trunk/wp-admin/includes/ms.php
r13896 r13918 28 28 $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s Kb in size.'), get_site_option( 'fileupload_maxk', 1500 ) ); 29 29 if ( upload_is_user_over_quota( false ) ) { 30 $file['error'] = __( 'You have used your space quota. Please delete files before uploading.');30 $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); 31 31 } 32 32 if ( $file['error'] != '0' ) … … 46 46 * @return void 47 47 */ 48 function wpmu_delete_blog( $blog_id, $drop = false) {48 function wpmu_delete_blog( $blog_id, $drop = false ) { 49 49 global $wpdb; 50 50 51 $switch ed= false;51 $switch = false; 52 52 if ( $blog_id != $wpdb->blogid ) { 53 53 $switch = true; 54 switch_to_blog($blog_id); 55 } 56 57 do_action('delete_blog', $blog_id, $drop); 58 59 $users = get_users_of_blog($blog_id); 54 switch_to_blog( $blog_id ); 55 } 56 57 $blog_prefix = $wpdb->get_blog_prefix( $blog_id ); 58 59 do_action( 'delete_blog', $blog_id, $drop ); 60 61 $users = get_users_of_blog( $blog_id ); 60 62 61 63 // Remove users from this blog. 62 if ( ! empty($users) ) {63 foreach ( $users as $user) {64 remove_user_from_blog( $user->user_id, $blog_id);64 if ( ! empty( $users ) ) { 65 foreach ( $users as $user ) { 66 remove_user_from_blog( $user->user_id, $blog_id) ; 65 67 } 66 68 } … … 69 71 70 72 if ( $drop ) { 71 $drop_tables = $wpdb->get_results( "show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);73 $drop_tables = $wpdb->get_results( "SHOW TABLES LIKE '{$blog_prefix}%'", ARRAY_A ); 72 74 $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables ); 73 75 … … 76 78 $wpdb->query( "DROP TABLE IF EXISTS ". current( $drop_table ) ."" ); 77 79 } 78 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id) );80 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) ); 79 81 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id ); 80 $dir = rtrim( $dir, DIRECTORY_SEPARATOR);82 $dir = rtrim( $dir, DIRECTORY_SEPARATOR ); 81 83 $top_dir = $dir; 82 84 $stack = array($dir); 83 85 $index = 0; 84 86 85 while ( $index < count( $stack) ) {87 while ( $index < count( $stack ) ) { 86 88 # Get indexed directory from stack 87 89 $dir = $stack[$index]; 88 90 89 $dh = @ opendir($dir);91 $dh = @opendir( $dir ); 90 92 if ( $dh ) { 91 while ( ( $file = @ readdir($dh)) !== false ) {92 if ( $file == '.' or $file == '..')93 while ( ( $file = @readdir( $dh ) ) !== false ) { 94 if ( $file == '.' || $file == '..' ) 93 95 continue; 94 96 95 if ( @ is_dir($dir . DIRECTORY_SEPARATOR . $file))97 if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) 96 98 $stack[] = $dir . DIRECTORY_SEPARATOR . $file; 97 else if ( @ is_file($dir . DIRECTORY_SEPARATOR . $file))98 @ unlink($dir . DIRECTORY_SEPARATOR . $file);99 else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) 100 @unlink( $dir . DIRECTORY_SEPARATOR . $file ); 99 101 } 100 102 } … … 102 104 } 103 105 104 $stack = array_reverse( $stack); // Last added dirs are deepest106 $stack = array_reverse( $stack ); // Last added dirs are deepest 105 107 foreach( (array) $stack as $dir ) { 106 108 if ( $dir != $top_dir) 107 @rmdir($dir); 108 } 109 } 110 $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s", 'wp_{$blog_id}_autosave_draft_ids') ); 111 $blogs = get_site_option( "blog_list" ); 109 @rmdir( $dir ); 110 } 111 } 112 113 $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '{$blog_prefix}autosave_draft_ids'" ); 114 $blogs = get_site_option( 'blog_list' ); 112 115 if ( is_array( $blogs ) ) { 113 116 foreach ( $blogs as $n => $blog ) { 114 if ( $blog[ 'blog_id'] == $blog_id )115 unset( $blogs[ $n] );117 if ( $blog['blog_id'] == $blog_id ) 118 unset( $blogs[$n] ); 116 119 } 117 120 update_site_option( 'blog_list', $blogs ); … … 123 126 124 127 // @todo Merge with wp_delete_user() ? 125 function wpmu_delete_user( $id) {128 function wpmu_delete_user( $id ) { 126 129 global $wpdb; 127 130 128 131 $id = (int) $id; 129 132 130 do_action( 'wpmu_delete_user', $id);131 132 $blogs = get_blogs_of_user( $id);133 134 if ( ! empty( $blogs) ) {135 foreach ( $blogs as $blog) {136 switch_to_blog( $blog->userblog_id);137 remove_user_from_blog( $id, $blog->userblog_id);138 139 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );133 do_action( 'wpmu_delete_user', $id ); 134 135 $blogs = get_blogs_of_user( $id ); 136 137 if ( ! empty( $blogs ) ) { 138 foreach ( $blogs as $blog ) { 139 switch_to_blog( $blog->userblog_id ); 140 remove_user_from_blog( $id, $blog->userblog_id ); 141 142 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); 140 143 foreach ( (array) $post_ids as $post_id ) { 141 wp_delete_post( $post_id);144 wp_delete_post( $post_id ); 142 145 } 143 146 144 147 // Clean links 145 $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) );148 $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) ); 146 149 147 150 if ( $link_ids ) { 148 151 foreach ( $link_ids as $link_id ) 149 wp_delete_link( $link_id);152 wp_delete_link( $link_id ); 150 153 } 151 154 … … 154 157 } 155 158 156 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id) );157 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );158 159 clean_user_cache( $id);159 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id ) ); 160 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); 161 162 clean_user_cache( $id ); 160 163 161 164 // allow for commit transaction 162 do_action( 'deleted_user', $id);165 do_action( 'deleted_user', $id ); 163 166 164 167 return true; … … 170 173 return false; 171 174 172 screen_icon( 'tools');175 screen_icon(); 173 176 ?> 174 <h2><?php esc_html_e( 'Users'); ?></h2>175 <p><?php _e( 'Transfer posts before deleting users:' ); ?></p>176 <form action="ms-edit.php?action= allusers" method="post">177 <input type="hidden" name=" alluser_transfer_delete" />177 <h2><?php esc_html_e( 'Users' ); ?></h2> 178 <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p> 179 <form action="ms-edit.php?action=dodelete" method="post"> 180 <input type="hidden" name="dodelete" /> 178 181 <?php 179 wp_nonce_field( ' allusers' );182 wp_nonce_field( 'ms-users-delete' ); 180 183 $site_admins = get_site_option( 'site_admins', array( 'admin' ) ); 181 184 $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>"; … … 192 195 193 196 if ( !empty( $blogs ) ) { 194 echo '<p><strong>' . sprintf( __( 'Sites from %s:' ), $delete_user->user_login ) . '</strong></p>'; 197 ?> 198 <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p> 199 <?php 195 200 foreach ( (array) $blogs as $key => $details ) { 196 201 $blog_users = get_users_of_blog( $details->userblog_id ); 197 202 if ( is_array( $blog_users ) && !empty( $blog_users ) ) { 198 echo "<p><a href='http://{$details->domain}{$details->path}'>{$details->blogname}</a>";199 echo"<select name='blog[$val][{$key}]'>";200 $ out = '';203 $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>"; 204 $user_dropdown = "<select name='blog[$val][{$key}]'>"; 205 $user_list = ''; 201 206 foreach ( $blog_users as $user ) { 202 207 if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) ) 203 $ out .= "<option value='{$user->user_id}'>{$user->user_login}</option>";208 $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>"; 204 209 } 205 if ( $out == '' ) 206 $out = $admin_out; 207 echo $out; 208 echo "</select>\n"; 210 if ( '' == $user_list ) 211 $user_list = $admin_out; 212 $user_dropdown .= $user_list; 213 $user_dropdown .= "</select>\n"; 214 ?> 215 <ul style="list-style:none;"> 216 <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li> 217 <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" /> 218 <?php _e( 'Delete all posts and links.' ); ?></label></li> 219 <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" /> 220 <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li> 221 </ul> 222 <?php 209 223 } 210 224 } 225 echo "</fieldset>"; 211 226 } 212 227 } 213 228 } 214 229 ?> 215 <br class="clear" /> 216 <input type="submit" class="button-secondary delete" value="<?php _e( 'Delete user and transfer posts' ); ?> " /> 230 <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p> 217 231 </form> 218 232 <?php … … 226 240 switch_to_blog( $blog_id ); 227 241 228 $blog_allowed_themes = get_option( "allowedthemes");242 $blog_allowed_themes = get_option( 'allowedthemes' ); 229 243 if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes 230 $blog_allowed_themes = get_option( "allowed_themes");244 $blog_allowed_themes = get_option( 'allowed_themes' ); 231 245 232 246 if ( is_array( $blog_allowed_themes ) ) { 233 247 foreach( (array) $themes as $key => $theme ) { 234 $theme_key = esc_html( $theme[ 'Stylesheet'] );235 if ( isset( $blog_allowed_themes[ $key] ) == true ) {236 $blog_allowedthemes[ $theme_key] = 1;248 $theme_key = esc_html( $theme['Stylesheet'] ); 249 if ( isset( $blog_allowed_themes[$key] ) == true ) { 250 $blog_allowedthemes[$theme_key] = 1; 237 251 } 238 252 } 239 253 $blog_allowed_themes = $blog_allowedthemes; 240 add_option( "allowedthemes", $blog_allowed_themes );241 delete_option( "allowed_themes");254 add_option( 'allowedthemes', $blog_allowed_themes ); 255 delete_option( 'allowed_themes' ); 242 256 } 243 257 } … … 249 263 } 250 264 251 function update_option_new_admin_email( $old_value, $value) {265 function update_option_new_admin_email( $old_value, $value ) { 252 266 if ( $value == get_option( 'admin_email' ) || !is_email( $value ) ) 253 267 return; … … 255 269 $hash = md5( $value. time() .mt_rand() ); 256 270 $new_admin_email = array( 257 "hash"=> $hash,258 "newemail"=> $value271 'hash' => $hash, 272 'newemail' => $value 259 273 ); 260 274 update_option( 'adminhash', $new_admin_email ); 261 275 262 $content = apply_filters( 'new_admin_email_content', __( "Dear user,276 $content = apply_filters( 'new_admin_email_content', __( "Dear user, 263 277 264 278 You recently requested to have the administration email address on … … 274 288 Regards, 275 289 All at ###SITENAME### 276 ###SITEURL### "), $new_admin_email );277 278 $content = str_replace( '###ADMIN_URL###', esc_url(admin_url('options.php?adminhash='.$hash)), $content);279 $content = str_replace( '###EMAIL###', $value, $content);280 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content);281 $content = str_replace( '###SITEURL###', network_home_url(), $content);282 283 wp_mail( $value, sprintf( __('[%s] New Admin Email Address'), get_option('blogname')), $content );284 } 285 add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2);290 ###SITEURL### "), $new_admin_email ); 291 292 $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content ); 293 $content = str_replace( '###EMAIL###', $value, $content ); 294 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); 295 $content = str_replace( '###SITEURL###', network_home_url(), $content ); 296 297 wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), get_option( 'blogname' ) ), $content ); 298 } 299 add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 ); 286 300 287 301 function send_confirmation_on_profile_email() { … … 290 304 $errors = new WP_Error(); 291 305 292 if ( $current_user->id != $_POST[ 'user_id'] )306 if ( $current_user->id != $_POST['user_id'] ) 293 307 return false; 294 308 295 if ( $current_user->user_email != $_POST[ 'email'] ) {296 if ( !is_email( $_POST[ 'email'] ) ) {309 if ( $current_user->user_email != $_POST['email'] ) { 310 if ( !is_email( $_POST['email'] ) ) { 297 311 $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) ); 298 312 return; 299 313 } 300 314 301 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST[ 'email'] ) ) ) {315 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) { 302 316 $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address is already used." ), array( 'form-field' => 'email' ) ); 303 317 delete_option( $current_user->ID . '_new_email' ); … … 305 319 } 306 320 307 $hash = md5( $_POST[ 'email'] . time() . mt_rand() );321 $hash = md5( $_POST['email'] . time() . mt_rand() ); 308 322 $new_user_email = array( 309 "hash"=> $hash,310 "newemail" => $_POST[ 'email']323 'hash' => $hash, 324 'newemail' => $_POST['email'] 311 325 ); 312 326 update_option( $current_user->ID . '_new_email', $new_user_email ); 313 327 314 $content = apply_filters( 'new_user_email_content', __( "Dear user,328 $content = apply_filters( 'new_user_email_content', __( "Dear user, 315 329 316 330 You recently requested to have the email address on your account changed. … … 325 339 Regards, 326 340 All at ###SITENAME### 327 ###SITEURL###" ), $new_user_email );328 329 $content = str_replace( '###ADMIN_URL###', esc_url(admin_url('profile.php?newuseremail='.$hash)), $content);330 $content = str_replace( '###EMAIL###', $_POST[ 'email'], $content);331 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content);332 $content = str_replace( '###SITEURL###', network_home_url(), $content);333 334 wp_mail( $_POST[ 'email' ], sprintf(__('[%s] New Email Address'), get_option('blogname')), $content );335 $_POST[ 'email'] = $current_user->user_email;341 ###SITEURL###" ), $new_user_email ); 342 343 $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content ); 344 $content = str_replace( '###EMAIL###', $_POST['email'], $content); 345 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); 346 $content = str_replace( '###SITEURL###', network_home_url(), $content ); 347 348 wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), get_option( 'blogname' ) ), $content ); 349 $_POST['email'] = $current_user->user_email; 336 350 } 337 351 } … … 340 354 function new_user_email_admin_notice() { 341 355 global $current_user; 342 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET[ 'updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) )343 echo "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email[ 'newemail'] ) . "</div>";356 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) ) 357 echo "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>"; 344 358 } 345 359 add_action( 'admin_notices', 'new_user_email_admin_notice' ); … … 349 363 $allowed_themes = get_site_option( 'allowedthemes' ); 350 364 if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) { 351 $allowed_themes = get_site_option( "allowed_themes"); // convert old allowed_themes format365 $allowed_themes = get_site_option( 'allowed_themes' ); // convert old allowed_themes format 352 366 if ( !is_array( $allowed_themes ) ) { 353 367 $allowed_themes = array(); 354 368 } else { 355 369 foreach( (array) $themes as $key => $theme ) { 356 $theme_key = esc_html( $theme[ 'Stylesheet'] );370 $theme_key = esc_html( $theme['Stylesheet'] ); 357 371 if ( isset( $allowed_themes[ $key ] ) == true ) { 358 372 $allowedthemes[ $theme_key ] = 1; … … 377 391 378 392 $dir_name = trailingslashit( BLOGUPLOADDIR ); 379 if ( !( is_dir($dir_name) && is_readable($dir_name)) )393 if ( !( is_dir( $dir_name) && is_readable( $dir_name ) ) ) 380 394 return true; 381 395 382 $dir = dir( $dir_name);396 $dir = dir( $dir_name ); 383 397 $size = 0; 384 398 … … 386 400 if ( $file != '.' && $file != '..' ) { 387 401 if ( is_dir( $dir_name . $file) ) { 388 $size += get_dirsize( $dir_name . $file);402 $size += get_dirsize( $dir_name . $file ); 389 403 } else { 390 $size += filesize( $dir_name . $file);404 $size += filesize( $dir_name . $file ); 391 405 } 392 406 } … … 395 409 $size = $size / 1024 / 1024; 396 410 397 if ( ( $space_allowed - $size) <= 0 )411 if ( ( $space_allowed - $size ) <= 0 ) 398 412 return false; 399 413 … … 407 421 */ 408 422 function get_space_allowed() { 409 $space_allowed = get_option( 'blog_upload_space');423 $space_allowed = get_option( 'blog_upload_space' ); 410 424 if ( $space_allowed == false ) 411 $space_allowed = get_site_option( 'blog_upload_space');412 if ( empty( $space_allowed) || !is_numeric($space_allowed) )425 $space_allowed = get_site_option( 'blog_upload_space' ); 426 if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) ) 413 427 $space_allowed = 50; 414 428 … … 418 432 function display_space_usage() { 419 433 $space = get_space_allowed(); 420 $used = get_dirsize( BLOGUPLOADDIR ) /1024/1024;434 $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024; 421 435 422 436 if ( $used > $space ) … … 427 441 if ( $space > 1000 ) { 428 442 $space = number_format( $space / 1024 ); 429 $space .= __( 'GB');443 $space .= __( 'GB' ); 430 444 } else { 431 $space .= __( 'MB');445 $space .= __( 'MB' ); 432 446 } 433 447 ?> 434 <strong><?php printf( __('Used: %1s%% of %2s'), number_format($percentused), $space );?></strong>448 <strong><?php printf( __( 'Used: %1s%% of %2s' ), number_format( $percentused ), $space );?></strong> 435 449 <?php 436 450 } … … 442 456 443 457 $quota = get_space_allowed(); 444 $used = get_dirsize( BLOGUPLOADDIR ) /1024/1024;458 $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024; 445 459 446 460 if ( $used > $quota ) … … 448 462 else 449 463 $percentused = ( $used / $quota ) * 100; 450 $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';464 $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam'; 451 465 $used = round( $used, 2 ); 452 466 $percentused = number_format( $percentused ); 453 467 454 468 ?> 455 <p class="sub musub"><?php _e( 'Storage Space'); ?></p>456 <div class="table ">469 <p class="sub musub"><?php _e( 'Storage Space' ); ?></p> 470 <div class="table table_content musubtable"> 457 471 <table> 458 472 <tr class="first"> 459 <td class="first b b-posts"><?php printf( __( '<a href="upload.php" title="Manage Uploads" class="musublink">%sMB</a>' ), $quota ); ?></td> 460 <td class="t posts"><?php _e('Space Allowed'); ?></td> 461 <td class="b b-comments"><?php printf( __( '<a href="upload.php" title="Manage Uploads" class="musublink">%1sMB (%2$s%%)</a>' ), $used, $percentused ); ?></td> 462 <td class="last t comments <?php echo $used_color;?>"><?php _e('Space Used');?></td> 473 <td class="first b b-posts"><?php printf( __( '<a href="' . esc_url( admin_url( 'upload.php' ) ) . '" title="Manage Uploads" class="musublink">%sMB</a>' ), $quota ); ?></td> 474 <td class="t posts"><?php _e( 'Space Allowed' ); ?></td> 463 475 </tr> 464 476 </table> 465 477 </div> 478 <div class="table table_discussion musubtable"> 479 <table> 480 <tr class="first"> 481 <td class="b b-comments"><?php printf( __( '<a href="' . esc_url( admin_url( 'upload.php' ) ) . '" title="Manage Uploads" class="musublink">%1sMB (%2$s%%)</a>' ), $used, $percentused ); ?></td> 482 <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td> 483 </tr> 484 </table> 485 </div> 486 <br class="clear" /> 466 487 <?php 467 488 } 468 if ( current_user_can( 'edit_posts') )469 add_action( 'activity_box_end', 'dashboard_quota');489 if ( current_user_can( 'edit_posts' ) ) 490 add_action( 'activity_box_end', 'dashboard_quota' ); 470 491 471 492 // Edit blog upload space setting on Edit Blog page 472 493 function upload_space_setting( $id ) { 473 $quota = get_blog_option( $id, "blog_upload_space");494 $quota = get_blog_option( $id, 'blog_upload_space' ); 474 495 if ( !$quota ) 475 496 $quota = ''; … … 477 498 ?> 478 499 <tr> 479 <th><?php _e( 'Site Upload Space Quota'); ?></th>480 <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e('MB (Leave blank for network default)'); ?></td>500 <th><?php _e( 'Site Upload Space Quota '); ?></th> 501 <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e( 'MB (Leave blank for network default)' ); ?></td> 481 502 </tr> 482 503 <?php 483 504 } 484 add_action( 'wpmueditblogaction', 'upload_space_setting');505 add_action( 'wpmueditblogaction', 'upload_space_setting' ); 485 506 486 507 function update_user_status( $id, $pref, $value, $refresh = 1 ) { … … 490 511 491 512 if ( $refresh == 1 ) 492 refresh_user_details( $id);513 refresh_user_details( $id ); 493 514 494 515 if ( $pref == 'spam' ) { 495 516 if ( $value == 1 ) 496 do_action( "make_spam_user", $id );517 do_action( 'make_spam_user', $id ); 497 518 else 498 do_action( "make_ham_user", $id );519 do_action( 'make_ham_user', $id ); 499 520 } 500 521 … … 502 523 } 503 524 504 function refresh_user_details( $id) {525 function refresh_user_details( $id ) { 505 526 $id = (int) $id; 506 527 … … 508 529 return false; 509 530 510 clean_user_cache( $id);531 clean_user_cache( $id ); 511 532 512 533 return $id; … … 514 535 515 536 function format_code_lang( $code = '' ) { 516 $code = strtolower(substr($code, 0, 2)); 517 $lang_codes = array('aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic', 'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue', 'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz', 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam', 'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', 'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian', 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh', 'wa' => 'Walloon' 518 , 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu'); 519 $lang_codes = apply_filters('lang_codes', $lang_codes, $code); 537 $code = strtolower( substr( $code, 0, 2 ) ); 538 $lang_codes = array( 539 'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 540 'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 541 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic', 542 'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue', 543 'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz', 544 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam', 545 'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', 546 'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian', 547 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili', 548 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 549 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' ); 550 $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); 520 551 return strtr( $code, $lang_codes ); 521 552 } … … 526 557 $term->slug = sanitize_title( $term->name ); 527 558 } else { 528 $term[ 'slug' ] = sanitize_title( $term[ 'name'] );559 $term['slug'] = sanitize_title( $term['name'] ); 529 560 } 530 561 } … … 536 567 global $current_user; 537 568 $c = 0; 538 if ( isset( $_GET[ 'c'] ) )539 $c = (int) $_GET[ 'c'];569 if ( isset( $_GET['c'] ) ) 570 $c = (int) $_GET['c']; 540 571 541 572 if ( $c >= 5 ) { … … 547 578 $dashboard_blog = get_dashboard_blog(); 548 579 if ( is_object( $blog ) ) { 549 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c) ); // redirect and count to 5, "just in case"580 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case" 550 581 exit; 551 582 } … … 565 596 } 566 597 $blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) ); 567 $protocol = ( is_ssl() ? 'https://' : 'http://' ); 568 wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case" 598 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); 569 599 exit; 570 600 } … … 590 620 if ( $code_lang == 'en_US' ) { // American English 591 621 $flag = true; 592 $ae = __( 'American English');593 $output[$ae] = '<option value="' .$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$ae.'</option>';622 $ae = __( 'American English' ); 623 $output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $ae . '</option>'; 594 624 } elseif ( $code_lang == 'en_GB' ) { // British English 595 625 $flag = true; 596 $be = __( 'British English');597 $output[$be] = '<option value="' .$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$be.'</option>';626 $be = __( 'British English' ); 627 $output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $be . '</option>'; 598 628 } else { 599 $translated = format_code_lang($code_lang); 600 $output[$translated] = '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$translated.'</option>'; 601 } 602 603 } 604 605 if ( $flag === false ) { // WordPress english 606 $output[] = '<option value=""'.((empty($current)) ? ' selected="selected"' : '').'>'.__('English')."</option>"; 607 } 629 $translated = format_code_lang( $code_lang ); 630 $output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . esc_html ( $translated ) . '</option>'; 631 } 632 633 } 634 635 if ( $flag === false ) // WordPress english 636 $output[] = '<option value=""' . selected( $current, '' ) . '>' . __( 'English' ) . "</option>"; 608 637 609 638 // Order by name 610 uksort( $output, 'strnatcasecmp');611 612 $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current);613 echo implode( "\n\t", $output);639 uksort( $output, 'strnatcasecmp' ); 640 641 $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current ); 642 echo implode( "\n\t", $output ); 614 643 } 615 644 … … 638 667 return; 639 668 640 if ( !empty( $_GET[ 'feed_dismiss'] ) )641 update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET[ 'feed_dismiss'], true );669 if ( !empty( $_GET['feed_dismiss'] ) ) 670 update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET['feed_dismiss'], true ); 642 671 643 672 $url = get_site_option( 'admin_notice_feed' ); … … 667 696 return false; 668 697 if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) 669 echo "<div id='update-nag'>" . __( 'Thank you for Updating! Please visit the <a href="ms-upgrade-network.php">Update Network</a> page to update all your sites.') . "</div>";698 echo "<div id='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Update Network</a> page to update all your sites.' ), esc_url( admin_url( 'ms-upgrade-network.php' ) ) ) . "</div>"; 670 699 } 671 700 add_action( 'admin_notices', 'site_admin_notice' ); … … 674 703 if ( is_subdomain_install() ) 675 704 return $data; 676 if ( $data[ 'post_type'] != 'page' )705 if ( $data['post_type'] != 'page' ) 677 706 return $data; 678 if ( !isset( $data[ 'post_name' ] ) || $data[ 'post_name'] == '' )707 if ( !isset( $data['post_name'] ) || $data['post_name'] == '' ) 679 708 return $data; 680 709 if ( !is_main_site() ) 681 710 return $data; 682 711 683 $post_name = $data[ 'post_name'];712 $post_name = $data['post_name']; 684 713 $c = 0; 685 714 while( $c < 10 && get_id_from_blogname( $post_name ) ) { … … 687 716 $c ++; 688 717 } 689 if ( $post_name != $data[ 'post_name'] ) {690 $data[ 'post_name'] = $post_name;718 if ( $post_name != $data['post_name'] ) { 719 $data['post_name'] = $post_name; 691 720 } 692 721 return $data; … … 700 729 <tr> 701 730 <?php /* translators: My sites label */ ?> 702 <th scope="row"><?php _e( 'Primary Site'); ?></th>731 <th scope="row"><?php _e( 'Primary Site' ); ?></th> 703 732 <td> 704 733 <?php 705 734 $all_blogs = get_blogs_of_user( $current_user->ID ); 706 $primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true);735 $primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true ); 707 736 if ( count( $all_blogs ) > 1 ) { 708 737 $found = false; … … 712 741 if ( $primary_blog == $blog->userblog_id ) 713 742 $found = true; 714 ?><option value= '<?php echo $blog->userblog_id ?>'<?php if ( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>><?php echo get_home_url($blog->userblog_id) ?></option><?php743 ?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php 715 744 } ?> 716 745 </select> … … 739 768 return; 740 769 $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); 741 if ( empty($mu_media_buttons[ 'image']) && current_theme_supports( 'post-thumbnails' ) ) {742 echo "<div id='update-nag'>" . sprintf( __( "Warning! The current theme supports post thumbnails. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), admin_url( 'ms-options.php') ) . "</div>";770 if ( empty($mu_media_buttons['image']) && current_theme_supports( 'post-thumbnails' ) ) { 771 echo "<div id='update-nag'>" . sprintf( __( "Warning! The current theme supports post thumbnails. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), esc_url( admin_url( 'ms-options.php' ) ) ) . "</div>"; 743 772 } 744 773 } … … 761 790 */ 762 791 function _admin_notice_multisite_activate_plugins_page() { 763 $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href=" ms-options.php#menu">' . __( 'Activate' ) . '</a>' );792 $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="' . esc_url( admin_url( 'ms-options.php#menu' ) ) . '">' . __( 'Activate' ) . '</a>' ); 764 793 echo "<div class='error'><p>$message</p></div>"; 765 794 } -
trunk/wp-admin/ms-delete-site.php
r13022 r13918 1 1 <?php 2 require_once( 'admin.php');2 require_once( './admin.php' ); 3 3 4 4 if ( !is_multisite() ) 5 wp_die( __( 'Multisite support is not enabled.') );5 wp_die( __( 'Multisite support is not enabled.' ) ); 6 6 7 7 // @todo Create a delete blog cap. 8 if ( ! current_user_can('manage_options') ) 9 wp_die(__('You do not have sufficient permissions to delete this blog.')); 8 if ( ! current_user_can( 'manage_options' ) ) 9 wp_die(__( 'You do not have sufficient permissions to delete this site.')); 10 11 if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { 12 if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) { 13 wpmu_delete_blog( $wpdb->blogid ); 14 wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) ); 15 } else { 16 wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); 17 } 18 } 10 19 11 $action = isset( $_POST['action']) ? $_POST['action'] : 'splash';20 $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash'; 12 21 13 $title = __( 'Delete Blog');22 $title = __( 'Delete Site' ); 14 23 $parent_file = 'tools.php'; 15 require_once( 'admin-header.php');24 require_once( './admin-header.php' ); 16 25 17 26 echo '<div class="wrap">'; 18 27 screen_icon(); 19 echo '<h2>' . esc_html($title) .'</h2>';28 echo '<h2>' . esc_html( $title ) . '</h2>'; 20 29 21 if ( isset($_POST['action']) && $_POST['action'] == "deleteblog" && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1' ) { 22 $hash = wp_generate_password(20, false); 23 update_option( "delete_blog_hash", $hash ); 24 $url_delete = admin_url('ms-delete-site.php?h=' . $hash); 25 $msg = __("Dear User, 26 You recently clicked the 'Delete Blog' link on your blog and filled in a 30 if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) { 31 $hash = wp_generate_password( 20, false ); 32 update_option( 'delete_blog_hash', $hash ); 33 34 $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); 35 36 $content = apply_filters( 'delete_site_email_content', __( "Dear User, 37 You recently clicked the 'Delete Site' link on your site and filled in a 27 38 form on that page. 28 If you really want to delete your blog, click the link below. You will not39 If you really want to delete your site, click the link below. You will not 29 40 be asked to confirm again so only click this link if you are absolutely certain: 30 URL_DELETE 41 ###URL_DELETE### 31 42 32 If you delete your blog, please consider opening a new bloghere33 some time in the future! (But remember your current blogand username43 If you delete your site, please consider opening a new site here 44 some time in the future! (But remember your current site and username 34 45 are gone forever.) 35 46 36 47 Thanks for using the site, 37 48 Webmaster 38 SITE_NAME 39 "); 40 $msg = str_replace( "URL_DELETE", $url_delete, $msg ); 41 $msg = str_replace( "SITE_NAME", $current_site->site_name, $msg ); 42 wp_mail( get_option( "admin_email" ), "[ " . get_option( "blogname" ) . " ] ".__("Delete My Blog"), $msg ); 49 ###SITE_NAME###" ) ); 50 51 $content = str_replace( '###URL_DELETE###', $url_delete, $content ); 52 $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content ); 53 54 wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Delete My Site' ), $content ); 43 55 ?> 44 <p><?php _e('Thank you. Please check your email for a link to confirm your action. Your blog will not be deleted until this link is clicked.') ?></p> 56 57 <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ') ?></p> 58 59 <?php } else { 60 ?> 61 <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p> 62 <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p> 63 64 <form method="post" name="deletedirect"> 65 <input type="hidden" name="action" value="deleteblog" /> 66 <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_site->domain . $current_site->path ); ?></strong></label></p> 67 <p class="submit"><input type="submit" value="<?php esc_attr_e( 'Delete My Site Permanently' ) ?>" /></p> 68 </form> 45 69 <?php 46 } elseif ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option('delete_blog_hash') != false ) {47 if ( get_option('delete_blog_hash') == $_GET['h'] ) {48 wpmu_delete_blog( $wpdb->blogid );49 echo "<p>" . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site->site_name) . "</p>";50 } else {51 echo "<p>" . __("I'm sorry, the link you clicked is stale. Please select another option.") . "</p>";52 }53 } else {54 ?>55 <p><?php printf(__('If you do not want to use your %s blog any more, you can delete it using the form below. When you click <strong>Delete My Blog</strong> you will be sent an email with a link in it. Click on this link to delete your blog.'), $current_site->site_name); ?></p>56 <p><?php _e('Remember, once deleted your blog cannot be restored.') ?></p>57 <form method='post' name='deletedirect'>58 <input type='hidden' name='action' value='deleteblog' />59 <p><input id='confirmdelete' type='checkbox' name='confirmdelete' value='1' /> <label for='confirmdelete'><strong><?php printf( __("I'm sure I want to permanently disable my blog, and I am aware I can never get it back or use %s again."), $current_blog->domain); ?></strong></label></p>60 <p class="submit"><input type='submit' value='<?php esc_attr_e('Delete My Blog Permanently') ?>' /></p>61 </form>62 <?php63 70 } 64 71 echo '</div>'; 65 72 66 include( 'admin-footer.php');73 include( './admin-footer.php' ); 67 74 ?> -
trunk/wp-admin/ms-edit.php
r13796 r13918 1 1 <?php 2 require_once( 'admin.php');2 require_once( './admin.php' ); 3 3 4 4 if ( !is_multisite() ) 5 wp_die( __('Multisite support is not enabled.') ); 6 7 do_action('wpmuadminedit', ''); 8 9 if ( isset($_GET[ 'id' ]) ) 10 $id = intval( $_GET[ 'id' ] ); 11 elseif ( isset($_POST[ 'id' ]) ) 12 $id = intval( $_POST[ 'id' ] ); 13 14 if ( isset( $_POST['ref'] ) == false && !empty($_SERVER['HTTP_REFERER']) ) 15 $_POST['ref'] = $_SERVER['HTTP_REFERER']; 5 wp_die( __( 'Multisite support is not enabled.' ) ); 6 7 do_action( 'wpmuadminedit' , ''); 8 9 if ( isset( $_GET['id' ]) ) 10 $id = intval( $_GET['id'] ); 11 elseif ( isset( $_POST['id'] ) ) 12 $id = intval( $_POST['id'] ); 16 13 17 14 switch ( $_GET['action'] ) { 18 case "siteoptions":19 check_admin_referer( 'siteoptions');15 case 'siteoptions': 16 check_admin_referer( 'siteoptions' ); 20 17 if ( ! current_user_can( 'manage_network_options' ) ) 21 wp_die( __( 'You do not have permission to access this page.') );18 wp_die( __( 'You do not have permission to access this page.' ) ); 22 19 23 20 if ( empty( $_POST ) ) 24 wp_die( __("You probably need to go back to the <a href='ms-options.php'>options page</a>") );25 26 if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages()) ) )27 update_site_option( "WPLANG", $_POST['WPLANG'] );21 wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">options page</a>.', esc_url( admin_url( 'ms-options.php' ) ) ) ) ); 22 23 if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) ) 24 update_site_option( 'WPLANG', $_POST['WPLANG'] ); 28 25 29 26 if ( is_email( $_POST['admin_email'] ) ) 30 update_site_option( "admin_email", $_POST['admin_email'] );27 update_site_option( 'admin_email', $_POST['admin_email'] ); 31 28 32 29 $illegal_names = split( ' ', $_POST['illegal_names'] ); … … 36 33 $names[] = trim( $name ); 37 34 } 38 update_site_option( "illegal_names", $names );35 update_site_option( 'illegal_names', $names ); 39 36 40 37 if ( $_POST['limited_email_domains'] != '' ) { 41 $limited_email_domains = str_replace( ' ', "\n", $_POST[ 'limited_email_domains'] );38 $limited_email_domains = str_replace( ' ', "\n", $_POST['limited_email_domains'] ); 42 39 $limited_email_domains = split( "\n", stripslashes( $limited_email_domains ) ); 43 40 $limited_email = array(); … … 47 44 $limited_email[] = trim( $domain ); 48 45 } 49 update_site_option( "limited_email_domains", $limited_email );50 } else { 51 update_site_option( "limited_email_domains", '' );46 update_site_option( 'limited_email_domains', $limited_email ); 47 } else { 48 update_site_option( 'limited_email_domains', '' ); 52 49 } 53 50 54 51 if ( $_POST['banned_email_domains'] != '' ) { 55 $banned_email_domains = split( "\n", stripslashes( $_POST[ 'banned_email_domains'] ) );52 $banned_email_domains = split( "\n", stripslashes( $_POST['banned_email_domains'] ) ); 56 53 $banned = array(); 57 54 foreach ( (array) $banned_email_domains as $domain ) { … … 60 57 $banned[] = trim( $domain ); 61 58 } 62 update_site_option( "banned_email_domains", $banned );63 } else { 64 update_site_option( "banned_email_domains", '' );65 } 66 update_site_option( 'default_user_role', $_POST[ 'default_user_role'] );67 if ( trim( $_POST[ 'dashboard_blog_orig'] ) == '' )68 $_POST[ 'dashboard_blog_orig'] = $current_site->blog_id;69 if ( trim( $_POST[ 'dashboard_blog'] ) == '' ) {70 $_POST[ 'dashboard_blog'] = $current_site->blog_id;59 update_site_option( 'banned_email_domains', $banned ); 60 } else { 61 update_site_option( 'banned_email_domains', '' ); 62 } 63 update_site_option( 'default_user_role', $_POST['default_user_role'] ); 64 if ( trim( $_POST['dashboard_blog_orig'] ) == '' ) 65 $_POST['dashboard_blog_orig'] = $current_site->blog_id; 66 if ( trim( $_POST['dashboard_blog'] ) == '' ) { 67 $_POST['dashboard_blog'] = $current_site->blog_id; 71 68 $dashboard_blog_id = $current_site->blog_id; 72 69 } else { 73 $dashboard_blog = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $_POST[ 'dashboard_blog'] ) ) ) );70 $dashboard_blog = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $_POST['dashboard_blog'] ) ) ) ); 74 71 $blog_details = get_blog_details( $dashboard_blog ); 75 72 if ( false === $blog_details ) { … … 84 81 } 85 82 $wpdb->hide_errors(); 86 $dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( "public"=> 0 ), $current_site->id );83 $dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( 'public' => 0 ), $current_site->id ); 87 84 $wpdb->show_errors(); 88 85 } else { … … 92 89 if ( is_wp_error( $dashboard_blog_id ) ) 93 90 wp_die( __( 'Problem creating dashboard blog: ' ) . $dashboard_blog_id->get_error_message() ); 94 if ( $_POST[ 'dashboard_blog_orig' ] != $_POST[ 'dashboard_blog'] ) {91 if ( $_POST['dashboard_blog_orig'] != $_POST['dashboard_blog'] ) { 95 92 $users = get_users_of_blog( get_site_option( 'dashboard_blog' ) ); 96 93 $move_users = array(); … … 107 104 } 108 105 } 109 update_site_option( "dashboard_blog", $dashboard_blog_id );106 update_site_option( 'dashboard_blog', $dashboard_blog_id ); 110 107 // global terms 111 if ( !global_terms_enabled() && ! empty( $_POST[ 'global_terms_enabled'] ) ) {108 if ( !global_terms_enabled() && ! empty( $_POST['global_terms_enabled'] ) ) { 112 109 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 113 110 // create global terms table … … 115 112 } 116 113 $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed', 'global_terms_enabled' ); 117 $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1 );114 $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1 ); 118 115 foreach ( $checked_options as $option_name => $option_unchecked_value ) { 119 if ( ! isset( $_POST[ $option_name ]) )120 $_POST[ $option_name] = $option_unchecked_value;116 if ( ! isset( $_POST[$option_name] ) ) 117 $_POST[$option_name] = $option_unchecked_value; 121 118 } 122 119 foreach ( $options as $option_name ) { 123 if ( ! isset($_POST[ $option_name]) )120 if ( ! isset($_POST[$option_name]) ) 124 121 continue; 125 $value = stripslashes_deep( $_POST[ $option_name] );122 $value = stripslashes_deep( $_POST[$option_name] ); 126 123 update_site_option( $option_name, $value ); 127 124 } … … 130 127 do_action( 'update_wpmu_options' ); 131 128 132 wp_redirect( add_query_arg( "updated", "true", 'ms-options.php') );133 exit(); 134 break; 135 case "addblog":136 check_admin_referer( 'add-blog');137 138 if ( ! current_user_can( 'manage_sites' ) ) 139 wp_die( __( 'You do not have permission to access this page.') );140 141 if ( is_array( $_POST[ 'blog'] ) == false )142 wp_die( "Can't create an empty site.");129 wp_redirect( add_query_arg( 'updated', 'true', admin_url( 'ms-options.php' ) ) ); 130 exit(); 131 break; 132 case 'addblog': 133 check_admin_referer( 'add-blog' ); 134 135 if ( ! current_user_can( 'manage_sites' ) ) 136 wp_die( __( 'You do not have permission to access this page.' ) ); 137 138 if ( is_array( $_POST['blog'] ) == false ) 139 wp_die( __( "Can't create an empty site." ) ); 143 140 $blog = $_POST['blog']; 144 141 $domain = ''; 145 if ( ! preg_match( '/(--)/', $blog[ 'domain' ] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog[ 'domain'] ) )146 $domain = strtolower( $blog[ 'domain'] );147 $email = sanitize_email( $blog[ 'email'] );148 $title = $blog[ 'title'];142 if ( ! preg_match( '/(--)/', $blog['domain'] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) 143 $domain = strtolower( $blog['domain'] ); 144 $email = sanitize_email( $blog['email'] ); 145 $title = $blog['title']; 149 146 150 147 if ( empty( $domain ) ) … … 153 150 wp_die( __( 'Missing email address.' ) ); 154 151 if ( !is_email( $email ) ) 155 wp_die( __( 'Invalid email address ' ) );152 wp_die( __( 'Invalid email address.' ) ); 156 153 157 154 if ( is_subdomain_install() ) { 158 $newdomain = $domain .".".$current_site->domain;155 $newdomain = $domain . '.' . $current_site->domain; 159 156 $path = $base; 160 157 } else { 161 158 $newdomain = $current_site->domain; 162 $path = $base .$domain.'/';159 $path = $base . $domain . '/'; 163 160 } 164 161 … … 169 166 $user_id = wpmu_create_user( $domain, $password, $email ); 170 167 if ( false == $user_id ) 171 wp_die( __( 'There was an error creating the user') );168 wp_die( __( 'There was an error creating the user.' ) ); 172 169 else 173 wp_new_user_notification( $user_id, $password);170 wp_new_user_notification( $user_id, $password ); 174 171 } 175 172 176 173 $wpdb->hide_errors(); 177 $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( "public" => 1 ), $current_site->id);174 $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id ); 178 175 $wpdb->show_errors(); 179 if ( !is_wp_error( $id) ) {176 if ( !is_wp_error( $id ) ) { 180 177 $dashboard_blog = get_dashboard_blog(); 181 178 if ( get_user_option( 'primary_blog', $user_id ) == $dashboard_blog->blog_id ) 182 179 update_user_option( $user_id, 'primary_blog', $id, true ); 183 $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain .$path, stripslashes( $title ) );184 wp_mail( get_site_option('admin_email'), sprintf( __('[%s] New Site Created'), $current_site->site_name), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );185 wpmu_welcome_notification( $id, $user_id, $password, $title, array( "public"=> 1 ) );186 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add-blog'), $_SERVER['HTTP_REFERER']) );180 $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) ); 181 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); 182 wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); 183 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add-blog' ), wp_get_referer() ) ); 187 184 exit(); 188 185 } else { … … 191 188 break; 192 189 193 case "updateblog":194 check_admin_referer( 'editblog');195 if ( ! current_user_can( 'manage_sites' ) ) 196 wp_die( __( 'You do not have permission to access this page.') );190 case 'updateblog': 191 check_admin_referer( 'editblog' ); 192 if ( ! current_user_can( 'manage_sites' ) ) 193 wp_die( __( 'You do not have permission to access this page.' ) ); 197 194 198 195 if ( empty( $_POST ) ) 199 wp_die( __('You probably need to go back to the <a href="ms-sites.php">sites page</a>') ); 196 wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">sites page</a>', esc_url( admin_url( 'ms-sites.php' ) ) ) ) ); 197 198 switch_to_blog( $id ); 200 199 201 200 // themes 202 if ( isset($_POST[ 'theme' ]) && is_array( $_POST[ 'theme' ] ) ) 203 $_POST[ 'option' ][ 'allowedthemes' ] = $_POST[ 'theme' ]; 204 else 205 $_POST[ 'option' ][ 'allowedthemes' ] = ''; 206 207 switch_to_blog( $id ); 208 if ( is_array( $_POST[ 'option' ] ) ) { 201 $allowedthemes = array(); 202 if ( isset($_POST['theme']) && is_array( $_POST['theme'] ) ) { 203 foreach ( $_POST['theme'] as $theme => $val ) { 204 if ( 'on' == $val ) 205 $allowedthemes[$theme] = true; 206 } 207 } 208 update_option( 'allowedthemes', $allowedthemes ); 209 210 // options 211 if ( is_array( $_POST['option'] ) ) { 209 212 $c = 1; 210 $count = count( $_POST[ 'option'] );213 $count = count( $_POST['option'] ); 211 214 foreach ( (array) $_POST['option'] as $key => $val ) { 212 215 if ( $key === 0 || is_array( $val ) ) … … 220 223 } 221 224 225 // home and siteurl 222 226 if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) { 223 $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path']);227 $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] ); 224 228 if ( get_option( 'siteurl' ) != $blog_address ) 225 update_option( 'siteurl', $blog_address );229 update_option( 'siteurl', $blog_address ); 226 230 227 231 if ( get_option( 'home' ) != $blog_address ) … … 232 236 delete_option( 'rewrite_rules' ); 233 237 234 // update blogs count235 delete_site_transient( "blog_count" );236 237 238 // update blogs table 238 $blog_data = stripslashes_deep( $_POST[ 'blog' ]);239 update_blog_details( $id, $blog_data);239 $blog_data = stripslashes_deep( $_POST['blog'] ); 240 update_blog_details( $id, $blog_data ); 240 241 241 242 // get blog prefix … … 243 244 244 245 // user roles 245 if ( isset( $_POST[ 'role' ] ) && is_array( $_POST[ 'role' ] ) == true ) { 246 $newroles = $_POST[ 'role' ]; 246 if ( isset( $_POST['role'] ) && is_array( $_POST['role'] ) == true ) { 247 $newroles = $_POST['role']; 248 247 249 reset( $newroles ); 248 250 foreach ( (array) $newroles as $userid => $role ) { 249 $user = new WP_User( $userid);251 $user = new WP_User( $userid ); 250 252 if ( ! $user ) 251 253 continue; 252 $user->for_blog( $id);253 $user->set_role( $role);254 $user->for_blog( $id ); 255 $user->set_role( $role ); 254 256 } 255 257 } 256 258 257 259 // remove user 258 if ( isset( $_POST[ 'blogusers' ] ) && is_array( $_POST[ 'blogusers'] ) ) {259 reset( $_POST[ 'blogusers'] );260 foreach ( (array) $_POST[ 'blogusers'] as $key => $val )260 if ( isset( $_POST['blogusers'] ) && is_array( $_POST['blogusers'] ) ) { 261 reset( $_POST['blogusers'] ); 262 foreach ( (array) $_POST['blogusers'] as $key => $val ) 261 263 remove_user_from_blog( $key, $id ); 262 264 } 263 265 264 266 // change password 265 if ( isset( $_POST[ 'user_password' ] ) && is_array( $_POST[ 'user_password'] ) ) {266 reset( $_POST[ 'user_password'] );267 $newroles = $_POST[ 'role'];268 foreach ( (array) $_POST[ 'user_password'] as $userid => $pass ) {269 unset( $_POST[ 'role'] );270 $_POST[ 'role'] = $newroles[ $userid ];267 if ( isset( $_POST['user_password'] ) && is_array( $_POST['user_password'] ) ) { 268 reset( $_POST['user_password'] ); 269 $newroles = $_POST['role']; 270 foreach ( (array) $_POST['user_password'] as $userid => $pass ) { 271 unset( $_POST['role'] ); 272 $_POST['role'] = $newroles[ $userid ]; 271 273 if ( $pass != '' ) { 272 274 $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" ); 273 275 $userdata = get_userdata($userid); 274 $_POST[ 'pass1' ] = $_POST[ 'pass2'] = $pass;275 $_POST[ 'email'] = $userdata->user_email;276 $_POST[ 'rich_editing'] = $userdata->rich_editing;276 $_POST['pass1'] = $_POST['pass2'] = $pass; 277 $_POST['email'] = $userdata->user_email; 278 $_POST['rich_editing'] = $userdata->rich_editing; 277 279 edit_user( $userid ); 278 280 if ( $cap == null ) … … 280 282 } 281 283 } 282 unset( $_POST[ 'role'] );283 $_POST[ 'role'] = $newroles;284 } 285 286 // add user ?287 if ( isset( $_POST[ 'user_password' ] ) && !empty( $_POST[ 'newuser'] ) ) {288 $newuser = $_POST[ 'newuser'];284 unset( $_POST['role'] ); 285 $_POST['role'] = $newroles; 286 } 287 288 // add user 289 if ( !empty( $_POST['newuser'] ) ) { 290 $newuser = $_POST['newuser']; 289 291 $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) ); 290 292 if ( $userid ) { 291 $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key=' wp_" . $id . "_capabilities'" );293 $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" ); 292 294 if ( $user == false ) 293 add_user_to_blog( $id, $userid, $_POST[ 'new_role' ]);295 add_user_to_blog( $id, $userid, $_POST['new_role'] ); 294 296 } 295 297 } 296 298 do_action( 'wpmu_update_blog_options' ); 297 299 restore_current_blog(); 298 wp mu_admin_do_redirect( "ms-sites.php?action=editblog&updated=true&id=".$id);299 break; 300 301 case "deleteblog":300 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'editblog', 'id' => $id ), wp_get_referer() ) ); 301 break; 302 303 case 'deleteblog': 302 304 check_admin_referer('deleteblog'); 303 305 if ( ! current_user_can( 'manage_sites' ) ) 304 wp_die( __( 'You do not have permission to access this page.') );306 wp_die( __( 'You do not have permission to access this page.' ) ); 305 307 306 308 if ( $id != '0' && $id != $current_site->blog_id ) 307 309 wpmu_delete_blog( $id, true ); 308 310 309 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete'), $_POST[ 'ref' ]) );310 exit(); 311 break; 312 313 case "allblogs":314 if ( isset( $_POST['doaction']) || isset($_POST['doaction2']) ) {315 check_admin_referer( 'bulk-sites');316 317 if ( ! current_user_can( 'manage_sites' ) )318 wp_die( __('You do not have permission to access this page.') );319 320 if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )321 $doaction = $doaction = ($_POST['action'] != -1)? $_POST['action'] : $_POST['action2'];322 323 324 foreach ( (array) $_POST[ 'allblogs'] as $key => $val ) {325 if ( $val != '0' && $val != $current_site->blog_id ) {326 switch ( $doaction ) {327 case 'delete':328 $blogfunction = 'all_delete';329 wpmu_delete_blog( $val, true );311 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) ); 312 exit(); 313 break; 314 315 case 'allblogs': 316 if ( isset( $_POST['doaction']) || isset($_POST['doaction2'] ) ) { 317 check_admin_referer( 'bulk-ms-sites' ); 318 319 if ( ! current_user_can( 'manage_sites' ) ) 320 wp_die( __( 'You do not have permission to access this page.' ) ); 321 322 if ( $_GET['action'] != -1 || $_POST['action2'] != -1 ) 323 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 324 325 326 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 327 if ( $val != '0' && $val != $current_site->blog_id ) { 328 switch ( $doaction ) { 329 case 'delete': 330 $blogfunction = 'all_delete'; 331 wpmu_delete_blog( $val, true ); 330 332 break; 331 case 'spam': 332 $blogfunction = 'all_spam'; 333 update_blog_status( $val, "spam", '1', 0 ); 334 set_time_limit(60); 333 334 case 'spam': 335 $blogfunction = 'all_spam'; 336 update_blog_status( $val, 'spam', '1', 0 ); 337 set_time_limit( 60 ); 335 338 break; 336 case 'notspam': 337 $blogfunction = 'all_notspam'; 338 update_blog_status( $val, "spam", '0', 0 ); 339 set_time_limit(60); 339 340 case 'notspam': 341 $blogfunction = 'all_notspam'; 342 update_blog_status( $val, 'spam', '0', 0 ); 343 set_time_limit( 60 ); 340 344 break; 345 } 346 } else { 347 wp_die( __( 'You are not allowed to change the current site.' ) ); 341 348 } 342 } else { 343 wp_die( __('You are not allowed to change one of these sites.') ); 344 exit(); 345 }; 346 }; 347 348 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $blogfunction), $_SERVER['HTTP_REFERER'] ) ); 349 exit(); 350 351 } else { 352 wp_redirect( admin_url("ms-sites.php") ); 353 } 354 break; 355 356 case "archiveblog": 357 check_admin_referer('archiveblog'); 358 if ( ! current_user_can( 'manage_sites' ) ) 359 wp_die( __('You do not have permission to access this page.') ); 360 361 update_blog_status( $id, "archived", '1' ); 362 do_action( "archive_blog", $id ); 363 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'archive'), $_POST['ref'] ) ); 364 exit(); 365 break; 366 367 case "unarchiveblog": 368 check_admin_referer('unarchiveblog'); 369 if ( ! current_user_can( 'manage_sites' ) ) 370 wp_die( __('You do not have permission to access this page.') ); 371 372 do_action( "unarchive_blog", $id ); 373 update_blog_status( $id, "archived", '0' ); 374 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unarchive'), $_POST['ref'] ) ); 375 exit(); 376 break; 377 378 case "activateblog": 379 check_admin_referer('activateblog'); 380 if ( ! current_user_can( 'manage_sites' ) ) 381 wp_die( __('You do not have permission to access this page.') ); 382 383 update_blog_status( $id, "deleted", '0' ); 384 do_action( "activate_blog", $id ); 385 wp_redirect( add_query_arg( "updated", array('updated' => 'true', 'action' => 'activate'), $_POST['ref'] ) ); 386 exit(); 387 break; 388 389 case "deactivateblog": 390 check_admin_referer('deactivateblog'); 391 if ( ! current_user_can( 'manage_sites' ) ) 392 wp_die( __('You do not have permission to access this page.') ); 393 394 do_action( "deactivate_blog", $id ); 395 update_blog_status( $id, "deleted", '1' ); 396 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'deactivate'), $_POST['ref'] ) ); 397 exit(); 398 break; 399 400 case "unspamblog": 401 check_admin_referer('unspamblog'); 402 if ( ! current_user_can( 'manage_sites' ) ) 403 wp_die( __('You do not have permission to access this page.') ); 404 405 update_blog_status( $id, "spam", '0' ); 406 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unspam'), $_POST['ref'] ) ); 407 exit(); 408 break; 409 410 case "spamblog": 411 check_admin_referer('spamblog'); 412 if ( ! current_user_can( 'manage_sites' ) ) 413 wp_die( __('You do not have permission to access this page.') ); 414 415 update_blog_status( $id, "spam", '1' ); 416 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'spam'), $_POST['ref'] ) ); 417 exit(); 418 break; 419 420 case "mature": 349 } 350 351 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) ); 352 exit(); 353 } else { 354 wp_redirect( admin_url( 'ms-sites.php' ) ); 355 } 356 break; 357 358 case 'archiveblog': 359 check_admin_referer( 'archiveblog' ); 360 if ( ! current_user_can( 'manage_sites' ) ) 361 wp_die( __( 'You do not have permission to access this page.' ) ); 362 363 update_blog_status( $id, 'archived', '1' ); 364 do_action( 'archive_blog', $id ); 365 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) ); 366 exit(); 367 break; 368 369 case 'unarchiveblog': 370 check_admin_referer( 'unarchiveblog' ); 371 if ( ! current_user_can( 'manage_sites' ) ) 372 wp_die( __( 'You do not have permission to access this page.' ) ); 373 374 do_action( 'unarchive_blog', $id ); 375 update_blog_status( $id, 'archived', '0' ); 376 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) ); 377 exit(); 378 break; 379 380 case 'activateblog': 381 check_admin_referer( 'activateblog' ); 382 if ( ! current_user_can( 'manage_sites' ) ) 383 wp_die( __( 'You do not have permission to access this page.' ) ); 384 385 update_blog_status( $id, 'deleted', '0' ); 386 do_action( 'activate_blog', $id ); 387 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) ); 388 exit(); 389 break; 390 391 case 'deactivateblog': 392 check_admin_referer( 'deactivateblog' ); 393 if ( ! current_user_can( 'manage_sites' ) ) 394 wp_die( __( 'You do not have permission to access this page.' ) ); 395 396 do_action( 'deactivate_blog', $id ); 397 update_blog_status( $id, 'deleted', '1' ); 398 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) ); 399 exit(); 400 break; 401 402 case 'unspamblog': 403 check_admin_referer( 'unspamblog' ); 404 if ( ! current_user_can( 'manage_sites' ) ) 405 wp_die( __( 'You do not have permission to access this page.' ) ); 406 407 update_blog_status( $id, 'spam', '0' ); 408 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) ); 409 exit(); 410 break; 411 412 case 'spamblog': 413 check_admin_referer( 'spamblog' ); 414 if ( ! current_user_can( 'manage_sites' ) ) 415 wp_die( __( 'You do not have permission to access this page.' ) ); 416 417 update_blog_status( $id, 'spam', '1' ); 418 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) ); 419 exit(); 420 break; 421 422 case 'matureblog': 423 check_admin_referer( 'matureblog' ); 424 if ( ! current_user_can( 'manage_sites' ) ) 425 wp_die( __( 'You do not have permission to access this page.' ) ); 426 421 427 update_blog_status( $id, 'mature', '1' ); 422 428 do_action( 'mature_blog', $id ); 423 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'mature'), $_POST['ref'] ) ); 424 exit(); 425 break; 426 427 case "unmature": 429 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) ); 430 exit(); 431 break; 432 433 case 'unmatureblog': 434 check_admin_referer( 'unmatureblog' ); 435 if ( ! current_user_can( 'manage_sites' ) ) 436 wp_die( __( 'You do not have permission to access this page.' ) ); 437 428 438 update_blog_status( $id, 'mature', '0' ); 429 439 do_action( 'unmature_blog', $id ); 430 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'umature'), $_POST['ref']) );440 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) ); 431 441 exit(); 432 442 break; 433 443 434 444 // Themes 435 case "updatethemes":445 case 'updatethemes': 436 446 if ( ! current_user_can( 'manage_network_themes' ) ) 437 wp_die( __( 'You do not have permission to access this page.') );447 wp_die( __( 'You do not have permission to access this page.' ) ); 438 448 439 449 if ( is_array( $_POST['theme'] ) ) { … … 446 456 update_site_option( 'allowedthemes', $allowed_themes ); 447 457 } 448 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'themes'), $_SERVER['HTTP_REFERER']) );458 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'themes' ), wp_get_referer() ) ); 449 459 exit(); 450 460 break; 451 461 452 462 // Common 453 case "confirm": 454 $referrer = ( isset($_GET['ref']) ) ? stripslashes($_GET['ref']) : $_SERVER['HTTP_REFERER']; 455 $referrer = esc_url($referrer); 463 case 'confirm': 456 464 if ( !headers_sent() ) { 457 465 nocache_headers(); 458 466 header( 'Content-Type: text/html; charset=utf-8' ); 459 467 } 468 if ( $current_site->blog_id == $id ) 469 wp_die( __( 'You are not allowed to change the current site.' ) ); 460 470 ?> 461 471 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 462 <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes') ) language_attributes(); ?>>472 <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>> 463 473 <head> 464 <title><?php _e( "WordPress › Confirm your action"); ?></title>474 <title><?php _e( 'WordPress › Confirm your action' ); ?></title> 465 475 466 476 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> … … 468 478 </head> 469 479 <body id="error-page"> 470 <h1 id="logo"><img alt="WordPress" src="<?php echo esc_ url( admin_url( 'images/wordpress-logo.png' ) ); ?>" /></h1>471 <form action= 'ms-edit.php?action=<?php echo esc_attr( $_GET[ 'action2' ] ) ?>' method='post'>472 <input type= 'hidden' name='action' value='<?php echo esc_attr( $_GET['action2'] ) ?>'/>473 <input type= 'hidden' name='id' value='<?php echo esc_attr( $id ); ?>'/>474 <input type= 'hidden' name='ref' value='<?php echo $referrer; ?>'/>475 <?php wp_nonce_field( $_GET['action2'] )?>476 <p><?php e cho esc_html( stripslashes($_GET['msg']) ); ?></p>477 <p class="submit"><input class="button" type= 'submit' value='<?php _e("Confirm"); ?>'/></p>480 <h1 id="logo"><img alt="WordPress" src="<?php echo esc_attr( admin_url( 'images/wordpress-logo.png' ) ); ?>" /></h1> 481 <form action="ms-edit.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post"> 482 <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" /> 483 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> 484 <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> 485 <?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?> 486 <p><?php esc_html_e( stripslashes( $_GET['msg'] ) ); ?></p> 487 <p class="submit"><input class="button" type="submit" value="<?php _e( 'Confirm' ); ?>" /></p> 478 488 </form> 479 489 </body> … … 482 492 break; 483 493 484 // Users (not used any more) 485 case "deleteuser": 486 check_admin_referer('deleteuser'); 487 if ( $id != '0' && $id != '1' ) 488 wpmu_delete_user($id); 489 490 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST['ref'] ) ); 491 exit(); 492 break; 493 494 case "allusers": 495 check_admin_referer('allusers'); 494 // Users 495 case 'deleteuser': 496 496 if ( ! current_user_can( 'manage_network_users' ) ) 497 wp_die( __('You do not have permission to access this page.') ); 498 499 if ( isset($_POST['alluser_delete']) ) { 500 require_once('admin-header.php'); 501 echo '<div class="wrap" style="position:relative;">'; 497 wp_die( __( 'You do not have permission to access this page.' ) ); 498 499 check_admin_referer( 'deleteuser' ); 500 501 if ( $id != '0' && $id != '1' ) { 502 $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays 503 $title = __( 'Users' ); 504 $parent_file = 'ms-admin.php'; 505 require_once( 'admin-header.php' ); 506 echo '<div class="wrap">'; 502 507 confirm_delete_users( $_POST['allusers'] ); 503 508 echo '</div>'; 504 require_once('admin-footer.php'); 505 } elseif ( isset( $_POST[ 'alluser_transfer_delete' ] ) ) { 506 if ( is_array( $_POST[ 'blog' ] ) && !empty( $_POST[ 'blog' ] ) ) { 507 foreach ( $_POST[ 'blog' ] as $id => $users ) { 508 foreach ( $users as $blogid => $user_id ) { 509 require_once( 'admin-footer.php' ); 510 exit(); 511 } else { 512 wp_redirect( admin_url( 'ms-users.php' ) ); 513 } 514 break; 515 516 case 'allusers': 517 if ( ! current_user_can( 'manage_network_users' ) ) 518 wp_die( __( 'You do not have permission to access this page.' ) ); 519 520 if ( isset( $_POST['doaction']) || isset($_POST['doaction2'] ) ) { 521 check_admin_referer( 'bulk-ms-users' ); 522 523 if ( $_GET['action'] != -1 || $_POST['action2'] != -1 ) 524 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 525 526 foreach ( (array) $_POST['allusers'] as $key => $val ) { 527 if ( $val != '' || $val != '0' ) { 528 switch ( $doaction ) { 529 case 'delete': 530 $title = __( 'Users' ); 531 $parent_file = 'ms-admin.php'; 532 require_once( 'admin-header.php' ); 533 echo '<div class="wrap">'; 534 confirm_delete_users( $_POST['allusers'] ); 535 echo '</div>'; 536 require_once( 'admin-footer.php' ); 537 exit(); 538 break; 539 540 case 'superadmin': 541 $userfunction = 'add_superadmin'; 542 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 543 544 $user = new WP_User( $val ); 545 if ( ! in_array( $user->user_login, $super_admins ) ) { 546 if ( $current_site->blog_id ) 547 add_user_to_blog( $current_site->blog_id, $user->ID, 'administrator' ); 548 549 $super_admins[] = $user->user_login; 550 update_site_option( 'site_admins' , $super_admins ); 551 } 552 break; 553 554 case 'notsuperadmin': 555 $userfunction = 'remove_superadmin'; 556 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 557 $admin_email = get_site_option( 'admin_email' ); 558 559 $user = new WP_User( $val ); 560 if ( $user->ID != $current_user->ID || $user->user_email != $admin_email ) { 561 foreach ( $super_admins as $key => $username ) { 562 if ( $username == $user->user_login ) { 563 unset( $super_admins[$key] ); 564 break; 565 } 566 } 567 } 568 569 update_site_option( 'site_admins' , $super_admins ); 570 break; 571 572 case 'spam': 573 $user = new WP_User( $val ); 574 if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) 575 wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network admnistrator.' ), esc_html( $user->user_login ) ) ); 576 577 $userfunction = 'all_spam'; 578 $blogs = get_blogs_of_user( $val, true ); 579 foreach ( (array) $blogs as $key => $details ) { 580 if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! 581 update_blog_status( $details->userblog_id, 'spam', '1' ); 582 } 583 update_user_status( $val, 'spam', '1', 1 ); 584 break; 585 586 case 'notspam': 587 $userfunction = 'all_notspam'; 588 $blogs = get_blogs_of_user( $val, true ); 589 foreach ( (array) $blogs as $key => $details ) 590 update_blog_status( $details->userblog_id, 'spam', '0' ); 591 592 update_user_status( $val, 'spam', '0', 1 ); 593 break; 594 } 595 } 596 } 597 598 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); 599 exit(); 600 } else { 601 wp_redirect( admin_url( 'ms-users.php' ) ); 602 } 603 break; 604 605 case 'dodelete': 606 check_admin_referer( 'ms-users-delete' ); 607 if ( ! current_user_can( 'manage_network_users' ) ) 608 wp_die( __( 'You do not have permission to access this page.' ) ); 609 610 if ( is_array( $_POST['blog'] ) && ! empty( $_POST['blog'] ) ) { 611 foreach ( $_POST['blog'] as $id => $users ) { 612 foreach ( $users as $blogid => $user_id ) { 613 if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) 509 614 remove_user_from_blog( $id, $blogid, $user_id ); 510 } 615 else 616 remove_user_from_blog( $id, $blogid ); 511 617 } 512 618 } 513 if ( is_array( $_POST[ 'user' ] ) && !empty( $_POST[ 'user' ] ) ) 514 foreach( $_POST[ 'user' ] as $id ) 515 wpmu_delete_user( $id ); 516 517 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'all_delete'), 'ms-users.php' ) ); 518 } elseif ( isset( $_POST[ 'add_superadmin' ] ) ) { 519 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 520 $mainblog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" ); 521 foreach ( (array) $_POST['allusers'] as $key => $val ) { 522 if ( $val == '' || $val == '0' ) 523 continue; 524 $user = new WP_User( $val ); 525 if ( in_array( $user->user_login, $super_admins ) ) 526 continue; 527 if ( $mainblog_id ) 528 add_user_to_blog( $mainblog_id, $user->ID, 'administrator' ); 529 $super_admins[] = $user->user_login; 530 } 531 update_site_option( 'site_admins' , $super_admins ); 532 533 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add_superadmin' ), $_SERVER['HTTP_REFERER'] ) ); 534 } elseif ( isset( $_POST[ 'remove_superadmin' ] ) ) { 535 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 536 $admin_email = get_site_option( 'admin_email' ); 537 foreach ( (array) $_POST['allusers'] as $key => $val ) { 538 if ( $val == '' || $val == '0' ) 539 continue; 540 $user = new WP_User( $val ); 541 if ( $user->ID == $current_user->ID || $user->user_email == $admin_email ) 542 continue; 543 foreach ( $super_admins as $key => $username ) { 544 if ( $username == $user->user_login ) { 545 unset( $super_admins[ $key ] ); 546 break; 547 } 548 } 549 } 550 update_site_option( 'site_admins' , $super_admins ); 551 552 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'remove_superadmin' ), $_SERVER['HTTP_REFERER'] ) ); 553 } else { 554 foreach ( (array) $_POST['allusers'] as $key => $val ) { 555 if ( $val == '' || $val == '0' ) 556 continue; 557 $user = new WP_User( $val ); 558 if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) 559 wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network admnistrator.' ), $user->user_login ) ); 560 if ( isset($_POST['alluser_spam']) ) { 561 $userfunction = 'all_spam'; 562 $blogs = get_blogs_of_user( $val, true ); 563 foreach ( (array) $blogs as $key => $details ) { 564 if ( $details->userblog_id == $current_site->blog_id ) { continue; } // main blog not a spam ! 565 update_blog_status( $details->userblog_id, "spam", '1' ); 566 } 567 update_user_status( $val, "spam", '1', 1 ); 568 } elseif ( isset($_POST['alluser_notspam']) ) { 569 $userfunction = 'all_notspam'; 570 $blogs = get_blogs_of_user( $val, true ); 571 foreach ( (array) $blogs as $key => $details ) { 572 update_blog_status( $details->userblog_id, "spam", '0' ); 573 } 574 update_user_status( $val, "spam", '0', 1 ); 575 } 576 } 577 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $userfunction), $_SERVER['HTTP_REFERER'] ) ); 578 } 579 exit(); 580 break; 581 582 case "adduser": 583 check_admin_referer('add-user'); 619 } 620 $i = 0; 621 if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) 622 foreach( $_POST['user'] as $id ) { 623 wpmu_delete_user( $id ); 624 $i++; 625 } 626 627 if ( $i == 1 ) 628 $deletefunction = 'delete'; 629 else 630 $deletefunction = 'all_delete'; 631 632 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), admin_url( 'ms-users.php' ) ) ); 633 break; 634 635 case 'adduser': 636 check_admin_referer( 'add-user' ); 584 637 if ( ! current_user_can( 'manage_network_users' ) ) 585 wp_die( __( 'You do not have permission to access this page.') );586 587 if ( is_array( $_POST[ 'user'] ) == false )588 wp_die( __( "Cannot create an empty user.") );638 wp_die( __( 'You do not have permission to access this page.' ) ); 639 640 if ( is_array( $_POST['user'] ) == false ) 641 wp_die( __( 'Cannot create an empty user.' ) ); 589 642 $user = $_POST['user']; 590 643 if ( empty($user['username']) && empty($user['email']) ) 591 wp_die( __( 'Missing username and email.') );644 wp_die( __( 'Missing username and email.' ) ); 592 645 elseif ( empty($user['username']) ) 593 wp_die( __( 'Missing username.') );646 wp_die( __( 'Missing username.' ) ); 594 647 elseif ( empty($user['email']) ) 595 wp_die( __( 'Missing email.') );648 wp_die( __( 'Missing email.' ) ); 596 649 597 650 $password = wp_generate_password(); 598 $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );651 $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); 599 652 600 653 if ( false == $user_id ) 601 wp_die( __( 'Duplicated username or email address.') );654 wp_die( __( 'Duplicated username or email address.' ) ); 602 655 else 603 wp_new_user_notification( $user_id, $password);656 wp_new_user_notification( $user_id, $password ); 604 657 605 658 if ( get_site_option( 'dashboard_blog' ) == false ) … … 608 661 add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) ); 609 662 610 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add'), $_SERVER['HTTP_REFERER']) );663 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) ); 611 664 exit(); 612 665 break; 613 666 614 667 default: 615 wp mu_admin_do_redirect( "ms-admin.php");668 wp_redirect( admin_url( 'ms-admin.php' ) ); 616 669 break; 617 670 } -
trunk/wp-admin/ms-options.php
r13884 r13918 1 1 <?php 2 require_once( 'admin.php');2 require_once( './admin.php' ); 3 3 4 4 if ( !is_multisite() ) 5 wp_die( __( 'Multisite support is not enabled.') );6 7 $title = __( 'Network Options');5 wp_die( __( 'Multisite support is not enabled.' ) ); 6 7 $title = __( 'Network Options' ); 8 8 $parent_file = 'ms-admin.php'; 9 9 10 include( 'admin-header.php');10 include( './admin-header.php' ); 11 11 12 12 if ( ! current_user_can( 'manage_network_options' ) ) 13 wp_die( __( 'You do not have permission to access this page.') );13 wp_die( __( 'You do not have permission to access this page.' ) ); 14 14 15 15 if (isset($_GET['updated'])) { 16 16 ?> 17 <div id="message" class="updated fade"><p><?php _e( 'Options saved.') ?></p></div>17 <div id="message" class="updated fade"><p><?php _e( 'Options saved.' ) ?></p></div> 18 18 <?php 19 19 } … … 22 22 <div class="wrap"> 23 23 <?php screen_icon(); ?> 24 <h2><?php _e( 'Network Options') ?></h2>24 <h2><?php _e( 'Network Options' ) ?></h2> 25 25 <form method="post" action="ms-edit.php?action=siteoptions"> 26 <?php wp_nonce_field( "siteoptions"); ?>27 <h3><?php _e( 'Operational Settings'); ?></h3>28 <table class="form-table"> 29 <tr valign="top"> 30 <th scope="row"><label for="site_name"><?php _e( 'Network Name') ?></label></th>31 <td> 32 <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name) ?>" />33 <br /> 34 <?php _e( 'What you would like to call this website.') ?>35 </td> 36 </tr> 37 38 <tr valign="top"> 39 <th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email') ?></label></th>26 <?php wp_nonce_field( 'siteoptions' ); ?> 27 <h3><?php _e( 'Operational Settings' ); ?></h3> 28 <table class="form-table"> 29 <tr valign="top"> 30 <th scope="row"><label for="site_name"><?php _e( 'Network Name' ) ?></label></th> 31 <td> 32 <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" /> 33 <br /> 34 <?php _e( 'What you would like to call this website.' ) ?> 35 </td> 36 </tr> 37 38 <tr valign="top"> 39 <th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th> 40 40 <td> 41 41 <input name="admin_email" type="text" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option('admin_email') ) ?>" /> … … 46 46 47 47 <tr valign="top"> 48 <th scope="row"><?php _e( 'Global Terms') ?></th>49 <td> 50 <label><input type= 'radio' id="global_terms_enabled" name="global_terms_enabled" value='1'<?php checked( get_site_option( 'global_terms_enabled' ), 1 ) ?>/> <?php _e( 'Maintain a global list of terms from all sites across the network.' ); ?></label><br />51 <label><input type= 'radio' id="global_terms_enabled" name="global_terms_enabled" value='0'<?php checked( get_site_option( 'global_terms_enabled' ), 0 ) ?>/> <?php _e( 'Disabled' ); ?></label></td>52 </tr> 53 </table> 54 <h3><?php _e( 'Dashboard Settings'); ?></h3>55 <table class="form-table"> 56 <tr valign="top"> 57 <th scope="row"><label for="dashboard_blog"><?php _e( 'Dashboard Site') ?></label></th>48 <th scope="row"><?php _e( 'Global Terms' ) ?></th> 49 <td> 50 <label><input type="radio" id="global_terms_enabled" name="global_terms_enabled" value="1"<?php checked( get_site_option( 'global_terms_enabled' ), 1 ) ?>/> <?php _e( 'Maintain a global list of terms from all sites across the network.' ); ?></label><br /> 51 <label><input type="radio" id="global_terms_enabled" name="global_terms_enabled" value="0"<?php checked( get_site_option( 'global_terms_enabled' ), 0 ) ?>/> <?php _e( 'Disabled' ); ?></label></td> 52 </tr> 53 </table> 54 <h3><?php _e( 'Dashboard Settings' ); ?></h3> 55 <table class="form-table"> 56 <tr valign="top"> 57 <th scope="row"><label for="dashboard_blog"><?php _e( 'Dashboard Site' ) ?></label></th> 58 58 <td> 59 59 <?php … … 64 64 $blogname = ''; 65 65 }?> 66 <input name="dashboard_blog_orig" type="hidden" id="dashboard_blog_orig" value="<?php echo esc_attr( $blogname); ?>" />67 <input name="dashboard_blog" type="text" id="dashboard_blog" value="<?php echo esc_attr( $blogname); ?>" class="regular-text" />66 <input name="dashboard_blog_orig" type="hidden" id="dashboard_blog_orig" value="<?php echo esc_attr( $blogname ); ?>" /> 67 <input name="dashboard_blog" type="text" id="dashboard_blog" value="<?php echo esc_attr( $blogname ); ?>" class="regular-text" /> 68 68 <br /> 69 69 <?php _e( "Site path ('dashboard', 'control', 'manager', etc) or blog id.<br />New users are added to this site as the user role defined below if they don't have a site. Leave blank for the main site. Users with the subscriber role on old site will be moved to the new site if changed. The new site will be created if it does not exist." ); ?> … … 71 71 </tr> 72 72 <tr valign="top"> 73 <th scope="row"><label for="default_user_role"><?php _e( 'Dashboard User Default Role') ?></label></th>73 <th scope="row"><label for="default_user_role"><?php _e( 'Dashboard User Default Role' ) ?></label></th> 74 74 <td> 75 75 <select name="default_user_role" id="default_user_role"><?php … … 82 82 </tr> 83 83 <tr valign="top"> 84 <th scope="row"><label for="admin_notice_feed"><?php _e( 'Admin Notice Feed') ?></label></th>84 <th scope="row"><label for="admin_notice_feed"><?php _e( 'Admin Notice Feed' ) ?></label></th> 85 85 <td><input name="admin_notice_feed" class="large-text" type="text" id="admin_notice_feed" value="<?php echo esc_attr( get_site_option( 'admin_notice_feed' ) ) ?>" size="80" /><br /> 86 86 <?php _e( 'Display the latest post from this RSS or Atom feed on all site dashboards. Leave blank to disable.' ); ?><br /> 87 <?php if ( get_site_option( 'admin_notice_feed' ) != network_home_url('feed/', 'http') ) 88 echo __( "A good one to use would be the feed from your main site: " ) . network_home_url('feed/'); ?></td> 89 </tr> 90 </table> 91 <h3><?php _e('Registration Settings'); ?></h3> 92 <table class="form-table"> 93 <tr valign="top"> 94 <th scope="row"><?php _e('Allow new registrations') ?></th> 87 88 <?php if ( get_site_option( 'admin_notice_feed' ) != get_home_url( $current_site->id, 'feed/' ) ) 89 echo __( 'A good one to use would be the feed from your main site: ' ) . esc_url( get_home_url( $current_site->id, 'feed/' ) ) ?></td> 90 </tr> 91 </table> 92 <h3><?php _e( 'Registration Settings' ); ?></h3> 93 <table class="form-table"> 94 <tr valign="top"> 95 <th scope="row"><?php _e( 'Allow new registrations' ) ?></th> 95 96 <?php 96 if ( !get_site_option( 'registration') )97 if ( !get_site_option( 'registration' ) ) 97 98 update_site_option( 'registration', 'none' ); 99 $reg = get_site_option( 'registration' ); 98 100 ?> 99 101 <td> 100 <label><input name="registration" type="radio" id="registration1" value= 'none'<?php checked( get_site_option('registration'), 'none') ?> /> <?php _e('Registration is disabled.'); ?></label><br />101 <label><input name="registration" type="radio" id="registration2" value= 'user'<?php checked( get_site_option('registration'), 'user') ?> /> <?php _e('User accounts may be registered.'); ?></label><br />102 <label><input name="registration" type="radio" id="registration3" value= 'blog'<?php checked( get_site_option('registration'), 'blog') ?> /> <?php _e('Logged in users may register new sites.'); ?></label><br />103 <label><input name="registration" type="radio" id="registration4" value= 'all'<?php checked( get_site_option('registration'), 'all') ?> /> <?php _e('Both sites and user accounts can be registered.'); ?></label><br />104 <p><?php _e( 'Disable or enable registration and who or what can be registered. (Default is disabled.)'); ?></p>102 <label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br /> 103 <label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br /> 104 <label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog') ?> /> <?php _e( 'Logged in users may register new sites.' ); ?></label><br /> 105 <label><input name="registration" type="radio" id="registration4" value="all"<?php checked( $reg, 'all') ?> /> <?php _e( 'Both sites and user accounts can be registered.' ); ?></label><br /> 106 <p><?php _e( 'Disable or enable registration and who or what can be registered. (Default is disabled.)' ); ?></p> 105 107 <?php if ( is_subdomain_install() ) { 106 echo '<p>' . __( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a url you will redirect visitors to if they visit a non-existent site.') . '</p>';108 echo '<p>' . __( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a url you will redirect visitors to if they visit a non-existent site.' ) . '</p>'; 107 109 } ?> 108 110 </td> … … 110 112 111 113 <tr valign="top"> 112 <th scope="row"><?php _e( 'Registration notification') ?></th>114 <th scope="row"><?php _e( 'Registration notification' ) ?></th> 113 115 <?php 114 if ( !get_site_option( 'registrationnotification') )116 if ( !get_site_option( 'registrationnotification' ) ) 115 117 update_site_option( 'registrationnotification', 'yes' ); 116 118 ?> 117 119 <td> 118 <label><input name="registrationnotification" type="checkbox" id="registrationnotification" value= 'yes'<?php checked( get_site_option('registrationnotification'), 'yes' ) ?> /> <?php _e('Send the network admin an email notification every time someone registers a site or user account.') ?></label>120 <label><input name="registrationnotification" type="checkbox" id="registrationnotification" value="yes"<?php checked( get_site_option( 'registrationnotification' ), 'yes' ) ?> /> <?php _e( 'Send the network admin an email notification every time someone registers a site or user account.' ) ?></label> 119 121 </td> 120 122 </tr> 121 123 122 124 <tr valign="top" id="addnewusers"> 123 <th scope="row"><?php _e( 'Add New Users') ?></th>124 <td> 125 <label><input name="add_new_users" type="checkbox" id="add_new_users" value= '1'<?php checked( get_site_option('add_new_users') ) ?> /> <?php _e('Allow site administrators to add new users to their site via the "Users->Add New" page.'); ?></label>126 </td> 127 </tr> 128 129 <tr valign="top"> 130 <th scope="row"><label for="illegal_names"><?php _e( 'Banned Names') ?></label></th>131 <td> 132 <input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", get_site_option( 'illegal_names') ) ); ?>" size="45" />133 <br /> 134 <?php _e( 'Users are not allowed to register these sites. Separate names by spaces.') ?>135 </td> 136 </tr> 137 138 <tr valign="top"> 139 <th scope="row"><label for="limited_email_domains"><?php _e( 'Limited Email Registrations') ?></label></th>140 <td> 141 <?php $limited_email_domains = get_site_option( 'limited_email_domains');125 <th scope="row"><?php _e( 'Add New Users' ) ?></th> 126 <td> 127 <label><input name="add_new_users" type="checkbox" id="add_new_users" value="1"<?php checked( get_site_option( 'add_new_users' ) ) ?> /> <?php _e( 'Allow site administrators to add new users to their site via the "Users->Add New" page.' ); ?></label> 128 </td> 129 </tr> 130 131 <tr valign="top"> 132 <th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th> 133 <td> 134 <input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", get_site_option( 'illegal_names' ) ) ); ?>" size="45" /> 135 <br /> 136 <?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?> 137 </td> 138 </tr> 139 140 <tr valign="top"> 141 <th scope="row"><label for="limited_email_domains"><?php _e( 'Limited Email Registrations' ) ?></label></th> 142 <td> 143 <?php $limited_email_domains = get_site_option( 'limited_email_domains' ); 142 144 $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?> 143 <textarea name="limited_email_domains" id="limited_email_domains" cols= '45' rows='5'><?php echo wp_htmledit_pre( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>144 <br /> 145 <?php _e( 'If you want to limit site registrations to certain domains. Enter one domain per line.') ?>145 <textarea name="limited_email_domains" id="limited_email_domains" cols="45" rows="5"><?php echo wp_htmledit_pre( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea> 146 <br /> 147 <?php _e( 'If you want to limit site registrations to certain domains. Enter one domain per line.' ) ?> 146 148 </td> 147 149 </tr> … … 150 152 <th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th> 151 153 <td> 152 <textarea name="banned_email_domains" id="banned_email_domains" cols= '45' rows='5'><?php echo wp_htmledit_pre( get_site_option('banned_email_domains') == '' ? '' : implode( "\n", (array) get_site_option('banned_email_domains') ) ); ?></textarea>154 <textarea name="banned_email_domains" id="banned_email_domains" cols="45" rows="5"><?php echo wp_htmledit_pre( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea> 153 155 <br /> 154 156 <?php _e('If you want to ban domains from site registrations. Enter one domain per line.') ?> … … 161 163 162 164 <tr valign="top"> 163 <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email') ?></label></th>164 <td> 165 <textarea name="welcome_email" id="welcome_email" rows= '5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('welcome_email') ) ?></textarea>166 <br /> 167 <?php _e( 'The welcome email sent to new site owners.') ?>168 </td> 169 </tr> 170 <tr valign="top"> 171 <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email') ?></label></th>172 <td> 173 <textarea name="welcome_user_email" id="welcome_user_email" rows='5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('welcome_user_email') ) ?></textarea>174 <br /> 175 <?php _e( 'The welcome email sent to new users.') ?>176 </td> 177 </tr> 178 <tr valign="top"> 179 <th scope="row"><label for="first_post"><?php _e( 'First Post') ?></label></th>180 <td> 181 <textarea name="first_post" id="first_post" rows= '5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('first_post') ) ?></textarea>182 <br /> 183 <?php _e( 'The first post on a new site.') ?>184 </td> 185 </tr> 186 <tr valign="top"> 187 <th scope="row"><label for="first_page"><?php _e( 'First Page') ?></label></th>188 <td> 189 <textarea name="first_page" id="first_page" rows= '5' cols='45'class="large-text"><?php echo stripslashes( get_site_option('first_page') ) ?></textarea>190 <br /> 191 <?php _e( 'The first page on a new site.') ?>192 </td> 193 </tr> 194 <tr valign="top"> 195 <th scope="row"><label for="first_comment"><?php _e( 'First Comment') ?></label></th>196 <td> 197 <textarea name="first_comment" id="first_comment" rows= '5' cols='45'class="large-text"><?php echo stripslashes( get_site_option('first_comment') ) ?></textarea>198 <br /> 199 <?php _e( 'The first comment on a new site.') ?>200 </td> 201 </tr> 202 <tr valign="top"> 203 <th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author') ?></label></th>204 <td> 205 <input type="text" size= '40'name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />206 <br /> 207 <?php _e( 'The author of the first comment on a new site.') ?>208 </td> 209 </tr> 210 <tr valign="top"> 211 <th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL') ?></label></th>212 <td> 213 <input type="text" size= '40' name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr(get_site_option('first_comment_url')) ?>" />214 <br /> 215 <?php _e( 'The URL for the first comment on a new site.') ?>216 </td> 217 </tr> 218 </table> 219 <h3><?php _e( 'Upload Settings'); ?></h3>220 <table class="form-table"> 221 <tr valign="top"> 222 <th scope="row"><?php _e( 'Media upload buttons') ?></th>165 <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th> 166 <td> 167 <textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option( 'welcome_email' ) ) ?></textarea> 168 <br /> 169 <?php _e( 'The welcome email sent to new site owners.' ) ?> 170 </td> 171 </tr> 172 <tr valign="top"> 173 <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th> 174 <td> 175 <textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option( 'welcome_user_email' ) ) ?></textarea> 176 <br /> 177 <?php _e( 'The welcome email sent to new users.' ) ?> 178 </td> 179 </tr> 180 <tr valign="top"> 181 <th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th> 182 <td> 183 <textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option( 'first_post' ) ) ?></textarea> 184 <br /> 185 <?php _e( 'The first post on a new site.' ) ?> 186 </td> 187 </tr> 188 <tr valign="top"> 189 <th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th> 190 <td> 191 <textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option('first_page') ) ?></textarea> 192 <br /> 193 <?php _e( 'The first page on a new site.' ) ?> 194 </td> 195 </tr> 196 <tr valign="top"> 197 <th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th> 198 <td> 199 <textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option('first_comment') ) ?></textarea> 200 <br /> 201 <?php _e( 'The first comment on a new site.' ) ?> 202 </td> 203 </tr> 204 <tr valign="top"> 205 <th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th> 206 <td> 207 <input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" /> 208 <br /> 209 <?php _e( 'The author of the first comment on a new site.' ) ?> 210 </td> 211 </tr> 212 <tr valign="top"> 213 <th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th> 214 <td> 215 <input type="text" size="40" name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" /> 216 <br /> 217 <?php _e( 'The URL for the first comment on a new site.' ) ?> 218 </td> 219 </tr> 220 </table> 221 <h3><?php _e( 'Upload Settings' ); ?></h3> 222 <table class="form-table"> 223 <tr valign="top"> 224 <th scope="row"><?php _e( 'Media upload buttons' ) ?></th> 223 225 <?php $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); ?> 224 <td><label><input type= 'checkbox' id="mu_media_buttons_image" name="mu_media_buttons[image]" value='1'<?php checked( !empty($mu_media_buttons[ 'image' ]) ) ?>/> <?php _e( 'Images' ); ?></label><br />225 <label><input type= 'checkbox' id="mu_media_buttons_video" name="mu_media_buttons[video]" value='1'<?php checked( !empty($mu_media_buttons[ 'video' ]) ) ?>/> <?php _e( 'Videos' ); ?></label><br />226 <label><input type= 'checkbox' id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value='1'<?php checked( !empty($mu_media_buttons[ 'audio' ]) ) ?>/> <?php _e( 'Music' ); ?></label><br />226 <td><label><input type="checkbox" id="mu_media_buttons_image" name="mu_media_buttons[image]" value="1"<?php checked( ! empty( $mu_media_buttons['image'] ) ) ?>/> <?php _e( 'Images' ); ?></label><br /> 227 <label><input type="checkbox" id="mu_media_buttons_video" name="mu_media_buttons[video]" value="1"<?php checked( ! empty( $mu_media_buttons['video'] ) ) ?>/> <?php _e( 'Videos' ); ?></label><br /> 228 <label><input type="checkbox" id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value="1"<?php checked( ! empty( $mu_media_buttons['audio'] ) ) ?>/> <?php _e( 'Music' ); ?></label><br /> 227 229 <?php _e( 'The media upload buttons to display on the "Write Post" page. Make sure you update the allowed upload file types below as well.' ); ?></td> 228 230 </tr> 229 231 230 232 <tr valign="top"> 231 <th scope="row"><?php _e( 'Site upload space') ?></th>232 <td> 233 <label><input type= 'checkbox' id="upload_space_check_disabled" name="upload_space_check_disabled" value='0'<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '<input name="blog_upload_space" type="text" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 10) ) . '" size="3" />' ); ?></label><br />234 </tr> 235 236 <tr valign="top"> 237 <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types') ?></label></th>233 <th scope="row"><?php _e( 'Site upload space' ) ?></th> 234 <td> 235 <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '<input name="blog_upload_space" type="text" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 10) ) . '" size="3" />' ); ?></label><br /> 236 </tr> 237 238 <tr valign="top"> 239 <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th> 238 240 <td><input name="upload_filetypes" type="text" id="upload_filetypes" class="large-text" value="<?php echo esc_attr( get_site_option('upload_filetypes', 'jpg jpeg png gif') ) ?>" size="45" /></td> 239 241 </tr> 240 242 241 243 <tr valign="top"> 242 <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size') ?></label></th>243 <td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="text" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" size="5" />' ); ?></td>244 <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th> 245 <td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="text" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" size="5" />' ); ?></td> 244 246 </tr> 245 247 </table> … … 248 250 $languages = get_available_languages(); 249 251 if ( ! empty( $languages ) ) { 250 $lang = get_site_option( 'WPLANG');252 $lang = get_site_option( 'WPLANG' ); 251 253 ?> 252 <h3><?php _e( 'Network Wide Settings'); ?></h3>254 <h3><?php _e( 'Network Wide Settings' ); ?></h3> 253 255 <div class="updated inline"><p><strong><?php _e( 'Notice:' ); ?></strong> <?php _e( 'These settings may be overridden by site owners.' ); ?></p></div> 254 256 <table class="form-table"> … … 256 258 ?> 257 259 <tr valign="top"> 258 <th><label for="WPLANG"><?php _e( 'Default Language') ?></label></th>260 <th><label for="WPLANG"><?php _e( 'Default Language' ) ?></label></th> 259 261 <td> 260 262 <select name="WPLANG" id="WPLANG"> 261 <?php mu_dropdown_languages( $languages, get_site_option( 'WPLANG') ); ?>263 <?php mu_dropdown_languages( $languages, get_site_option( 'WPLANG' ) ); ?> 262 264 </select> 263 265 </td> … … 268 270 ?> 269 271 270 <h3><?php _e( 'Menu Settings'); ?></h3>272 <h3><?php _e( 'Menu Settings' ); ?></h3> 271 273 <table id="menu" class="form-table"> 272 274 <tr valign="top"> … … 277 279 $menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) ); 278 280 foreach ( (array) $menu_items as $key => $val ) { 279 echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[ $key ] ) ? checked( $menu_perms[ $key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>";281 echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[$key] ) ? checked( $menu_perms[$key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>"; 280 282 } 281 283 ?> … … 286 288 <?php do_action( 'wpmu_options' ); // Add more options here ?> 287 289 288 <p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes') ?>" /></p>290 <p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes' ) ?>" /></p> 289 291 </form> 290 292 </div> 291 293 292 <?php include( './admin-footer.php'); ?>294 <?php include( './admin-footer.php' ); ?> -
trunk/wp-admin/ms-sites.php
r13733 r13918 1 1 <?php 2 require_once( 'admin.php');2 require_once( './admin.php' ); 3 3 4 4 if ( !is_multisite() ) 5 wp_die( __( 'Multisite support is not enabled.') );6 7 $title = __( 'Sites');5 wp_die( __( 'Multisite support is not enabled.' ) ); 6 7 $title = __( 'Sites' ); 8 8 $parent_file = 'ms-admin.php'; 9 9 10 10 wp_enqueue_script( 'admin-forms' ); 11 11 12 require_once( 'admin-header.php');12 require_once( './admin-header.php' ); 13 13 14 14 if ( ! current_user_can( 'manage_sites' ) ) 15 wp_die( __('You do not have permission to access this page.') ); 16 17 $id = isset($_GET['id']) ? intval( $_GET['id'] ) : 0; 18 $protocol = is_ssl() ? 'https://' : 'http://'; 19 20 if ( isset($_GET['updated']) && $_GET['updated'] == 'true' ) { 15 wp_die( __( 'You do not have permission to access this page.' ) ); 16 17 $id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0; 18 19 if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) { 21 20 ?> 22 21 <div id="message" class="updated fade"><p> 23 22 <?php 24 switch ( $_GET['action']) {23 switch ( $_GET['action'] ) { 25 24 case 'all_notspam': 26 _e( 'Sites mark as not spam !');25 _e( 'Sites mark as not spam.' ); 27 26 break; 28 27 case 'all_spam': 29 _e( 'Sites mark as spam !');28 _e( 'Sites mark as spam.' ); 30 29 break; 31 30 case 'all_delete': 32 _e( 'Sites deleted !');31 _e( 'Sites deleted.' ); 33 32 break; 34 33 case 'delete': 35 _e( 'Site deleted !');34 _e( 'Site deleted.' ); 36 35 break; 37 36 case 'add-blog': 38 _e( 'Site added !');37 _e( 'Site added.' ); 39 38 break; 40 39 case 'archive': 41 _e( 'Site archived !');40 _e( 'Site archived.' ); 42 41 break; 43 42 case 'unarchive': 44 _e( 'Site unarchived !');43 _e( 'Site unarchived.' ); 45 44 break; 46 45 case 'activate': 47 _e( 'Site activated !');46 _e( 'Site activated.' ); 48 47 break; 49 48 case 'deactivate': 50 _e( 'Site deactivated !');49 _e( 'Site deactivated.' ); 51 50 break; 52 51 case 'unspam': 53 _e( 'Site mark as not spam !');52 _e( 'Site mark as not spam.' ); 54 53 break; 55 54 case 'spam': 56 _e( 'Site mark as spam !');57 break; 58 case 'u mature':59 _e( 'Site mark as not mature !');55 _e( 'Site mark as spam.' ); 56 break; 57 case 'unmature': 58 _e( 'Site mark as not mature.' ); 60 59 break; 61 60 case 'mature': 62 _e( 'Site mark as mature !');61 _e( 'Site mark as mature.' ); 63 62 break; 64 63 default: 65 _e( 'Options saved !');64 _e( 'Settings saved.' ); 66 65 break; 67 66 } … … 71 70 } 72 71 73 $action = isset( $_GET['action']) ? $_GET['action'] : 'list';72 $action = isset( $_GET['action'] ) ? $_GET['action'] : 'list'; 74 73 75 74 switch ( $action ) { 76 // Edit blog77 case "editblog":75 // Edit site 76 case 'editblog': 78 77 $blog_prefix = $wpdb->get_blog_prefix( $id ); 79 78 $options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '\_%' AND option_name NOT LIKE '%user_roles'" ); 80 $details = get_blog_details( $id);79 $details = get_blog_details( $id ); 81 80 $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" ); 82 81 $is_main_site = is_main_site( $id ); … … 84 83 <div class="wrap"> 85 84 <?php screen_icon(); ?> 86 <h2><?php _e( 'Edit Site'); ?> - <a href='<?php echo get_home_url($id); ?>'><?php echo get_home_url($id); ?></a></h2>85 <h2><?php _e( 'Edit Site' ); ?> - <a href="<?php echo esc_url( get_home_url( $id ) ); ?>"><?php echo esc_url( get_home_url( $id ) ); ?></a></h2> 87 86 <form method="post" action="ms-edit.php?action=updateblog"> 88 <?php wp_nonce_field('editblog'); ?> 89 <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> 90 <div class='metabox-holder' style='width:49%;float:left;'> 91 <div id="blogedit_bloginfo" class="postbox " > 92 <h3 class='hndle'><span><?php _e('Site info (wp_blogs)'); ?></span></h3> 93 <div class="inside"> 94 <table class="form-table"> 95 <tr class="form-field form-required"> 96 <th scope="row"><?php _e('Domain') ?></th> 97 <?php if ( $is_main_site ) { ?> 98 <td>http://<?php echo esc_attr($details->domain) ?></td> 99 <?php } else { ?> 100 <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr($details->domain) ?>" size="33" /></td> 101 <?php } ?> 87 <?php wp_nonce_field( 'editblog' ); ?> 88 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> 89 <div class="metabox-holder" style="width:49%;float:left;"> 90 <div id="blogedit_bloginfo" class="postbox"> 91 <h3 class="hndle"><span><?php _e( 'Site info (wp_blogs)' ); ?></span></h3> 92 <div class="inside"> 93 <table class="form-table"> 94 <tr class="form-field form-required"> 95 <th scope="row"><?php _e( 'Domain' ) ?></th> 96 <?php 97 $protocol = is_ssl() ? 'https://' : 'http://'; 98 if ( $is_main_site ) { ?> 99 <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td> 100 <?php } else { ?> 101 <td><?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td> 102 <?php } ?> 103 </tr> 104 <tr class="form-field form-required"> 105 <th scope="row"><?php _e( 'Path' ) ?></th> 106 <?php if ( $is_main_site ) { ?> 107 <td><code><?php echo esc_attr( $details->path ) ?></code></td> 108 <?php } else { ?> 109 <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" size="40" style='margin-bottom:5px;' /> 110 <br /><input type="checkbox" style="width:20px;" name="update_home_url" value="update" <?php if ( get_blog_option( $id, 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_blog_option( $id, 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></td> 111 <?php } ?> 112 </tr> 113 <tr class="form-field"> 114 <th scope="row"><?php _e( 'Registered') ?></th> 115 <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" size="40" /></td> 116 </tr> 117 <tr class="form-field"> 118 <th scope="row"><?php _e('Last Updated') ?></th> 119 <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" size="40" /></td> 120 </tr> 121 <tr class="form-field"> 122 <th scope="row"><?php _e('Public') ?></th> 123 <td> 124 <label><input type="radio" style="width:20px;" name="blog[public]" value="1" <?php checked( $details->public, 1 ); ?> /> <?php _e( 'Yes' ) ?></label> 125 <label><input type="radio" style="width:20px;" name="blog[public]" value="0" <?php checked( $details->public, 0 ); ?> /> <?php _e( 'No' ) ?></label> 126 </td> 127 </tr> 128 <tr class="form-field"> 129 <th scope="row"><?php _e( 'Archived' ); ?></th> 130 <td> 131 <label><input type="radio" style="width:20px;" name="blog[archived]" value="1" <?php checked( $details->archived, 1 ); ?> /> <?php _e( 'Yes' ) ?></label> 132 <label><input type="radio" style="width:20px;" name="blog[archived]" value="0" <?php checked( $details->archived, 0 ); ?> /> <?php _e( 'No' ) ?></label> 133 </td> 134 </tr> 135 <tr class="form-field"> 136 <th scope="row"><?php _e( 'Mature' ); ?></th> 137 <td> 138 <label><input type="radio" style="width:20px;" name="blog[mature]" value="1" <?php checked( $details->mature, 1 ); ?> /> <?php _e( 'Yes' ) ?></label> 139 <label><input type="radio" style="width:20px;" name="blog[mature]" value="0" <?php checked( $details->mature, 0); ?> /> <?php _e( 'No' ) ?></label> 140 </td> 141 </tr> 142 <tr class="form-field"> 143 <th scope="row"><?php _e( 'Spam' ); ?></th> 144 <td> 145 <label><input type="radio" style="width:20px;" name="blog[spam]" value="1" <?php checked( $details->spam, 1 ); ?> /> <?php _e( 'Yes' ) ?></label> 146 <label><input type="radio" style="width:20px;" name="blog[spam]" value="0" <?php checked( $details->spam, 0 ); ?> /> <?php _e( 'No' ) ?></label> 147 </td> 148 </tr> 149 <tr class="form-field"> 150 <th scope="row"><?php _e( 'Deleted' ); ?></th> 151 <td> 152 <label><input type="radio" style="width:20px;" name="blog[deleted]" value="1" <?php checked( $details->deleted, 1 ); ?> /> <?php _e( 'Yes' ) ?></label> 153 <label><input type="radio" style="width:20px;" name="blog[deleted]" value="0" <?php checked( $details->deleted, 0 ); ?> /> <?php _e( 'No' ) ?></label> 154 </td> 155 </tr> 156 </table> 157 <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p> 158 </div> 159 </div> 160 161 <div id="blogedit_blogoptions" class="postbox" > 162 <h3 class="hndle"><span><?php printf( __( 'Site options (%soptions)' ), $blog_prefix ); ?></span></h3> 163 <div class="inside"> 164 <table class="form-table"> 165 <?php 166 $editblog_default_role = 'subscriber'; 167 foreach ( $options as $option ) { 168 if ( $option->option_name == 'default_role' ) 169 $editblog_default_role = $option->option_value; 170 $disabled = false; 171 $class = 'all-options'; 172 if ( is_serialized( $option->option_value ) ) { 173 if ( is_serialized_string( $option->option_value ) ) { 174 $option->option_value = esc_html( maybe_unserialize( $option->option_value ), 'single' ); 175 } else { 176 $option->option_value = 'SERIALIZED DATA'; 177 $disabled = true; 178 $class = 'all-options disabled'; 179 } 180 } 181 if ( strpos( $option->option_value, "\n" ) !== false ) { 182 ?> 183 <tr class="form-field"> 184 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th> 185 <td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php wp_htmledit_pre( $option->option_value ) ?></textarea></td> 186 </tr> 187 <?php 188 } else { 189 ?> 190 <tr class="form-field"> 191 <th scope="row"><?php esc_html_e( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></th> 192 <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?> 193 <td><code><?php esc_html_e( $option->option_value ) ?></code></td> 194 <?php } else { ?> 195 <td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ) ?>]" type="text" id="<?php echo esc_attr( $option->option_name ) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td> 196 <?php } ?> 197 </tr> 198 <?php 199 } 200 } // End foreach 201 ?> 202 </table> 203 <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p> 204 </div> 205 </div> 206 </div> 207 208 <div class="metabox-holder" style="width:49%;float:right;"> 209 <?php 210 // Site Themes 211 $themes = get_themes(); 212 $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id ); 213 $allowed_themes = get_site_option( 'allowedthemes' ); 214 215 if ( ! $allowed_themes ) 216 $allowed_themes = array_keys( $themes ); 217 218 $out = ''; 219 foreach ( $themes as $key => $theme ) { 220 $theme_key = esc_html( $theme['Stylesheet'] ); 221 if ( ! isset( $allowed_themes[$theme_key] ) ) { 222 $checked = isset( $blog_allowed_themes[ $theme_key ] ) ? 'checked="checked"' : ''; 223 $out .= '<tr class="form-field form-required"> 224 <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html( $key ) . '</th> 225 <td><label><input name="theme[' . esc_attr( $theme_key ) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/> ' . __( 'Active' ) . '</label></td> 226 </tr>'; 227 } 228 } 229 230 if ( $out != '' ) { 231 ?> 232 <div id="blogedit_blogthemes" class="postbox"> 233 <h3 class="hndle"><span><?php esc_html_e( 'Site Themes' ); ?></span></h3> 234 <div class="inside"> 235 <p class="description"><?php _e( 'Activate the themename of an existing theme and hit "Update Options" to allow the theme for this site.' ) ?></p> 236 <table class="form-table"> 237 <?php echo $out; ?> 238 </table> 239 <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p> 240 </div></div> 241 <?php } 242 243 // Site users 244 $blogusers = get_users_of_blog( $id ); 245 if ( is_array( $blogusers ) ) { 246 echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __( 'Site Users' ) . '</span></h3><div class="inside">'; 247 echo '<table class="form-table">'; 248 echo "<tr><th>" . __( 'User' ) . "</th><th>" . __( 'Role' ) . "</th><th>" . __( 'Password' ) . "</th><th>" . __( 'Remove' ) . "</th></tr>"; 249 reset( $blogusers ); 250 foreach ( (array) $blogusers as $key => $val ) { 251 if ( isset( $val->meta_value ) && ! $val->meta_value ) 252 continue; 253 $t = @unserialize( $val->meta_value ); 254 if ( is_array( $t ) ) { 255 reset( $t ); 256 $existing_role = key( $t ); 257 } 258 echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>'; 259 if ( $val->user_id != $current_user->data->ID ) { 260 ?> 261 <td> 262 <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php 263 foreach ( $editblog_roles as $role => $role_assoc ){ 264 $name = translate_user_role( $role_assoc['name'] ); 265 echo '<option ' . selected( $role, $existing_role ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>'; 266 } 267 ?> 268 </select> 269 </td> 270 <td> 271 <input type="text" name="user_password[<?php echo esc_attr( $val->user_id ) ?>]" /> 272 </td> 273 <?php 274 echo '<td><input title="' . __( 'Click to remove user' ) . '" type="checkbox" name="blogusers[' . esc_attr( $val->user_id ) . ']" /></td>'; 275 } else { 276 echo "<td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __( 'N/A' ) . "</strong></td>"; 277 } 278 echo '</tr>'; 279 } 280 echo "</table>"; 281 echo '<p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="' . esc_attr__( 'Update Options' ) . '" /></p>'; 282 echo "</div></div>"; 283 } 284 ?> 285 286 <div id="blogedit_blogadduser" class="postbox"> 287 <h3 class="hndle"><span><?php _e( 'Add a new user' ); ?></span></h3> 288 <div class="inside"> 289 <p class="description"><?php _e( 'Enter the username of an existing user and hit "Update Options" to add the user.' ) ?></p> 290 <table class="form-table"> 291 <tr> 292 <th scope="row"><?php _e( 'User Login:' ) ?></th> 293 <td><input type="text" name="newuser" id="newuser" /></td> 102 294 </tr> 103 <tr class="form-field form-required"> 104 <th scope="row"><?php _e('Path') ?></th> 105 <?php if ( $is_main_site ) { ?> 106 <td><?php echo esc_attr($details->path) ?></td> 107 <?php } else { ?> 108 <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr($details->path) ?>" size="40" style='margin-bottom:5px;' /> 109 <br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if ( get_blog_option( $id, 'siteurl' ) == untrailingslashit( get_blogaddress_by_id($id) ) || get_blog_option( $id, 'home' ) == untrailingslashit( get_blogaddress_by_id($id) ) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td> 110 <?php } ?> 111 </tr> 112 <tr class="form-field"> 113 <th scope="row"><?php _e('Registered') ?></th> 114 <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details->registered) ?>" size="40" /></td> 115 </tr> 116 <tr class="form-field"> 117 <th scope="row"><?php _e('Last Updated') ?></th> 118 <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details->last_updated) ?>" size="40" /></td> 119 </tr> 120 <tr class="form-field"> 121 <th scope="row"><?php _e('Public') ?></th> 295 <tr> 296 <th scope="row"><?php _e( 'Role:' ) ?></th> 122 297 <td> 123 <input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if ( $details->public == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 124 <input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if ( $details->public == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 125 </td> 126 </tr> 127 <tr class="form-field"> 128 <th scope="row"><?php _e( 'Archived' ); ?></th> 129 <td> 130 <input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if ( $details->archived == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 131 <input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if ( $details->archived == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 132 </td> 133 </tr> 134 <tr class="form-field"> 135 <th scope="row"><?php _e( 'Mature' ); ?></th> 136 <td> 137 <input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if ( $details->mature == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 138 <input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if ( $details->mature == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 139 </td> 140 </tr> 141 <tr class="form-field"> 142 <th scope="row"><?php _e( 'Spam' ); ?></th> 143 <td> 144 <input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if ( $details->spam == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 145 <input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if ( $details->spam == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 146 </td> 147 </tr> 148 <tr class="form-field"> 149 <th scope="row"><?php _e( 'Deleted' ); ?></th> 150 <td> 151 <input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if ( $details->deleted == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 152 <input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if ( $details->deleted == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 298 <select name="new_role" id="new_role"> 299 <?php 300 reset( $editblog_roles ); 301 foreach ( $editblog_roles as $role => $role_assoc ){ 302 $name = translate_user_role( $role_assoc['name'] ); 303 $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : ''; 304 echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>'; 305 } 306 ?> 307 </select> 153 308 </td> 154 309 </tr> 155 310 </table> 156 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> 157 </div></div> 158 159 <div id="blogedit_blogoptions" class="postbox" > 160 <h3 class='hndle'><span><?php printf( __('Site options (%soptions)'), $blog_prefix ); ?></span></h3> 161 <div class="inside"> 162 <table class="form-table"> 163 <?php 164 $editblog_default_role = 'subscriber'; 165 foreach ( $options as $option ) { 166 if ( $option->option_name == 'default_role' ) 167 $editblog_default_role = $option->option_value; 168 $disabled = false; 169 if ( is_serialized($option->option_value) ) { 170 if ( is_serialized_string($option->option_value) ) { 171 $option->option_value = esc_html(maybe_unserialize($option->option_value), 'single'); 172 } else { 173 $option->option_value = "SERIALIZED DATA"; 174 $disabled = true; 175 } 176 } 177 if ( stristr($option->option_value, "\r") || stristr($option->option_value, "\n") || stristr($option->option_value, "\r\n") ) { 178 ?> 179 <tr class="form-field"> 180 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th> 181 <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" id="<?php echo esc_attr($option->option_name) ?>"<?php disabled( $disabled ) ?>><?php echo esc_html( $option->option_value ) ?></textarea></td> 182 </tr> 183 <?php 184 } else { 185 ?> 186 <tr class="form-field"> 187 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th> 188 <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?> 189 <td><?php echo esc_attr( $option->option_value ) ?></td> 190 <?php } else { ?> 191 <td><input name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td> 192 <?php } ?> 193 </tr> 194 <?php 195 } 196 } // End foreach 197 ?> 198 </table> 199 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> 200 </div></div> 201 </div> 202 203 <div class='metabox-holder' style='width:49%;float:right;'> 204 <?php 205 // Blog Themes 206 $themes = get_themes(); 207 $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id ); 208 $allowed_themes = get_site_option( "allowedthemes" ); 209 if ( ! $allowed_themes ) 210 $allowed_themes = array_keys( $themes ); 211 $out = ''; 212 foreach ( $themes as $key => $theme ) { 213 $theme_key = esc_html( $theme['Stylesheet'] ); 214 if ( ! isset($allowed_themes[$theme_key] ) ) { 215 $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; 216 $out .= '<tr class="form-field form-required"> 217 <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html($key) . '</th> 218 <td><input name="theme[' . esc_attr($theme_key) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td> 219 </tr>'; 220 } 221 } 222 223 if ( $out != '' ) { 224 ?> 225 <div id="blogedit_blogthemes" class="postbox"> 226 <h3 class='hndle'><span><?php esc_html_e('Site Themes'); ?></span></h3> 227 <div class="inside"> 228 <table class="form-table"> 229 <tr><th style="font-weight:bold;"><?php esc_html_e('Theme'); ?></th></tr> 230 <?php echo $out; ?> 231 </table> 232 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> 233 </div></div> 234 <?php } ?> 235 236 <?php 237 // Blog users 238 $blogusers = get_users_of_blog( $id ); 239 if ( is_array( $blogusers ) ) { 240 echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __('Site Users') . '</span></h3><div class="inside">'; 241 echo '<table class="form-table">'; 242 echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th></tr>"; 243 reset($blogusers); 244 foreach ( (array) $blogusers as $key => $val ) { 245 if ( isset( $val->meta_value ) && ! $val->meta_value ) 246 continue; 247 $t = @unserialize( $val->meta_value ); 248 if ( is_array( $t ) ) { 249 reset( $t ); 250 $existing_role = key( $t ); 251 } 252 echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>'; 253 if ( $val->user_id != $current_user->data->ID ) { 254 ?> 255 <td> 256 <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php 257 foreach ( $editblog_roles as $role => $role_assoc ){ 258 $name = translate_user_role($role_assoc['name']); 259 $selected = ( $role == $existing_role ) ? 'selected="selected"' : ''; 260 echo "<option {$selected} value=\"" . esc_attr($role) . "\">{$name}</option>"; 261 } 262 ?> 263 </select> 264 </td> 265 <td> 266 <input type='text' name='user_password[<?php echo esc_attr($val->user_id) ?>]' /> 267 </td> 268 <?php 269 echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . esc_attr($val->user_id) . ']" /></td>'; 270 } else { 271 echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>"; 272 } 273 echo '</tr>'; 274 } 275 echo "</table>"; 276 echo '<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="' . esc_attr__('Update Options') . '" /></p>'; 277 echo "</div></div>"; 278 } 279 ?> 280 281 <div id="blogedit_blogadduser" class="postbox"> 282 <h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3> 283 <div class="inside"> 284 <p style="margin:10px 0 0px;padding:0px 10px 10px;border-bottom:1px solid #DFDFDF;"><?php _e('Enter the username of an existing user and hit <em>Update Options</em> to add the user.') ?></p> 285 <table class="form-table"> 286 <tr> 287 <th scope="row"><?php _e('User Login:') ?></th> 288 <td><input type="text" name="newuser" id="newuser" /></td> 289 </tr> 290 <tr> 291 <th scope="row"><?php _e('Role:') ?></th> 292 <td> 293 <select name="new_role" id="new_role"> 294 <?php 295 reset( $editblog_roles ); 296 foreach ( $editblog_roles as $role => $role_assoc ){ 297 $name = translate_user_role( $role_assoc['name'] ); 298 $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : ''; 299 echo "<option {$selected} value=\"" . esc_attr($role) . "\">{$name}</option>"; 300 } 301 ?> 302 </select> 303 </td> 304 </tr> 311 <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p> 312 </div> 313 </div> 314 315 <div id="blogedit_miscoptions" class="postbox"> 316 <h3 class="hndle"><span><?php _e( 'Misc Site Actions' ) ?></span></h3> 317 <div class="inside"> 318 <table class="form-table"> 319 <?php do_action( 'wpmueditblogaction', $id ); ?> 305 320 </table> 306 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> 307 </div></div> 308 309 <div id="blogedit_miscoptions" class="postbox"> 310 <h3 class='hndle'><span><?php _e('Misc Site Actions') ?></span></h3> 311 <div class="inside"> 312 <table class="form-table"> 313 <?php do_action( 'wpmueditblogaction', $id ); ?> 314 </table> 315 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> 316 </div></div> 317 321 <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p> 322 </div> 323 </div> 318 324 </div> 319 325 … … 324 330 break; 325 331 326 // List blogs332 // List sites 327 333 case 'list': 328 334 default: … … 337 343 $per_page = apply_filters( 'ms_sites_per_page', $per_page ); 338 344 339 $s = isset( $_GET['s']) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';345 $s = isset( $_GET['s'] ) ? stripslashes( trim( $_GET[ 's' ] ) ) : ''; 340 346 $like_s = esc_sql( like_escape( $s ) ); 341 347 342 348 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; 343 344 if ( isset( $_GET['blogstatus'] ) ) {345 if ( 'deleted' == $_GET['blogstatus'] ) {346 $query .= " AND {$wpdb->blogs}.deleted = '1' ";347 } elseif ( 'archived' == $_GET['blogstatus'] ) {348 $query .= " AND {$wpdb->blogs}.archived = '1' ";349 } elseif ( 'spam' == $_GET['blogstatus'] ) {350 $query .= " AND {$wpdb->blogs}.spam = '1' ";351 }352 }353 349 354 350 if ( isset( $_GET['searchaction'] ) ) { … … 381 377 $query .= $order; 382 378 383 $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(blog_id)', $query) );384 385 $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page );379 $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(blog_id)', $query ) ); 380 381 $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page ); 386 382 $blog_list = $wpdb->get_results( $query, ARRAY_A ); 387 383 … … 390 386 'base' => add_query_arg( 'paged', '%#%' ), 391 387 'format' => '', 392 'prev_text' => __( '«'),393 'next_text' => __( '»'),388 'prev_text' => __( '«' ), 389 'next_text' => __( '»' ), 394 390 'total' => $num_pages, 395 391 'current' => $pagenum 396 392 )); 397 393 398 if ( empty( $_GET['mode']) )394 if ( empty( $_GET['mode'] ) ) 399 395 $mode = 'list'; 400 396 else 401 397 $mode = esc_attr( $_GET['mode'] ); 402 403 // for subsubsub and $blog_list404 $status_list = array( 'archived' => array( 'site-archived', __('Archived') ), 'spam' => array( 'site-spammed', __('Spam') ), 'deleted' => array( 'site-deleted', __('Deleted') ) );405 398 ?> 406 399 … … 408 401 <?php screen_icon(); ?> 409 402 <h2><?php _e('Sites') ?> 410 <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites'); ?></a>403 <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites' ); ?></a> 411 404 <?php 412 if ( isset( $_GET['s']) && $_GET['s'] )413 printf( '<span class="subtitle">' . __( 'Search results for “%s”') . '</span>', esc_html( $s ) );405 if ( isset( $_GET['s'] ) && $_GET['s'] ) 406 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); 414 407 ?> 415 408 </h2> 416 417 <ul class="subsubsub">418 <?php419 $status_links = array();420 $status_class = '';421 $count = get_blog_count();422 423 if ( empty($_GET['blogstatus']) || $_GET['blogstatus'] == 'all' )424 $status_class = ' class="current"';425 426 $status_links[] = "<li><a href='ms-sites.php?blogstatus=all'$status_class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'sites' ), number_format_i18n( $count ) ) . '</a>';427 428 foreach ( $status_list as $status => $col ) {429 $status_class = '';430 431 if ( empty( $count->$status ) )432 continue;433 434 if ( isset( $_GET['blogstatus'] ) && ( $_GET['blogstatus'] == $status ) )435 $status_class = ' class="current"';436 437 $status_links[] = "<li><a href='ms-sites.php?blogstatus=$status'$status_class>" . sprintf( $col[1] . ' <span class="count">(%s)</span>' , number_format_i18n( $count->$status ) ) . '</a>';438 };439 440 echo implode( " |</li>\n", $status_links ) . '</li>';441 unset( $status_links );442 ?>443 </ul>444 409 445 410 <form action="ms-sites.php" method="get" id="ms-search"> 446 411 <p class="search-box"> 447 412 <input type="hidden" name="action" value="blogs" /> 448 <input type="text" name="s" value="<?php e sc_attr_e( $s ); ?>" />449 <input type="submit" class="button" value="<?php esc_attr_e( 'Search Site by') ?>" />413 <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" /> 414 <input type="submit" class="button" value="<?php esc_attr_e( 'Search Site by' ) ?>" /> 450 415 <select name="searchaction"> 451 <option value="name" selected="selected"><?php _e( 'Name'); ?></option>452 <option value="id"><?php _e( 'ID'); ?></option>453 <option value="ip"><?php _e( 'IP address'); ?></option>416 <option value="name" selected="selected"><?php _e( 'Name' ); ?></option> 417 <option value="id"><?php _e( 'ID' ); ?></option> 418 <option value="ip"><?php _e( 'IP address' ); ?></option> 454 419 </select> 455 420 </p> … … 457 422 458 423 <form id="form-site-list" action="ms-edit.php?action=allblogs" method="post"> 459 <input type="hidden" name="mode" value="<?php echo esc_attr( $mode); ?>" />424 <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" /> 460 425 <div class="tablenav"> 461 426 <div class="alignleft actions"> 462 427 <select name="action"> 463 <option value="-1" selected="selected"><?php _e( 'Bulk Actions'); ?></option>464 <option value="delete"><?php _e( 'Delete'); ?></option>465 <option value="spam"><?php _e( 'Mark as Spam'); ?></option>466 <option value="notspam"><?php _e( 'Not Spam'); ?></option>428 <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option> 429 <option value="delete"><?php _e( 'Delete' ); ?></option> 430 <option value="spam"><?php _e( 'Mark as Spam' ); ?></option> 431 <option value="notspam"><?php _e( 'Not Spam' ); ?></option> 467 432 </select> 468 <input type="submit" value="<?php esc_attr_e( 'Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />469 <?php wp_nonce_field( 'bulk-sites'); ?>433 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" /> 434 <?php wp_nonce_field( 'bulk-ms-sites' ); ?> 470 435 </div> 471 436 … … 482 447 483 448 <div class="view-switch"> 484 <a href="<?php echo esc_url( add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>485 <a href="<?php echo esc_url( add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>449 <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'List View' ) ?>" alt="<?php _e( 'List View' ) ?>" /></a> 450 <a href="<?php echo esc_url( add_query_arg( 'mode', 'excerpt', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'Excerpt View' ) ?>" alt="<?php _e( 'Excerpt View' ) ?>" /></a> 486 451 </div> 487 452 … … 492 457 <?php 493 458 // define the columns to display, the syntax is 'internal name' => 'display name' 494 $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain') : __('Path');495 $ posts_columns = array(496 'id' => __( 'ID'),459 $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' ); 460 $sites_columns = array( 461 'id' => __( 'ID' ), 497 462 'blogname' => $blogname_columns, 498 'lastupdated' => __( 'Last Updated'),499 'registered' => __( 'Registered'),500 'users' => __( 'Users')463 'lastupdated' => __( 'Last Updated'), 464 'registered' => __( 'Registered' ), 465 'users' => __( 'Users' ) 501 466 ); 502 467 503 468 if ( has_filter( 'wpmublogsaction' ) ) 504 $ posts_columns['plugins'] = __('Actions');505 506 $ posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);469 $sites_columns['plugins'] = __( 'Actions' ); 470 471 $sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns ); 507 472 ?> 508 473 … … 510 475 <thead> 511 476 <tr> 512 <th style=""class="manage-column column-cb check-column" id="cb" scope="col">477 <th class="manage-column column-cb check-column" id="cb" scope="col"> 513 478 <input type="checkbox" /> 514 479 </th> 515 480 <?php 516 foreach($posts_columns as $column_id => $column_display_name) { 481 $col_url = ''; 482 foreach($sites_columns as $column_id => $column_display_name) { 517 483 $column_link = "<a href='"; 518 484 $order2 = ''; 519 485 if ( $order_by == $column_id ) 520 $order2 = ( $order == 'DESC') ? 'ASC' : 'DESC';521 522 $column_link .= esc_url( add_query_arg( array('order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), $_SERVER['REQUEST_URI']) );486 $order2 = ( $order == 'DESC' ) ? 'ASC' : 'DESC'; 487 488 $column_link .= esc_url( add_query_arg( array( 'order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) ); 523 489 $column_link .= "'>{$column_display_name}</a>"; 524 $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link; 525 ?> 526 <th scope="col"> 527 <?php echo $col_url ?> 528 </th> 529 <?php } ?> 490 $col_url .= '<th scope="col">' . ( ( $column_id == 'users' || $column_id == 'plugins' ) ? $column_display_name : $column_link ) . '</th>'; 491 } 492 echo $col_url ?> 530 493 </tr> 531 494 </thead> 532 495 <tfoot> 533 496 <tr> 534 <th class="manage-column column-cb check-column" id="cb " scope="col">497 <th class="manage-column column-cb check-column" id="cb1" scope="col"> 535 498 <input type="checkbox" /> 536 499 </th> 537 <?php foreach($posts_columns as $column_id => $column_display_name) {538 $column_link = "<a href='";539 $order2 = '';540 if ( $order_by == $column_id )541 $order2 = ($order == 'DESC') ? 'ASC' : 'DESC';542 543 $column_link .= esc_url(add_query_arg( array('order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) );544 $column_link .= "'>{$column_display_name}</a>";545 $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;546 ?>547 <th scope="col">548 500 <?php echo $col_url ?> 549 </th>550 <?php } ?>551 501 </tr> 552 502 </tfoot> 553 <tbody id="the- list">503 <tbody id="the-site-list" class="list:site"> 554 504 <?php 505 $status_list = array( 'archived' => array( 'site-archived', __( 'Archived' ) ), 'spam' => array( 'site-spammed', __( 'Spam' ) ), 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 'mature' => array( 'site-mature', __( 'Mature' ) ) ); 555 506 if ( $blog_list ) { 556 507 $class = ''; 557 508 foreach ( $blog_list as $blog ) { 558 $class = ( 'alternate' == $class) ? '' : 'alternate';509 $class = ( 'alternate' == $class ) ? '' : 'alternate'; 559 510 reset( $status_list ); 560 511 … … 567 518 } 568 519 $blog_state = ''; 569 if ( ! empty( $blog_states) ) {570 $state_count = count( $blog_states);520 if ( ! empty( $blog_states ) ) { 521 $state_count = count( $blog_states ); 571 522 $i = 0; 572 523 $blog_state .= ' - '; … … 579 530 echo "<tr class='$class'>"; 580 531 581 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain']) : $blog['path'];582 foreach ( $ posts_columns as $column_name=>$column_display_name ) {532 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 533 foreach ( $sites_columns as $column_name=>$column_display_name ) { 583 534 switch ( $column_name ) { 584 535 case 'id': ?> 585 536 <th scope="row" class="check-column"> 586 <input type= 'checkbox' id='blog_<?php echo $blog['blog_id'] ?>' name='allblogs[]' value='<?php echo esc_attr($blog['blog_id']) ?>'/>537 <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" /> 587 538 </th> 588 539 <th valign="top" scope="row"> … … 594 545 case 'blogname': ?> 595 546 <td class="column-title"> 596 <a href=" ms-sites.php?action=editblog&id=<?php echo $blog['blog_id']?>" class="edit"><?php echo $blogname . $blog_state; ?></a>547 <a href="<?php echo esc_url( admin_url( 'ms-sites.php?action=editblog&id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a> 597 548 <?php 598 549 if ( 'list' != $mode ) … … 600 551 601 552 $actions = array(); 602 $actions[] = '<a href="ms-sites.php?action=editblog&id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>'; 603 $actions[] = "<a href='" . get_admin_url($blog['blog_id']) . "' class='edit'>" . __('Backend') . '</a>'; 604 605 if ( get_blog_status( $blog['blog_id'], "deleted" ) == '1' ) 606 $actions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=activateblog&ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to activate the site %s" ), $blogname ) ) . '">' . __('Activate') . '</a>'; 607 else 608 $actions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=deactivateblog&ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to deactivate the site %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>'; 609 610 if ( get_blog_status( $blog['blog_id'], "archived" ) == '1' ) 611 $actions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unarchive the site %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>'; 612 else 613 $actions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to archive the site %s" ), $blogname ) ) . '">' . __('Archive') . '</a>'; 614 615 if ( get_blog_status( $blog['blog_id'], "spam" ) == '1' ) 616 $actions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unspam the site %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>'; 617 else 618 $actions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to mark the site %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>'; 619 620 $actions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to delete the site %s" ), $blogname ) ) . '">' . __("Delete") . '</a>'; 621 622 $actions[] = "<a href='" . get_home_url($blog['blog_id']) . "' rel='permalink'>" . __('Visit') . '</a>'; 623 ?> 624 625 <?php if ( count($actions) ) : ?> 553 $actions[] = '<span class="edit"><a href="' . esc_url( admin_url( 'ms-sites.php?action=editblog&id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a><span>'; 554 $actions[] = "<span class='backend'><a href='" . esc_url( get_admin_url($blog['blog_id']) ) . "' class='edit'>" . __( 'Backend' ) . '</a></span>'; 555 if ( $current_site->blog_id != $blog['blog_id'] ) { 556 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) 557 $actions[] = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to activate the site %s" ), $blogname ) ) ) ) . '">' . __( 'Activate' ) . '</a></span>'; 558 else 559 $actions[] = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to deactivate the site %s" ), $blogname ) ) ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 560 561 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' ) 562 $actions[] = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unarchive the site %s." ), $blogname ) ) ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 563 else 564 $actions[] = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to archive the site %s." ), $blogname ) ) ) ) . '">' . __( 'Archive' ) . '</a></span>'; 565 566 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' ) 567 $actions[] = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unspam the site %s." ), $blogname ) ) ) ) . '">' . __( 'Not Spam' ) . '</a></span>'; 568 else 569 $actions[] = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to mark the site %s as spam." ), $blogname ) ) ) ) . '">' . __( 'Spam' ) . '</a></span>'; 570 571 if ( get_blog_status( $blog['blog_id'], 'mature' ) == '1' ) 572 $actions[] = '<span class="mature"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=unmatureblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unmature the site %s." ), $blogname ) ) ) ) . '">' . __( 'Not Mature' ) . '</a></span>'; 573 else 574 $actions[] = '<span class="mature"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=matureblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to mark the site %s as mature." ), $blogname ) ) ) ) . '">' . __( 'Mature' ) . '</a></span>'; 575 576 $actions[] = '<span class="delete"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to delete the site %s." ), $blogname ) ) ) ) . '">' . __( 'Delete' ) . '</a></span>'; 577 } 578 579 $actions[] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'] ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a>'; 580 581 if ( count( $actions ) ) : ?> 626 582 <div class="row-actions"> 627 <?php echo implode( ' | ', $actions); ?>583 <?php echo implode( ' | ', $actions ); ?> 628 584 </div> 629 585 <?php endif; ?> … … 639 595 else 640 596 $date = 'Y/m/d \<\b\r \/\> g:i:s a'; 641 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( "Never") : mysql2date( __( $date ), $blog['last_updated'] ); ?>597 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( __( $date ), $blog['last_updated'] ); ?> 642 598 </td> 643 599 <?php … … 645 601 case 'registered': ?> 646 602 <td valign="top"> 647 <?php echo mysql2date(__( $date ), $blog['registered'] ); ?> 603 <?php 604 if ( $blog['registered'] == '0000-00-00 00:00:00' ) 605 echo '—'; 606 else 607 echo mysql2date( __( $date ), $blog['registered'] ); 608 ?> 648 609 </td> 649 610 <?php … … 657 618 if ( count( $blogusers ) > 5 ) { 658 619 $blogusers = array_slice( $blogusers, 0, 5 ); 659 $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . get_admin_url($blog['blog_id'], 'users.php') . '">' . __( 'More' ) . '</a>';620 $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . esc_url( get_admin_url( $blog['blog_id'], 'users.php' ) ) . '">' . __( 'More' ) . '</a>'; 660 621 } 661 622 foreach ( $blogusers as $key => $val ) { 662 echo '<a href=" user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login. '</a> ';623 echo '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $val->user_id ) ) . '">' . esc_html( $val->user_login ) . '</a> '; 663 624 if ( 'list' != $mode ) 664 625 echo '(' . $val->user_email . ')'; … … 676 637 <?php if ( has_filter( 'wpmublogsaction' ) ) { ?> 677 638 <td valign="top"> 678 <?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?>639 <?php do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> 679 640 </td> 680 641 <?php } ?> … … 684 645 <?php if ( has_filter( 'manage_blogs_custom_column' ) ) { ?> 685 646 <td valign="top"> 686 <?php do_action( 'manage_blogs_custom_column', $column_name, $blog['blog_id']); ?>647 <?php do_action( 'manage_blogs_custom_column', $column_name, $blog['blog_id'] ); ?> 687 648 </td> 688 649 <?php } ?> … … 696 657 } else { ?> 697 658 <tr> 698 <td colspan=" 8"><?php _e('No blogs found.') ?></td>659 <td colspan="<?php echo (int) count( $sites_columns ); ?>"><?php _e( 'No blogs found.' ) ?></td> 699 660 </tr> 700 661 <?php … … 712 673 <div class="alignleft actions"> 713 674 <select name="action2"> 714 <option value="-1" selected="selected"><?php _e( 'Bulk Actions'); ?></option>715 <option value="delete"><?php _e( 'Delete'); ?></option>716 <option value="spam"><?php _e( 'Mark as Spam'); ?></option>717 <option value="notspam"><?php _e( 'Not Spam'); ?></option>675 <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option> 676 <option value="delete"><?php _e( 'Delete' ); ?></option> 677 <option value="spam"><?php _e( 'Mark as Spam' ); ?></option> 678 <option value="notspam"><?php _e( 'Not Spam' ); ?></option> 718 679 </select> 719 <input type="submit" value="<?php esc_attr_e( 'Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />680 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 720 681 </div> 721 682 <br class="clear" /> … … 727 688 <div class="wrap"> 728 689 <a name="form-add-site"></a> 729 <h2><?php _e( 'Add Site') ?></h2>690 <h2><?php _e( 'Add Site' ) ?></h2> 730 691 <form method="post" action="ms-edit.php?action=addblog"> 731 <?php wp_nonce_field( 'add-blog') ?>692 <?php wp_nonce_field( 'add-blog' ) ?> 732 693 <table class="form-table"> 733 694 <tr class="form-field form-required"> 734 <th scope= 'row'><?php _e('Site Address') ?></th>695 <th scope="row"><?php _e( 'Site Address' ) ?></th> 735 696 <td> 736 697 <?php if ( is_subdomain_install() ) { ?> 737 <input name="blog[domain]" type="text" class="regular-text" title="<?php _e( 'Domain') ?>"/>.<?php echo $current_site->domain;?>698 <input name="blog[domain]" type="text" class="regular-text" title="<?php _e( 'Domain' ) ?>"/>.<?php echo $current_site->domain;?> 738 699 <?php } else { 739 echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php _e( 'Domain') ?>"/>700 echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php _e( 'Domain' ) ?>"/> 740 701 <?php } 741 echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";702 echo '<p>' . __( 'Only the characters a-z and 0-9 recommended.' ) . '</p>'; 742 703 ?> 743 704 </td> 744 705 </tr> 745 706 <tr class="form-field form-required"> 746 <th scope= 'row'><?php _e('Site Title') ?></th>747 <td><input name="blog[title]" type="text" class="regular-text" title="<?php _e( 'Title') ?>"/></td>707 <th scope="row"><?php _e( 'Site Title' ) ?></th> 708 <td><input name="blog[title]" type="text" class="regular-text" title="<?php _e( 'Title' ) ?>"/></td> 748 709 </tr> 749 710 <tr class="form-field form-required"> 750 <th scope= 'row'><?php _e('Admin Email') ?></th>751 <td><input name="blog[email]" type="text" class="regular-text" title="<?php _e( 'Email') ?>"/></td>711 <th scope="row"><?php _e( 'Admin Email' ) ?></th> 712 <td><input name="blog[email]" type="text" class="regular-text" title="<?php _e( 'Email' ) ?>"/></td> 752 713 </tr> 753 714 <tr class="form-field"> 754 <td colspan= '2'><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td>715 <td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td> 755 716 </tr> 756 717 </table> 757 718 <p class="submit"> 758 <input class="button" type="submit" name="go" value="<?php esc_attr_e( 'Add Site') ?>" /></p>719 <input class="button" type="submit" name="go" value="<?php esc_attr_e( 'Add Site' ) ?>" /></p> 759 720 </form> 760 721 </div> … … 763 724 } // end switch( $action ) 764 725 765 include( 'admin-footer.php'); ?>726 include( './admin-footer.php' ); ?> -
trunk/wp-admin/ms-themes.php
r13771 r13918 1 1 <?php 2 require_once( 'admin.php');2 require_once( './admin.php' ); 3 3 4 $title = __( 'Network Themes');4 $title = __( 'Network Themes' ); 5 5 $parent_file = 'ms-admin.php'; 6 require_once( 'admin-header.php');6 require_once( './admin-header.php' ); 7 7 8 8 if ( ! current_user_can( 'manage_network_themes' ) ) 9 wp_die( __( 'You do not have permission to access this page.') );9 wp_die( __( 'You do not have permission to access this page.' ) ); 10 10 11 if ( isset( $_GET['updated']) ) {11 if ( isset( $_GET['updated'] ) ) { 12 12 ?> 13 <div id="message" class="updated fade"><p><?php _e( 'Site themes saved.') ?></p></div>13 <div id="message" class="updated fade"><p><?php _e( 'Site themes saved.' ) ?></p></div> 14 14 <?php 15 15 } … … 19 19 ?> 20 20 <div class="wrap"> 21 <form action= 'ms-edit.php?action=updatethemes' method='post'>21 <form action="<?php echo esc_url( admin_url( 'ms-edit.php?action=updatethemes' ) ); ?>" method="post"> 22 22 <?php screen_icon(); ?> 23 <h2><?php _e( 'Network Themes') ?></h2>24 <p><?php _e( 'Disable themes network-wide. You can enable themes on a site by site basis.') ?></p>23 <h2><?php _e( 'Network Themes' ) ?></h2> 24 <p><?php _e( 'Disable themes network-wide. You can enable themes on a site by site basis.' ) ?></p> 25 25 <table class="widefat"> 26 26 <thead> 27 27 <tr> 28 <th style="width:15%;text-align:center;"><?php _e( 'Active') ?></th>29 <th style="width:25%;"><?php _e( 'Theme') ?></th>30 <th style="width:10%;"><?php _e( 'Version') ?></th>31 <th style="width:60%;"><?php _e( 'Description') ?></th>28 <th style="width:15%;text-align:center;"><?php _e( 'Active' ) ?></th> 29 <th style="width:25%;"><?php _e( 'Theme' ) ?></th> 30 <th style="width:10%;"><?php _e( 'Version' ) ?></th> 31 <th style="width:60%;"><?php _e( 'Description' ) ?></th> 32 32 </tr> 33 33 </thead> … … 38 38 foreach ( (array) $themes as $key => $theme ) { 39 39 $total_theme_count++; 40 $theme_key = esc_html( $theme['Stylesheet']);41 $class = ( 'alt' == $class) ? '' : 'alt';40 $theme_key = esc_html( $theme['Stylesheet'] ); 41 $class = ( 'alt' == $class ) ? '' : 'alt'; 42 42 $class1 = $enabled = $disabled = ''; 43 $enabled = $disabled = false; 43 44 44 if ( isset( $allowed_themes[ $theme_key] ) == true ) {45 $enabled = 'checked="checked" ';45 if ( isset( $allowed_themes[$theme_key] ) == true ) { 46 $enabled = true; 46 47 $activated_themes_count++; 47 $class1 = ' 48 $class1 = 'active'; 48 49 } else { 49 $disabled = 'checked="checked" ';50 $disabled = true; 50 51 } 51 52 ?> 52 <tr valign="top" class="<?php echo $class .$class1; ?>">53 <tr valign="top" class="<?php echo $class, $class1; ?>"> 53 54 <td style="text-align:center;"> 54 <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="enabled_<?php echo $theme_key ?>" value="enabled" <?php echo $enabled ?> /> <?php _e('Yes') ?></label>55 <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="enabled_<?php echo $theme_key ?>" value="enabled" <?php checked( $enabled ) ?> /> <?php _e( 'Yes' ) ?></label> 55 56 56 <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="disabled_<?php echo $theme_key ?>" value="disabled" <?php echo $disabled ?> /> <?php _e('No') ?></label>57 <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="disabled_<?php echo $theme_key ?>" value="disabled" <?php checked( $disabled ) ?> /> <?php _e( 'No' ) ?></label> 57 58 </td> 58 59 <th scope="row" style="text-align:left;"><?php echo $key ?></th> … … 65 66 66 67 <p class="submit"> 67 <input type= 'submit' value='<?php _e('Update Themes') ?>'/></p>68 <input type="submit" value="<?php _e( 'Update Themes' ) ?>" /></p> 68 69 </form> 69 70 70 <h3><?php _e( 'Total')?></h3>71 <h3><?php _e( 'Total' )?></h3> 71 72 <p> 72 <?php printf( __('Themes Installed: %d'), $total_theme_count); ?>73 <?php printf( __( 'Themes Installed: %d' ), $total_theme_count); ?> 73 74 <br /> 74 <?php printf( __('Themes Activated: %d'), $activated_themes_count); ?>75 <?php printf( __( 'Themes Activated: %d' ), $activated_themes_count); ?> 75 76 </p> 76 77 </div> 77 78 78 <?php include( 'admin-footer.php'); ?>79 <?php include( './admin-footer.php' ); ?> -
trunk/wp-admin/ms-users.php
r13733 r13918 1 1 <?php 2 require_once( 'admin.php');2 require_once( './admin.php' ); 3 3 4 4 if ( !is_multisite() ) 5 wp_die( __( 'Multisite support is not enabled.') );6 7 $title = __( 'Users');5 wp_die( __( 'Multisite support is not enabled.' ) ); 6 7 $title = __( 'Users' ); 8 8 $parent_file = 'ms-admin.php'; 9 9 10 10 wp_enqueue_script( 'admin-forms' ); 11 11 12 require_once( 'admin-header.php');12 require_once( './admin-header.php' ); 13 13 14 14 if ( ! current_user_can( 'manage_network_users' ) ) 15 wp_die( __( 'You do not have permission to access this page.') );16 17 if ( isset( $_GET['updated']) && $_GET['updated'] == 'true') {15 wp_die( __( 'You do not have permission to access this page.' ) ); 16 17 if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) { 18 18 ?> 19 19 <div id="message" class="updated fade"><p> 20 20 <?php 21 switch ( $_GET['action']) {21 switch ( $_GET['action'] ) { 22 22 case 'delete': 23 _e( 'User deleted !');23 _e( 'User deleted.' ); 24 24 break; 25 25 case 'all_spam': 26 _e( 'Users marked as spam !');26 _e( 'Users marked as spam.' ); 27 27 break; 28 28 case 'all_notspam': 29 _e( 'Users marked as not spam !');29 _e( 'Users marked as not spam.' ); 30 30 break; 31 31 case 'all_delete': 32 _e( 'Users deleted !');32 _e( 'Users deleted.' ); 33 33 break; 34 34 case 'add': 35 _e( 'User added !');35 _e( 'User added.' ); 36 36 break; 37 37 case 'add_superadmin': 38 _e( 'Network admin added !');38 _e( 'Network admin added.' ); 39 39 break; 40 40 case 'remove_superadmin': 41 _e( 'Network admin removed !');41 _e( 'Network admin removed.' ); 42 42 break; 43 43 } … … 46 46 <?php 47 47 } 48 ?> 49 50 <div class="wrap" style="position:relative;"> 51 <?php 52 $apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1; 53 $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 15; 54 $s = isset($_GET[ 's' ]) ? esc_attr( trim( $_GET[ 's' ] ) ) : ''; 48 49 $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0; 50 if ( empty( $pagenum ) ) 51 $pagenum = 1; 52 53 $per_page = (int) get_user_option( 'ms_users_per_page' ); 54 if ( empty( $per_page ) || $per_page < 1 ) 55 $per_page = 15; 56 57 $per_page = apply_filters( 'ms_users_per_page', $per_page ); 58 59 $s = isset( $_GET['s'] ) ? stripslashes( trim( $_GET[ 's' ] ) ) : ''; 60 $like_s = esc_sql( like_escape( $s ) ); 55 61 56 62 $query = "SELECT * FROM {$wpdb->users}"; 57 63 58 if ( !empty( $s ) ) { 59 $search = '%' . trim( $s ) . '%'; 60 $query .= " WHERE user_login LIKE '$search' OR user_email LIKE '$search'"; 64 if ( !empty( $like_s ) ) { 65 $query .= " WHERE user_login LIKE '%$like_s%' OR user_email LIKE '%$like_s%'"; 61 66 } 62 67 63 68 $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id'; 64 65 69 if ( $order_by == 'email' ) { 66 70 $query .= ' ORDER BY user_email '; … … 76 80 } 77 81 78 $order = isset($_GET['order']) ? $_GET['order'] : 'ASC'; 79 $order = ( 'DESC' == $order ) ? 'DESC' : 'ASC'; 82 $order = ( isset( $_GET['order'] ) && 'DESC' == $_GET['order'] ) ? 'DESC' : 'ASC'; 80 83 $query .= $order; 81 84 82 if ( !empty( $s ) ) 83 $total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(ID)', $query) ); 85 $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(ID)', $query ) ); 86 87 $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page) . ", " . intval( $per_page ); 88 89 $user_list = $wpdb->get_results( $query, ARRAY_A ); 90 91 $num_pages = ceil( $total / $per_page ); 92 $page_links = paginate_links( array( 93 'base' => add_query_arg( 'paged', '%#%' ), 94 'format' => '', 95 'prev_text' => __( '«' ), 96 'next_text' => __( '»' ), 97 'total' => $num_pages, 98 'current' => $pagenum 99 )); 100 101 if ( empty( $_GET['mode'] ) ) 102 $mode = 'list'; 84 103 else 85 $total = $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->users}"); 86 87 $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num ); 88 89 $user_list = $wpdb->get_results( $query, ARRAY_A ); 90 91 // Pagination 92 $user_navigation = paginate_links( array( 93 'total' => ceil($total / $num), 94 'current' => $apage, 95 'base' => add_query_arg( 'apage', '%#%' ), 96 'format' => '' 97 )); 98 99 if ( $user_navigation ) { 100 $user_navigation = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', 101 number_format_i18n( ( $apage - 1 ) * $num + 1 ), 102 number_format_i18n( min( $apage * $num, $total ) ), 103 number_format_i18n( $total ), 104 $user_navigation 105 ); 106 } 104 $mode = esc_attr( $_GET['mode'] ); 107 105 108 106 ?> 109 107 <div class="wrap"> 110 108 <?php screen_icon(); ?> 111 <h2><?php esc_html_e("Users"); ?></h2> 109 <h2><?php esc_html_e( 'Users' ); ?> 110 <a href="#form-add-user" class="button add-new-h2"><?php echo esc_html_x( 'Add New' , 'users'); ?></a> 111 <?php 112 if ( isset( $_GET['s'] ) && $_GET['s'] ) 113 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); 114 ?> 115 </h2> 116 112 117 <form action="ms-users.php" method="get" class="search-form"> 113 118 <p class="search-box"> 114 <input type="text" name="s" value="<?php if ( isset($_GET['s']) ) esc_attr( stripslashes( $s )); ?>" class="search-input" id="user-search-input" />115 <input type="submit" id="post-query-submit" value="<?php esc_attr_e( 'Search Users') ?>" class="button" />119 <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" class="search-input" id="user-search-input" /> 120 <input type="submit" id="post-query-submit" value="<?php esc_attr_e( 'Search Users' ) ?>" class="button" /> 116 121 </p> 117 122 </form> 118 </div>119 123 120 124 <form id="form-user-list" action='ms-edit.php?action=allusers' method='post'> 125 <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" /> 121 126 <div class="tablenav"> 122 <?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?>123 124 127 <div class="alignleft actions"> 125 <input type="submit" value="<?php esc_attr_e('Delete') ?>" name="alluser_delete" class="button-secondary delete" /> 126 <input type="submit" value="<?php esc_attr_e('Mark as Spammers') ?>" name="alluser_spam" class="button-secondary" /> 127 <input type="submit" value="<?php esc_attr_e('Not Spam') ?>" name="alluser_notspam" class="button-secondary" /> 128 <input type="submit" value="<?php esc_attr_e('Add Network Admins') ?>" name="add_superadmin" class="button-secondary" /> 129 <input type="submit" value="<?php esc_attr_e('Remove Network Admins') ?>" name="remove_superadmin" class="button-secondary" /> 130 <?php wp_nonce_field( 'allusers' ); ?> 131 <br class="clear" /> 128 <select name="action"> 129 <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option> 130 <option value="delete"><?php _e( 'Delete' ); ?></option> 131 <option value="spam"><?php _e( 'Mark as Spammers' ); ?></option> 132 <option value="notspam"><?php _e( 'Not Spam' ); ?></option> 133 <option value="superadmin"><?php _e( 'Add Super Admins' ); ?></option> 134 <option value="notsuperadmin"><?php _e( 'Remove Super Admins' ); ?></option> 135 </select> 136 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" /> 137 <?php wp_nonce_field( 'bulk-ms-users' ); ?> 138 </div> 139 140 <?php if ( $page_links ) { ?> 141 <div class="tablenav-pages"> 142 <?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', 143 number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ), 144 number_format_i18n( min( $pagenum * $per_page, $num_pages ) ), 145 number_format_i18n( $num_pages ), 146 $page_links 147 ); echo $page_links_text; ?> 148 </div> 149 <?php } ?> 150 151 <div class="view-switch"> 152 <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'List View' ) ?>" alt="<?php _e( 'List View' ) ?>" /></a> 153 <a href="<?php echo esc_url( add_query_arg( 'mode', 'excerpt', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'Excerpt View' ) ?>" alt="<?php _e( 'Excerpt View' ) ?>" /></a> 132 154 </div> 133 155 </div> 134 135 <?php if ( isset($_GET['s']) && $_GET['s'] != '' ) : ?> 136 <p><a href="ms-sites.php?action=blogs&s=<?php echo urlencode( stripslashes( $s ) ); ?>&blog_name=Search+blogs+by+name"><?php _e('Search Sites for') ?> <strong><?php echo stripslashes( $s ) ?></strong></a></p> 137 <?php endif; ?> 156 <div class="clear"></div> 138 157 139 158 <?php 140 159 // define the columns to display, the syntax is 'internal name' => 'display name' 141 $ posts_columns = array(142 ' checkbox' => '',143 'login' => __( 'Username'),144 'name' => __( 'Name'),145 'email' => __( 'E-mail'),146 'registered' => __( 'Registered'),147 'blogs' => ''160 $users_columns = array( 161 'id' => __( 'ID' ), 162 'login' => __( 'Username' ), 163 'name' => __( 'Name' ), 164 'email' => __( 'E-mail' ), 165 'registered' => __( 'Registered' ), 166 'blogs' => __( 'Sites' ) 148 167 ); 149 $ posts_columns = apply_filters('wpmu_users_columns', $posts_columns);168 $users_columns = apply_filters( 'wpmu_users_columns', $users_columns ); 150 169 ?> 151 <table class="widefat" cellspacing="0">170 <table class="widefat"> 152 171 <thead> 153 172 <tr> 154 <?php foreach( (array) $posts_columns as $column_id => $column_display_name) { 155 if ( $column_id == 'blogs' ) { 156 echo '<th scope="col">'.__('Sites').'</th>'; 157 } elseif ( $column_id == 'checkbox') { 158 echo '<th scope="col" class="check-column"><input type="checkbox" /></th>'; 159 } else { ?> 160 <th scope="col"><a href="ms-users.php?sortby=<?php echo $column_id ?>&<?php if ( $order_by == $column_id ) { if ( $order == 'DESC' ) { echo "order=ASC&" ; } else { echo "order=DESC&"; } } ?>apage=<?php echo $apage ?>"><?php echo $column_display_name; ?></a></th> 161 <?php } ?> 162 <?php } ?> 173 <th class="manage-column column-cb check-column" id="cb" scope="col"> 174 <input type="checkbox" /> 175 </th> 176 <?php 177 $col_url = ''; 178 foreach($users_columns as $column_id => $column_display_name) { 179 $column_link = "<a href='"; 180 $order2 = ''; 181 if ( $order_by == $column_id ) 182 $order2 = ( $order == 'DESC' ) ? 'ASC' : 'DESC'; 183 184 $column_link .= esc_url( add_query_arg( array( 'order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array( 'action', 'updated' ), $_SERVER['REQUEST_URI'] ) ) ); 185 $column_link .= "'>{$column_display_name}</a>"; 186 $col_url .= '<th scope="col">' . ( $column_id == 'blogs' ? $column_display_name : $column_link ) . '</th>'; 187 } 188 echo $col_url; ?> 163 189 </tr> 164 190 </thead> 165 <tbody id="users" class="list:user user-list"> 166 <?php if ($user_list) { 191 <tfoot> 192 <tr> 193 <th class="manage-column column-cb check-column" id="cb" scope="col"> 194 <input type="checkbox" /> 195 </th> 196 <?php echo $col_url; ?> 197 </tr> 198 </tfoot> 199 <tbody id="the-user-list" class="list:user"> 200 <?php if ( $user_list ) { 167 201 $class = ''; 168 202 $super_admins = get_site_option( 'site_admins' ); 169 foreach ( (array) $user_list as $user ) {170 $class = ( 'alternate' == $class) ? '' : 'alternate';171 172 $status_list = array( "spam" => "site-spammed", "deleted" => "site-deleted");203 foreach ( (array) $user_list as $user ) { 204 $class = ( 'alternate' == $class ) ? '' : 'alternate'; 205 206 $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' ); 173 207 174 208 foreach ( $status_list as $status => $col ) { … … 178 212 179 213 ?> 180 181 214 <tr class="<?php echo $class; ?>"> 182 215 <?php 183 foreach( (array) $posts_columns as $column_name=>$column_display_name) : 184 switch($column_name) { 185 case 'checkbox': ?> 186 <th scope="row" class="check-column"><input type='checkbox' id='user_<?php echo $user['ID'] ?>' name='allusers[]' value='<?php echo esc_attr($user['ID']) ?>' /></th> 216 foreach( (array) $users_columns as $column_name=>$column_display_name ) : 217 switch( $column_name ) { 218 case 'id': ?> 219 <th scope="row" class="check-column"> 220 <input type="checkbox" id="blog_<?php echo $user['ID'] ?>" name="allusers[]" value="<?php echo esc_attr( $user['ID'] ) ?>" /> 221 </th> 222 <th valign="top" scope="row"> 223 <?php echo $user['ID'] ?> 224 </th> 187 225 <?php 188 226 break; … … 190 228 case 'login': 191 229 $avatar = get_avatar( $user['user_email'], 32 ); 192 $edit = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=".$user['ID'] ) );193 // @todo Make delete link work like delete button with transfering users (in ms-edit.php)194 //$delete = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), wp_nonce_url( 'ms-edit.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user['ID'] ) );195 230 ?> 196 231 <td class="username column-username"> 197 <?php echo $avatar; ?><strong><a href="<?php echo $edit; ?>" class="edit"><?php echo stripslashes($user['user_login']); ?></a><?php198 if ( in_array( $user[ 'user_login'], $super_admins ) )199 echo ' - ' . __( 'Super admin' );200 ?></strong>232 <?php echo $avatar; ?><strong><a href="<?php echo esc_url( admin_url( 'user-edit.php?user_id=' . $user['ID'] ) ); ?>" class="edit"><?php echo stripslashes( $user['user_login'] ); ?></a><?php 233 if ( in_array( $user['user_login'], $super_admins ) ) 234 echo ' - ' . __( 'Super admin' ); 235 ?></strong> 201 236 <br/> 202 237 <div class="row-actions"> 203 <span class="edit"><a href="<?php echo $edit; ?>">Edit</a></span> 204 <?php /*<span class="delete"><a href="<?php echo $delete; ?>" class="delete">Delete</a></span> */ ?> 238 <span class="edit"><a href="<?php echo esc_url( admin_url( 'user-edit.php?user_id=' . $user['ID'] ) ); ?>"><?php _e( 'Edit'); ?></a></span> 239 <?php if ( ! in_array( $user['user_login'], $super_admins ) ) { ?> 240 | <span class="delete"><a href="<?php echo $delete = esc_url( admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'ms-edit.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user['ID'] ) ) ); ?>" class="delete"><?php _e( 'Delete' ); ?></a></span> 241 <?php } ?> 205 242 </div> 206 243 </td> … … 218 255 break; 219 256 220 case 'registered': ?> 221 <td><?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i a'), $user['user_registered']); ?></td> 257 case 'registered': 258 if ( 'list' == $mode ) 259 $date = 'Y/m/d'; 260 else 261 $date = 'Y/m/d \<\b\r \/\> g:i:s a'; 262 ?> 263 <td><?php echo mysql2date( __( $date ), $user['user_registered'] ); ?></td> 222 264 <?php 223 265 break; … … 230 272 if ( is_array( $blogs ) ) { 231 273 foreach ( (array) $blogs as $key => $val ) { 232 $path = ( $val->path == '/') ? '' : $val->path;233 echo '<a href=" ms-sites.php?action=editblog&id=' . $val->userblog_id .'">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';274 $path = ( $val->path == '/' ) ? '' : $val->path; 275 echo '<a href="'. esc_url( admin_url( 'ms-sites.php?action=editblog&id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>'; 234 276 echo ' <small class="row-actions">'; 235 277 236 278 // Edit 237 echo '<a href=" ms-sites.php?action=editblog&id=' . $val->userblog_id . '">' . __('Edit') . '</a> | ';279 echo '<a href="'. esc_url( admin_url( 'ms-sites.php?action=editblog&id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a> | '; 238 280 239 281 // View 240 282 echo '<a '; 241 283 if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 ) 242 echo 'style="background-color: #f 66" ';243 echo ' target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . '</a>';244 284 echo 'style="background-color: #faa" '; 285 echo 'href="' . esc_url( get_home_url( $val->userblog_id ) ) . '">' . __( 'View' ) . '</a>'; 286 245 287 echo '</small><br />'; 246 288 } … … 252 294 253 295 default: ?> 254 <td><?php do_action( 'manage_users_custom_column', $column_name, $user['ID']); ?></td>296 <td><?php do_action( 'manage_users_custom_column', $column_name, $user['ID'] ); ?></td> 255 297 <?php 256 298 break; … … 263 305 } else { 264 306 ?> 265 <tr style='background-color: <?php echo $bgcolor; ?>'>266 <td colspan="<?php echo (int) count($ posts_columns); ?>"><?php _e('No users found.') ?></td>307 <tr> 308 <td colspan="<?php echo (int) count($users_columns); ?>"><?php _e( 'No users found.' ) ?></td> 267 309 </tr> 268 310 <?php … … 273 315 274 316 <div class="tablenav"> 275 <?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?> 276 277 <div class="alignleft"> 278 <input type="submit" value="<?php esc_attr_e('Delete') ?>" name="alluser_delete" class="button-secondary delete" /> 279 <input type="submit" value="<?php esc_attr_e('Mark as Spammers') ?>" name="alluser_spam" class="button-secondary" /> 280 <input type="submit" value="<?php esc_attr_e('Not Spam') ?>" name="alluser_notspam" class="button-secondary" /> 281 <input type="submit" value="<?php esc_attr_e('Add Network Admins') ?>" name="add_superadmin" class="button-secondary" /> 282 <input type="submit" value="<?php esc_attr_e('Remove Network Admins') ?>" name="remove_superadmin" class="button-secondary" /> 283 <?php wp_nonce_field( 'allusers' ); ?> 284 <br class="clear" /> 317 <?php 318 if ( $page_links ) 319 echo "<div class='tablenav-pages'>$page_links_text</div>"; 320 ?> 321 322 <div class="alignleft actions"> 323 <select name="action2"> 324 <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option> 325 <option value="delete"><?php _e( 'Delete' ); ?></option> 326 <option value="spam"><?php _e( 'Mark as Spammers' ); ?></option> 327 <option value="notspam"><?php _e( 'Not Spam' ); ?></option> 328 <option value="superadmin"><?php _e( 'Add Super Admins' ); ?></option> 329 <option value="notsuperadmin"><?php _e( 'Remove Super Admins' ); ?></option> 330 </select> 331 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 285 332 </div> 333 <br class="clear" /> 286 334 </div> 287 </form> 288 </div> 335 336 </form> 337 </div> 289 338 290 339 <?php 291 if ( apply_filters( 'show_adduser_fields', true) ) :340 if ( apply_filters( 'show_adduser_fields', true ) ) : 292 341 ?> 293 342 <div class="wrap"> 294 <h2><?php _e( 'Add user') ?></h2>295 <form action="ms-edit.php?action=adduser" method="post" >343 <h2><?php _e( 'Add user' ) ?></h2> 344 <form action="ms-edit.php?action=adduser" method="post" id="form-add-user"> 296 345 <table class="form-table"> 297 346 <tr class="form-field form-required"> 298 <th scope= 'row'><?php _e('Username') ?></th>299 <td><input type="text" name="user[username]" /></td>347 <th scope="row"><?php _e( 'Username' ) ?></th> 348 <td><input type="text" class="regular-text" name="user[username]" /></td> 300 349 </tr> 301 350 <tr class="form-field form-required"> 302 <th scope= 'row'><?php _e('Email') ?></th>303 <td><input type="text" name="user[email]" /></td>351 <th scope="row"><?php _e( 'Email' ) ?></th> 352 <td><input type="text" class="regular-text" name="user[email]" /></td> 304 353 </tr> 305 354 <tr class="form-field"> 306 <td colspan= '2'><?php _e('Username and password will be mailed to the above email address.') ?></td>355 <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td> 307 356 </tr> 308 357 </table> 309 358 <p class="submit"> 310 <?php wp_nonce_field( 'add-user') ?>311 <input class="button" type="submit" name="Add user" value="<?php esc_attr_e('Add user') ?>" /></p>359 <?php wp_nonce_field( 'add-user' ) ?> 360 <input class="button" type="submit" value="<?php esc_attr_e( 'Add user' ) ?>" /></p> 312 361 </form> 313 362 </div> 314 363 <?php endif; ?> 315 364 316 <?php include( 'admin-footer.php'); ?>365 <?php include( './admin-footer.php' ); ?> -
trunk/wp-admin/my-sites.php
r13896 r13918 1 1 <?php 2 3 require_once('admin.php'); 2 require_once( './admin.php' ); 4 3 5 4 if ( !is_multisite() ) 6 wp_die( __( 'Multisite support is not enabled.') );5 wp_die( __( 'Multisite support is not enabled.' ) ); 7 6 8 7 if ( ! current_user_can('read') ) 9 wp_die( __('You do not have sufficient permissions to view this page.'));8 wp_die( __( 'You do not have sufficient permissions to view this page.' ) ); 10 9 11 $action = isset( $_POST['action']) ? $_POST['action'] : 'splash';10 $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash'; 12 11 13 12 $blogs = get_blogs_of_user( $current_user->id ); … … 18 17 $updated = false; 19 18 if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) { 20 check_admin_referer('update-my-sites'); 21 // @todo Validate primary blog. 22 update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true ); 23 $updated = true; 19 check_admin_referer( 'update-my-sites' ); 20 21 $blog = get_blog_details( (int) $_POST['primary_blog'] ); 22 if ( $blog && isset( $blog->domain ) ) { 23 update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true ); 24 $updated = true; 25 } else { 26 wp_die( __( "The primary site, which you have choosen, doesn't exists." ) ); 27 } 24 28 } 25 29 26 $title = __( 'My Sites');30 $title = __( 'My Sites' ); 27 31 $parent_file = 'index.php'; 28 require_once( 'admin-header.php');32 require_once( './admin-header.php' ); 29 33 30 34 if ( $updated ) { ?> 31 <div id="message" class="updated fade"><p><strong><?php _e( 'Your site preferences have been updated.' ); ?></strong></p></div>35 <div id="message" class="updated fade"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div> 32 36 <?php } ?> 33 37 34 38 <div class="wrap"> 35 39 <?php screen_icon(); ?> 36 <h2><?php e cho esc_html($title); ?></h2>40 <h2><?php esc_html_e( $title ); ?></h2> 37 41 <form id="myblogs" action="" method="post"> 38 42 <?php 39 43 choose_primary_blog(); 40 44 do_action( 'myblogs_allblogs_options' ); 41 ?><table class='widefat'> <?php 45 ?> 46 <br clear="all" /> 47 <table class="widefat fixed"> 48 <?php 42 49 $settings_html = apply_filters( 'myblogs_options', '', 'global' ); 43 50 if ( $settings_html != '' ) { … … 53 60 elseif ( $num >= 10 ) 54 61 $cols = 2; 55 $num_rows = ceil( $num/$cols);62 $num_rows = ceil( $num / $cols ); 56 63 $split = 0; 57 64 for ( $i = 1; $i <= $num_rows; $i++ ) { … … 62 69 $c = ''; 63 70 foreach ( $rows as $row ) { 64 $c = $c == "alternate"? '' : 'alternate';71 $c = $c == 'alternate' ? '' : 'alternate'; 65 72 echo "<tr class='$c'>"; 66 $ t = '';73 $i = 0; 67 74 foreach ( $row as $user_blog ) { 68 $ t = $t == 'border-right: 1px solid #ccc;'? '' : 'border-right: 1px solid #ccc;';69 echo "<td valign='top' style='$ t; width:50%'>";75 $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;'; 76 echo "<td valign='top' style='$s'>"; 70 77 echo "<h3>{$user_blog->blogname}</h3>"; 71 echo "<p>" . apply_filters( "myblogs_blog_actions", "<a href='" . get_home_url($user_blog->userblog_id) . "'>" . __( 'Visit' ) . "</a> | <a href='" . get_admin_url($user_blog->userblog_id) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";78 echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>"; 72 79 echo apply_filters( 'myblogs_options', '', $user_blog ); 73 80 echo "</td>"; 81 $i++; 74 82 } 75 83 echo "</tr>"; … … 77 85 </table> 78 86 <input type="hidden" name="action" value="updateblogsettings" /> 79 <?php wp_nonce_field( 'update-my-sites'); ?>87 <?php wp_nonce_field( 'update-my-sites' ); ?> 80 88 <p> 81 <input type="submit" class="button-primary" value="<?php _e( 'Update Options') ?>" name="submit" />89 <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" /> 82 90 </p> 83 91 </form> 84 92 </div> 85 93 <?php 86 include('admin-footer.php'); 87 94 include( './admin-footer.php' ); 88 95 ?>
Note: See TracChangeset
for help on using the changeset viewer.