113 lines
2.8 KiB
PHP
Executable File
113 lines
2.8 KiB
PHP
Executable File
<?php //define('__ROOT__', dirname(__FILE__) );
|
|
require_once __ROOT__.'/manager/security.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
|
|
|
|
|
|
|
|
|
|
|
|
if( isset($request->level_0) ){ // si level 0 défini
|
|
|
|
/* ROUTAGE (niveau 0) */
|
|
switch( $request->level_0 ){
|
|
|
|
/***************/
|
|
/* UTILISATEUR */
|
|
/***************/
|
|
case 'user':
|
|
if( isset($request->level_1) ){ userManager::switch_level_1($request, $answer); }
|
|
else { $answer->request = 'missing_level_1'; }
|
|
break;
|
|
|
|
|
|
/***********/
|
|
/* GROUPES */
|
|
/***********/
|
|
case 'groups':
|
|
if( isset($request->level_1) ){ groupsManager::switch_level_1($request, $answer); }
|
|
else { $answer->request = 'missing_level_1'; }
|
|
break;
|
|
|
|
|
|
/********************************/
|
|
/* DOSSIER ETUDIANT (NOTES,...) */
|
|
/********************************/
|
|
case 'career':
|
|
if( isset($request->level_1) ){ careerManager::switch_level_1($request, $answer); }
|
|
else { $answer->request = 'missing_level_1'; }
|
|
break;
|
|
|
|
|
|
/***********/
|
|
/* MODULES */
|
|
/***********/
|
|
case 'modules':
|
|
if( isset($request->level_1) ){ modulesManager::switch_level_1($request, $answer); }
|
|
else { $answer->request = 'missing_level_1'; }
|
|
break;
|
|
|
|
/*********/
|
|
/* EXCEL */
|
|
/*********/
|
|
case 'excel':
|
|
if( isset($request->level_1) ){ excelManager::switch_level_1($request, $answer); }
|
|
else { $answer->request = 'missing_level_1'; }
|
|
break;
|
|
|
|
|
|
/************/
|
|
/* CONTRÔLE */
|
|
/************/
|
|
case 'tests':
|
|
break;
|
|
|
|
|
|
/**************/
|
|
/* PARAMETRES */
|
|
/**************/
|
|
case 'settings':
|
|
break;
|
|
|
|
|
|
/***********/
|
|
/* DEFAULT */
|
|
/***********/
|
|
default:
|
|
$answer->request = 'unknown_level_0';
|
|
break;
|
|
}
|
|
}else
|
|
$answer->request = 'missing_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);
|
|
|
|
}
|
|
|
|
?>
|