git-svn-id: https://develop.svn.wordpress.org/trunk@1452 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2004-07-06 17:58:48 +00:00
parent 3cba01120b
commit 1f53b28c09
1 changed files with 52 additions and 61 deletions

View File

@ -1,11 +1,11 @@
<?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.");
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.
$path_info = array();
@ -15,7 +15,7 @@ if (! empty($_SERVER['PATH_INFO'])) {
$pathinfo = $_SERVER['PATH_INFO'];
// Trim leading '/'.
$pathinfo = preg_replace("!^/!", '', $pathinfo);
$pathinfo = preg_replace('!^/!', '', $pathinfo);
if (! empty($rewrite)) {
// 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 != '') {
$doing_rss = 1;
if ('' != $feed) {
$doing_rss = true;
}
if ($tb == 1) {
$doing_trackback = 1;
if (1 == $tb) {
$doing_trackback = true;
}
// Sending HTTP headers
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');
} else {
// 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_etag = '"' . md5($wp_last_modified) . '"';
@ -117,7 +110,6 @@ if (!isset($doing_rss) || !$doing_rss) {
}
}
}
}
// Getting settings from DB
@ -131,6 +123,7 @@ if (isset($showposts) && $showposts) {
$showposts = (int) $showposts;
$posts_per_page = $showposts;
}
$archive_mode = get_settings('archive_mode');
$use_gzipcompression = get_settings('gzipcompression');
@ -149,7 +142,6 @@ $query_string = apply_filters('query_string', $query_string);
$wp_query_state->parse_query($query_string);
// Update some caches.
update_category_cache();
// Call query posts to do the work.
@ -160,8 +152,7 @@ if (1 == count($posts)) {
$more = 1;
$single = 1;
}
if ($s && empty($paged)) { // If they were doing a search and got one result
if (!strstr($_SERVER['PHP_SELF'], 'wp-admin')) // And not in admin section
if ( $s && empty($paged) && !strstr($_SERVER['PHP_SELF'], 'wp-admin/')) { // If they were doing a search and got one result
header('Location: ' . get_permalink($posts[0]->ID));
}
}