2010-10-21 20:35:52 +02:00
< ? php
/**
2010-12-16 08:13:01 +01:00
* Edit Site Settings Administration Screen
2010-10-21 20:35:52 +02:00
*
* @ package WordPress
2010-11-10 15:27:15 +01:00
* @ subpackage Multisite
2010-10-21 20:35:52 +02:00
* @ since 3.1 . 0
*/
/** Load WordPress Administration Bootstrap */
2010-11-10 15:27:15 +01:00
require_once ( './admin.php' );
2010-10-21 20:35:52 +02:00
if ( ! is_multisite () )
wp_die ( __ ( 'Multisite support is not enabled.' ) );
2010-12-16 08:41:38 +01:00
if ( ! current_user_can ( 'manage_sites' ) )
wp_die ( __ ( 'You do not have sufficient permissions to edit this site.' ) );
2010-10-21 20:35:52 +02:00
2011-12-01 03:22:07 +01:00
get_current_screen () -> add_help_tab ( array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
'<p>' . __ ( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '</p>' .
'<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>' .
'<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>' .
'<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>' .
'<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>'
) );
2011-11-02 22:42:57 +01:00
get_current_screen () -> set_help_sidebar (
2010-12-16 07:52:47 +01:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2012-05-03 15:34:33 +02:00
'<p>' . __ ( '<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>' ) . '</p>' .
2010-12-25 20:21:00 +01:00
'<p>' . __ ( '<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>' ) . '</p>'
2010-12-16 07:52:47 +01:00
);
2010-10-21 20:35:52 +02:00
$id = isset ( $_REQUEST [ 'id' ] ) ? intval ( $_REQUEST [ 'id' ] ) : 0 ;
if ( ! $id )
wp_die ( __ ( 'Invalid site ID.' ) );
$details = get_blog_details ( $id );
2010-12-09 13:36:39 +01:00
if ( ! can_edit_network ( $details -> site_id ) )
2010-10-21 20:35:52 +02:00
wp_die ( __ ( 'You do not have permission to access this page.' ) );
$is_main_site = is_main_site ( $id );
if ( isset ( $_REQUEST [ 'action' ]) && 'update-site' == $_REQUEST [ 'action' ] && is_array ( $_POST [ 'option' ] ) ) {
check_admin_referer ( 'edit-site' );
switch_to_blog ( $id );
$skip_options = array ( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form.
foreach ( ( array ) $_POST [ 'option' ] as $key => $val ) {
2013-03-01 18:14:09 +01:00
$key = wp_unslash ( $key );
$val = wp_unslash ( $val );
2010-10-21 20:35:52 +02:00
if ( $key === 0 || is_array ( $val ) || in_array ( $key , $skip_options ) )
continue ; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
2013-04-29 02:26:49 +02:00
update_option ( $key , $val );
2010-10-21 20:35:52 +02:00
}
2010-11-30 21:29:02 +01:00
do_action ( 'wpmu_update_blog_options' );
2010-10-21 20:35:52 +02:00
restore_current_blog ();
2010-12-16 08:14:34 +01:00
wp_redirect ( add_query_arg ( array ( 'update' => 'updated' , 'id' => $id ), 'site-settings.php' ) );
2010-12-09 19:02:54 +01:00
exit ;
2010-10-21 20:35:52 +02:00
}
if ( isset ( $_GET [ 'update' ]) ) {
$messages = array ();
if ( 'updated' == $_GET [ 'update' ] )
$messages [] = __ ( 'Site options updated.' );
}
2011-06-03 17:35:45 +02:00
$site_url_no_http = preg_replace ( '#^http(s)?://#' , '' , get_blogaddress_by_id ( $id ) );
$title_site_url_linked = sprintf ( __ ( 'Edit Site: <a href="%1$s">%2$s</a>' ), get_blogaddress_by_id ( $id ), $site_url_no_http );
$title = sprintf ( __ ( 'Edit Site: %s' ), $site_url_no_http );
2010-10-21 20:35:52 +02:00
$parent_file = 'sites.php' ;
$submenu_file = 'sites.php' ;
require ( '../admin-header.php' );
?>
< div class = " wrap " >
2010-10-21 22:24:54 +02:00
< ? php screen_icon ( 'ms-admin' ); ?>
2011-06-03 17:35:45 +02:00
< h2 id = " edit-site " >< ? php echo $title_site_url_linked ?> </h2>
2010-10-25 22:45:58 +02:00
< h3 class = " nav-tab-wrapper " >
2010-10-21 20:35:52 +02:00
< ? php
2010-12-16 08:13:01 +01:00
$tabs = array (
'site-info' => array ( 'label' => __ ( 'Info' ), 'url' => 'site-info.php' ),
'site-users' => array ( 'label' => __ ( 'Users' ), 'url' => 'site-users.php' ),
'site-themes' => array ( 'label' => __ ( 'Themes' ), 'url' => 'site-themes.php' ),
'site-settings' => array ( 'label' => __ ( 'Settings' ), 'url' => 'site-settings.php' ),
);
2010-10-21 20:35:52 +02:00
foreach ( $tabs as $tab_id => $tab ) {
$class = ( $tab [ 'url' ] == $pagenow ) ? ' nav-tab-active' : '' ;
2011-12-14 00:45:31 +01:00
echo '<a href="' . $tab [ 'url' ] . '?id=' . $id . '" class="nav-tab' . $class . '">' . esc_html ( $tab [ 'label' ] ) . '</a>' ;
2010-10-21 20:35:52 +02:00
}
?>
</ h3 >
< ? php
if ( ! empty ( $messages ) ) {
foreach ( $messages as $msg )
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>' ;
} ?>
2010-12-16 08:14:34 +01:00
< form method = " post " action = " site-settings.php?action=update-site " >
2010-10-21 20:35:52 +02:00
< ? php wp_nonce_field ( 'edit-site' ); ?>
< input type = " hidden " name = " id " value = " <?php echo esc_attr( $id ) ?> " />
< table class = " form-table " >
< ? php
$blog_prefix = $wpdb -> get_blog_prefix ( $id );
$options = $wpdb -> get_results ( " SELECT * FROM { $blog_prefix } options WHERE option_name NOT LIKE ' \ _%' AND option_name NOT LIKE '%user_roles' " );
foreach ( $options as $option ) {
if ( $option -> option_name == 'default_role' )
$editblog_default_role = $option -> option_value ;
$disabled = false ;
$class = 'all-options' ;
if ( is_serialized ( $option -> option_value ) ) {
if ( is_serialized_string ( $option -> option_value ) ) {
2013-04-29 02:26:49 +02:00
$option -> option_value = esc_html ( maybe_unserialize ( $option -> option_value ) );
2010-10-21 20:35:52 +02:00
} else {
$option -> option_value = 'SERIALIZED DATA' ;
$disabled = true ;
$class = 'all-options disabled' ;
}
}
if ( strpos ( $option -> option_value , " \n " ) !== false ) {
?>
< tr class = " form-field " >
< th scope = " row " >< ? php echo ucwords ( str_replace ( " _ " , " " , $option -> option_name ) ) ?> </th>
2010-11-17 18:12:01 +01:00
< 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 echo esc_textarea( $option->option_value ) ?></textarea></td>
2010-10-21 20:35:52 +02:00
</ tr >
< ? php
} else {
?>
< tr class = " form-field " >
< th scope = " row " >< ? php echo esc_html ( ucwords ( str_replace ( " _ " , " " , $option -> option_name ) ) ); ?> </th>
< ? php if ( $is_main_site && in_array ( $option -> option_name , array ( 'siteurl' , 'home' ) ) ) { ?>
< td >< code >< ? php echo esc_html ( $option -> option_value ) ?> </code></td>
< ? php } else { ?>
< 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>
< ? php } ?>
</ tr >
< ? php
}
} // End foreach
2010-11-30 21:29:02 +01:00
do_action ( 'wpmueditblogaction' , $id );
2010-10-21 20:35:52 +02:00
?>
</ table >
< ? php submit_button (); ?>
</ form >
</ div >
< ? php
2010-12-09 19:02:54 +01:00
require ( '../admin-footer.php' );