Upgrade to WordPress 2.6.2.
authormrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Oct 2008 02:21:53 +0000 (02:21 +0000)
committermrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Oct 2008 02:21:53 +0000 (02:21 +0000)
* blog:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@37309 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
WebKitSite/ChangeLog
WebKitSite/blog/wp-admin/import/textpattern.php
WebKitSite/blog/wp-admin/includes/image.php
WebKitSite/blog/wp-admin/includes/template.php
WebKitSite/blog/wp-includes/formatting.php
WebKitSite/blog/wp-includes/pluggable.php
WebKitSite/blog/wp-includes/post.php
WebKitSite/blog/wp-includes/query.php
WebKitSite/blog/wp-includes/version.php
WebKitSite/blog/wp-includes/widgets.php
WebKitSite/blog/wp-login.php
WebKitSite/blog/wp-settings.php

index ce7964a..ea24fc3 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-04  Mark Rowe  <mrowe@apple.com>
+
+        Upgrade to WordPress 2.6.2.
+
+        * blog:
+
 2008-09-26  Timothy Hatcher  <timothy@apple.com>
 
         Add screenshots of searching in the Web Inspector.
index c3fb1d7..bbddc08 100644 (file)
@@ -333,7 +333,7 @@ class Textpattern_Import {
                                $category1 = get_category_by_slug($Category1);
                                $category1 = $category1->term_id;
                                $category2 = get_category_by_slug($Category2);
-                               $category2 = $category1->term_id;
+                               $category2 = $category2->term_id;
                                if($cat1 = $category1) { $cats[1] = $cat1; }
                                if($cat2 = $category2) { $cats[2] = $cat2; }
 
index 7699f98..8de2907 100644 (file)
@@ -219,17 +219,17 @@ function wp_read_image_metadata( $file ) {
                if ( !empty($info['APP13']) ) {
                        $iptc = iptcparse($info['APP13']);
                        if ( !empty($iptc['2#110'][0]) ) // credit
-                               $meta['credit'] = trim( $iptc['2#110'][0] );
+                               $meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
                        elseif ( !empty($iptc['2#080'][0]) ) // byline
-                               $meta['credit'] = trim( $iptc['2#080'][0] );
+                               $meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
                        if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created datee and time
                                $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
                        if ( !empty($iptc['2#120'][0]) ) // caption
-                               $meta['caption'] = trim( $iptc['2#120'][0] );
+                               $meta['caption'] = utf8_encode(trim($iptc['2#120'][0]));
                        if ( !empty($iptc['2#116'][0]) ) // copyright
-                               $meta['copyright'] = trim( $iptc['2#116'][0] );
+                               $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0]));
                        if ( !empty($iptc['2#005'][0]) ) // title
-                               $meta['title'] = trim( $iptc['2#005'][0] );
+                               $meta['title'] = utf8_encode(trim($iptc['2#005'][0]));
                 }
        }
 
index 3d6aac5..e132733 100644 (file)
@@ -715,7 +715,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
                        $approved
                        ORDER BY comment_date_gmt DESC LIMIT $start, $num");
        } else {
-               $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments USE INDEX (comment_date_gmt) WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
+               $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
        }
 
        update_comment_cache($comments);
index e2b969a..eeafe0b 100644 (file)
@@ -332,6 +332,9 @@ function sanitize_user( $username, $strict = false ) {
        if ( $strict )
                $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
 
+       // Consolidate contiguous whitespace
+       $username = preg_replace('|\s+|', ' ', $username);
+
        return apply_filters('sanitize_user', $username, $raw_username, $strict);
 }
 
index 09b4c06..e7ca2a7 100644 (file)
@@ -1289,11 +1289,53 @@ function wp_generate_password($length = 12, $special_chars = true) {
 
        $password = '';
        for ( $i = 0; $i < $length; $i++ )
-               $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
+               $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
        return $password;
 }
 endif;
 
+if ( !function_exists('wp_rand') ) :
+ /**
+ * Generates a random number
+ *
+ * @since 2.6.2
+ *
+ * @param int $min Lower limit for the generated number (optional, default is 0)
+ * @param int $max Upper limit for the generated number (optional, default is 4294967295)
+ * @return int A random number between min and max
+ */
+function wp_rand( $min = 0, $max = 0 ) {
+       global $rnd_value;
+
+       $seed = get_option('random_seed');
+
+       // Reset $rnd_value after 14 uses
+       // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
+       if ( strlen($rnd_value) < 8 ) {
+               $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
+               $rnd_value .= sha1($rnd_value);
+               $rnd_value .= sha1($rnd_value . $seed);
+               $seed = md5($seed . $rnd_value);
+               update_option('random_seed', $seed);
+       }
+
+       // Take the first 8 digits for our value
+       $value = substr($rnd_value, 0, 8);
+
+       // Strip the first eight, leaving the remainder for the next call to wp_rand().
+       $rnd_value = substr($rnd_value, 8);
+
+       $value = abs(hexdec($value));
+
+       // Reduce the value to be within the min - max range
+       // 4294967295 = 0xffffffff = max random number
+       if ( $max != 0 )
+               $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1)));
+
+       return abs(intval($value)); 
+}
+endif;
+
 if ( !function_exists('wp_set_password') ) :
 /**
  * Updates the user's password with a new encrypted one.
index 252489c..3252640 100644 (file)
@@ -465,7 +465,7 @@ function get_posts($args = null) {
                'order' => 'DESC', 'include' => '',
                'exclude' => '', 'meta_key' => '',
                'meta_value' =>'', 'post_type' => 'post',
-               'post_parent' => 0
+               'post_parent' => 0, 'suppress_filters' => true
        );
 
        $r = wp_parse_args( $args, $defaults );
@@ -594,27 +594,20 @@ function get_post_meta($post_id, $key, $single = false) {
 
        $meta_cache = wp_cache_get($post_id, 'post_meta');
 
+       if ( !$meta_cache ) {
+               update_postmeta_cache($post_id);
+               $meta_cache = wp_cache_get($post_id, 'post_meta');
+       }
+
        if ( isset($meta_cache[$key]) ) {
                if ( $single ) {
                        return maybe_unserialize( $meta_cache[$key][0] );
                } else {
-                       return maybe_unserialize( $meta_cache[$key] );
+                       return array_map('maybe_unserialize', $meta_cache[$key]);
                }
        }
 
-       if ( !$meta_cache ) {
-               update_postmeta_cache($post_id);
-               $meta_cache = wp_cache_get($post_id, 'post_meta');
-       }
-
-       if ( $single ) {
-               if ( isset($meta_cache[$key][0]) )
-                       return maybe_unserialize($meta_cache[$key][0]);
-               else
-                       return '';
-       } else {
-               return maybe_unserialize($meta_cache[$key]);
-       }
+       return '';
 }
 
 /**
@@ -3297,7 +3290,7 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
        if ( !$post || empty($post['ID']) )
                return;
 
-       if ( isset($post['post_type']) && 'revision' == $post_post['type'] )
+       if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
                return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
 
        $post = _wp_post_revision_fields( $post, $autosave );
index 3410ebc..40208f3 100644 (file)
@@ -775,7 +775,7 @@ class WP_Query {
                if ( !empty($qv['post_status']) )
                        $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
 
-               if ( $this->is_posts_page && !$qv['withcomments'] )
+               if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
                        $this->is_comment_feed = false;
 
                $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
@@ -829,7 +829,12 @@ class WP_Query {
                $join = '';
                $search = '';
                $groupby = '';
+               $fields = "$wpdb->posts.*";
                $post_status_join = false;
+               $page = 1;
+
+               if ( !isset($q['suppress_filters']) )
+                       $q['suppress_filters'] = false;
 
                if ( !isset($q['post_type']) ) {
                        if ( $this->is_search )
@@ -1361,8 +1366,10 @@ class WP_Query {
 
                // Apply filters on where and join prior to paging so that any
                // manipulations to them are reflected in the paging by day queries.
-               $where = apply_filters('posts_where', $where);
-               $join = apply_filters('posts_join', $join);
+               if ( !$q['suppress_filters'] ) {
+                       $where = apply_filters('posts_where', $where);
+                       $join = apply_filters('posts_join', $join);
+               }
 
                // Paging
                if ( empty($q['nopaging']) && !$this->is_singular ) {
@@ -1394,9 +1401,11 @@ class WP_Query {
                                $cgroupby = '';
                        }
 
-                       $cjoin = apply_filters('comment_feed_join', $cjoin);
-                       $cwhere = apply_filters('comment_feed_where', $cwhere);
-                       $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+                       if ( !$q['suppress_filters'] ) {
+                               $cjoin = apply_filters('comment_feed_join', $cjoin);
+                               $cwhere = apply_filters('comment_feed_where', $cwhere);
+                               $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+                       }
 
                        $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss'));
                        $this->comment_count = count($this->comments);
@@ -1414,28 +1423,33 @@ class WP_Query {
                                $where = "AND 0";
                }
 
+               $orderby = $q['orderby'];
+
                // Apply post-paging filters on where and join.  Only plugins that
                // manipulate paging queries should use these hooks.
-
-               $where = apply_filters('posts_where_paged', $where);
-               $groupby = apply_filters('posts_groupby', $groupby);
-               $join = apply_filters('posts_join_paged', $join);
-               $orderby = apply_filters('posts_orderby', $q['orderby']);
-               $distinct = apply_filters('posts_distinct', $distinct);
-               $fields = apply_filters('posts_fields', "$wpdb->posts.*");
-               $limits = apply_filters( 'post_limits', $limits );
+               if ( !$q['suppress_filters'] ) {
+                       $where = apply_filters('posts_where_paged', $where);
+                       $groupby = apply_filters('posts_groupby', $groupby);
+                       $join = apply_filters('posts_join_paged', $join);
+                       $orderby = apply_filters('posts_orderby', $orderby);
+                       $distinct = apply_filters('posts_distinct', $distinct);
+                       $fields = apply_filters('posts_fields', $fields);
+                       $limits = apply_filters( 'post_limits', $limits );
+               }
 
                // Announce current selection parameters.  For use by caching plugins.
                do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
 
                // Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above.
-               $where = apply_filters('posts_where_request', $where);
-               $groupby = apply_filters('posts_groupby_request', $groupby);
-               $join = apply_filters('posts_join_request', $join);
-               $orderby = apply_filters('posts_orderby_request', $orderby);
-               $distinct = apply_filters('posts_distinct_request', $distinct);
-               $fields = apply_filters('posts_fields_request', $fields);
-               $limits = apply_filters( 'post_limits_request', $limits );
+               if ( !$q['suppress_filters'] ) {
+                       $where = apply_filters('posts_where_request', $where);
+                       $groupby = apply_filters('posts_groupby_request', $groupby);
+                       $join = apply_filters('posts_join_request', $join);
+                       $orderby = apply_filters('posts_orderby_request', $orderby);
+                       $distinct = apply_filters('posts_distinct_request', $distinct);
+                       $fields = apply_filters('posts_fields_request', $fields);
+                       $limits = apply_filters( 'post_limits_request', $limits );
+               }
 
                if ( ! empty($groupby) )
                        $groupby = 'GROUP BY ' . $groupby;
@@ -1445,12 +1459,14 @@ class WP_Query {
                if ( !empty($limits) )
                        $found_rows = 'SQL_CALC_FOUND_ROWS';
 
-               $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
-               $this->request = apply_filters('posts_request', $request);
+               $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
+               if ( !$q['suppress_filters'] )
+                       $this->request = apply_filters('posts_request', $this->request);
 
                $this->posts = $wpdb->get_results($this->request);
                // Raw results filter.  Prior to status checks.
-               $this->posts = apply_filters('posts_results', $this->posts);
+               if ( !$q['suppress_filters'] )
+                       $this->posts = apply_filters('posts_results', $this->posts);
 
                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
                        $cjoin = apply_filters('comment_feed_join', '');
@@ -1497,7 +1513,8 @@ class WP_Query {
                        }
                }
 
-               $this->posts = apply_filters('the_posts', $this->posts);
+               if ( !$q['suppress_filters'] )
+                       $this->posts = apply_filters('the_posts', $this->posts);
 
                update_post_caches($this->posts);
 
index fb8daf4..d532c52 100644 (file)
@@ -8,7 +8,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '2.6.1';
+$wp_version = '2.6.2';
 
 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
index 2a71a02..73e1f6e 100644 (file)
@@ -1162,8 +1162,12 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                                        $author = ' <cite>' . wp_specialchars( strip_tags( $item['author_name'] ) ) . '</cite>';
                        }
 
-                       echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
-               }
+                       if ( $link == '' ) {
+                               echo "<li>$title{$date}{$summary}{$author}</li>"; 
+                       } else {
+                               echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>"; 
+                       }
+}
                echo '</ul>';
        } else {
                echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
index e1fa23b..265a223 100644 (file)
@@ -424,6 +424,8 @@ default:
 
        $user = wp_signon('', $secure_cookie);
 
+       $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
+
        if ( !is_wp_error($user) ) {
                // If the user can't edit posts, send them to their profile.
                if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
index 588ffc2..466f04a 100644 (file)
@@ -101,7 +101,7 @@ if ( empty($PHP_SELF) )
        $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
 
 if ( version_compare( '4.3', phpversion(), '>' ) ) {
-       die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, php_version() ) );
+       die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
 }
 
 if ( !defined('WP_CONTENT_DIR') )