[wp-cvs] wordpress wp-blog-header.php,1.74,1.75

Matthew Mullenweg saxmatt at users.sourceforge.net
Tue Jul 6 17:58:55 UTC 2004


Update of /cvsroot/cafelog/wordpress
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27244

Modified Files:
	wp-blog-header.php 
Log Message:
http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000150 and various formatting cleanups.

Index: wp-blog-header.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-blog-header.php,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** wp-blog-header.php	30 Jun 2004 15:31:48 -0000	1.74
--- wp-blog-header.php	6 Jul 2004 17:58:48 -0000	1.75
***************
*** 1,14 ****
  <?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-includes/wp-l10n.php');
  
  // Process PATH_INFO, if set.
  $path_info = array();
! if (! empty($_SERVER['PATH_INFO'])) {
      // Fetch the rewrite rules.
      $rewrite = rewrite_rules('matches');
--- 1,14 ----
  <?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-includes/wp-l10n.php');
  
  // Process PATH_INFO, if set.
  $path_info = array();
! if ( !empty( $_SERVER['PATH_INFO'] ) ) {
      // Fetch the rewrite rules.
      $rewrite = rewrite_rules('matches');
***************
*** 16,20 ****
      $pathinfo = $_SERVER['PATH_INFO'];
      // Trim leading '/'.
!     $pathinfo = preg_replace("!^/!", '', $pathinfo);
  
      if (! empty($rewrite)) {
--- 16,20 ----
      $pathinfo = $_SERVER['PATH_INFO'];
      // Trim leading '/'.
!     $pathinfo = preg_replace('!^/!', '', $pathinfo);
  
      if (! empty($rewrite)) {
***************
*** 53,96 ****
  $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');
  
!     for ($i=0; $i<count($wpvarstoreset); $i += 1) {
!         $wpvar = $wpvarstoreset[$i];
!         if (!isset($$wpvar)) {
!             if (empty($_POST[$wpvar])) {
!                 if (empty($_GET[$wpvar]) && empty($path_info[$wpvar])) {
!                     $$wpvar = '';
!                 } elseif (!empty($_GET[$wpvar])) {
!                     $$wpvar = $_GET[$wpvar];
!                 } else {
!                     $$wpvar = $path_info[$wpvar];
!                 }
!             } else {
!                 $$wpvar = $_POST[$wpvar];
!             }
!         }
!     }
  
! if ($feed != '') {
!     $doing_rss = 1;
  }
  
! if ($tb == 1) {
!     $doing_trackback = 1;
  }
  
  // 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).'"';
  	@header('Last-Modified: '.$wp_last_modified);
  	@header('ETag: '.$wp_etag);
--- 53,89 ----
  $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');
  
! for ($i=0; $i<count($wpvarstoreset); $i += 1) {
! 	$wpvar = $wpvarstoreset[$i];
! 	if (!isset($$wpvar)) {
! 		if (empty($_POST[$wpvar])) {
! 			if (empty($_GET[$wpvar]) && empty($path_info[$wpvar])) {
! 				$$wpvar = '';
! 			} elseif (!empty($_GET[$wpvar])) {
! 				$$wpvar = $_GET[$wpvar];
! 			} else {
! 				$$wpvar = $path_info[$wpvar];
! 			}
! 		} else {
! 			$$wpvar = $_POST[$wpvar];
! 		}
! 	}
! }
  
! if ('' != $feed) {
!     $doing_rss = true;
  }
  
! if (1 == $tb) {
!     $doing_trackback = true;
  }
  
  // Sending HTTP headers
  
! if ( !isset($doing_rss) || !$doing_rss ) {
  	@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) . '"';
  	@header('Last-Modified: '.$wp_last_modified);
  	@header('ETag: '.$wp_etag);
***************
*** 118,135 ****
  		}
  	}
- 
  }
  
  // Getting settings from DB
! if (isset($doing_rss) && $doing_rss == 1)
!     $posts_per_page=get_settings('posts_per_rss');
! if (!isset($posts_per_page) || $posts_per_page == 0)
      $posts_per_page = get_settings('posts_per_page');
! if (!isset($what_to_show))
      $what_to_show = get_settings('what_to_show');
! if (isset($showposts) && $showposts) {
!     $showposts = (int)$showposts;
      $posts_per_page = $showposts;
  }
  $archive_mode = get_settings('archive_mode');
  $use_gzipcompression = get_settings('gzipcompression');
--- 111,128 ----
  		}
  	}
  }
  
  // Getting settings from DB
! if ( isset($doing_rss) && $doing_rss == 1 )
!     $posts_per_page = get_settings('posts_per_rss');
! if ( !isset($posts_per_page) || $posts_per_page == 0 )
      $posts_per_page = get_settings('posts_per_page');
! if ( !isset($what_to_show) )
      $what_to_show = get_settings('what_to_show');
! if ( isset($showposts) && $showposts ) {
!     $showposts = (int) $showposts;
      $posts_per_page = $showposts;
  }
+ 
  $archive_mode = get_settings('archive_mode');
  $use_gzipcompression = get_settings('gzipcompression');
***************
*** 140,147 ****
  $query_string = '';
  foreach (array_merge($wpvarstoreset, $more_wpvars) as $wpvar) {
!     if ($$wpvar != '') {
!         $query_string .= (strlen($query_string) < 1) ? '' : '&';
!         $query_string .= $wpvar . '=' . rawurlencode($$wpvar);
!     }
  }
  
--- 133,140 ----
  $query_string = '';
  foreach (array_merge($wpvarstoreset, $more_wpvars) as $wpvar) {
! 	if ($$wpvar != '') {
! 		$query_string .= (strlen($query_string) < 1) ? '' : '&';
! 		$query_string .= $wpvar . '=' . rawurlencode($$wpvar);
! 	}
  }
  
***************
*** 150,154 ****
  $wp_query_state->parse_query($query_string);
  
- // Update some caches.
  update_category_cache();
  
--- 143,146 ----
***************
*** 157,183 ****
  
  if (1 == count($posts)) {
!     if ($p || $name) {
!         $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
!             header('Location: ' . get_permalink($posts[0]->ID));
!     }
  }
  
  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 ( get_settings('gzipcompression') ) 
!         gzip_compression();
  }
  
--- 149,174 ----
  
  if (1 == count($posts)) {
! 	if ($p || $name) {
! 		$more = 1;
! 		$single = 1;
! 	}
! 	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));
! 	}
  }
  
  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 ( get_settings('gzipcompression') ) 
! 		gzip_compression();
  }
  




More information about the cvs mailing list