From: Domas Mituzas Date: Wed, 9 Jun 2004 16:13:46 +0000 (+0000) Subject: * fixed indexExists X-Git-Tag: 1.5.0alpha1~2964 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=81138304bda0b99815f7c3d87494aa3f9e771366;p=lhc%2Fweb%2Fwiklou.git * fixed indexExists * wfStrencode now uses pg_escape_string instead of addslashes * timestamp functions designed to use internal PG timestamp --- diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 3633d63d96..83a07aa9fe 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -1,4 +1,5 @@ query( $sql, DB_READ, $fname ); if ( !$res ) { return NULL; @@ -504,24 +501,24 @@ function wfEmergencyAbort( &$conn ) { function wfStrencode( $s ) { - return addslashes( $s ); + return pg_escape_string( $s ); } -# Ideally we'd be using actual time fields in the db +# Use PostgreSQL timestamp without timezone data type function wfTimestamp2Unix( $ts ) { - return gmmktime( ( (int)substr( $ts, 8, 2) ), - (int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ), - (int)substr( $ts, 4, 2 ), (int)substr( $ts, 6, 2 ), - (int)substr( $ts, 0, 4 ) ); + return gmmktime( ( (int)substr( $ts, 11, 2) ), + (int)substr( $ts, 14, 2 ), (int)substr( $ts, 17, 2 ), + (int)substr( $ts, 5, 2 ), (int)substr( $ts, 8, 2 ), + (int)substr( $ts, 0, 4 ) ); } function wfUnix2Timestamp( $unixtime ) { - return gmdate( "YmdHis", $unixtime ); + return gmdate( "Y-m-d H:i:s", $unixtime ); } function wfTimestampNow() { # return NOW - return gmdate( "YmdHis" ); + return gmdate( "Y-m-d H:i:s" ); } # Sorting hack for MySQL 3, which doesn't use index sorts for DESC