- [x] Ajout de "use CLASS;" dans les fichiers pour simplifier la lisibilite
This commit is contained in:
parent
f200d254a0
commit
dc65466364
12
automate.php
12
automate.php
|
@ -1,13 +1,7 @@
|
||||||
<?php define('__ROOT__', dirname(__FILE__) );
|
<?php define('__ROOT__', dirname(__FILE__) );
|
||||||
require_once __ROOT__.'/manager/autoloader.php';
|
require_once __ROOT__.'/manager/autoloader.php';
|
||||||
|
|
||||||
|
debug();
|
||||||
ini_set('display_errors',1);
|
|
||||||
ini_set('display_startup_errors',1);
|
|
||||||
error_reporting(-1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,7 +240,7 @@
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}insertUsersComposite();
|
}//insertUsersComposite();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -2,25 +2,34 @@
|
||||||
"user" :[
|
"user" :[
|
||||||
"create",
|
"create",
|
||||||
|
|
||||||
|
"getAll",
|
||||||
"getById",
|
"getById",
|
||||||
"getByCode",
|
"getByCode",
|
||||||
"getAll",
|
"getByUsername",
|
||||||
"getGroup",
|
|
||||||
|
"getGroups",
|
||||||
|
|
||||||
"delete"
|
"delete"
|
||||||
],
|
],
|
||||||
|
|
||||||
"machine" :[
|
"machine" :[
|
||||||
"get",
|
"create",
|
||||||
|
|
||||||
"getAll",
|
"getAll",
|
||||||
|
"getById",
|
||||||
|
|
||||||
"getGroup"
|
"getGroup"
|
||||||
],
|
],
|
||||||
|
|
||||||
"group" :[
|
"group" :[
|
||||||
"get",
|
"create",
|
||||||
|
"link",
|
||||||
|
"unlink",
|
||||||
|
|
||||||
"getAll",
|
"getAll",
|
||||||
"getUser",
|
"getById",
|
||||||
"getMachine"
|
|
||||||
|
"getMembers"
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
12
index.php
12
index.php
|
@ -1,7 +1,11 @@
|
||||||
<?php define('__ROOT__', dirname(__FILE__) );
|
<?php define('__ROOT__', dirname(__FILE__) );
|
||||||
// \manager\session_start();
|
|
||||||
require_once __ROOT__.'/manager/autoloader.php';
|
require_once __ROOT__.'/manager/autoloader.php';
|
||||||
|
|
||||||
|
use \router\Router;
|
||||||
|
use \manager\ResourceDispatcher;
|
||||||
|
use \manager\ModuleRequest;
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
/* DEBUGGER */
|
/* DEBUGGER */
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
@ -11,7 +15,7 @@
|
||||||
|
|
||||||
/* [0] On initialise le routeur
|
/* [0] On initialise le routeur
|
||||||
===================================================*/
|
===================================================*/
|
||||||
$R = new router\Router( $_GET['url'] );
|
$R = new Router( $_GET['url'] );
|
||||||
// var_dump($R);
|
// var_dump($R);
|
||||||
|
|
||||||
/* [1] On cree les regles de routage
|
/* [1] On cree les regles de routage
|
||||||
|
@ -37,11 +41,11 @@
|
||||||
// $R->get('settings/', function(){ include __ROOT__.'/view.php'; });
|
// $R->get('settings/', function(){ include __ROOT__.'/view.php'; });
|
||||||
|
|
||||||
// Dispatcher
|
// Dispatcher
|
||||||
$R->get('f(?:/([\w-]+))*/?', function(){ new \manager\ResourceDispatcher($_GET['url'], true); });
|
$R->get('f(?:/([\w-]+))*/?', function(){ new ResourceDispatcher($_GET['url'], true); });
|
||||||
|
|
||||||
// Api
|
// Api
|
||||||
$R->post('api/?', function(){
|
$R->post('api/?', function(){
|
||||||
$request = \manager\ModuleRequest::fromPost($_POST);
|
$request = ModuleRequest::fromPost($_POST);
|
||||||
$answer = $request->dispatch();
|
$answer = $request->dispatch();
|
||||||
|
|
||||||
echo $answer->serialize();
|
echo $answer->serialize();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace manager;
|
namespace manager;
|
||||||
|
use \manager\ManagerError;
|
||||||
|
use \manager\ResourceDispatcher;
|
||||||
|
|
||||||
|
|
||||||
class DataBase{
|
class DataBase{
|
||||||
|
@ -34,18 +36,18 @@
|
||||||
self::$pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->dbname, $this->username, $this->password);
|
self::$pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->dbname, $this->username, $this->password);
|
||||||
|
|
||||||
// On signale que tout s'est bien passe
|
// On signale que tout s'est bien passe
|
||||||
self::$error = \manager\ManagerError::Success;
|
self::$error = ManagerError::Success;
|
||||||
|
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
// On signale qu'il y a une erreur
|
// On signale qu'il y a une erreur
|
||||||
self::$error = \manager\ManagerError::PDOConnection;
|
self::$error = ManagerError::PDOConnection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* retourne une instance de la classe */
|
/* retourne une instance de la classe */
|
||||||
public static function getInstance(){
|
public static function getInstance(){
|
||||||
if( self::$instance == null || self::$error != \manager\ManagerError::Success ){ // Si aucune instance existante OU erreur de connection
|
if( self::$instance == null || self::$error != ManagerError::Success ){ // Si aucune instance existante OU erreur de connection
|
||||||
|
|
||||||
// chargement de la configuration du server SQL
|
// chargement de la configuration du server SQL
|
||||||
if( !isset($_SERVER['HTTP_HOST']) || isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'stefproject' )
|
if( !isset($_SERVER['HTTP_HOST']) || isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'stefproject' )
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace manager;
|
namespace manager;
|
||||||
|
use \manager\ManagerError;
|
||||||
|
|
||||||
|
|
||||||
// FORMAT:
|
// FORMAT:
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace manager;
|
namespace manager;
|
||||||
|
use \manager\ModuleAnswer;
|
||||||
|
use \manager\ManagerError;
|
||||||
|
use \manager\ResourceDispatcher;
|
||||||
|
|
||||||
// FORMAT:
|
// FORMAT:
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// On definit la racine __ROOT__ si c'est pas deja fait
|
// On definit la racine __ROOT__ si c'est pas deja fait
|
||||||
if( !defined('__ROOT__') )
|
if( !defined('__ROOT__') ) define('__ROOT__', dirname(dirname(__FILE__)) );
|
||||||
define('__ROOT__', dirname(dirname(__FILE__)) );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +19,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* APPEL DYNAMIQUE DES CLASSES PASSEES EN PARAMETRE
|
||||||
|
*
|
||||||
|
* @classes<Array> Tableau contenant le nom des classes
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function autoload($classes){
|
||||||
|
foreach($classes as $class){
|
||||||
|
$name_only = substr(strrchr($class, '\\'), 1);
|
||||||
|
var_dump('use '.$class.' as '.$name_only.';');
|
||||||
|
eval('use '.$class.' as '.$name_only.';');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* AUTOLOADER
|
/* AUTOLOADER
|
||||||
*
|
*
|
||||||
|
@ -30,9 +58,10 @@
|
||||||
$path = str_replace('\\', '/', $className) . '.php';
|
$path = str_replace('\\', '/', $className) . '.php';
|
||||||
$path = __ROOT__.'/'.$path;
|
$path = __ROOT__.'/'.$path;
|
||||||
|
|
||||||
// Si le fichier existe, on l'inclut
|
// Si le fichier existe
|
||||||
if( file_exists($path) )
|
if( file_exists($path) )
|
||||||
require_once $path;
|
require_once $path; // on inclue le fichier
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On definit l'autoloader comme autoloader (obvious)
|
// On definit l'autoloader comme autoloader (obvious)
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace manager\module;
|
namespace manager\module;
|
||||||
|
use \manager\Database;
|
||||||
|
use \manager\sessionManager;
|
||||||
|
use \manager\ManagerError;
|
||||||
|
use \manager\Repo;
|
||||||
|
|
||||||
class userDefault{
|
class userDefault{
|
||||||
|
|
||||||
|
@ -12,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
public static function getAll(){
|
public static function getAll(){
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$users = new \manager\Repo('user/getAll');
|
$users = new Repo('user/getAll');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'users' => $users->answer()
|
'users' => $users->answer()
|
||||||
|
@ -37,54 +41,62 @@
|
||||||
public static function create($code=null, $username=null, $firstname=null, $lastname=null, $mail=null, $password=null, $status=null){
|
public static function create($code=null, $username=null, $firstname=null, $lastname=null, $mail=null, $password=null, $status=null){
|
||||||
/* [1] Normalisation + verification des donnees
|
/* [1] Normalisation + verification des donnees
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$password_hash = \manager\sessionManager::secure_sha1($password);
|
$password_hash = sessionManager::secure_sha1($password);
|
||||||
|
|
||||||
$correct_param = \manager\Database::check('user.code', $code);
|
$correct_param = Database::check('user.code', $code);
|
||||||
$correct_param = $correct_param && \manager\Database::check('user.username', $username);
|
$correct_param = $correct_param && Database::check('user.username', $username);
|
||||||
$correct_param = $correct_param && \manager\Database::check('user.firstname', $firstname);
|
$correct_param = $correct_param && Database::check('user.firstname', $firstname);
|
||||||
$correct_param = $correct_param && \manager\Database::check('user.lastname', $lastname);
|
$correct_param = $correct_param && Database::check('user.lastname', $lastname);
|
||||||
$correct_param = $correct_param && \manager\Database::check('user.mail', $mail);
|
$correct_param = $correct_param && Database::check('user.mail', $mail);
|
||||||
$correct_param = $correct_param && \manager\Database::check('user.password', $password_hash);
|
$correct_param = $correct_param && Database::check('user.password', $password_hash);
|
||||||
$correct_param = $correct_param && \manager\Database::check('user.status', $status);
|
$correct_param = $correct_param && Database::check('user.status', $status);
|
||||||
|
|
||||||
// Si les parametres ne sont pas corrects, on retourne une erreur
|
// Si les parametres ne sont pas corrects, on retourne une erreur
|
||||||
if( !$correct_param )
|
if( !$correct_param )
|
||||||
return array('ModuleError' => \manager\ManagerError::ParamError);
|
return array('ModuleError' => ManagerError::ParamError);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [2] Creation de l'utilisateur
|
/* [2] Creation de l'utilisateur
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$create_user = new \manager\Repo('user/create', array($code, $username, $firstname, $lastname, $mail, $password_hash, $status) );
|
$create_user = new Repo('user/create', array($code, $username, $firstname, $lastname, $mail, $password_hash, $status) );
|
||||||
$id_user = $create_user->answer();
|
$id_user = $create_user->answer();
|
||||||
|
|
||||||
// Si une erreur est retournee, on retourne une erreur
|
// Si une erreur est retournee, on retourne une erreur
|
||||||
if( $id_user === false )
|
if( $id_user === false )
|
||||||
return array('ModuleError' => \manager\ManagerError::ModuleError);
|
return array('ModuleError' => ManagerError::ModuleError);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [3] Creation du groupe de meme nom que l'username
|
/* [3] Creation du groupe de meme nom que l'username
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$create_group = new \manager\Repo('group/create', array($username) );
|
$create_group = new Repo('group/create', array($username) );
|
||||||
$id_group = $create_group->answer();
|
$id_group = $create_group->answer();
|
||||||
|
|
||||||
// Si une erreur est retournee, on retourne une erreur
|
// Si une erreur est retournee, on retourne une erreur
|
||||||
if( $id_group === false )
|
if( $id_group === false )
|
||||||
return array('ModuleError' => \manager\ManagerError::ModuleError);
|
return array('ModuleError' => ManagerError::ModuleError);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [4] Association au groupe
|
/* [4] Association au groupe
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$assoc_goup = new \manager\Repo('group/associate', array($id_user, $id_group));
|
$assoc_goup = new Repo('group/link', array($id_user, $id_group));
|
||||||
$id_assoc = $assoc_goup->answer();
|
$id_assoc = $assoc_goup->answer();
|
||||||
|
|
||||||
// Si une erreur est retournee, on retourne une erreur
|
// Si une erreur est retournee, on retourne une erreur
|
||||||
if( $id_assoc === false )
|
if( $id_assoc === false )
|
||||||
return array('ModuleError' => \manager\ManagerError::ModuleError);
|
return array('ModuleError' => ManagerError::ModuleError);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [5] Gestion du retour
|
/* [5] Gestion du retour
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
return array(
|
return array(
|
||||||
'ModuleError' => \manager\ManagerError::Success,
|
'ModuleError' => ManagerError::Success,
|
||||||
'id_user' => $id_user
|
'id_user' => $id_user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,38 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace manager\repo;
|
namespace manager\repo;
|
||||||
|
use \manager\Database;
|
||||||
|
|
||||||
class user{
|
class user{
|
||||||
|
|
||||||
|
/* CREATION D'UN UTILISATEUR ET DE SON GROUPE INDIVIDUEL
|
||||||
|
*
|
||||||
|
* @code<String> Code RFID de l'utilisateur
|
||||||
|
* @username<String> Identifiant l'utilisateur
|
||||||
|
* @firstname<String> Prenom de l'utilisateur
|
||||||
|
* @lastcode<String> Nom de l'utilisateur
|
||||||
|
* @mail<String> Adresse email de l'utilisateur
|
||||||
|
* @password<String> Mot de passe de l'utilisateur
|
||||||
|
* @status<String> Status de l'utilisateur
|
||||||
|
*
|
||||||
|
* @return nomRetour<typeRetour> Description du retour
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function create($code, $username, $firstname, $lastname, $mail, $password, $status){
|
||||||
|
/* [1] Creation de l'utilisateur (unicite de l'username)
|
||||||
|
=========================================================*/
|
||||||
|
$check_unique = ( self::getByCode($code) == false );
|
||||||
|
$check_unique = $check_unique && ( self::getByUsername($username) == false );
|
||||||
|
|
||||||
|
var_dump($check_unique);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* RENVOIE LA LISTE DE TOUS LES UTILISATEURS
|
/* RENVOIE LA LISTE DE TOUS LES UTILISATEURS
|
||||||
*
|
*
|
||||||
|
@ -12,13 +41,13 @@
|
||||||
*/
|
*/
|
||||||
public static function getAll(){
|
public static function getAll(){
|
||||||
// On ecrit la requete
|
// On ecrit la requete
|
||||||
$request = \manager\Database::getPDO()->query("SELECT * FROM user ORDER BY id_user");
|
$request = Database::getPDO()->query("SELECT * FROM user ORDER BY id_user");
|
||||||
|
|
||||||
// On recupere le resutat
|
// On recupere le resutat
|
||||||
$answer = $request->fetchAll();
|
$answer = $request->fetchAll();
|
||||||
|
|
||||||
// On retourne en supprimant les indices numeriques
|
// On retourne en supprimant les indices numeriques
|
||||||
return \manager\Database::delNumeric( $answer );
|
return Database::delNumeric( $answer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,11 +57,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* RENVOIE L'UTILISATEUR D'ID DONNE
|
/* RENVOIE L'UTILISATEUR D'ID DONNE
|
||||||
*
|
*
|
||||||
* @id<int> Id de l'utilisateur en question
|
* @id<int> Id de l'utilisateur en question
|
||||||
|
@ -43,7 +67,7 @@
|
||||||
*/
|
*/
|
||||||
public static function getById($id){
|
public static function getById($id){
|
||||||
// On ecrit la requete
|
// On ecrit la requete
|
||||||
$request = \manager\Database::getPDO()->prepare("SELECT * FROM user
|
$request = Database::getPDO()->prepare("SELECT * FROM user
|
||||||
WHERE id_user = :id");
|
WHERE id_user = :id");
|
||||||
|
|
||||||
// On execute la requete
|
// On execute la requete
|
||||||
|
@ -59,7 +83,7 @@
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// On retourne en supprimant les indices numeriques
|
// On retourne en supprimant les indices numeriques
|
||||||
return \manager\Database::delNumeric( $answer, true );
|
return Database::delNumeric( $answer, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,11 +93,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* RENVOIE L'UTILISATEUR DE CODE DONNE
|
/* RENVOIE L'UTILISATEUR DE CODE DONNE
|
||||||
*
|
*
|
||||||
* @code<String> Code de l'utilisateur en question
|
* @code<String> Code de l'utilisateur en question
|
||||||
|
@ -84,7 +103,7 @@
|
||||||
*/
|
*/
|
||||||
public static function getByCode($code){
|
public static function getByCode($code){
|
||||||
// On ecrit la requete
|
// On ecrit la requete
|
||||||
$request = \manager\Database::getPDO()->prepare("SELECT * FROM user
|
$request = Database::getPDO()->prepare("SELECT * FROM user
|
||||||
WHERE code = :code");
|
WHERE code = :code");
|
||||||
|
|
||||||
// On execute la requete
|
// On execute la requete
|
||||||
|
@ -100,7 +119,9 @@
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// On retourne en supprimant les indices numeriques
|
// On retourne en supprimant les indices numeriques
|
||||||
return \manager\Database::delNumeric( $answer, true );
|
return Database::delNumeric( $answer, true );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,31 +131,104 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* CREATION D'UN UTILISATEUR ET DE SON GROUPE INDIVIDUEL
|
/* RENVOIE L'UTILISATEUR D'USERNAME DONNE
|
||||||
*
|
*
|
||||||
* @code<String> Code RFID de l'utilisateur
|
* @username<String> Identifiant de l'utilisateur en question
|
||||||
* @username<String> Identifiant l'utilisateur
|
|
||||||
* @firstname<String> Prenom de l'utilisateur
|
|
||||||
* @lastcode<String> Nom de l'utilisateur
|
|
||||||
* @mail<String> Adresse email de l'utilisateur
|
|
||||||
* @password<String> Mot de passe de l'utilisateur
|
|
||||||
* @status<String> Status de l'utilisateur
|
|
||||||
*
|
*
|
||||||
* @return nomRetour<typeRetour> Description du retour
|
* @return utilisateur<Array> Renvoie l'utilisateur d'username donne si existe
|
||||||
|
* @return error<Boolean> Retourne FALSE si aucun resultat
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function create($code, $username, $firstname, $lastname, $mail, $password, $status){
|
public static function getByUsername($username){
|
||||||
/* [1] Creation de l'utilisateur (unicite de l'username)
|
// On ecrit la requete
|
||||||
=========================================================*/
|
$request = Database::getPDO()->prepare("SELECT * FROM user
|
||||||
$check_unique = ( self::getByCode($code) == false );
|
WHERE username = :username");
|
||||||
|
|
||||||
var_dump($check_unique);
|
// On execute la requete
|
||||||
|
$request->execute(array(
|
||||||
|
':username' => $username
|
||||||
|
));
|
||||||
|
|
||||||
|
// On recupere 1 seul utilisateur
|
||||||
|
$answer = $request->fetch();
|
||||||
|
|
||||||
|
// Gestion d'erreur -> aucun resultat
|
||||||
|
if( $answer == null )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// On retourne en supprimant les indices numeriques
|
||||||
|
return Database::delNumeric( $answer, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* RENVOIE LES GROUPE AUQUELS UN UTILISATEUR DONNE APPARTIENT
|
||||||
|
*
|
||||||
|
* @id_user<int> UID de l'utilisateur en question
|
||||||
|
*
|
||||||
|
* @return groups<Array> Renvoie un tableau d'UID des groupes
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getGroups($id_user){
|
||||||
|
/* [1] On redige/execute la requete
|
||||||
|
=========================================================*/
|
||||||
|
$select_groups = Database::getPDO()->prepare("SELECT gm.id_group FROM user as u, group_merge as gm
|
||||||
|
WHERE u.id_user = gm.id_user
|
||||||
|
AND u.id_user = :id_user
|
||||||
|
ORDER BY gm.id_user ASC");
|
||||||
|
$select_groups->execute(array(
|
||||||
|
':id_user' => $id_user
|
||||||
|
));
|
||||||
|
|
||||||
|
// On retourne en supprimant les indices numeriques
|
||||||
|
return Database::delNumeric( $select_groups->fetchAll() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* SUPPRIME UN UTILISATEUR DONNE
|
||||||
|
*
|
||||||
|
* @id_user<int> UID de l'utilisateur en question
|
||||||
|
*
|
||||||
|
* @return status<Boolean> Retourne si oui ou non l'utilisateur a bien ete supprime
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function delete($id_user){
|
||||||
|
/* [1] On redige/execute la requete
|
||||||
|
=========================================================*/
|
||||||
|
$delete_user = Database::getPDO()->prepare("DELETE FROM user WHERE id_user = :id_user");
|
||||||
|
$delete_user->execute(array(
|
||||||
|
':id_user' => $id_user
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] On verifie que l'utilisateur n'existe plus
|
||||||
|
=========================================================*/
|
||||||
|
return ( self::getById($id_user) === false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -431,7 +431,7 @@
|
||||||
<span class="warning"><strong>Dead Code</strong></span>
|
<span class="warning"><strong>Dead Code</strong></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 17:24:32 CET 2016.</small>
|
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 18:08:46 CET 2016.</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -220,7 +220,7 @@
|
||||||
<span class="warning"><strong>Dead Code</strong></span>
|
<span class="warning"><strong>Dead Code</strong></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 17:24:32 CET 2016.</small>
|
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 18:08:46 CET 2016.</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -450,7 +450,7 @@
|
||||||
<span class="warning"><strong>Dead Code</strong></span>
|
<span class="warning"><strong>Dead Code</strong></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 17:24:32 CET 2016.</small>
|
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 18:08:46 CET 2016.</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
<span class="warning"><strong>Dead Code</strong></span>
|
<span class="warning"><strong>Dead Code</strong></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 17:24:32 CET 2016.</small>
|
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 18:08:46 CET 2016.</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 17:24:32 CET 2016.</small>
|
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 18:08:46 CET 2016.</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
<span class="success"><strong>High</strong>: 70% to 100%</span>
|
<span class="success"><strong>High</strong>: 70% to 100%</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 17:24:32 CET 2016.</small>
|
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 18:08:46 CET 2016.</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -284,7 +284,7 @@
|
||||||
<span class="warning"><strong>Dead Code</strong></span>
|
<span class="warning"><strong>Dead Code</strong></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 17:24:32 CET 2016.</small>
|
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.5.9-1ubuntu4.14</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Sat Feb 13 18:08:46 CET 2016.</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
1
todo.md
1
todo.md
|
@ -39,6 +39,7 @@
|
||||||
########
|
########
|
||||||
# FAIT #
|
# FAIT #
|
||||||
########
|
########
|
||||||
|
- [x] Ajout de "use CLASS;" dans les fichiers pour simplifier la lisibilite
|
||||||
- [x] [phpunit/sessionManager] test unitaires du manager de session php
|
- [x] [phpunit/sessionManager] test unitaires du manager de session php
|
||||||
- [x] [ModuleAnswer] Gestion des erreurs au niveau interne des Modules
|
- [x] [ModuleAnswer] Gestion des erreurs au niveau interne des Modules
|
||||||
- [x] [autoloader][phpunit/bootstrap.php] Correction des bugs de $_SERVER avec PHPUnit -> autoloader + bootstrap personnalise
|
- [x] [autoloader][phpunit/bootstrap.php] Correction des bugs de $_SERVER avec PHPUnit -> autoloader + bootstrap personnalise
|
||||||
|
|
Loading…
Reference in New Issue