Changeset 13918 for trunk/wp-admin/my-sites.php
- Timestamp:
- 04/01/2010 09:21:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.