| Line 34... |
Line 34... |
| 34 |
// +------------------------------------------------------------------------------------------------------+
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
| 35 |
// | INCLUSION DE FICHIERS |
|
35 |
// | INCLUSION DE FICHIERS |
|
| 36 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| 38 |
// Fichiers de la bibliotheque PEAR
|
38 |
// Fichiers de la bibliotheque PEAR
|
| 39 |
include_once 'Auth/Auth.php';
|
39 |
include 'Auth/Auth.php';
|
| 40 |
include_once 'DB.php';
|
40 |
include 'DB.php';
|
| 41 |
include_once 'HTML/QuickForm.php';
|
41 |
include 'HTML/QuickForm.php';
|
| 42 |
include_once 'gtt_config.inc.php';
|
42 |
include 'gtt_config.inc.php';
|
| Line 43... |
Line 43... |
| 43 |
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
|
43 |
include CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
|
| 44 |
|
44 |
|
| 45 |
// Test des choix de menu a afficher
|
45 |
// Test des choix de menu a afficher
|
| 46 |
$action = 1;
|
46 |
$action = 1;
|
| 47 |
if (!empty($_GET['action'])) {
|
47 |
if (!empty($_GET['action'])) {
|
| 48 |
$action = $_GET['action'];
|
48 |
$action = $_GET['action'];
|
| 49 |
}
|
49 |
}
|
| 50 |
if (!preg_match('/^\d+$/', $action)) {
|
50 |
if (!preg_match('/^\d+$/', $action)) {
|
| 51 |
// Connexion a la base de donnees
|
51 |
// Connexion a la base de donnees
|
| 52 |
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
|
- |
|
| 53 |
if (DB::isError($GLOBALS['db'])) {
|
52 |
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
|
| 54 |
$GLOBALS['db']->getMessage();
|
53 |
if (PEAR::isError($GLOBALS['db'])) {
|
| 55 |
echo "Echec connexion a la base de donnees";
|
- |
|
| 56 |
}
|
54 |
trigger_error("Echec connexion a la base de donnees : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
|
| 57 |
|
55 |
}
|
| 58 |
$params = array('dsn' => GTT_BDD_DSN,
|
56 |
$params = array('dsn' => GTT_BDD_DSN,
|
| 59 |
'table' => GEST_UTILISATEUR,
|
57 |
'table' => 'gestion_utilisateur',
|
| 60 |
'usernamecol' => GEST_CHAMPS_EMAIL,
|
58 |
'usernamecol' => 'gu_email',
|
| 61 |
'passwordcol' => GEST_CHAMPS_PASSWORD,
|
59 |
'passwordcol' => 'gu_password',
|
| Line 62... |
Line 60... |
| 62 |
'cryptype' => 'md5',
|
60 |
'cryptype' => 'md5',
|
| 63 |
'db_fields' => '*');
|
61 |
'db_fields' => '*');
|
| Line 68... |
Line 66... |
| 68 |
$a->setExpire(3600*24*30);
|
66 |
$a->setExpire(3600*24*30);
|
| 69 |
$a->start();
|
67 |
$a->start();
|
| 70 |
if (!$a->getAuth()) {
|
68 |
if (!$a->getAuth()) {
|
| 71 |
$action = GTT_ACTION_DECONNEXION;
|
69 |
$action = GTT_ACTION_DECONNEXION;
|
| 72 |
}
|
70 |
}
|
| 73 |
|
71 |
|
| 74 |
// Récuperation d'informations générales
|
72 |
// Récuperation d'informations générales
|
| 75 |
require_once GTT_CHEMIN_CLASSE.'GestionnaireErreur.class.php';
|
73 |
require_once GTT_CHEMIN_CLASSE.'GestionnaireErreur.class.php';
|
| 76 |
require_once GTT_CHEMIN_METIER.'aGttSql.class.php';
|
74 |
require_once GTT_CHEMIN_METIER.'aGttSql.class.php';
|
| 77 |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
|
75 |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
|
| 78 |
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($a->getUserName()));
|
76 |
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($a->getUserName()));
|
| 79 |
$GLOBALS['_GTT_']['auth'] = $a;
|
77 |
$GLOBALS['_GTT_']['auth'] = $a;
|
| Line 80... |
Line 78... |
| 80 |
|
78 |
|
| 81 |
// Utilisation du mécanisme MVC avec Squelette PHP et objet
|
79 |
// Utilisation du mécanisme MVC avec Squelette PHP et objet
|
| 82 |
require_once GTT_CHEMIN_CLASSE.'aControlleurAction.class.php';
|
80 |
require_once GTT_CHEMIN_CLASSE.'aControlleurAction.class.php';
|
| 83 |
require_once GTT_CHEMIN_CLASSE.'Registre.class.php';
|
81 |
require_once GTT_CHEMIN_CLASSE.'Registre.class.php';
|
| 84 |
$module = 'Preference';
|
82 |
$module = 'Gestion';
|
| 85 |
if (isset($_GET['module']) && !empty($_GET['module'])) {
|
83 |
if (isset($_GET['module']) && !empty($_GET['module'])) {
|
| 86 |
$module = $_GET['module'];
|
84 |
$module = $_GET['module'];
|
| 87 |
}
|
85 |
}
|
| 88 |
$nom_module = 'GttControlleur'.$module;
|
86 |
$nom_module = 'GttControlleur'.$module;
|