X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/cc7b1505cd9fafd87c3672f669e13e98b0c544f7..022dfbbbe3215917d84708eb09acca93b21ae9e0:/wp-admin/import/rss.php
diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php
index e4a81673..187c8ac2 100644
--- a/wp-admin/import/rss.php
+++ b/wp-admin/import/rss.php
@@ -38,21 +38,22 @@ class RSS_Import {
$index = 0;
foreach ($this->posts as $post) {
preg_match('|
(.*?)|is', $post, $post_title);
- $post_title = $wpdb->escape(trim($post_title[1]));
+ $post_title = str_replace(array(''), '', $wpdb->escape( trim($post_title[1]) ));
- preg_match('|(.*?)|is', $post, $post_date);
+ preg_match('|(.*?)|is', $post, $post_date_gmt);
- if ($post_date) {
- $post_date = strtotime($post_date[1]);
+ if ($post_date_gmt) {
+ $post_date_gmt = strtotime($post_date_gmt[1]);
} else {
// if we don't already have something from pubDate
- preg_match('|(.*?)|is', $post, $post_date);
- $post_date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date[1]);
- $post_date = str_replace('T', ' ', $post_date);
- $post_date = strtotime($post_date);
+ preg_match('|(.*?)|is', $post, $post_date_gmt);
+ $post_date_gmt = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date_gmt[1]);
+ $post_date_gmt = str_replace('T', ' ', $post_date_gmt);
+ $post_date_gmt = strtotime($post_date_gmt);
}
- $post_date = gmdate('Y-m-d H:i:s', $post_date);
+ $post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt);
+ $post_date = get_date_from_gmt( $post_date_gmt );
preg_match_all('|(.*?)|is', $post, $categories);
$categories = $categories[1];
@@ -90,7 +91,7 @@ class RSS_Import {
$post_author = 1;
$post_status = 'publish';
- $this->posts[$index] = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
+ $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
$index++;
}
}
@@ -153,6 +154,7 @@ class RSS_Import {
$this->greet();
break;
case 1 :
+ check_admin_referer('import-upload');
$this->import();
break;
}
@@ -167,5 +169,5 @@ class RSS_Import {
$rss_import = new RSS_Import();
-register_importer('rss', 'RSS', __('Import posts from an RSS feed'), array ($rss_import, 'dispatch'));
+register_importer('rss', __('RSS'), __('Import posts from an RSS feed'), array ($rss_import, 'dispatch'));
?>