diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-08-06 09:35:24 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-08-06 09:35:24 +0000 |
| commit | d407afd2cf84fa1d87be4dd387cdb6539aac3112 (patch) | |
| tree | 3b87936604a68a81cfcca74af607c5108d535142 /wp-includes | |
| parent | f7904d143986a96e6f209b51b380ad1ee640cad5 (diff) | |
| download | wordpress-mu-d407afd2cf84fa1d87be4dd387cdb6539aac3112.tar.gz wordpress-mu-d407afd2cf84fa1d87be4dd387cdb6539aac3112.tar.xz wordpress-mu-d407afd2cf84fa1d87be4dd387cdb6539aac3112.zip | |
Sync for WP 2.2.2
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1013 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
| -rw-r--r-- | wp-includes/functions.php | 25 | ||||
| -rw-r--r-- | wp-includes/general-template.php | 3 | ||||
| -rw-r--r-- | wp-includes/theme.php | 1 | ||||
| -rw-r--r-- | wp-includes/widgets.php | 2 |
4 files changed, 22 insertions, 9 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 67787e1..60a5730 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -203,6 +203,7 @@ function is_serialized_string($data) { /* Options functions */ +// expects $setting to already be SQL-escaped function get_option($setting) { global $wpdb, $switched, $current_blog; @@ -311,16 +312,19 @@ function wp_load_alloptions() { return $alloptions; } +// expects $option_name to NOT be SQL-escaped function update_option($option_name, $newvalue) { global $wpdb; wp_protect_special_option($option_name); + $safe_option_name = $wpdb->escape($option_name); + if ( is_string($newvalue) ) $newvalue = trim($newvalue); // If the new and old values are the same, no need to update. - $oldvalue = get_option($option_name); + $oldvalue = get_option($safe_option_name); if ( $newvalue === $oldvalue ) { return false; } @@ -358,21 +362,21 @@ function update_option($option_name, $newvalue) { } // thx Alex Stapleton, http://alex.vort-x.net/blog/ +// expects $name to NOT be SQL-escaped function add_option($name, $value = '', $description = '', $autoload = 'yes') { global $wpdb; wp_protect_special_option($name); + $safe_name = $wpdb->escape($name); - // Make sure the option doesn't already exist we can check the cache before we ask for a db query + // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query $notoptions = wp_cache_get('notoptions', 'options'); - if ( is_array($notoptions) && isset($notoptions[$name]) ) { - unset($notoptions[$name]); - wp_cache_set('notoptions', $notoptions, 'options'); - } elseif ( false !== get_option($name) ) { + if ( !is_array($notoptions) || !isset($notoptions[$name]) ) + if ( false !== get_option($safe_name) ) return; - } $value = maybe_serialize($value); + $autoload = ( 'no' === $autoload ) ? 'no' : 'yes'; if ( 'yes' == $autoload ) { $alloptions = wp_load_alloptions(); @@ -382,6 +386,13 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') { wp_cache_set($name, $value, 'options'); } + // This option exists now + $notoptions = wp_cache_get('notoptions', 'options'); // yes, again... we need it to be fresh + if ( is_array($notoptions) && isset($notoptions[$name]) ) { + unset($notoptions[$name]); + wp_cache_set('notoptions', $notoptions, 'options'); + } + $name = $wpdb->escape($name); $value = $wpdb->escape($value); $description = $wpdb->escape($description); diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index bdc5b04..7c3c5f3 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -814,7 +814,8 @@ function user_can_richedit() { if ( !isset( $wp_rich_edit) ) { if ( get_user_option( 'rich_editing' ) == 'true' && ( ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval($match[1]) >= 420 ) || - !preg_match( '!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT'] ) ) ) { + !preg_match( '!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT'] ) ) + && 'comment.php' != $pagenow ) { $wp_rich_edit = true; } else { $wp_rich_edit = false; diff --git a/wp-includes/theme.php b/wp-includes/theme.php index e561e23..f20ae68 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -79,6 +79,7 @@ function get_theme_data( $theme_file ) { $name = trim( $name ); $theme = $name; $theme_uri = trim( $theme_uri[1] ); + $template = trim( $template[1] ); if ( '' == $author_uri[1] ) { $author = trim( $author_name[1] ); diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 25027d3..52f0a0e 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -630,7 +630,7 @@ function wp_widget_categories($args) { var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { - location.href = "<?php echo get_option('siteurl'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; + location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange = onCatChange; |
