git-svn-id: http://svn.automattic.com/wordpress/trunk@1452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-07-06 17:58:48 +00:00
parent d1640ab7fe
commit a82c9d7f59
1 changed files with 52 additions and 61 deletions

View File

@ -1,11 +1,11 @@
<?php <?php
if (!file_exists(dirname(__FILE__).'/' . 'wp-config.php')) if ( !file_exists( dirname(__FILE__) . '/wp-config.php') )
die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='wp-admin/setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file."); die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='wp-admin/setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
require_once(dirname(__FILE__).'/' . '/wp-config.php'); require_once( dirname(__FILE__) . '/wp-config.php');
require_once(dirname(__FILE__).'/' . 'wp-includes/wp-l10n.php'); require_once( dirname(__FILE__) . '/wp-includes/wp-l10n.php');
// Process PATH_INFO, if set. // Process PATH_INFO, if set.
$path_info = array(); $path_info = array();
@ -15,7 +15,7 @@ if (! empty($_SERVER['PATH_INFO'])) {
$pathinfo = $_SERVER['PATH_INFO']; $pathinfo = $_SERVER['PATH_INFO'];
// Trim leading '/'. // Trim leading '/'.
$pathinfo = preg_replace("!^/!", '', $pathinfo); $pathinfo = preg_replace('!^/!', '', $pathinfo);
if (! empty($rewrite)) { if (! empty($rewrite)) {
// Get the name of the file requesting path info. // Get the name of the file requesting path info.
@ -69,26 +69,19 @@ $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','e
} }
} }
if ($feed != '') { if ('' != $feed) {
$doing_rss = 1; $doing_rss = true;
} }
if ($tb == 1) { if (1 == $tb) {
$doing_trackback = 1; $doing_trackback = true;
} }
// Sending HTTP headers // Sending HTTP headers
if ( !isset($doing_rss) || !$doing_rss ) { if ( !isset($doing_rss) || !$doing_rss ) {
// It is presumptious to think that WP is the only thing that might change on the page.
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
@header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
@header("Cache-Control: post-check=0, pre-check=0", false);
@header("Pragma: no-cache"); // HTTP/1.0
@header ('X-Pingback: '. get_settings('siteurl') . '/xmlrpc.php'); @header ('X-Pingback: '. get_settings('siteurl') . '/xmlrpc.php');
} else { } else {
// We're showing a feed, so WP is indeed the only thing that last changed // We're showing a feed, so WP is indeed the only thing that last changed
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
$wp_etag = '"' . md5($wp_last_modified) . '"'; $wp_etag = '"' . md5($wp_last_modified) . '"';
@ -117,7 +110,6 @@ if (!isset($doing_rss) || !$doing_rss) {
} }
} }
} }
} }
// Getting settings from DB // Getting settings from DB
@ -131,6 +123,7 @@ if (isset($showposts) && $showposts) {
$showposts = (int) $showposts; $showposts = (int) $showposts;
$posts_per_page = $showposts; $posts_per_page = $showposts;
} }
$archive_mode = get_settings('archive_mode'); $archive_mode = get_settings('archive_mode');
$use_gzipcompression = get_settings('gzipcompression'); $use_gzipcompression = get_settings('gzipcompression');
@ -149,7 +142,6 @@ $query_string = apply_filters('query_string', $query_string);
$wp_query_state->parse_query($query_string); $wp_query_state->parse_query($query_string);
// Update some caches.
update_category_cache(); update_category_cache();
// Call query posts to do the work. // Call query posts to do the work.
@ -160,8 +152,7 @@ if (1 == count($posts)) {
$more = 1; $more = 1;
$single = 1; $single = 1;
} }
if ($s && empty($paged)) { // If they were doing a search and got one result if ( $s && empty($paged) && !strstr($_SERVER['PHP_SELF'], 'wp-admin/')) { // If they were doing a search and got one result
if (!strstr($_SERVER['PHP_SELF'], 'wp-admin')) // And not in admin section
header('Location: ' . get_permalink($posts[0]->ID)); header('Location: ' . get_permalink($posts[0]->ID));
} }
} }