Ticket #2591: optionsphp-serialize.diff
File optionsphp-serialize.diff, 1.7 KB (added by , 19 years ago) |
---|
-
options.php
50 50 foreach ($options as $option) { 51 51 $option = trim($option); 52 52 $value = trim(stripslashes($_POST[$option])); 53 $type = trim(stripslashes($_POST['type'][$option])); 53 54 if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) 54 55 $value = 'closed'; 55 56 56 57 if( $option == 'blogdescription' || $option == 'blogname' ) 57 58 if (current_user_can('unfiltered_html') == false) 58 59 $value = wp_filter_post_kses( $value ); 59 60 61 if ('array' != $type && 'object' != $type) 62 $value = serialize($value); 63 60 64 if (update_option($option, $value) ) { 61 65 $any_changed++; 62 66 } … … 95 99 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name"); 96 100 97 101 foreach ($options as $option) : 98 $value = wp_specialchars($option->option_value); 102 $value = maybe_unserialize($option->option_value); 103 $type = gettype($value); 104 105 if ('array' == $type || 'object' == $type) 106 $value = $option->option_value; 107 108 $value = wp_specialchars($value); 99 109 echo " 100 110 <tr> 101 111 <th scope='row'><label for='$option->option_name'>$option->option_name</label></th> 102 <td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /></td> 112 <td> 113 <input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /> 114 <input type='hidden' name='type[$option->option_name]' id='type[$option->option_name]' size='30' value='" . $type . "' /> 115 </td> 103 116 <td>$option->option_description</td> 104 117 </tr>"; 105 118 endforeach;