From 6c4e62ef3243120384df0c1e915c3ce9643ceff4 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 26 Aug 2010 21:02:12 +0000 Subject: [PATCH] Merge r71750 to trunk: let wfTimestamp() accept TS_RFC2822 as an input format in addition to output --- includes/GlobalFunctions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0b6e8f5d46..b96e167139 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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"); -- 2.20.1