[Cs-webapplibs-commits] SF.net SVN: cs-webapplibs:[114] trunk/0.3
Status: Beta
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-08-19 20:12:40
|
Revision: 114 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=114&view=rev Author: crazedsanity Date: 2009-08-19 20:12:33 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Changes to work with MySQL. /cs_authToken.class.php: * create_token(): -- use a combination of strftime(strtotime()) to create an appropriate expiration date based on a given lifetime (i.e. "1 day"). -- use "expiration" column instead of duration. * get_token_data(): -- updated to use expiration instead of creation + duration. /setup/authToken_schema.pgsql.sql: * cswal_auth_token_table: -- change creation to a timestamp. -- change duration(interval) to expiration(timestamp) Modified Paths: -------------- trunk/0.3/cs_authToken.class.php trunk/0.3/setup/authtoken_schema.pgsql.sql Modified: trunk/0.3/cs_authToken.class.php =================================================================== --- trunk/0.3/cs_authToken.class.php 2009-08-19 19:24:52 UTC (rev 113) +++ trunk/0.3/cs_authToken.class.php 2009-08-19 20:12:33 UTC (rev 114) @@ -111,7 +111,7 @@ 'token' => '____INCOMPLETE____' ); if(!is_null($lifetime) && strlen($lifetime)) { - $insertData['duration'] = $lifetime; + $insertData['expiration'] = strftime('%Y-%m-%d %T', strtotime($lifetime)); } if(!is_null($maxUses) && is_numeric($maxUses) && $maxUses > 0) { $insertData['max_uses'] = $maxUses; @@ -282,7 +282,7 @@ protected function get_token_data($tokenId) { try { $data = $this->db->run_query("SELECT * FROM ". $this->table ." WHERE auth_token_id=". $tokenId - ." AND (creation + duration)::date >= CURRENT_DATE", 'auth_token_id'); + ." AND expiration::date >= CURRENT_DATE", 'auth_token_id'); if(is_array($data) && count($data) == 1) { $tokenData = $data; } Modified: trunk/0.3/setup/authtoken_schema.pgsql.sql =================================================================== --- trunk/0.3/setup/authtoken_schema.pgsql.sql 2009-08-19 19:24:52 UTC (rev 113) +++ trunk/0.3/setup/authtoken_schema.pgsql.sql 2009-08-19 20:12:33 UTC (rev 114) @@ -15,6 +15,6 @@ token text NOT NULL, max_uses integer DEFAULT NULL, total_uses integer NOT NULL DEFAULT 0, - creation date NOT NULL DEFAULT NOW(), - duration interval NOT NULL DEFAULT '1 day'::interval + creation timestamp NOT NULL DEFAULT NOW(), + expiration timestamp NOT NULL DEFAULT NOW() + '1 day'::interval ); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |