--- loginticket.module 2008-03-05 03:45:36.000000000 +0800 +++ loginticket.module 2009-03-22 18:58:40.000000000 +0800 @@ -189,14 +189,14 @@ function loginticket_load($purpose, $arr * The purpose of the tickets, as specified in loginticket_create(). * @param $array * An associative array of attributes to search for in selecting the tickets. - * Allowed keys: 'passcode', 'passcode_md5', and 'uid'. + * Allowed keys: 'tid', 'passcode', 'passcode_md5', and 'uid'. * @param $include_expired_tickets * If TRUE, this function also returns tickets that are already expired. * Otherwise (by default), only valid tickets are included in the result. * * @return An array of tickets that fulfill the given constraints, or an empty * array if there are no such tickets. The tickets themselves are - * objects with attributes named 'purpose', 'passcode_md5', 'expires', + * objects with attributes named 'tid', 'purpose', 'passcode_md5', 'expires', * and 'uid'. */ function loginticket_load_array($purpose, $array = array(), $include_expired_tickets = FALSE) { @@ -214,6 +214,10 @@ function loginticket_load_array($purpose $args[] = time(); } + if (array_key_exists('tid', $array)) { + $conds_or[] = "tid = %d"; + $args[] = $array['tid']; + } if (array_key_exists('passcode', $array)) { $conds_or[] = "passcode_md5 = '%s'"; $args[] = md5($array['passcode']); @@ -263,14 +267,14 @@ function loginticket_delete($tickets) { $params = array(); foreach ($tickets as $ticket) { - $placeholders[] = "'%s'"; - $params[] = $ticket->passcode_md5; + $placeholders[] = "'%d'"; + $params[] = $ticket->tid; loginticket_invoke_all('delete', $ticket); } // delete all the processed tickets db_query('DELETE FROM {loginticket} - WHERE passcode_md5 IN ('. implode(',', $placeholders) .')', + WHERE tid = ('. implode(',', $placeholders) .')', $params); }