Ticket #39200: 39200.1.patch
File 39200.1.patch, 4.1 KB (added by , 8 years ago) |
---|
-
src/wp-admin/options.php
74 74 } 75 75 } 76 76 77 if ( is_multisite() && ! is_super_admin() && 'update' != $action ) {77 if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' != $action ) { 78 78 wp_die( 79 79 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 80 80 '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', … … 93 93 94 94 $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); 95 95 96 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) 96 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) { 97 97 $whitelist_options['reading'][] = 'blog_charset'; 98 } 98 99 99 100 if ( get_site_option( 'initial_db_version' ) < 32453 ) { 100 101 $whitelist_options['writing'][] = 'use_smilies'; … … 102 103 } 103 104 104 105 if ( !is_multisite() ) { 105 if ( !defined( 'WP_SITEURL' ) ) 106 if ( !defined( 'WP_SITEURL' ) ) { 106 107 $whitelist_options['general'][] = 'siteurl'; 107 if ( !defined( 'WP_HOME' ) ) 108 } 109 if ( !defined( 'WP_HOME' ) ) { 108 110 $whitelist_options['general'][] = 'home'; 111 } 109 112 110 113 $whitelist_options['general'][] = 'admin_email'; 111 114 $whitelist_options['general'][] = 'users_can_register'; … … 131 134 * 132 135 * @param bool $enabled Whether post-by-email configuration is enabled. Default true. 133 136 */ 134 if ( apply_filters( 'enable_post_by_email_configuration', true ) ) 137 if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { 135 138 $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options); 139 } 136 140 } 137 141 138 142 /** … … 156 160 check_admin_referer( $option_page . '-options' ); 157 161 } 158 162 159 if ( !isset( $whitelist_options[ $option_page ] ) ) 163 if ( !isset( $whitelist_options[ $option_page ] ) ) { 160 164 wp_die( __( '<strong>ERROR</strong>: options page not found.' ) ); 165 } 161 166 162 167 if ( 'options' == $option_page ) { 163 if ( is_multisite() && ! is_super_admin() )168 if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) { 164 169 wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) ); 170 } 165 171 $options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) ); 166 172 } else { 167 173 $options = $whitelist_options[ $option_page ]; … … 169 175 170 176 if ( 'general' == $option_page ) { 171 177 // 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'] ) ) { 173 179 $_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'] ) ) { 175 182 $_POST['time_format'] = $_POST['time_format_custom']; 183 } 176 184 // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. 177 185 if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { 178 186 $_POST['gmt_offset'] = $_POST['timezone_string']; … … 235 243 * Handle settings errors and return to options page 236 244 */ 237 245 // If no settings errors were registered add a general 'updated' message. 238 if ( !count( get_settings_errors() ) ) 246 if ( !count( get_settings_errors() ) ) { 239 247 add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); 248 } 240 249 set_transient('settings_errors', get_settings_errors(), 30); 241 250 242 251 /** … … 261 270 262 271 foreach ( (array) $options as $option ) : 263 272 $disabled = false; 264 if ( $option->option_name == '' ) 273 if ( $option->option_name == '' ) { 265 274 continue; 275 } 266 276 if ( is_serialized( $option->option_value ) ) { 267 277 if ( is_serialized_string( $option->option_value ) ) { 268 278 // This is a serialized string, so we should display it.