Changeset 5831
- Timestamp:
- 08/01/2007 07:14:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-includes/functions.php
r5121 r5831 300 300 /* Options functions */ 301 301 302 // expects $setting to already be SQL-escaped 302 303 function get_settings($setting) { 303 304 global $wpdb; … … 377 378 } 378 379 380 // expects $option_name to NOT be SQL-escaped 379 381 function update_option($option_name, $newvalue) { 380 382 global $wpdb; 381 383 384 $safe_option_name = $wpdb->escape($option_name); 385 382 386 if ( is_string($newvalue) ) 383 387 $newvalue = trim($newvalue); 384 388 385 389 // If the new and old values are the same, no need to update. 386 $oldvalue = get_option($ option_name);390 $oldvalue = get_option($safe_option_name); 387 391 if ( $newvalue == $oldvalue ) { 388 392 return false; … … 417 421 418 422 // thx Alex Stapleton, http://alex.vort-x.net/blog/ 423 // expects $name to NOT be SQL-escaped 419 424 function add_option($name, $value = '', $description = '', $autoload = 'yes') { 420 425 global $wpdb; 421 426 427 $safe_name = $wpdb->escape($name); 428 422 429 // Make sure the option doesn't already exist 423 if ( false !== get_option($ name) )430 if ( false !== get_option($safe_name) ) 424 431 return; 425 432
Note: See TracChangeset
for help on using the changeset viewer.