Changeset 1452 for trunk/wp-blog-header.php
- Timestamp:
- 07/06/2004 05:58:48 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/wp-blog-header.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-blog-header.php
r1449 r1452 1 1 <?php 2 2 3 if ( !file_exists(dirname(__FILE__).'/' . 'wp-config.php'))3 if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) 4 4 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."); 5 5 6 require_once( dirname(__FILE__).'/'. '/wp-config.php');6 require_once( dirname(__FILE__) . '/wp-config.php'); 7 7 8 require_once( dirname(__FILE__).'/' . 'wp-includes/wp-l10n.php');8 require_once( dirname(__FILE__) . '/wp-includes/wp-l10n.php'); 9 9 10 10 // Process PATH_INFO, if set. 11 11 $path_info = array(); 12 if ( ! empty($_SERVER['PATH_INFO'])) {12 if ( !empty( $_SERVER['PATH_INFO'] ) ) { 13 13 // Fetch the rewrite rules. 14 14 $rewrite = rewrite_rules('matches'); … … 16 16 $pathinfo = $_SERVER['PATH_INFO']; 17 17 // Trim leading '/'. 18 $pathinfo = preg_replace( "!^/!", '', $pathinfo);18 $pathinfo = preg_replace('!^/!', '', $pathinfo); 19 19 20 20 if (! empty($rewrite)) { … … 53 53 $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name'); 54 54 55 for ($i=0; $i<count($wpvarstoreset); $i += 1) { 56 $wpvar = $wpvarstoreset[$i]; 57 if (!isset($$wpvar)) { 58 if (empty($_POST[$wpvar])) { 59 if (empty($_GET[$wpvar]) && empty($path_info[$wpvar])) { 60 $$wpvar = ''; 61 } elseif (!empty($_GET[$wpvar])) { 62 $$wpvar = $_GET[$wpvar]; 63 } else { 64 $$wpvar = $path_info[$wpvar]; 65 } 66 } else { 67 $$wpvar = $_POST[$wpvar]; 68 } 69 } 70 } 71 72 if ($feed != '') { 73 $doing_rss = 1; 55 for ($i=0; $i<count($wpvarstoreset); $i += 1) { 56 $wpvar = $wpvarstoreset[$i]; 57 if (!isset($$wpvar)) { 58 if (empty($_POST[$wpvar])) { 59 if (empty($_GET[$wpvar]) && empty($path_info[$wpvar])) { 60 $$wpvar = ''; 61 } elseif (!empty($_GET[$wpvar])) { 62 $$wpvar = $_GET[$wpvar]; 63 } else { 64 $$wpvar = $path_info[$wpvar]; 65 } 66 } else { 67 $$wpvar = $_POST[$wpvar]; 68 } 69 } 74 70 } 75 71 76 if ($tb == 1) { 77 $doing_trackback = 1; 72 if ('' != $feed) { 73 $doing_rss = true; 74 } 75 76 if (1 == $tb) { 77 $doing_trackback = true; 78 78 } 79 79 80 80 // Sending HTTP headers 81 81 82 if (!isset($doing_rss) || !$doing_rss) { 83 // It is presumptious to think that WP is the only thing that might change on the page. 84 @header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past 85 @header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified 86 @header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 87 @header("Cache-Control: post-check=0, pre-check=0", false); 88 @header("Pragma: no-cache"); // HTTP/1.0 82 if ( !isset($doing_rss) || !$doing_rss ) { 89 83 @header ('X-Pingback: '. get_settings('siteurl') . '/xmlrpc.php'); 90 84 } else { 91 92 85 // We're showing a feed, so WP is indeed the only thing that last changed 93 86 $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; 94 $wp_etag = '"' .md5($wp_last_modified).'"';87 $wp_etag = '"' . md5($wp_last_modified) . '"'; 95 88 @header('Last-Modified: '.$wp_last_modified); 96 89 @header('ETag: '.$wp_etag); … … 118 111 } 119 112 } 120 121 113 } 122 114 123 115 // Getting settings from DB 124 if ( isset($doing_rss) && $doing_rss == 1)125 $posts_per_page =get_settings('posts_per_rss');126 if ( !isset($posts_per_page) || $posts_per_page == 0)116 if ( isset($doing_rss) && $doing_rss == 1 ) 117 $posts_per_page = get_settings('posts_per_rss'); 118 if ( !isset($posts_per_page) || $posts_per_page == 0 ) 127 119 $posts_per_page = get_settings('posts_per_page'); 128 if ( !isset($what_to_show))120 if ( !isset($what_to_show) ) 129 121 $what_to_show = get_settings('what_to_show'); 130 if ( isset($showposts) && $showposts) {131 $showposts = (int) $showposts;122 if ( isset($showposts) && $showposts ) { 123 $showposts = (int) $showposts; 132 124 $posts_per_page = $showposts; 133 125 } 126 134 127 $archive_mode = get_settings('archive_mode'); 135 128 $use_gzipcompression = get_settings('gzipcompression'); … … 140 133 $query_string = ''; 141 134 foreach (array_merge($wpvarstoreset, $more_wpvars) as $wpvar) { 142 if ($$wpvar != '') {143 $query_string .= (strlen($query_string) < 1) ? '' : '&';144 $query_string .= $wpvar . '=' . rawurlencode($$wpvar);145 }135 if ($$wpvar != '') { 136 $query_string .= (strlen($query_string) < 1) ? '' : '&'; 137 $query_string .= $wpvar . '=' . rawurlencode($$wpvar); 138 } 146 139 } 147 140 … … 150 143 $wp_query_state->parse_query($query_string); 151 144 152 // Update some caches.153 145 update_category_cache(); 154 146 … … 157 149 158 150 if (1 == count($posts)) { 159 if ($p || $name) { 160 $more = 1; 161 $single = 1; 162 } 163 if ($s && empty($paged)) { // If they were doing a search and got one result 164 if (!strstr($_SERVER['PHP_SELF'], 'wp-admin')) // And not in admin section 165 header('Location: ' . get_permalink($posts[0]->ID)); 166 } 151 if ($p || $name) { 152 $more = 1; 153 $single = 1; 154 } 155 if ( $s && empty($paged) && !strstr($_SERVER['PHP_SELF'], 'wp-admin/')) { // If they were doing a search and got one result 156 header('Location: ' . get_permalink($posts[0]->ID)); 157 } 167 158 } 168 159 169 160 if ($pagenow != 'wp-feed.php' && $feed != '') { 170 require(dirname(__FILE__) . '/wp-feed.php');171 exit;161 require(dirname(__FILE__) . '/wp-feed.php'); 162 exit; 172 163 } 173 164 174 165 if ($pagenow != 'wp-trackback.php' && $tb == 1) { 175 require(dirname(__FILE__) . '/wp-trackback.php');176 exit;166 require(dirname(__FILE__) . '/wp-trackback.php'); 167 exit; 177 168 } 178 169 179 170 if ($pagenow != 'post.php' && $pagenow != 'edit.php') { 180 if ( get_settings('gzipcompression') )181 gzip_compression();171 if ( get_settings('gzipcompression') ) 172 gzip_compression(); 182 173 } 183 174
Note: See TracChangeset
for help on using the changeset viewer.