diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index fcc3cb1be..792c834d7 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.php @@ -92,7 +92,7 @@ if ($action == 'retrospam') {

- +

diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index f9cc2bedd..f0aa0d6ca 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -11,7 +11,7 @@ include('admin-header.php');

- + diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index 2229042c3..138833b3a 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -63,7 +63,7 @@ echo "\n\t";

- +

diff --git a/wp-admin/options-personal.php b/wp-admin/options-personal.php index 4d9583a40..4afffc369 100644 --- a/wp-admin/options-personal.php +++ b/wp-admin/options-personal.php @@ -12,7 +12,7 @@ include('admin-header.php');

-

+

diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index 2bd7a45e5..1274fd14a 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.php @@ -55,7 +55,7 @@ include('admin-header.php');

- +

diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index b8cf448bc..f3be84959 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -89,7 +89,7 @@ endforeach;

- +

diff --git a/wp-admin/options.php b/wp-admin/options.php index ecfb2c2b6..7d7865684 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -33,40 +33,32 @@ case 'update': if (!$_POST['page_options']) { foreach ($_POST as $key => $value) { - $option_names[] = "'$key'"; + $options[] = "'$key'"; } - $option_names = implode(',', $option_names); } else { - $option_names = stripslashes($_POST['page_options']); + $options = explode(',', stripslashes($_POST['page_options'])); } - $options = $wpdb->get_results("SELECT $wpdb->options.option_id, option_name, option_type, option_value, option_admin_level FROM $wpdb->options WHERE option_name IN ($option_names)"); - // Save for later. $old_siteurl = get_settings('siteurl'); $old_home = get_settings('home'); -// HACK -// Options that if not there have 0 value but need to be something like "closed" - $nonbools = array('default_ping_status', 'default_comment_status'); - if ($options) { - $options = apply_filters( 'options_to_update' , $options ); - foreach ($options as $option) { - $old_val = $option->option_value; - $new_val = trim($_POST[$option->option_name]); - if( in_array($option->option_name, $nonbools) && ( $new_val == '0' || $new_val == '') ) - $new_val = 'closed'; - if ($new_val !== $old_val) { - $result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'"); - wp_cache_set($option->option_name, $new_val, 'options'); - $any_changed++; - } + // HACK + // Options that if not there have 0 value but need to be something like "closed" + $nonbools = array('default_ping_status', 'default_comment_status'); + if ($options) { + foreach ($options as $option) { + $option = trim($option); + $value = trim(stripslashes($_POST[$option])); + if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) + $value = 'closed'; + + if ( update_option($option, $value) ) + $any_changed++; + } } - unset($cache_settings); // so they will be re-read - get_settings('siteurl'); // make it happen now - } // end if options - if ($any_changed) { + if ($any_changed) { // If siteurl or home changed, reset cookies. if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) { // If home changed, write rewrite rules to new location. diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 0f7ce6e10..4b216e715 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -342,7 +342,7 @@ function update_option($option_name, $newvalue) { // If the new and old values are the same, no need to update. $oldvalue = get_option($option_name); if ( $newvalue == $oldvalue ) - return true; + return false; if ( false === $oldvalue ) { add_option($option_name, $newvalue);