2015-10-22 12:06:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/* GESTION DE L'AUTHENTIFICATION - SI L'UTILISATEUR EST CONNECTÉ */
|
|
|
|
|
|
|
|
// A faire
|
|
|
|
/* si l'utilisateur est connecté */
|
|
|
|
if( true ){
|
|
|
|
|
|
|
|
$answer = new stdClass(); // on initialise la réponse (Objet vide)
|
|
|
|
|
|
|
|
/* si $_POST['json'] existe */
|
|
|
|
if( !empty($_POST) && isset($_POST['json']) ){
|
|
|
|
|
|
|
|
$request = json_decode( $_POST['json'] ); // on décode la requête
|
|
|
|
|
|
|
|
|
|
|
|
/* si le JSON n'est pas corrompu (décodable) */
|
|
|
|
if( $request != null ){ // si le json n'est pas corrompu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
if( isset($request->level_0) ){ // si level 0 défini
|
2015-10-22 12:06:49 +00:00
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/* ROUTAGE (niveau 0) */
|
|
|
|
switch( $request->level_0 ){
|
2015-10-22 12:06:49 +00:00
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/***************/
|
|
|
|
/* UTILISATEUR */
|
|
|
|
/***************/
|
|
|
|
case 'user':
|
|
|
|
if( isset($request->level_1) ){ include 'manager/user.php'; user_switch_level_1($request, $answer); }
|
|
|
|
else { $answer->request = 'missing_level_1'; }
|
|
|
|
break;
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/***********/
|
|
|
|
/* GROUPES */
|
|
|
|
/***********/
|
|
|
|
case 'groups':
|
|
|
|
if( isset($request->level_1) ){ include 'manager/groups.php'; groups_switch_level_1($request, $answer); }
|
2015-10-23 08:56:22 +00:00
|
|
|
else { $answer->request = 'missing_level_1'; }
|
2015-10-23 08:04:26 +00:00
|
|
|
break;
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/********************/
|
|
|
|
/* CALCUL DES NOTES */
|
|
|
|
/********************/
|
|
|
|
case 'MCC':
|
|
|
|
break;
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/**********/
|
|
|
|
/* MODULE */
|
|
|
|
/**********/
|
|
|
|
case 'modules':
|
|
|
|
break;
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/************/
|
|
|
|
/* CONTRÔLE */
|
|
|
|
/************/
|
|
|
|
case 'tests':
|
|
|
|
break;
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/**************/
|
|
|
|
/* PARAMETRES */
|
|
|
|
/**************/
|
|
|
|
case 'settings':
|
|
|
|
break;
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
2015-10-23 08:04:26 +00:00
|
|
|
/***********/
|
|
|
|
/* DEFAULT */
|
|
|
|
/***********/
|
|
|
|
default:
|
|
|
|
$answer->request = 'unknown_level_0';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}else
|
2015-10-22 12:06:49 +00:00
|
|
|
$answer->request = 'no_level_0';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else // si json corrompu (undécodable)
|
|
|
|
$answer->request = 'jsoncorrupted';
|
|
|
|
|
|
|
|
}else // $_POST vide [OU] $_POST['json'] pas défini
|
|
|
|
$answer->request = 'nopost';
|
|
|
|
|
|
|
|
|
|
|
|
// on envoie (affiche) l'objet en JSON
|
|
|
|
echo json_encode($answer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|