index.php now handles feeds and trackbacks.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-05-31 23:35:32 +00:00
parent 2367e7cef2
commit 44e890f765
4 changed files with 33 additions and 10 deletions

View File

@ -68,6 +68,13 @@ $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','e
}
}
if ($feed != '') {
$doing_rss = 1;
}
if ($tb == 1) {
$doing_trackback = 1;
}
// Sending HTTP headers
@ -160,6 +167,16 @@ if (1 == count($posts)) {
}
}
if ($pagenow != 'wp-feed.php' && $feed != '') {
require(dirname(__FILE__) . '/wp-feed.php');
exit;
}
if ($pagenow != 'wp-trackback.php' && $tb == 1) {
require(dirname(__FILE__) . '/wp-trackback.php');
exit;
}
if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
if ($use_gzipcompression) {
// gzipping the output of the script

View File

@ -1,8 +1,12 @@
<?php
$blog = 1;
$doing_rss = 1;
require('wp-blog-header.php');
if (! $doing_rss) {
$doing_rss = 1;
require('wp-blog-header.php');
}
// Remove the pad, if present.
$feed = preg_replace('/^_+/', '', $feed);
if ($feed == '' || $feed == 'feed') {
// TODO: Get default feed from options DB.

View File

@ -1227,8 +1227,8 @@ function generate_rewrite_rules($permalink_structure = '') {
$num_tokens = count($tokens[0]);
$index = 'index.php';
$feedindex = 'wp-feed.php';
$trackbackindex = 'wp-trackback.php';
$feedindex = 'index.php';
$trackbackindex = 'index.php';
for ($i = 0; $i < $num_tokens; ++$i) {
if (0 < $i) {
$queries[$i] = $queries[$i - 1] . '&';
@ -1263,7 +1263,7 @@ function generate_rewrite_rules($permalink_structure = '') {
if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')) {
$post = 1;
$trackbackmatch = $match . $trackbackregex;
$trackbackquery = $trackbackindex . '?' . $query;
$trackbackquery = $trackbackindex . '?' . $query . '&tb=1';
$match = $match . '?([0-9]+)?/?$';
$query = $index . '?' . $query . '&page=' . preg_index($num_toks + 1, $matches);
} else {
@ -1315,11 +1315,11 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
// Site feed
$sitefeedmatch = 'feed/?([_0-9a-z-]+)?/?$';
$sitefeedquery = 'wp-feed.php?feed=' . preg_index(1, $matches);
$sitefeedquery = 'index.php?feed=_' . preg_index(1, $matches);
// Site comment feed
$sitecommentfeedmatch = 'comments/feed/?([_0-9a-z-]+)?/?$';
$sitecommentfeedquery = 'wp-feed.php?feed=' . preg_index(1, $matches) . '&withcomments=1';
$sitecommentfeedquery = 'index.php?feed=_' . preg_index(1, $matches) . '&withcomments=1';
// Site page
$sitepagematch = $pageregex;
@ -1344,7 +1344,6 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
$author_structure = $front . 'author/%author%';
$author_rewrite = generate_rewrite_rules($author_structure);
// Put them together.
$rewrite = $site_rewrite + $category_rewrite + $author_rewrite + $post_rewrite;

View File

@ -10,7 +10,10 @@ $title = $_POST['title'];
$excerpt = $_POST['excerpt'];
$blog_name = $_POST['blog_name'];
require('wp-blog-header.php');
if (! $doing_trackback) {
$doing_trackback = 1;
require('wp-blog-header.php');
}
if ( (($p != '') && ($p != 'all')) || ($name != '') ) {
$tb_id = $posts[0]->ID;