2016-01-09 15:51:30 +00:00
|
|
|
<?php define('__ROOT__', dirname(__FILE__) );
|
2015-10-28 17:08:12 +00:00
|
|
|
require_once __ROOT__.'/manager/security.php';
|
|
|
|
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
/* 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':
|
2015-12-06 19:08:28 +00:00
|
|
|
if( isset($request->level_1) ){ userManager::switch_level_1($request, $answer); }
|
|
|
|
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
|
|
|
/***********/
|
|
|
|
/* GROUPES */
|
|
|
|
/***********/
|
|
|
|
case 'groups':
|
2015-12-06 19:08:28 +00:00
|
|
|
if( isset($request->level_1) ){ groupsManager::switch_level_1($request, $answer); }
|
|
|
|
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-29 23:01:35 +00:00
|
|
|
/********************************/
|
|
|
|
/* DOSSIER ETUDIANT (NOTES,...) */
|
|
|
|
/********************************/
|
|
|
|
case 'career':
|
2015-12-06 19:08:28 +00:00
|
|
|
if( isset($request->level_1) ){ careerManager::switch_level_1($request, $answer); }
|
|
|
|
else { $answer->request = 'missing_level_1'; }
|
2015-10-23 08:04:26 +00:00
|
|
|
break;
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
2016-01-02 13:21:31 +00:00
|
|
|
/***********/
|
|
|
|
/* MODULES */
|
|
|
|
/***********/
|
2015-10-23 08:04:26 +00:00
|
|
|
case 'modules':
|
2015-12-06 19:08:28 +00:00
|
|
|
if( isset($request->level_1) ){ modulesManager::switch_level_1($request, $answer); }
|
|
|
|
else { $answer->request = 'missing_level_1'; }
|
2015-11-21 17:09:03 +00:00
|
|
|
break;
|
|
|
|
|
2016-01-02 13:21:31 +00:00
|
|
|
/*********/
|
|
|
|
/* EXCEL */
|
|
|
|
/*********/
|
|
|
|
case 'excel':
|
|
|
|
if( isset($request->level_1) ){ excelManager::switch_level_1($request, $answer); }
|
2015-12-06 19:08:28 +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
|
|
|
/************/
|
|
|
|
/* 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
|
2016-01-08 12:36:59 +00:00
|
|
|
$answer->request = 'missing_level_0';
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}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
|
2016-01-09 15:31:04 +00:00
|
|
|
echo json_encode($answer);
|
2015-10-22 12:06:49 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|