From b652f2fdf29b0b59a14d65aa3461a7a50666fe02 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 19 Dec 2004 11:11:52 +0000 Subject: [PATCH] Add TS_RFC2822 output format for wfTimestamp to encapsulate the several manual formattings in this style --- includes/GlobalFunctions.php | 7 ++++--- includes/OutputPage.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 524ee08412..e06835174c 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -995,6 +995,8 @@ define('TS_UNIX',0); define('TS_MW',1); /** Standard database timestamp (yyyy-mm-dd hh:mm:ss) */ define('TS_DB',2); +/** For HTTP and e-mail headers -- output only */ +define('TS_RFC2822', 3 ); /** * @todo document @@ -1018,13 +1020,12 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) { switch($outputtype) { case TS_UNIX: return $uts; - break; case TS_MW: return gmdate( 'YmdHis', $uts ); - break; case TS_DB: return gmdate( 'Y-m-d H:i:s', $uts ); - break; + case TS_RFC2822: + return gmdate( "D, j M Y H:i:s", $uts ) . ' GMT'; default: return; } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 963ac3e3d4..93dc544852 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -102,7 +102,7 @@ class OutputPage { return; } - $lastmod = gmdate( 'D, j M Y H:i:s', wfTimestamp(TS_UNIX, max( $timestamp, $wgUser->mTouched ) ) ) . ' GMT'; + $lastmod = wfTimestamp( TS_RFC2822, max( $timestamp, $wgUser->mTouched ) ); if( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { # IE sends sizes after the date like this: @@ -384,7 +384,7 @@ class OutputPage { if( !$wgDebugRedirects ) { header("HTTP/1.1 {$this->mRedirectCode} Moved Permanently"); } - $this->mLastModified = gmdate( 'D, j M Y H:i:s' ) . ' GMT'; + $this->mLastModified = wfTimestamp( TS_RFC2822 ); } $this->sendCacheControl(); -- 2.20.1