| Line 1... |
Line 1... |
| 1 |
<?php
|
1 |
<?php
|
| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
class GttCtrlActionIdentification extends aControlleurAction {
|
3 |
class GttCtrlActionIdentification extends aControlleurAction {
|
| 4 |
|
4 |
|
| 5 |
public function __construct(Registre $Registre)
|
5 |
public function __construct(Registre $Registre)
|
| 6 |
{
|
6 |
{
|
| 7 |
$Registre->ajouterEspace('Identification', 'identification');
|
- |
|
| 8 |
$Registre->ajouterSquelette('identification', 'connexion.tpl.html');
|
7 |
$Registre->ajouterEspace('Identification', 'identification');
|
| 9 |
}
|
8 |
}
|
| 10 |
|
9 |
|
| 11 |
public function executer()
|
10 |
public function executer()
|
| 12 |
{
|
11 |
{
|
| - |
|
12 |
$aso_identification = array();
|
| - |
|
13 |
$params = array('dsn' => GTT_BDD_DSN,
|
| - |
|
14 |
'table' => 'gestion_utilisateur',
|
| - |
|
15 |
'usernamecol' => 'gu_email',
|
| - |
|
16 |
'passwordcol' => 'gu_password',
|
| - |
|
17 |
'cryptype' => 'md5',
|
| - |
|
18 |
'db_fields' => '*');
|
| - |
|
19 |
// Création de l'objet auth
|
| - |
|
20 |
$a = new Auth('DB', $params, null, false);
|
| - |
|
21 |
$a->setSessionname(GTT_AUTH_SESSION_NOM);
|
| - |
|
22 |
$a->setExpire(time()+(int)GTT_AUTH_SESSION_DUREE);
|
| - |
|
23 |
$a->start();
|
| 13 |
$aso_identification = array();
|
24 |
$GLOBALS['_GTT_']['auth'] = $a;
|
| 14 |
$this->getRegistre()->ajouterSquelette('identification', 'identite.tpl.html');
|
25 |
setcookie(session_name(),session_id(), time()+(int)GTT_AUTH_SESSION_DUREE, "/");
|
| - |
|
26 |
if ($GLOBALS['_GTT_']['auth']->getAuth()) {
|
| - |
|
27 |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
|
| - |
|
28 |
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($a->getUserName()));
|
| 15 |
//$GLOBALS['_GTT_']['auth']->logout();
|
29 |
|
| 16 |
$aso_identification['nom'] = $GLOBALS['_GTT_']['Utilisateur']->getNom();
|
30 |
$aso_identification['nom'] = $GLOBALS['_GTT_']['Utilisateur']->getNom();
|
| 17 |
$aso_identification['prenom'] = $GLOBALS['_GTT_']['Utilisateur']->getPrenom();
|
- |
|
| - |
|
31 |
$aso_identification['prenom'] = $GLOBALS['_GTT_']['Utilisateur']->getPrenom();
|
| 18 |
|
32 |
$this->getRegistre()->ajouterSquelette('identification', 'identite.tpl.html');
|
| 19 |
//echo '<pre>'.print_r($aso_identification, true).'</pre>';
|
33 |
//echo '<pre>'.print_r($aso_identification, true).'</pre>';
|
| - |
|
34 |
$this->getRegistre()->ajouterDonnee('identification', $aso_identification);
|
| - |
|
35 |
} else {
|
| - |
|
36 |
$this->setSuivant('Deconnexion', 1);
|
| 20 |
$this->getRegistre()->ajouterDonnee('identification', $aso_identification);
|
37 |
}
|
| 21 |
}
|
38 |
}
|
| 22 |
|
39 |
|
| 23 |
public function executerDeconnexion()
|
40 |
public function executerDeconnexion()
|
| 24 |
{
|
41 |
{
|
| 25 |
$aso_connexion = array();
|
42 |
$aso_connexion = array();
|
| - |
|
43 |
$this->getRegistre()->setTitre('Bienvenue sur GTT!');
|
| 26 |
$this->getRegistre()->setTitre('Bienvenue sur GTT!');
|
44 |
$this->getRegistre()->ajouterSquelette('identification', 'connexion.tpl.html');
|
| 27 |
// Création de l'url de réponse du formulaire
|
45 |
// Création de l'url de réponse du formulaire
|
| 28 |
$aso_connexion['url'] = 'index.php?action='.GTT_ACTION_CONNEXION;
|
46 |
$aso_connexion['url'] = 'index.php?action='.GTT_ACTION_CONNEXION;
|
| 29 |
$GLOBALS['_GTT_']['auth']->logout();
|
47 |
$GLOBALS['_GTT_']['auth']->logout();
|
| 30 |
|
48 |
|
| 31 |
//echo '<pre>'.print_r($aso_connexion, true).'</pre>';
|
49 |
//echo '<pre>'.print_r($aso_connexion, true).'</pre>';
|
| - |
|
50 |
$this->getRegistre()->ajouterDonnee('identification', $aso_connexion);
|
| 32 |
$this->getRegistre()->ajouterDonnee('identification', $aso_connexion);
|
51 |
$this->getRegistre()->set('action_finale', true);
|
| 33 |
}
|
52 |
}
|
| 34 |
}
|
53 |
}
|
| 35 |
?>
|
54 |
?>
|