Changeset 12897
- Timestamp:
- 01/29/2010 05:36:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/ms-sites.php
r12801 r12897 77 77 case "editblog": 78 78 $blog_prefix = $wpdb->get_blog_prefix( $id ); 79 $options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE ' _transient_rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A);80 $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A);79 $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); 81 81 $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" ); 82 82 ?> 83 83 <div class="wrap"> 84 84 <?php screen_icon(); ?> 85 <h2><?php _e('Edit Blog'); ?> - <a href='http://<?php echo $details ['domain'].$details['path']; ?>'>http://<?php echo $details['domain'].$details['path']; ?></a></h2>85 <h2><?php _e('Edit Blog'); ?> - <a href='http://<?php echo $details->domain . $details->path; ?>'>http://<?php echo $details->domain . $details->path; ?></a></h2> 86 86 <form method="post" action="ms-edit.php?action=updateblog"> 87 87 <?php wp_nonce_field('editblog'); ?> … … 94 94 <tr class="form-field form-required"> 95 95 <th scope="row"><?php _e('Domain') ?></th> 96 <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details ['domain']?>" size="33" /></td>96 <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details->domain ?>" size="33" /></td> 97 97 </tr> 98 98 <tr class="form-field form-required"> 99 99 <th scope="row"><?php _e('Path') ?></th> 100 <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr($details ['path']) ?>" size="40" style='margin-bottom:5px;' />101 <br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if ( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details ['domain'] . $details['path']) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>100 <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr($details->path) ?>" size="40" style='margin-bottom:5px;' /> 101 <br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if ( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details->domain . $details->path) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details->domain . $details->path) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td> 102 102 </tr> 103 103 <tr class="form-field"> 104 104 <th scope="row"><?php _e('Registered') ?></th> 105 <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details ['registered']) ?>" size="40" /></td>105 <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details->registered) ?>" size="40" /></td> 106 106 </tr> 107 107 <tr class="form-field"> 108 108 <th scope="row"><?php _e('Last Updated') ?></th> 109 <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details ['last_updated']) ?>" size="40" /></td>109 <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details->last_updated) ?>" size="40" /></td> 110 110 </tr> 111 111 <tr class="form-field"> 112 112 <th scope="row"><?php _e('Public') ?></th> 113 113 <td> 114 <input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if ( $details ['public']== '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>115 <input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if ( $details ['public']== '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>114 <input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if ( $details->public == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 115 <input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if ( $details->public == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 116 116 </td> 117 117 </tr> … … 119 119 <th scope="row"><?php _e( 'Archived' ); ?></th> 120 120 <td> 121 <input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if ( $details ['archived']== '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>122 <input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if ( $details ['archived']== '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>121 <input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if ( $details->archived == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 122 <input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if ( $details->archived == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 123 123 </td> 124 124 </tr> … … 126 126 <th scope="row"><?php _e( 'Mature' ); ?></th> 127 127 <td> 128 <input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if ( $details ['mature']== '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>129 <input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if ( $details ['mature']== '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>128 <input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if ( $details->mature == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 129 <input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if ( $details->mature == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 130 130 </td> 131 131 </tr> … … 133 133 <th scope="row"><?php _e( 'Spam' ); ?></th> 134 134 <td> 135 <input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if ( $details ['spam']== '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>136 <input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if ( $details ['spam']== '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>135 <input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if ( $details->spam == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 136 <input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if ( $details->spam == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 137 137 </td> 138 138 </tr> … … 140 140 <th scope="row"><?php _e( 'Deleted' ); ?></th> 141 141 <td> 142 <input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if ( $details ['deleted']== '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>143 <input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if ( $details ['deleted']== '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>142 <input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if ( $details->deleted == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?> 143 <input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if ( $details->deleted == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?> 144 144 </td> 145 145 </tr> … … 154 154 <?php 155 155 $editblog_default_role = 'subscriber'; 156 foreach ( $options as $key => $val ) { 157 if ( $val['option_name'] == 'default_role' ) { 158 $editblog_default_role = $val['option_value']; 159 } 156 foreach ( $options as $option ) { 157 if ( $option->option_name == 'default_role' ) 158 $editblog_default_role = $option->option_value; 160 159 $disabled = ''; 161 if ( is_serialized($ val['option_value']) ) {162 if ( is_serialized_string($ val['option_value']) ) {163 $ val['option_value'] = wp_specialchars(maybe_unserialize($val['option_value']), 'single');160 if ( is_serialized($option->option_value) ) { 161 if ( is_serialized_string($option->option_value) ) { 162 $option->option_value = wp_specialchars(maybe_unserialize($option->option_value), 'single'); 164 163 } else { 165 $ val['option_value']= "SERIALIZED DATA";164 $option->option_value = "SERIALIZED DATA"; 166 165 $disabled = ' disabled="disabled"'; 167 166 } 168 167 } 169 if ( stristr($ val['option_value'], "\r") || stristr($val['option_value'], "\n") || stristr($val['option_value'], "\r\n") ) {168 if ( stristr($option->option_value, "\r") || stristr($option->option_value, "\n") || stristr($option->option_value, "\r\n") ) { 170 169 ?> 171 170 <tr class="form-field"> 172 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $ val['option_name']) ) ?></th>173 <td><textarea rows="5" cols="40" name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>"<?php echo $disabled ?>><?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1) ?></textarea></td>171 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th> 172 <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>"<?php echo $disabled ?>><?php echo esc_html( $option->option_value ) ?></textarea></td> 174 173 </tr> 175 174 <?php … … 177 176 ?> 178 177 <tr class="form-field"> 179 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $ val['option_name']) ) ?></th>180 <td><input name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>" value="<?php echo esc_attr( stripslashes( $val['option_value'] ), 1) ?>" size="40" <?php echo $disabled ?> /></td>178 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th> 179 <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 echo $disabled ?> /></td> 181 180 </tr> 182 181 <?php … … 195 194 $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id ); 196 195 $allowed_themes = get_site_option( "allowedthemes" ); 197 if ( $allowed_themes == false ) {196 if ( ! $allowed_themes ) 198 197 $allowed_themes = array_keys( $themes ); 199 }200 198 $out = ''; 201 foreach ( $themes as $key => $theme ) {199 foreach ( $themes as $key => $theme ) { 202 200 $theme_key = wp_specialchars( $theme['Stylesheet'] ); 203 if ( isset($allowed_themes[$theme_key] ) == false) {201 if ( ! isset($allowed_themes[$theme_key] ) ) { 204 202 $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; 205 203 $out .= '<tr class="form-field form-required"> 206 <th title="' .htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th>207 <td><input name="theme[' .$theme_key.']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td>204 <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html($key) . '</th> 205 <td><input name="theme[' . esc_attr($theme_key) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td> 208 206 </tr>'; 209 207 } … … 213 211 ?> 214 212 <div id="blogedit_blogthemes" class="postbox"> 215 <h3 class='hndle'><span><?php _e('Blog Themes'); ?></span></h3>213 <h3 class='hndle'><span><?php esc_html_e('Blog Themes'); ?></span></h3> 216 214 <div class="inside"> 217 215 <table class="form-table"> 218 <tr><th style="font-weight:bold;"><?php _e('Theme'); ?></th></tr>216 <tr><th style="font-weight:bold;"><?php esc_html_e('Theme'); ?></th></tr> 219 217 <?php echo $out; ?> 220 218 </table> … … 242 240 <td> 243 241 <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php 244 foreach ( $editblog_roles as $role => $role_assoc ){242 foreach ( $editblog_roles as $role => $role_assoc ){ 245 243 $name = translate_with_context($role_assoc['name']); 246 244 $selected = ( $role == $existing_role ) ? 'selected="selected"' : ''; … … 251 249 </td> 252 250 <td> 253 <input type='text' name='user_password[<?php echo $val->user_id?>]' />251 <input type='text' name='user_password[<?php echo esc_attr($val->user_id) ?>]' /> 254 252 </td> 255 253 <?php 256 echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id. ']" /></td>';254 echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . esc_attr($val->user_id) . ']" /></td>'; 257 255 } else { 258 256 echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>"; … … 449 447 if ( $blog_list ) { 450 448 $bgcolor = $class = ''; 451 $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55");449 $status_list = array( 'archived' => array( '#fee', __('Archived') ), 'spam' => array( '#faa', __('Spam') ), 'deleted' => array( '#f55', __('Deleted') ) ); 452 450 foreach ( $blog_list as $blog ) { 453 451 $class = ('alternate' == $class) ? '' : 'alternate'; 454 452 reset( $status_list ); 455 453 456 $bgcolour = ""; 454 $bgcolour = ''; 455 $blog_states = array(); 457 456 foreach ( $status_list as $status => $col ) { 458 457 if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) { 459 $bgcolour = "style='background: $col'"; 458 $bgcolour = "style='background: {$col[0]}'"; 459 $blog_states[] = $col[1]; 460 } 461 } 462 $blog_state = ''; 463 if ( ! empty($blog_states) ) { 464 $state_count = count($blog_states); 465 $i = 0; 466 $blog_state .= ' - '; 467 foreach ( $blog_states as $state ) { 468 ++$i; 469 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 470 $blog_state .= "<span class='post-state'>$state$sep</span>"; 460 471 } 461 472 } … … 464 475 $blogname = ( is_subdomain_install() ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path']; 465 476 foreach ( $posts_columns as $column_name=>$column_display_name ) { 466 switch ($column_name) {477 switch ( $column_name ) { 467 478 case 'id': ?> 468 479 <th scope="row" class="check-column"> … … 477 488 case 'blogname': ?> 478 489 <td valign="top"> 479 <a href="ms-sites.php?action=editblog&id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname; ?></a>490 <a href="ms-sites.php?action=editblog&id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname; echo $blog_state?></a> 480 491 <br/> 481 492 <?php 482 $ controlActions = array();483 $ controlActions[] = '<a href="ms-sites.php?action=editblog&id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';484 $ controlActions[] = "<a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'>" . __('Backend') . '</a>';493 $actions = array(); 494 $actions[] = '<a href="ms-sites.php?action=editblog&id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>'; 495 $actions[] = "<a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'>" . __('Backend') . '</a>'; 485 496 486 497 if ( get_blog_status( $blog['blog_id'], "deleted" ) == '1' ) 487 $ controlActions[] = '<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 blog %s" ), $blogname ) ) . '">' . __('Activate') . '</a>';498 $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 blog %s" ), $blogname ) ) . '">' . __('Activate') . '</a>'; 488 499 else 489 $ controlActions[] = '<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 blog %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>';500 $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 blog %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>'; 490 501 491 502 if ( get_blog_status( $blog['blog_id'], "archived" ) == '1' ) 492 $ controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>';503 $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 blog %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>'; 493 504 else 494 $ controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) . '">' . __('Archive') . '</a>';505 $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 blog %s" ), $blogname ) ) . '">' . __('Archive') . '</a>'; 495 506 496 507 if ( get_blog_status( $blog['blog_id'], "spam" ) == '1' ) 497 $ controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>';508 $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 blog %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>'; 498 509 else 499 $ controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>';500 501 $ controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to delete the blog %s" ), $blogname ) ) . '">' . __("Delete") . '</a>';502 503 $ controlActions[] = "<a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'>" . __('Visit') . '</a>';510 $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 blog %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>'; 511 512 $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 blog %s" ), $blogname ) ) . '">' . __("Delete") . '</a>'; 513 514 $actions[] = "<a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'>" . __('Visit') . '</a>'; 504 515 ?> 505 516 506 <?php if ( count($controlActions)) : ?>517 <?php if ( count($actions) ) : ?> 507 518 <div class="row-actions"> 508 <?php echo implode(' | ', $ controlActions); ?>519 <?php echo implode(' | ', $actions); ?> 509 520 </div> 510 521 <?php endif; ?> … … 536 547 $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . $protocol . $blog[ 'domain' ] . $blog[ 'path' ] . 'wp-admin/users.php">' . __( 'More' ) . '</a>'; 537 548 } 538 foreach ( $blogusers as $key => $val ) {549 foreach ( $blogusers as $key => $val ) 539 550 echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />'; 540 } 541 if ( $blogusers_warning != '' ) { 551 if ( $blogusers_warning != '' ) 542 552 echo '<strong>' . $blogusers_warning . '</strong><br />'; 543 }544 553 } 545 554 ?>
Note: See TracChangeset
for help on using the changeset viewer.