Merge r71750 to trunk: let wfTimestamp() accept TS_RFC2822 as an input format in...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 26 Aug 2010 21:02:12 +0000 (21:02 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 26 Aug 2010 21:02:12 +0000 (21:02 +0000)
includes/GlobalFunctions.php

index 0b6e8f5..b96e167 100644 (file)
@@ -1951,7 +1951,7 @@ define( 'TS_DB2', 8 );
 function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
        $uts = 0;
        $da = array();
-       if ( $ts == 0 ) {
+       if ( $ts === 0 ) {
                $uts = time();
        } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D', $ts, $da ) ) {
                # TS_DB
@@ -1972,6 +1972,9 @@ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
                # TS_POSTGRES
        } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d* GMT$/', $ts, $da ) ) {
                # TS_POSTGRES
+       } elseif ( preg_match( '/^[A-Z][a-z]{2}, \d\d [A-Z][a-z]{2} \d{4} \d\d:\d\d:\d\d/', $ts ) ) {
+               # TS_RFC2822
+               $uts = strtotime( $ts );
        } else {
                # Bogus value; fall back to the epoch...
                wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n");