2016-04-10 14:40:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace manager\repo;
|
|
|
|
use \manager\Database;
|
|
|
|
|
|
|
|
class token{
|
|
|
|
|
|
|
|
/* Gestion de la table Token (pour secu) et des derivations
|
|
|
|
*
|
|
|
|
* 1. Gestion des access
|
|
|
|
* - getById(id_token)
|
|
|
|
* - getAll()
|
|
|
|
*
|
|
|
|
* 2. Gestion de la verification
|
|
|
|
* - check(token, id_personne)
|
|
|
|
*
|
|
|
|
* 3. Gestion de la
|
|
|
|
* - merge(idA, idB)
|
|
|
|
*
|
|
|
|
* 4. Gestion de creation
|
|
|
|
* - create(pseudo, nom, prenom, facebook, telephone)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* RETOURNE LA LISTE DE TOUS LES TOKENS
|
|
|
|
*
|
|
|
|
* @return tokens<Array> Liste de tous les tokens
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public static function getAll(){
|
|
|
|
/* [1] On prepare et execute la requete
|
|
|
|
=========================================================*/
|
|
|
|
$request = Database::getPDO()->query("SELECT id_token as id, name, token, creation, expires
|
|
|
|
FROM api_token
|
2016-04-10 15:01:44 +00:00
|
|
|
WHERE CURDATE() BETWEEN creation AND expires
|
2016-04-10 14:40:49 +00:00
|
|
|
ORDER BY creation ASC");
|
|
|
|
|
|
|
|
/* [2] On recupere et retourne les donnees
|
|
|
|
=========================================================*/
|
|
|
|
return Database::delNumeric( $request->fetchAll() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|