Index: wp-rss.php
===================================================================
--- wp-rss.php	(revision 4914)
+++ wp-rss.php	(working copy)
@@ -5,33 +5,6 @@
 	wp('feed=rss');
 }
 
-header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
-$more = 1;
+require (ABSPATH . WPINC . '/feed-rss.php');
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-<!-- generator="wordpress/<?php echo $wp_version ?>" -->
-<rss version="0.92">
-<channel>
-	<title><?php bloginfo_rss('name') ?></title>
-	<link><?php bloginfo_rss('url') ?></link>
-	<description><?php bloginfo_rss('description') ?></description>
-	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
-	<docs>http://backend.userland.com/rss092</docs>
-	<language><?php echo get_option('rss_language'); ?></language>
-	<?php do_action('rss_head'); ?>
-
-<?php while (have_posts()) : the_post(); ?>
-	<item>
-		<title><?php the_title_rss() ?></title>
-<?php if (get_option('rss_use_excerpt')) { ?>
-		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
-<?php } else { // use content ?>
-		<description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description>
-<?php } ?>
-		<link><?php permalink_single_rss() ?></link>
-		<?php do_action('rss_item'); ?>
-	</item>
-<?php endwhile; ?>
-</channel>
-</rss>
+?>
\ No newline at end of file
Index: wp-rdf.php
===================================================================
--- wp-rdf.php	(revision 4914)
+++ wp-rdf.php	(working copy)
@@ -5,53 +5,6 @@
 	wp('feed=rdf');
 }
 
-header('Content-type: application/rdf+xml; charset=' . get_option('blog_charset'), true);
-$more = 1;
+require (ABSPATH . WPINC . '/feed-rdf.php');
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-<!-- generator="wordpress/<?php echo $wp_version ?>" -->
-<rdf:RDF
-	xmlns="http://purl.org/rss/1.0/"
-	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
-	xmlns:admin="http://webns.net/mvcb/"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	<?php do_action('rdf_ns'); ?>
->
-<channel rdf:about="<?php bloginfo_rss("url") ?>">
-	<title><?php bloginfo_rss('name') ?></title>
-	<link><?php bloginfo_rss('url') ?></link>
-	<description><?php bloginfo_rss('description') ?></description>
-	<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
-	<admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
-	<sy:updatePeriod>hourly</sy:updatePeriod>
-	<sy:updateFrequency>1</sy:updateFrequency>
-	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
-	<?php do_action('rdf_header'); ?>
-	<items>
-		<rdf:Seq>
-		<?php while (have_posts()): the_post(); ?>
-			<rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
-		<?php endwhile; ?>
-		</rdf:Seq>
-	</items>
-</channel>
-<?php rewind_posts(); while (have_posts()): the_post(); ?>
-<item rdf:about="<?php permalink_single_rss() ?>">
-	<title><?php the_title_rss() ?></title>
-	<link><?php permalink_single_rss() ?></link>
-	 <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
-	<dc:creator><?php the_author() ?></dc:creator>
-	<?php the_category_rss('rdf') ?>
-<?php if (get_option('rss_use_excerpt')) : ?>
-	<description><?php the_excerpt_rss() ?></description>
-<?php else : ?>
-	<description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length'), 2) ?></description>
-	<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
-<?php endif; ?>
-	<?php do_action('rdf_item'); ?>
-</item>
-<?php endwhile;  ?>
-</rdf:RDF>
+?>
\ No newline at end of file
Index: wp-includes/feed-rss2.php
===================================================================
--- wp-includes/feed-rss2.php	(revision 0)
+++ wp-includes/feed-rss2.php	(revision 0)
@@ -0,0 +1,50 @@
+<?php
+header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	<?php do_action('rss2_ns'); ?>
+>
+
+<channel>
+	<title><?php bloginfo_rss('name'); ?></title>
+	<link><?php bloginfo_rss('url') ?></link>
+	<description><?php bloginfo_rss("description") ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
+	<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('rss2_head'); ?>
+	<?php while( have_posts()) : the_post(); ?>
+	<item>
+		<title><?php the_title_rss() ?></title>
+		<link><?php permalink_single_rss() ?></link>
+		<comments><?php comments_link(); ?></comments>
+		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
+		<dc:creator><?php the_author() ?></dc:creator>
+		<?php the_category_rss() ?>
+
+		<guid isPermaLink="false"><?php the_guid(); ?></guid>
+<?php if (get_option('rss_use_excerpt')) : ?>
+		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
+<?php else : ?>
+		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
+	<?php if ( strlen( $post->post_content ) > 0 ) : ?>
+		<content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
+	<?php else : ?>
+		<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
+	<?php endif; ?>
+<?php endif; ?>
+		<wfw:commentRss><?php echo comments_rss(); ?></wfw:commentRss>
+<?php rss_enclosure(); ?>
+	<?php do_action('rss2_item'); ?>
+	</item>
+	<?php endwhile; ?>
+</channel>
+</rss>
Index: wp-includes/feed-atom.php
===================================================================
--- wp-includes/feed-atom.php	(revision 0)
+++ wp-includes/feed-atom.php	(revision 0)
@@ -0,0 +1,45 @@
+<?php
+header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+<feed
+  xmlns="http://www.w3.org/2005/Atom"
+  xmlns:thr="http://purl.org/syndication/thread/1.0"
+  xml:lang="<?php echo get_option('rss_language'); ?>"
+  xml:base="<?php bloginfo_rss('home') ?>/wp-atom.php"
+  <?php do_action('atom_ns'); ?>
+ >
+	<title type="text"><?php bloginfo_rss('name') ?></title>
+	<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
+	
+	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
+	<generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
+
+	<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
+	<id><?php bloginfo('atom_url'); ?></id>
+	<link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>" />
+
+	<?php do_action('atom_head'); ?>
+	<?php while (have_posts()) : the_post(); ?>
+	<entry>
+		<author>
+			<name><?php the_author() ?></name>
+			<uri><?php the_author_url()?></uri>
+		</author>
+		<title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
+		<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
+		<id><?php the_guid(); ?></id>
+		<updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
+		<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
+		<?php the_category_rss('atom') ?>
+		<summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
+<?php if ( !get_option('rss_use_excerpt') ) : ?>
+		<content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
+<?php endif; ?>
+<?php rss_enclosure(); ?>
+<?php do_action('atom_entry'); ?>
+	</entry>
+	<?php endwhile ; ?>
+</feed>
Index: wp-includes/feed-rss2-comments.php
===================================================================
--- wp-includes/feed-rss2-comments.php	(revision 0)
+++ wp-includes/feed-rss2-comments.php	(revision 0)
@@ -0,0 +1,83 @@
+<?php
+header('Content-type: text/xml;charset=' . get_option('blog_charset'), true);
+
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; 
+?>
+<!-- generator="wordpress/<?php echo $wp_version ?>" -->
+<rss version="2.0" 
+	xmlns:content="http://purl.org/rss/1.0/modules/content/">
+<channel>
+<?php
+$i = 0;
+if (have_posts()) :
+  while (have_posts()) : the_post();
+	if ($i < 1) {
+		$i++;
+?>
+	<title><?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); } ?></title>
+	<link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link>
+	<description><?php bloginfo_rss("description") ?></description>
+	<pubDate><?php echo gmdate('r'); ?></pubDate>
+	<generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
+
+<?php 
+		if (is_single() || is_page()) {
+			$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 
+			comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 
+			$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 
+			LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' 
+			AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' 
+			AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' 
+			ORDER BY comment_date_gmt ASC" );
+		} else { // if no post id passed in, we'll just ue the last 10 comments.
+			$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 
+			comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 
+			$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 
+			LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' 
+			AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "'  
+			ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') );
+		}
+	// this line is WordPress' motor, do not delete it.
+		if ($comments) {
+			foreach ($comments as $comment) {
+				$GLOBALS['comment'] =& $comment;
+				// Some plugins may need to know the metadata
+				// associated with this comment's post:
+				get_post_custom($comment->comment_post_ID);
+?>
+	<item>
+		<title><?php if ( ! (is_single() || is_page()) ) {
+			$title = get_the_title($comment->comment_post_ID);
+			$title = apply_filters('the_title', $title);
+			$title = apply_filters('the_title_rss', $title);
+			printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
+		} else {
+			printf(__('By: %s'), get_comment_author_rss());
+		} ?></title>
+		<link><?php comment_link() ?></link>
+		<author><?php echo get_comment_author_rss() ?></author>
+		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
+		<guid><?php comment_link() ?></guid>
+			<?php
+			if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
+			?>
+		<description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
+		<content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
+			<?php
+			} else {
+			?>
+		<description><?php comment_text_rss() ?></description>
+		<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
+			<?php
+			} // close check for password
+			do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID);
+			?>
+	</item>
+<?php
+			}
+		}
+	}
+endwhile; endif;
+?>
+</channel>
+</rss>
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 4920)
+++ wp-includes/functions.php	(working copy)
@@ -969,12 +969,12 @@
 	if ( $for_comments ) {
 		load_template(ABSPATH . 'wp-commentsrss2.php');
 	} else {
-		load_template(ABSPATH . 'wp-rss2.php');
+		load_template(ABSPATH . WPINC . '/feed-rss2.php');
 	}
 }
 
 function do_feed_atom() {
-	load_template(ABSPATH . 'wp-atom.php');
+	load_template(ABSPATH . WPINC . '/feed-atom.php');
 }
 
 function do_robots() {
Index: wp-includes/feed-rss.php
===================================================================
--- wp-includes/feed-rss.php	(revision 0)
+++ wp-includes/feed-rss.php	(revision 0)
@@ -0,0 +1,31 @@
+<?php
+header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+<!-- generator="wordpress/<?php echo $wp_version ?>" -->
+<rss version="0.92">
+<channel>
+	<title><?php bloginfo_rss('name') ?></title>
+	<link><?php bloginfo_rss('url') ?></link>
+	<description><?php bloginfo_rss('description') ?></description>
+	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
+	<docs>http://backend.userland.com/rss092</docs>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('rss_head'); ?>
+
+<?php while (have_posts()) : the_post(); ?>
+	<item>
+		<title><?php the_title_rss() ?></title>
+<?php if (get_option('rss_use_excerpt')) { ?>
+		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
+<?php } else { // use content ?>
+		<description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description>
+<?php } ?>
+		<link><?php permalink_single_rss() ?></link>
+		<?php do_action('rss_item'); ?>
+	</item>
+<?php endwhile; ?>
+</channel>
+</rss>
Index: wp-includes/feed-rdf.php
===================================================================
--- wp-includes/feed-rdf.php	(revision 0)
+++ wp-includes/feed-rdf.php	(revision 0)
@@ -0,0 +1,51 @@
+<?php
+header('Content-type: application/rdf+xml; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+<!-- generator="wordpress/<?php echo $wp_version ?>" -->
+<rdf:RDF
+	xmlns="http://purl.org/rss/1.0/"
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+	xmlns:admin="http://webns.net/mvcb/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	<?php do_action('rdf_ns'); ?>
+>
+<channel rdf:about="<?php bloginfo_rss("url") ?>">
+	<title><?php bloginfo_rss('name') ?></title>
+	<link><?php bloginfo_rss('url') ?></link>
+	<description><?php bloginfo_rss('description') ?></description>
+	<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
+	<admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
+	<sy:updatePeriod>hourly</sy:updatePeriod>
+	<sy:updateFrequency>1</sy:updateFrequency>
+	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
+	<?php do_action('rdf_header'); ?>
+	<items>
+		<rdf:Seq>
+		<?php while (have_posts()): the_post(); ?>
+			<rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
+		<?php endwhile; ?>
+		</rdf:Seq>
+	</items>
+</channel>
+<?php rewind_posts(); while (have_posts()): the_post(); ?>
+<item rdf:about="<?php permalink_single_rss() ?>">
+	<title><?php the_title_rss() ?></title>
+	<link><?php permalink_single_rss() ?></link>
+	 <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
+	<dc:creator><?php the_author() ?></dc:creator>
+	<?php the_category_rss('rdf') ?>
+<?php if (get_option('rss_use_excerpt')) : ?>
+	<description><?php the_excerpt_rss() ?></description>
+<?php else : ?>
+	<description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length'), 2) ?></description>
+	<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
+<?php endif; ?>
+	<?php do_action('rdf_item'); ?>
+</item>
+<?php endwhile;  ?>
+</rdf:RDF>
Index: wp-rss2.php
===================================================================
--- wp-rss2.php	(revision 4914)
+++ wp-rss2.php	(working copy)
@@ -5,52 +5,6 @@
 	wp('feed=rss2');
 }
 
-header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
-$more = 1;
+require (ABSPATH . WPINC . '/feed-rss2.php');
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-
-<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	<?php do_action('rss2_ns'); ?>
->
-
-<channel>
-	<title><?php bloginfo_rss('name'); ?></title>
-	<link><?php bloginfo_rss('url') ?></link>
-	<description><?php bloginfo_rss("description") ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
-	<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
-	<language><?php echo get_option('rss_language'); ?></language>
-	<?php do_action('rss2_head'); ?>
-	<?php while( have_posts()) : the_post(); ?>
-	<item>
-		<title><?php the_title_rss() ?></title>
-		<link><?php permalink_single_rss() ?></link>
-		<comments><?php comments_link(); ?></comments>
-		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
-		<dc:creator><?php the_author() ?></dc:creator>
-		<?php the_category_rss() ?>
-
-		<guid isPermaLink="false"><?php the_guid(); ?></guid>
-<?php if (get_option('rss_use_excerpt')) : ?>
-		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
-<?php else : ?>
-		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
-	<?php if ( strlen( $post->post_content ) > 0 ) : ?>
-		<content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
-	<?php else : ?>
-		<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
-	<?php endif; ?>
-<?php endif; ?>
-		<wfw:commentRss><?php echo comments_rss(); ?></wfw:commentRss>
-<?php rss_enclosure(); ?>
-	<?php do_action('rss2_item'); ?>
-	</item>
-	<?php endwhile; ?>
-</channel>
-</rss>
+?>
\ No newline at end of file
Index: wp-commentsrss2.php
===================================================================
--- wp-commentsrss2.php	(revision 4914)
+++ wp-commentsrss2.php	(working copy)
@@ -5,85 +5,6 @@
 	wp('feed=rss2&withcomments=1');
 }
 
-header('Content-type: text/xml;charset=' . get_option('blog_charset'), true);
+require (ABSPATH . WPINC . '/feed-rss2-comments.php');
 
-echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; 
-?>
-<!-- generator="wordpress/<?php echo $wp_version ?>" -->
-<rss version="2.0" 
-	xmlns:content="http://purl.org/rss/1.0/modules/content/">
-<channel>
-<?php
-$i = 0;
-if (have_posts()) :
-  while (have_posts()) : the_post();
-	if ($i < 1) {
-		$i++;
-?>
-	<title><?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); } ?></title>
-	<link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link>
-	<description><?php bloginfo_rss("description") ?></description>
-	<pubDate><?php echo gmdate('r'); ?></pubDate>
-	<generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
-
-<?php 
-		if (is_single() || is_page()) {
-			$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 
-			comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 
-			$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 
-			LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' 
-			AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' 
-			AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' 
-			ORDER BY comment_date_gmt ASC" );
-		} else { // if no post id passed in, we'll just ue the last 10 comments.
-			$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 
-			comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 
-			$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 
-			LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' 
-			AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "'  
-			ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') );
-		}
-	// this line is WordPress' motor, do not delete it.
-		if ($comments) {
-			foreach ($comments as $comment) {
-				$GLOBALS['comment'] =& $comment;
-				// Some plugins may need to know the metadata
-				// associated with this comment's post:
-				get_post_custom($comment->comment_post_ID);
-?>
-	<item>
-		<title><?php if ( ! (is_single() || is_page()) ) {
-			$title = get_the_title($comment->comment_post_ID);
-			$title = apply_filters('the_title', $title);
-			$title = apply_filters('the_title_rss', $title);
-			printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
-		} else {
-			printf(__('By: %s'), get_comment_author_rss());
-		} ?></title>
-		<link><?php comment_link() ?></link>
-		<author><?php echo get_comment_author_rss() ?></author>
-		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
-		<guid><?php comment_link() ?></guid>
-			<?php
-			if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
-			?>
-		<description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
-		<content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
-			<?php
-			} else {
-			?>
-		<description><?php comment_text_rss() ?></description>
-		<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
-			<?php
-			} // close check for password
-			do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID);
-			?>
-	</item>
-<?php
-			}
-		}
-	}
-endwhile; endif;
-?>
-</channel>
-</rss>
+?>
\ No newline at end of file
Index: wp-atom.php
===================================================================
--- wp-atom.php	(revision 4914)
+++ wp-atom.php	(working copy)
@@ -5,47 +5,6 @@
 	wp('feed=atom');
 }
 
-header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true);
-$more = 1;
+require (ABSPATH . WPINC . '/feed-atom.php');
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-<feed
-  xmlns="http://www.w3.org/2005/Atom"
-  xmlns:thr="http://purl.org/syndication/thread/1.0"
-  xml:lang="<?php echo get_option('rss_language'); ?>"
-  xml:base="<?php bloginfo_rss('home') ?>/wp-atom.php"
-  <?php do_action('atom_ns'); ?>
- >
-	<title type="text"><?php bloginfo_rss('name') ?></title>
-	<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
-	
-	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
-	<generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
-
-	<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
-	<id><?php bloginfo('atom_url'); ?></id>
-	<link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>" />
-
-	<?php do_action('atom_head'); ?>
-	<?php while (have_posts()) : the_post(); ?>
-	<entry>
-		<author>
-			<name><?php the_author() ?></name>
-			<uri><?php the_author_url()?></uri>
-		</author>
-		<title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
-		<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
-		<id><?php the_guid(); ?></id>
-		<updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
-		<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
-		<?php the_category_rss('atom') ?>
-		<summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
-<?php if ( !get_option('rss_use_excerpt') ) : ?>
-		<content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
-<?php endif; ?>
-<?php rss_enclosure(); ?>
-<?php do_action('atom_entry'); ?>
-	</entry>
-	<?php endwhile ; ?>
-</feed>
+?>
\ No newline at end of file
