From: Roan Kattouw Date: Thu, 26 Aug 2010 21:02:12 +0000 (+0000) Subject: Merge r71750 to trunk: let wfTimestamp() accept TS_RFC2822 as an input format in... X-Git-Tag: 1.31.0-rc.0~35311 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=6c4e62ef3243120384df0c1e915c3ce9643ceff4;p=lhc%2Fweb%2Fwiklou.git Merge r71750 to trunk: let wfTimestamp() accept TS_RFC2822 as an input format in addition to output --- 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");