Correction de date d'expiration des tokens (inf OU EGAL a la date d'expiration)

This commit is contained in:
xdrm-brackets 2016-04-11 14:26:38 +02:00
parent 30fea99ed6
commit ec9d10c71f
1 changed files with 4 additions and 12 deletions

View File

@ -33,22 +33,14 @@
public static function getAll(){
/* [1] On prepare et execute la requete
=========================================================*/
$request = Database::getPDO()->query("SELECT id_token as id, name, token, expires
$request = Database::getPDO()->query("SELECT id_token as id, name, token, expires, (CURDATE() > expires) as expired
FROM api_token
ORDER BY expires DESC");
/* [2] On recupere les donnees et ajout le status d'expire ou non
/* [3] On retourne les donnees
=========================================================*/
$data = Database::delNumeric( $request->fetchAll() );
// Si le token est expire
foreach($data as $i=>$token)
$data[$i]['expired'] = time() > strtotime($token['expires']);
/* [3] On retourne le resultat
=========================================================*/
return $data;
return Database::delNumeric( $request->fetchAll() );
}