Edit File by line
/home/barbar84/public_h.../wp-admin/network
File: site-settings.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Edit Site Settings Administration Screen
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Multisite
[5] Fix | Delete
* @since 3.1.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
/** Load WordPress Administration Bootstrap */
[9] Fix | Delete
require_once __DIR__ . '/admin.php';
[10] Fix | Delete
[11] Fix | Delete
if ( ! current_user_can( 'manage_sites' ) ) {
[12] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to edit this site.' ) );
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
get_current_screen()->add_help_tab( get_site_screen_help_tab_args() );
[16] Fix | Delete
get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() );
[17] Fix | Delete
[18] Fix | Delete
$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
[19] Fix | Delete
[20] Fix | Delete
if ( ! $id ) {
[21] Fix | Delete
wp_die( __( 'Invalid site ID.' ) );
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
$details = get_site( $id );
[25] Fix | Delete
if ( ! $details ) {
[26] Fix | Delete
wp_die( __( 'The requested site does not exist.' ) );
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
if ( ! can_edit_network( $details->site_id ) ) {
[30] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
$is_main_site = is_main_site( $id );
[34] Fix | Delete
[35] Fix | Delete
if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] && is_array( $_POST['option'] ) ) {
[36] Fix | Delete
check_admin_referer( 'edit-site' );
[37] Fix | Delete
[38] Fix | Delete
switch_to_blog( $id );
[39] Fix | Delete
[40] Fix | Delete
$skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form.
[41] Fix | Delete
foreach ( (array) $_POST['option'] as $key => $val ) {
[42] Fix | Delete
$key = wp_unslash( $key );
[43] Fix | Delete
$val = wp_unslash( $val );
[44] Fix | Delete
if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options, true ) ) {
[45] Fix | Delete
continue; // Avoids "0 is a protected WP option and may not be modified" error when editing blog options.
[46] Fix | Delete
}
[47] Fix | Delete
update_option( $key, $val );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Fires after the site options are updated.
[52] Fix | Delete
*
[53] Fix | Delete
* @since 3.0.0
[54] Fix | Delete
* @since 4.4.0 Added `$id` parameter.
[55] Fix | Delete
*
[56] Fix | Delete
* @param int $id The ID of the site being updated.
[57] Fix | Delete
*/
[58] Fix | Delete
do_action( 'wpmu_update_blog_options', $id );
[59] Fix | Delete
[60] Fix | Delete
restore_current_blog();
[61] Fix | Delete
wp_redirect(
[62] Fix | Delete
add_query_arg(
[63] Fix | Delete
array(
[64] Fix | Delete
'update' => 'updated',
[65] Fix | Delete
'id' => $id,
[66] Fix | Delete
),
[67] Fix | Delete
'site-settings.php'
[68] Fix | Delete
)
[69] Fix | Delete
);
[70] Fix | Delete
exit;
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
if ( isset( $_GET['update'] ) ) {
[74] Fix | Delete
$messages = array();
[75] Fix | Delete
if ( 'updated' === $_GET['update'] ) {
[76] Fix | Delete
$messages[] = __( 'Site options updated.' );
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
/* translators: %s: Site title. */
[81] Fix | Delete
$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );
[82] Fix | Delete
[83] Fix | Delete
$parent_file = 'sites.php';
[84] Fix | Delete
$submenu_file = 'sites.php';
[85] Fix | Delete
[86] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[87] Fix | Delete
[88] Fix | Delete
?>
[89] Fix | Delete
[90] Fix | Delete
<div class="wrap">
[91] Fix | Delete
<h1 id="edit-site"><?php echo $title; ?></h1>
[92] Fix | Delete
<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p>
[93] Fix | Delete
[94] Fix | Delete
<?php
[95] Fix | Delete
[96] Fix | Delete
network_edit_site_nav(
[97] Fix | Delete
array(
[98] Fix | Delete
'blog_id' => $id,
[99] Fix | Delete
'selected' => 'site-settings',
[100] Fix | Delete
)
[101] Fix | Delete
);
[102] Fix | Delete
[103] Fix | Delete
if ( ! empty( $messages ) ) {
[104] Fix | Delete
foreach ( $messages as $msg ) {
[105] Fix | Delete
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
?>
[109] Fix | Delete
<form method="post" action="site-settings.php?action=update-site">
[110] Fix | Delete
<?php wp_nonce_field( 'edit-site' ); ?>
[111] Fix | Delete
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
[112] Fix | Delete
<table class="form-table" role="presentation">
[113] Fix | Delete
<?php
[114] Fix | Delete
$blog_prefix = $wpdb->get_blog_prefix( $id );
[115] Fix | Delete
$sql = "SELECT * FROM {$blog_prefix}options
[116] Fix | Delete
WHERE option_name NOT LIKE %s
[117] Fix | Delete
AND option_name NOT LIKE %s";
[118] Fix | Delete
$query = $wpdb->prepare(
[119] Fix | Delete
$sql,
[120] Fix | Delete
$wpdb->esc_like( '_' ) . '%',
[121] Fix | Delete
'%' . $wpdb->esc_like( 'user_roles' )
[122] Fix | Delete
);
[123] Fix | Delete
$options = $wpdb->get_results( $query );
[124] Fix | Delete
[125] Fix | Delete
foreach ( $options as $option ) {
[126] Fix | Delete
if ( 'default_role' === $option->option_name ) {
[127] Fix | Delete
$editblog_default_role = $option->option_value;
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
$disabled = false;
[131] Fix | Delete
$class = 'all-options';
[132] Fix | Delete
[133] Fix | Delete
if ( is_serialized( $option->option_value ) ) {
[134] Fix | Delete
if ( is_serialized_string( $option->option_value ) ) {
[135] Fix | Delete
$option->option_value = esc_html( maybe_unserialize( $option->option_value ) );
[136] Fix | Delete
} else {
[137] Fix | Delete
$option->option_value = 'SERIALIZED DATA';
[138] Fix | Delete
$disabled = true;
[139] Fix | Delete
$class = 'all-options disabled';
[140] Fix | Delete
}
[141] Fix | Delete
}
[142] Fix | Delete
[143] Fix | Delete
if ( strpos( $option->option_value, "\n" ) !== false ) {
[144] Fix | Delete
?>
[145] Fix | Delete
<tr class="form-field">
[146] Fix | Delete
<th scope="row"><label for="<?php echo esc_attr( $option->option_name ); ?>"><?php echo ucwords( str_replace( '_', ' ', $option->option_name ) ); ?></label></th>
[147] Fix | Delete
<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>
[148] Fix | Delete
</tr>
[149] Fix | Delete
<?php
[150] Fix | Delete
} else {
[151] Fix | Delete
?>
[152] Fix | Delete
<tr class="form-field">
[153] Fix | Delete
<th scope="row"><label for="<?php echo esc_attr( $option->option_name ); ?>"><?php echo esc_html( ucwords( str_replace( '_', ' ', $option->option_name ) ) ); ?></label></th>
[154] Fix | Delete
<?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ), true ) ) { ?>
[155] Fix | Delete
<td><code><?php echo esc_html( $option->option_value ); ?></code></td>
[156] Fix | Delete
<?php } else { ?>
[157] Fix | Delete
<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>
[158] Fix | Delete
<?php } ?>
[159] Fix | Delete
</tr>
[160] Fix | Delete
<?php
[161] Fix | Delete
}
[162] Fix | Delete
} // End foreach.
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* Fires at the end of the Edit Site form, before the submit button.
[166] Fix | Delete
*
[167] Fix | Delete
* @since 3.0.0
[168] Fix | Delete
*
[169] Fix | Delete
* @param int $id Site ID.
[170] Fix | Delete
*/
[171] Fix | Delete
do_action( 'wpmueditblogaction', $id );
[172] Fix | Delete
?>
[173] Fix | Delete
</table>
[174] Fix | Delete
<?php submit_button(); ?>
[175] Fix | Delete
</form>
[176] Fix | Delete
[177] Fix | Delete
</div>
[178] Fix | Delete
<?php
[179] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[180] Fix | Delete
[181] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function