Make WordPress Core

Ticket #39200: 39200.1.patch

File 39200.1.patch, 4.1 KB (added by sathyapulse, 8 years ago)
  • src/wp-admin/options.php

     
    7474        }
    7575}
    7676
    77 if ( is_multisite() && ! is_super_admin() && 'update' != $action ) {
     77if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' != $action ) {
    7878        wp_die(
    7979                '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
    8080                '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
     
    9393
    9494$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
    9595
    96 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
     96if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
    9797        $whitelist_options['reading'][] = 'blog_charset';
     98}
    9899
    99100if ( get_site_option( 'initial_db_version' ) < 32453 ) {
    100101        $whitelist_options['writing'][] = 'use_smilies';
     
    102103}
    103104
    104105if ( !is_multisite() ) {
    105         if ( !defined( 'WP_SITEURL' ) )
     106        if ( !defined( 'WP_SITEURL' ) ) {
    106107                $whitelist_options['general'][] = 'siteurl';
    107         if ( !defined( 'WP_HOME' ) )
     108        }
     109        if ( !defined( 'WP_HOME' ) ) {
    108110                $whitelist_options['general'][] = 'home';
     111        }
    109112
    110113        $whitelist_options['general'][] = 'admin_email';
    111114        $whitelist_options['general'][] = 'users_can_register';
     
    131134         *
    132135         * @param bool $enabled Whether post-by-email configuration is enabled. Default true.
    133136         */
    134         if ( apply_filters( 'enable_post_by_email_configuration', true ) )
     137        if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
    135138                $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
     139        }
    136140}
    137141
    138142/**
     
    156160                check_admin_referer( $option_page . '-options' );
    157161        }
    158162
    159         if ( !isset( $whitelist_options[ $option_page ] ) )
     163        if ( !isset( $whitelist_options[ $option_page ] ) ) {
    160164                wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
     165        }
    161166
    162167        if ( 'options' == $option_page ) {
    163                 if ( is_multisite() && ! is_super_admin() )
     168                if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) {
    164169                        wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
     170                }
    165171                $options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) );
    166172        } else {
    167173                $options = $whitelist_options[ $option_page ];
     
    169175
    170176        if ( 'general' == $option_page ) {
    171177                // Handle custom date/time formats.
    172                 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) )
     178                if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) {
    173179                        $_POST['date_format'] = $_POST['date_format_custom'];
    174                 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) )
     180                }
     181                if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) {
    175182                        $_POST['time_format'] = $_POST['time_format_custom'];
     183                }
    176184                // Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
    177185                if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) {
    178186                        $_POST['gmt_offset'] = $_POST['timezone_string'];
     
    235243         * Handle settings errors and return to options page
    236244         */
    237245        // If no settings errors were registered add a general 'updated' message.
    238         if ( !count( get_settings_errors() ) )
     246        if ( !count( get_settings_errors() ) ) {
    239247                add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
     248        }
    240249        set_transient('settings_errors', get_settings_errors(), 30);
    241250
    242251        /**
     
    261270
    262271foreach ( (array) $options as $option ) :
    263272        $disabled = false;
    264         if ( $option->option_name == '' )
     273        if ( $option->option_name == '' ) {
    265274                continue;
     275        }
    266276        if ( is_serialized( $option->option_value ) ) {
    267277                if ( is_serialized_string( $option->option_value ) ) {
    268278                        // This is a serialized string, so we should display it.