Ticket #35379: 35379.diff
File 35379.diff, 2.4 KB (added by , 9 years ago) |
---|
-
src/wp-includes/formatting.php
3637 3637 * 3638 3638 * @param string $option The name of the option. 3639 3639 * @param string $value The unsanitised value. 3640 * @param string|boolean $network_id Optional. 3641 * Used when sanitizing a network option on a specific network ID. 3642 * Otherwise if is set to boolean TRUE, it will use the current site network ID 3643 * Defaults to FALSE 3644 * 3640 3645 * @return string Sanitized value. 3641 3646 */ 3642 function sanitize_option( $option, $value 3647 function sanitize_option( $option, $value,$network_id=false) { 3643 3648 global $wpdb; 3644 3649 3645 3650 $original_value = $value; 3646 3651 $error = ''; 3647 3652 3653 $network_called=false; 3654 if (( is_multisite() ) && ($network_id)) { 3655 global $current_site; 3656 if ((isset($current_site->id)) && (true === $network_id )) { 3657 $network_id = $current_site->id; 3658 } 3659 3660 $network_id = (int) $network_id; 3661 if ($network_id > 0) { 3662 $network_called=true; 3663 } 3664 } 3665 3648 3666 switch ( $option ) { 3649 3667 case 'admin_email' : 3650 3668 case 'new_admin_email' : … … 3780 3798 $allowed[] = WPLANG; 3781 3799 } 3782 3800 if ( ! in_array( $value, $allowed ) && ! empty( $value ) ) { 3783 $value = get_option( $option ); 3801 if ($network_called) { 3802 $value = get_network_option( $network_id, $option, false ); 3803 } else { 3804 $value = get_option( $option ); 3805 } 3806 3784 3807 } 3785 3808 break; 3786 3809 … … 3860 3883 } 3861 3884 3862 3885 if ( ! empty( $error ) ) { 3863 $value = get_option( $option ); 3886 if ($network_called) { 3887 $value = get_network_option( $network_id, $option, false ); 3888 } else { 3889 $value = get_option( $option ); 3890 } 3864 3891 if ( function_exists( 'add_settings_error' ) ) { 3865 3892 add_settings_error( $option, "invalid_{$option}", $error ); 3866 3893 } -
src/wp-includes/option.php
1433 1433 if ( ! is_multisite() ) { 1434 1434 $result = update_option( $option, $value ); 1435 1435 } else { 1436 $value = sanitize_option( $option, $value 1436 $value = sanitize_option( $option, $value, $network_id); 1437 1437 1438 1438 $serialized_value = maybe_serialize( $value ); 1439 1439 $result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $network_id, 'meta_key' => $option ) );