function setInformations() { global $options; global $logs; // On vérifie si l'authentification par le module HOPI est activée. if ($options->getOption("ModuleHopi")) { // Appel du module d'authenfication à travers HOPI. $hopi = new clHopi(); $HopiValid = $hopi->Valide(); } $this->genAgirEnTantQue(); // On regarde si une demande d'authentification directe est demandée. if ($_POST['login'] and $_POST['password'] and !$_POST['Déconnexion'] or $options->getOption("TypeAuth") == "CodeAcces" and $_POST['codeacces'] and !$_POST['Déconnexion'] or $options->getOption("TypeAuth") == "SSOBrignoles") { // Si l'authentification est réglée sur LDAP, on lance le module LDAP. if ($options->getOption("TypeAuth") == "LDAP") { $ldap = new clAuthLdap(); if ($ldap->Valide()) { $this->informations = $ldap->getInformations(); } else { if ($_POST['login'] == ADMINLOGIN and $_POST['password'] == ADMINPASSWORD and ADMINACTIF and ADMINLOGIN and ADMINPASSWORD) { $this->informations['type'] = "Config"; $this->informations['nom'] = ADMINLOGIN; $this->informations['prenom'] = ""; $this->informations['pseudo'] = ADMINLOGIN; $this->informations['mail'] = ""; $this->informations['iduser'] = ADMINLOGIN; $this->informations['idgroupe'] = "999999"; $this->informations['superadmin'] = "1"; $this->informations['idapp'] = IDAPPLICATION; $this->informations['fonctions'] = array(); $this->informations['service'] = array(); $this->informations['org'] = ''; } else { if (isset($logs)) { $logs->addLog("password", "Type : LDAP £ Login : "******" £ Password : "******"TypeAuth") == "LDAPCannes") { $ldap = new clAuthLdapCannes(); if ($ldap->Valide()) { $this->informations = $ldap->getInformations(); } else { if ($_POST['login'] == ADMINLOGIN and $_POST['password'] == ADMINPASSWORD and ADMINACTIF and ADMINLOGIN and ADMINPASSWORD) { $this->informations['type'] = "Config"; $this->informations['nom'] = ADMINLOGIN; $this->informations['prenom'] = ""; $this->informations['pseudo'] = ADMINLOGIN; $this->informations['mail'] = ""; $this->informations['iduser'] = ADMINLOGIN; $this->informations['idgroupe'] = "999999"; $this->informations['superadmin'] = "1"; $this->informations['idapp'] = IDAPPLICATION; $this->informations['fonctions'] = array(); $this->informations['service'] = array(); $this->informations['org'] = ''; } else { if (isset($logs)) { $logs->addLog("password", "Type : LDAP £ Login : "******" £ Password : "******"TypeAuth") == "CodeAcces") { $password = new clAuthVeille(); if ($password->Valide()) { $this->informations = $password->getInformations(); } else { if ($_POST['codeacces'] == ADMINPASSWORD and ADMINACTIF and ADMINPASSWORD) { $this->informations['type'] = "Config"; $this->informations['nom'] = ADMINLOGIN; $this->informations['prenom'] = ""; $this->informations['pseudo'] = ADMINLOGIN; $this->informations['mail'] = ""; $this->informations['iduser'] = ADMINLOGIN; $this->informations['idgroupe'] = "999999"; $this->informations['superadmin'] = "1"; $this->informations['idapp'] = IDAPPLICATION; $this->informations['fonctions'] = array(); $this->informations['service'] = array(); $this->informations['org'] = ''; } else { if (isset($logs)) { $logs->addLog("password", "Type : CodeAcces £ Code d'accès : " . $_POST['codeacces']); } } } } else { if ($options->getOption("TypeAuth") == "SSOBrignoles") { $password = new clAuthBrignoles(); if ($password->Valide()) { $this->informations = $password->getInformations(); } else { if ($_POST['login'] == ADMINLOGIN and $_POST['password'] == ADMINPASSWORD and ADMINACTIF and ADMINLOGIN and ADMINPASSWORD) { $this->informations['type'] = "Config"; $this->informations['nom'] = ADMINLOGIN; $this->informations['prenom'] = ""; $this->informations['pseudo'] = ADMINLOGIN; $this->informations['mail'] = ""; $this->informations['iduser'] = ADMINLOGIN; $this->informations['idgroupe'] = "999999"; $this->informations['superadmin'] = "1"; $this->informations['idapp'] = IDAPPLICATION; $this->informations['fonctions'] = array(); $this->informations['service'] = array(); $this->informations['org'] = ''; } else { if (isset($logs)) { $logs->addLog("password", "Type : CodeAcces £ Code d'accès : " . $_POST['codeacces']); } } } } else { // Sinon, on lance le module d'authentification interne dans la base MySQL. // Module d'authentification MySQL à venir... $sqli = new clMySQLInterne(); if ($sqli->Valide()) { $this->informations = $sqli->getInformations(); } else { if ($_POST['login'] == ADMINLOGIN and $_POST['password'] == ADMINPASSWORD and ADMINACTIF and ADMINLOGIN and ADMINPASSWORD) { $this->informations['type'] = "Config"; $this->informations['nom'] = ADMINLOGIN; $this->informations['prenom'] = ""; $this->informations['pseudo'] = ADMINLOGIN; $this->informations['mail'] = ""; $this->informations['iduser'] = ADMINLOGIN; $this->informations['idgroupe'] = "999999"; $this->informations['superadmin'] = "1"; $this->informations['idapp'] = IDAPPLICATION; $this->informations['fonctions'] = array(); $this->informations['service'] = array(); $this->informations['org'] = ''; } else { if (isset($logs)) { $logs->addLog("password", "Type : MySQL £ Login : "******" £ Password : "******"Config" and $this->informations['idapp'] != IDAPPLICATION) { $this->informations = ''; } } } // Si une déconnexion est demandée, on réinitialise les informations. if ($_POST['Déconnexion']) { global $pi; $_POST['navi'] = ''; $oldtype = $this->informations['type']; $this->informations = ''; } // Si la session Hopi demandée est valide et que les informations ne sont pas remplies, // alors on récupère les informations en provenance d'Hopi. if ((!$this->informations['idgroupe'] or $_GET['idsession']) and $HopiValid) { if (!($oldtype == "Hopi" and $_POST['Déconnexion'])) { $this->informations = $hopi->getInformations(); } } $this->informations['navigateur'] = $_SERVER["HTTP_USER_AGENT"]; // Si les informations ne sont toujours pas renseignées, alors on initialise ces informations // avec des valeurs par défaut (compte "Invité"). $this->informations['ip'] = $_SERVER['REMOTE_ADDR']; if (!$this->informations['idgroupe']) { if ($_POST['Déconnexion']) { global $pi; $pi->addPostIt("Déconnexion", "Vous êtes maintenant déconnecté.", "reussite", "1"); $_SESSION['hopisession'] = ''; } $this->informations['type'] = "Echec"; $this->informations['nom'] = "Invité"; $this->informations['prenom'] = "Invité"; $this->informations['pseudo'] = "Invité"; $this->informations['mail'] = "*****@*****.**"; $this->informations['iduser'] = "******"; $this->informations['idgroupe'] = "1"; $this->informations['fonctions'] = array(); $this->informations['service'] = array(); $this->informations['org'] = ''; if (($_POST['login'] and $_POST['password'] or $options->getOption("TypeAuth") == "CodeAcces" and $_POST['codeacces']) and !$_POST['Déconnexion']) { global $pi; if ($options->getOption("TypeAuth") == "CodeAcces") { if ($pi) { $pi->addPostIt("Erreur de connexion", "Le code d'accès entré n'est pas valide.", "erreur", 1); } } elseif (IDAPPLICATION != 2) { if ($pi) { $pi->addPostIt("Erreur de connexion", "Les informations de connexion entrées ne sont pas valides : Erreur dans le nom d'utilisateur ou le mot de passe.", "erreur", 1); } } else { if ($pi) { $pi->addPostIt("Erreur de connexion", "ATTENTION : Vous devez vous connecter dorénavant avec votre identifiant et votre mot de passe HOPI.", "erreur", 1); } } } } // Affichage pour débugage. if (DEBUGAUTHENTIFICATION) { print affTab($this->informations); } // Mise à jour de la base MySQL. $this->setSessionSQL(); // Sauvegarde des informations. $_SESSION['informations' . $this->index] = $this->informations; // Affichage pour débugage. if (DEBUGAUTHENTIFICATION) { print affTab($this->informations); } // Affichage pour débugage. if (DEBUGAUTHENTIFICATION) { print affTab($_SESSION['informations']); } if (!isset($this->informations['superadmin'])) { $this->informations['superadmin'] = 0; } }