Index: wp-login.php =================================================================== --- wp-login.php (.../2.1) (revision 5900) +++ wp-login.php (.../2.1.3) (revision 5900) @@ -286,7 +286,7 @@ $user_pass = ''; $using_cookie = FALSE; - if ( !isset( $_REQUEST['redirect_to'] ) ) + if ( !isset( $_REQUEST['redirect_to'] ) || is_user_logged_in() ) $redirect_to = 'wp-admin/'; else $redirect_to = $_REQUEST['redirect_to']; Index: wp-comments-post.php =================================================================== --- wp-comments-post.php (.../2.1) (revision 5900) +++ wp-comments-post.php (.../2.1.3) (revision 5900) @@ -25,14 +25,20 @@ // If the user is logged in $user = wp_get_current_user(); -if ( $user->ID ) : +if ( $user->ID ) { $comment_author = $wpdb->escape($user->display_name); $comment_author_email = $wpdb->escape($user->user_email); $comment_author_url = $wpdb->escape($user->user_url); -else : + if ( current_user_can('unfiltered_html') ) { + if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { + kses_remove_filters(); // start with a clean slate + kses_init_filters(); // set up the filters + } + } +} else { if ( get_option('comment_registration') ) wp_die( __('Sorry, you must be logged in to post a comment.') ); -endif; +} $comment_type = ''; Index: wp-includes/default-filters.php =================================================================== --- wp-includes/default-filters.php (.../2.1) (revision 5900) +++ wp-includes/default-filters.php (.../2.1.3) (revision 5900) @@ -31,6 +31,8 @@ add_filter('pre_comment_author_email', 'wp_filter_kses'); add_filter('pre_comment_author_url', 'wp_filter_kses'); +add_action('comment_form', 'wp_comment_form_unfiltered_html_nonce'); + // Default filters for these functions add_filter('comment_author', 'wptexturize'); add_filter('comment_author', 'convert_chars'); Index: wp-includes/post-template.php =================================================================== --- wp-includes/post-template.php (.../2.1) (revision 5900) +++ wp-includes/post-template.php (.../2.1.3) (revision 5900) @@ -273,6 +273,7 @@ $r = array_merge($defaults, $r); $output = ''; + $current_page = 0; // sanitize, mostly to keep spaces out $r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']); @@ -288,7 +289,8 @@ $output .= '
$1
\n", $pee); // make paragraphs, including one at the end $pee = preg_replace('|\s*?
|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace - $pee = preg_replace( '|(
", $pee ); $pee = preg_replace('!
([^<]+)\s*?((?:div|address|form)[^>]*>)!', "
$1
$2", $pee); $pee = preg_replace( '||', "$1
", $pee ); $pee = preg_replace('!
\s*(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee); // don't pee all over a tag @@ -82,7 +81,7 @@ if ( strstr( $pee, ')(.*?)!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '' ", $pee); $pee = preg_replace( "|\n$|", '', $pee ); -/**/ + return $pee; } @@ -1073,7 +1072,11 @@ $strip = array('%0d', '%0a'); $url = str_replace($strip, '', $url); $url = str_replace(';//', '://', $url); - $url = (!strstr($url, '://')) ? 'http://'.$url : $url; + // Append http unless a relative link starting with / or a php file. + if ( strpos($url, '://') === false && + substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9]+?\.php/i', $url) ) + $url = 'http://' . $url; + $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); if ( !is_array($protocols) ) $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'); Index: wp-includes/author-template.php =================================================================== --- wp-includes/author-template.php (.../2.1) (revision 5900) +++ wp-includes/author-template.php (.../2.1.3) (revision 5900) @@ -144,7 +144,7 @@ function get_author_posts_url($author_id, $author_nicename = '') { global $wpdb, $wp_rewrite, $post, $cache_userdata; - $auth_ID = $author_id; + $auth_ID = (int) $author_id; $link = $wp_rewrite->get_author_permastruct(); if ( empty($link) ) { Index: wp-includes/category.php =================================================================== --- wp-includes/category.php (.../2.1) (revision 5900) +++ wp-includes/category.php (.../2.1.3) (revision 5900) @@ -33,7 +33,7 @@ $key = md5( serialize( $r ) ); if ( $cache = wp_cache_get( 'get_categories', 'category' ) ) if ( isset( $cache[ $key ] ) ) - return $cache[ $key ]; + return apply_filters('get_categories', $cache[$key], $r); $where = 'cat_ID > 0'; $inclusions = ''; @@ -146,6 +146,7 @@ wp_cache_add($category->cat_ID, $category, 'category'); $_category = $category; } else { + $category = (int) $category; if ( ! $_category = wp_cache_get($category, 'category') ) { $_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1"); wp_cache_set($category, $_category, 'category'); Index: wp-includes/post.php =================================================================== --- wp-includes/post.php (.../2.1) (revision 5900) +++ wp-includes/post.php (.../2.1.3) (revision 5900) @@ -74,16 +74,16 @@ // get extended entry info () function get_extended($post) { //Match the new style more links - if (preg_match('//', $post, $matches)) { - list($main,$extended) = explode($matches[0],$post,2); + if ( preg_match('//', $post, $matches) ) { + list($main, $extended) = explode($matches[0], $post, 2); } else { $main = $post; $extended = ''; } // Strip leading and trailing whitespace - $main = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$main); - $extended = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$extended); + $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main); + $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended); return array('main' => $main, 'extended' => $extended); } @@ -105,6 +105,7 @@ $post_cache[$blog_id][$post->ID] = &$post; $_post = & $post_cache[$blog_id][$post->ID]; } else { + $post = (int) $post; if ( $_post = wp_cache_get($post, 'pages') ) return get_page($_post, $output); elseif ( isset($post_cache[$blog_id][$post]) ) @@ -374,7 +375,7 @@ global $id, $post_meta_cache, $wpdb, $blog_id; if ( !$post_id ) - $post_id = $id; + $post_id = (int) $id; $post_id = (int) $post_id; @@ -446,6 +447,8 @@ } function wp_get_post_categories($post_id = 0) { + $post_id = (int) $post_id; + $cats = &get_the_category($post_id); $cat_ids = array(); foreach ( $cats as $cat ) @@ -457,6 +460,7 @@ global $wpdb; // Set the limit clause, if we got a limit + $num = (int) $num; if ($num) { $limit = "LIMIT $num"; } @@ -470,6 +474,8 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) { global $wpdb; + $postid = (int) $postid; + $post = get_post($postid, $mode); // Set categories @@ -533,7 +539,7 @@ // Get the post ID. if ( $update ) - $post_ID = $ID; + $post_ID = (int) $ID; // Create a valid post name. Drafts are allowed to have an empty // post name. @@ -637,7 +643,7 @@ (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); - $post_ID = $wpdb->insert_id; + $post_ID = (int) $wpdb->insert_id; } if ( empty($post_name) && 'draft' != $post_status ) { @@ -763,6 +769,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { global $wpdb; + + $post_ID = (int) $post_ID; // If $post_categories isn't already an array, make it one: if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories)) $post_categories = array(get_option('default_category')); @@ -773,7 +781,7 @@ $old_categories = $wpdb->get_col(" SELECT category_id FROM $wpdb->post2cat - WHERE post_id = $post_ID"); + WHERE post_id = '$post_ID'"); if (!$old_categories) { $old_categories = array(); @@ -788,8 +796,8 @@ foreach ($delete_cats as $del) { $wpdb->query(" DELETE FROM $wpdb->post2cat - WHERE category_id = $del - AND post_id = $post_ID + WHERE category_id = '$del' + AND post_id = '$post_ID' "); } } @@ -799,10 +807,11 @@ if ($add_cats) { foreach ($add_cats as $new_cat) { + $new_cat = (int) $new_cat; if ( !empty($new_cat) ) $wpdb->query(" INSERT INTO $wpdb->post2cat (post_id, category_id) - VALUES ($post_ID, $new_cat)"); + VALUES ('$post_ID', '$new_cat')"); } } @@ -928,6 +937,7 @@ wp_cache_add($page->ID, $page, 'pages'); $_page = $page; } else { + $page = (int) $page; // first, check the cache if ( ! ( $_page = wp_cache_get($page, 'pages') ) ) { // not in the page cache? @@ -1244,7 +1254,7 @@ $update = false; if ( !empty($ID) ) { $update = true; - $post_ID = $ID; + $post_ID = (int) $ID; } // Create a valid post name. @@ -1339,7 +1349,7 @@ (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); - $post_ID = $wpdb->insert_id; + $post_ID = (int) $wpdb->insert_id; } if ( empty($post_name) ) { @@ -1494,7 +1504,7 @@ $mime = (int) $mime; if ( !$post =& get_post( $mime ) ) return false; - $post_id = $post->ID; + $post_id = (int) $post->ID; $mime = $post->post_mime_type; } Index: wp-includes/version.php =================================================================== --- wp-includes/version.php (.../2.1) (revision 5900) +++ wp-includes/version.php (.../2.1.3) (revision 5900) @@ -2,7 +2,7 @@ // This holds the version number in a separate file so we can bump it without cluttering the SVN -$wp_version = '2.1'; -$wp_db_version = 4772; +$wp_version = '2.1.3'; +$wp_db_version = 4773; ?> Index: wp-includes/js/scriptaculous/wp-scriptaculous.js =================================================================== --- wp-includes/js/scriptaculous/wp-scriptaculous.js (.../2.1) (revision 0) +++ wp-includes/js/scriptaculous/wp-scriptaculous.js (.../2.1.3) (revision 5900) @@ -0,0 +1,40 @@ +// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. + +var Scriptaculous = { + Version: '1.6.1', + require: function(libraryName) { + // inserting via DOM fails in Safari 2.0, so brute force approach + document.write(''); + }, + load: function() { + if((typeof Prototype=='undefined') || + (typeof Element == 'undefined') || + (typeof Element.Methods=='undefined') || + parseFloat(Prototype.Version.split(".")[0] + "." + + Prototype.Version.split(".")[1]) < 1.5) + throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); + + $A(document.getElementsByTagName("script")).findAll( function(s) { + return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) + }).each( function(s) { + var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); + var includes = s.src.match(/\?.*load=([a-z,]*)/); + if ( includes ) + includes[1].split(',').each( + function(include) { Scriptaculous.require(path+include+'.js') }); + }); + } +} + +Scriptaculous.load(); Index: wp-includes/js/tinymce/tiny_mce_config.php =================================================================== --- wp-includes/js/tinymce/tiny_mce_config.php (.../2.1) (revision 5900) +++ wp-includes/js/tinymce/tiny_mce_config.php (.../2.1.3) (revision 5900) @@ -1,5 +1,6 @@ ", valid_elements : "", Index: wp-includes/js/tinymce/wp-mce-help.php =================================================================== --- wp-includes/js/tinymce/wp-mce-help.php (.../2.1) (revision 5900) +++ wp-includes/js/tinymce/wp-mce-help.php (.../2.1.3) (revision 5900) @@ -1,4 +1,6 @@ - + > Index: wp-includes/js/tinymce/tiny_mce_gzip.php =================================================================== --- wp-includes/js/tinymce/tiny_mce_gzip.php (.../2.1) (revision 5900) +++ wp-includes/js/tinymce/tiny_mce_gzip.php (.../2.1.3) (revision 5900) @@ -6,7 +6,7 @@ * * @version 1.08 * @author Moxiecode - * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright 2005-2006, Moxiecode Systems AB, All rights reserved. * * This file compresses the TinyMCE JavaScript using GZip and * enables the browser to do two requests instead of one for each .js file. @@ -82,7 +82,7 @@ $debug = false; // Enable this option if you need debuging info // Headers -header("Content-type: text/javascript; charset: UTF-8"); +header("Content-Type: text/javascript; charset=" . get_bloginfo('charset')); // header("Cache-Control: must-revalidate"); header("Vary: Accept-Encoding"); // Handle proxies header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); Index: wp-includes/general-template.php =================================================================== --- wp-includes/general-template.php (.../2.1) (revision 5900) +++ wp-includes/general-template.php (.../2.1.3) (revision 5900) @@ -147,8 +147,7 @@ function wp_title($sep = '»', $display = true) { - global $wpdb; - global $m, $year, $monthnum, $day, $category_name, $wp_locale, $posts; + global $wpdb, $wp_locale, $wp_query; $cat = get_query_var('cat'); $p = get_query_var('p'); @@ -156,6 +155,10 @@ $category_name = get_query_var('category_name'); $author = get_query_var('author'); $author_name = get_query_var('author_name'); + $m = (int) get_query_var('m'); + $year = (int) get_query_var('year'); + $monthnum = (int)get_query_var('monthnum'); + $day = (int) get_query_var('day'); $title = ''; // If there's a category @@ -196,14 +199,15 @@ if ( !empty($year) ) { $title = $year; if ( !empty($monthnum) ) - $title .= " $sep ".$wp_locale->get_month($monthnum); + $title .= " $sep " . $wp_locale->get_month($monthnum); if ( !empty($day) ) - $title .= " $sep ".zeroise($day, 2); + $title .= " $sep " . zeroise($day, 2); } // If there is a post if ( is_single() || is_page() ) { - $title = strip_tags($posts[0]->post_title); + $queried = $wp_query->get_queried_object(); + $title = strip_tags($queried->post_title); $title = apply_filters('single_post_title', $title); } @@ -256,7 +260,12 @@ function single_month_title($prefix = '', $display = true ) { - global $m, $monthnum, $wp_locale, $year; + global $wp_locale; + + $m = (int) get_query_var('m'); + $year = (int) get_query_var('year'); + $monthnum = (int) get_query_var('monthnum'); + if ( !empty($monthnum) && !empty($year) ) { $my_year = $year; $my_month = $wp_locale->get_month($monthnum); @@ -280,6 +289,7 @@ function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') { $text = wptexturize($text); $title_text = attribute_escape($text); + $url = clean_url($url); if ('link' == $format) return "\t\n"; @@ -962,7 +972,7 @@ $link = str_replace('%#%', $current - 1, $link); if ( $add_args ) $link = add_query_arg( $add_args, $link ); - $page_links[] = "$prev_text"; + $page_links[] = "$prev_text"; endif; for ( $n = 1; $n <= $total; $n++ ) : if ( $n == $current ) : @@ -974,7 +984,7 @@ $link = str_replace('%#%', $n, $link); if ( $add_args ) $link = add_query_arg( $add_args, $link ); - $page_links[] = "$n"; + $page_links[] = "$n"; $dots = true; elseif ( $dots && !$show_all ) : $page_links[] = "..."; @@ -987,7 +997,7 @@ $link = str_replace('%#%', $current + 1, $link); if ( $add_args ) $link = add_query_arg( $add_args, $link ); - $page_links[] = "$next_text"; + $page_links[] = "$next_text"; endif; switch ( $type ) : case 'array' : Index: wp-includes/capabilities.php =================================================================== --- wp-includes/capabilities.php (.../2.1) (revision 5900) +++ wp-includes/capabilities.php (.../2.1.3) (revision 5900) @@ -55,7 +55,7 @@ unset($this->role_objects[$role]); unset($this->role_names[$role]); unset($this->roles[$role]); - + if ( $this->use_db ) update_option($this->role_key, $this->roles); } @@ -427,7 +427,7 @@ } $author_data = get_userdata($user_id); - $page_author_data = get_userdata($post->post_author); + $page_author_data = get_userdata($page->post_author); if ($user_id == $page_author_data->ID) $caps[] = 'read'; else Index: wp-includes/classes.php =================================================================== --- wp-includes/classes.php (.../2.1) (revision 5900) +++ wp-includes/classes.php (.../2.1.3) (revision 5900) @@ -148,6 +148,9 @@ $this->query_vars[$wpvar] = $_GET[$wpvar]; elseif (!empty($perma_query_vars[$wpvar])) $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; + + if ( !empty( $this->query_vars[$wpvar] ) ) + $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar]; } foreach ($this->private_query_vars as $var) { Index: wp-includes/cron.php =================================================================== --- wp-includes/cron.php (.../2.1) (revision 5900) +++ wp-includes/cron.php (.../2.1.3) (revision 5900) @@ -93,6 +93,10 @@ } function wp_cron() { + // Prevent infinite loops caused by lack of wp-cron.php + if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false ) + return; + $crons = _get_cron_array(); if ( !is_array($crons) ) Index: wp-includes/pluggable.php =================================================================== --- wp-includes/pluggable.php (.../2.1) (revision 5900) +++ wp-includes/pluggable.php (.../2.1.3) (revision 5900) @@ -473,7 +473,7 @@ if ( !function_exists('wp_verify_nonce') ) : function wp_verify_nonce($nonce, $action = -1) { $user = wp_get_current_user(); - $uid = $user->id; + $uid = (int) $user->id; $i = ceil(time() / 43200); @@ -487,7 +487,7 @@ if ( !function_exists('wp_create_nonce') ) : function wp_create_nonce($action = -1) { $user = wp_get_current_user(); - $uid = $user->id; + $uid = (int) $user->id; $i = ceil(time() / 43200); Index: wp-includes/comment.php =================================================================== --- wp-includes/comment.php (.../2.1) (revision 5900) +++ wp-includes/comment.php (.../2.1.3) (revision 5900) @@ -81,6 +81,7 @@ $comment_cache[$comment->comment_ID] = &$comment; $_comment = & $comment_cache[$comment->comment_ID]; } else { + $comment = (int) $comment; if ( !isset($comment_cache[$comment]) ) { $_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment' LIMIT 1"); $comment_cache[$comment->comment_ID] = & $_comment; @@ -169,7 +170,7 @@ if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]); $comment_author_url = stripslashes($comment_author_url); - $comment_author_url = attribute_escape($comment_author_url); + $comment_author_url = clean_url($comment_author_url); $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url; } } @@ -345,7 +346,7 @@ ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id') "); - $id = $wpdb->insert_id; + $id = (int) $wpdb->insert_id; if ( $comment_approved == 1) wp_update_comment_count($comment_post_ID); Index: wp-includes/theme.php =================================================================== --- wp-includes/theme.php (.../2.1) (revision 5900) +++ wp-includes/theme.php (.../2.1.3) (revision 5900) @@ -345,7 +345,7 @@ function get_page_template() { global $wp_query; - $id = $wp_query->post->ID; + $id = (int) $wp_query->post->ID; $template = get_post_meta($id, '_wp_page_template', true); if ( 'default' == $template ) Index: wp-includes/feed.php =================================================================== --- wp-includes/feed.php (.../2.1) (revision 5900) +++ wp-includes/feed.php (.../2.1.3) (revision 5900) @@ -108,7 +108,7 @@ function get_author_rss_link($echo = false, $author_id, $author_nicename) { - $auth_ID = $author_id; + $auth_ID = (int) $author_id; $permalink_structure = get_option('permalink_structure'); if ( '' == $permalink_structure ) { Index: wp-includes/rss.php =================================================================== --- wp-includes/rss.php (.../2.1) (revision 5900) +++ wp-includes/rss.php (.../2.1.3) (revision 5900) @@ -782,13 +782,13 @@ if ( preg_match( $pat, $date_str, $match ) ) { list( $year, $month, $day, $hours, $minutes, $seconds) = - array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); + array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]); # calc epoch for current date assuming GMT $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); $offset = 0; - if ( $match[10] == 'Z' ) { + if ( $match[11] == 'Z' ) { # zulu time, aka GMT } else { Index: wp-includes/functions.php =================================================================== --- wp-includes/functions.php (.../2.1) (revision 5900) +++ wp-includes/functions.php (.../2.1.3) (revision 5900) @@ -566,7 +566,7 @@ $post_id_array = (array) explode(',', $post_ids); $count = count( $post_id_array); for ( $i = 0; $i < $count; $i++ ) { - $post_id = $post_id_array[ $i ]; + $post_id = (int) $post_id_array[ $i ]; if ( isset( $category_cache[$blog_id][$post_id] ) ) { unset( $post_id_array[ $i ] ); continue; @@ -620,7 +620,7 @@ $post_id_array = (array) explode(',', $post_id_list); $count = count( $post_id_array); for ( $i = 0; $i < $count; $i++ ) { - $post_id = $post_id_array[ $i ]; + $post_id = (int) $post_id_array[ $i ]; if ( isset( $post_meta_cache[$blog_id][$post_id] ) ) { // If the meta is already cached unset( $post_id_array[ $i ] ); continue; @@ -920,9 +920,11 @@ return wp_specialchars(add_query_arg('_wpnonce', wp_create_nonce($action), $actionurl)); } -function wp_nonce_field($action = -1) { - echo ''; - wp_referer_field(); +function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true) { + $name = attribute_escape($name); + echo ''; + if ( $referer ) + wp_referer_field(); } function wp_referer_field() { @@ -1190,7 +1192,7 @@ $adminurl = get_option('siteurl') . '/wp-admin'; if ( wp_get_referer() ) - $adminurl = wp_get_referer(); + $adminurl = clean_url(wp_get_referer()); $title = __('WordPress Confirmation'); // Remove extra layer of slashes. @@ -1198,16 +1200,16 @@ if ( $_POST ) { $q = http_build_query($_POST); $q = explode( ini_get('arg_separator.output'), $q); - $html .= "\t\n"; + $html .= "\t\t
" . wp_specialchars(wp_explain_nonce($action)) . "
\n\t\t\n\t\t" . wp_explain_nonce($action) . "
\n\t\n\t" . wp_specialchars(wp_explain_nonce($action)) . "
\n\t\n\t$r
"; ?> @@ -248,7 +248,7 @@ $r = ''; if ( 1 < $page ) { $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; - $r .= '« '. __('Previous Page') .'' . "\n"; + $r .= '« '. __('Previous Page') .'' . "\n"; } if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : @@ -258,7 +258,7 @@ $p = false; if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; - $r .= '' . ( $page_num ) . "\n"; + $r .= '' . ( $page_num ) . "\n"; $in = true; elseif ( $in == true ) : $r .= "...\n"; @@ -269,7 +269,7 @@ } if ( ( $page ) * 20 < $total || -1 == $total ) { $args['apage'] = $page + 1; - $r .= ''. __('Next Page') .' »' . "\n"; + $r .= ''. __('Next Page') .' »' . "\n"; } echo "$r
"; ?> Index: wp-admin/admin-ajax.php =================================================================== --- wp-admin/admin-ajax.php (.../2.1) (revision 5900) +++ wp-admin/admin-ajax.php (.../2.1.3) (revision 5900) @@ -155,7 +155,7 @@ if ( !current_user_can( 'edit_post', $id ) ) die('-1'); if ( $id < 0 ) { - $now = current_time('timestamp'); + $now = current_time('timestamp', 1); if ( $pid = wp_insert_post( array( 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) ) ) ) @@ -231,7 +231,7 @@ if($_POST['post_ID'] < 0) { $_POST['temp_ID'] = $_POST['post_ID']; $id = wp_write_post(); - if(is_wp_error($id)) + if( is_wp_error($id) ) die($id->get_error_message()); else die("$id"); Index: wp-admin/post.php =================================================================== --- wp-admin/post.php (.../2.1) (revision 5900) +++ wp-admin/post.php (.../2.1.3) (revision 5900) @@ -69,7 +69,7 @@ ?>