| [ XREF Home ] [ Index ] |
PHP Cross Reference of WordPress TrunkProvided by Yoast |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Edit Site Info Administration Screen 4 * 5 * @package WordPress 6 * @subpackage Multisite 7 * @since 3.1.0 8 */ 9 10 /** Load WordPress Administration Bootstrap */ 11 require_once ( './admin.php' ); 12 13 if ( ! is_multisite() ) 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 16 if ( ! current_user_can( 'manage_sites' ) ) 17 wp_die( __( 'You do not have sufficient permissions to edit this site.' ) ); 18 19 add_contextual_help($current_screen, 20 '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' . 21 '<p>' . __('<strong>Info</strong> - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' . 22 '<p>' . __('<strong>Users</strong> - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' . 23 '<p>' . sprintf( __('<strong>Themes</strong> - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' . 24 '<p>' . __('<strong>Settings</strong> - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>' . 25 '<p><strong>' . __('For more information:') . '</strong></p>' . 26 '<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screens" target="_blank">Documentation on Site Management</a>') . '</p>' . 27 '<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' 28 ); 29 30 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 31 32 if ( ! $id ) 33 wp_die( __('Invalid site ID.') ); 34 35 $details = get_blog_details( $id ); 36 if ( !can_edit_network( $details->site_id ) ) 37 wp_die( __( 'You do not have permission to access this page.' ) ); 38 39 $is_main_site = is_main_site( $id ); 40 41 if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) { 42 check_admin_referer( 'edit-site' ); 43 44 switch_to_blog( $id ); 45 46 if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) { 47 $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] ); 48 if ( get_option( 'siteurl' ) != $blog_address ) 49 update_option( 'siteurl', $blog_address ); 50 51 if ( get_option( 'home' ) != $blog_address ) 52 update_option( 'home', $blog_address ); 53 } 54 55 // rewrite rules can't be flushed during switch to blog 56 delete_option( 'rewrite_rules' ); 57 58 // update blogs table 59 $blog_data = stripslashes_deep( $_POST['blog'] ); 60 $existing_details = get_blog_details( $id, false ); 61 $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); 62 foreach ( $blog_data_checkboxes as $c ) { 63 if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) 64 $blog_data[ $c ] = $existing_details->$c; 65 else 66 $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0; 67 } 68 update_blog_details( $id, $blog_data ); 69 70 restore_current_blog(); 71 wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') ); 72 exit; 73 } 74 75 if ( isset($_GET['update']) ) { 76 $messages = array(); 77 if ( 'updated' == $_GET['update'] ) 78 $messages[] = __('Site info updated.'); 79 } 80 81 $title = sprintf( __('Edit Site: %s'), get_blogaddress_by_id($id)); 82 $parent_file = 'sites.php'; 83 $submenu_file = 'sites.php'; 84 85 require ('../admin-header.php'); 86 87 ?> 88 89 <div class="wrap"> 90 <?php screen_icon('ms-admin'); ?> 91 <h2 id="edit-site"><?php echo $title ?></h2> 92 <h3 class="nav-tab-wrapper"> 93 <?php 94 $tabs = array( 95 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 96 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 97 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 98 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 99 ); 100 foreach ( $tabs as $tab_id => $tab ) { 101 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 102 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 103 } 104 ?> 105 </h3> 106 <?php 107 if ( ! empty( $messages ) ) { 108 foreach ( $messages as $msg ) 109 echo '<div id="message" class="updated"><p>' . $msg . '</p></div>'; 110 } ?> 111 <form method="post" action="site-info.php?action=update-site"> 112 <?php wp_nonce_field( 'edit-site' ); ?> 113 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> 114 <table class="form-table"> 115 <tr class="form-field form-required"> 116 <th scope="row"><?php _e( 'Domain' ) ?></th> 117 <?php 118 $protocol = is_ssl() ? 'https://' : 'http://'; 119 if ( $is_main_site ) { ?> 120 <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td> 121 <?php } else { ?> 122 <td><?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td> 123 <?php } ?> 124 </tr> 125 <tr class="form-field form-required"> 126 <th scope="row"><?php _e( 'Path' ) ?></th> 127 <?php if ( $is_main_site ) { ?> 128 <td><code><?php echo esc_attr( $details->path ) ?></code></td> 129 <?php } else { ?> 130 <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" size="40" style='margin-bottom:5px;' /> 131 <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> 132 <?php } ?> 133 </tr> 134 <tr class="form-field"> 135 <th scope="row"><?php _ex( 'Registered', 'site' ) ?></th> 136 <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" size="40" /></td> 137 </tr> 138 <tr class="form-field"> 139 <th scope="row"><?php _e( 'Last Updated' ); ?></th> 140 <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" size="40" /></td> 141 </tr> 142 <?php 143 $attribute_fields = array( 'public' => __( 'Public' ) ); 144 if ( ! $is_main_site ) { 145 $attribute_fields['archived'] = __( 'Archived' ); 146 $attribute_fields['spam'] = _x( 'Spam', 'site' ); 147 $attribute_fields['deleted'] = __( 'Deleted' ); 148 } 149 $attribute_fields['mature'] = __( 'Mature' ); 150 ?> 151 <tr> 152 <th scope="row"><?php _e( 'Attributes' ); ?></th> 153 <td> 154 <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?> 155 <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> /> 156 <?php echo $field_label; ?></label><br/> 157 <?php endforeach; ?> 158 </td> 159 </tr> 160 </table> 161 <?php submit_button(); ?> 162 </form> 163 164 </div> 165 <?php 166 require ('../admin-footer.php');
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jun 1 08:30:02 2011 |
Cross-referenced by PHPXref 0.7 Provided by Yoast and awesome WordPress Hosting |