Add TS_RFC2822 output format for wfTimestamp to encapsulate the several manual format...
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 19 Dec 2004 11:11:52 +0000 (11:11 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 19 Dec 2004 11:11:52 +0000 (11:11 +0000)
includes/GlobalFunctions.php
includes/OutputPage.php

index 524ee08..e068351 100644 (file)
@@ -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;
        }
index 963ac3e..93dc544 100644 (file)
@@ -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();