function GetInformations() { // $query = "select log_nom,log_prenom,log_fonction,log_fonctions, log_equipes,log_uf,log_uid from hopi.log where log_idsession = ".$this->hopisession ; $query = "select * from hopi.log where log_idsession = " . $this->hopisession; if (function_exists('OCILogon')) { $conn = @OCILogon("hopi", "hopi", "hopi"); $stmt = @OCIParse($conn, $query); @OCIExecute($stmt); $nrows = @OCIFetchStatement($stmt, $results); $ldap = new clAuthLdap(); if ($nrows > 0) { $_POST['login'] = $results["LOG_UID"][0]; $ldap->valide('noBind'); $_SESSION['hopisession'] = ''; return $ldap->getInformations(); } /* if ( $nrows > 0 ) { $log[uid] = $results["LOG_UID"][0] ; $log[nom] = $results["LOG_NOM"][0] ; $log[prenom] = $results["LOG_PRENOM"][0] ; $log[fonction] = $results["LOG_FONCTION"][0] ; $log[fonctions] = explode ( ',', $results["LOG_FONCTIONS"][0] ) ; $log[equipes] = explode ( ',', $results["LOG_EQUIPES"][0] ) ; $log[uf] = $results["LOG_UF"][0] ; $log[org] = $results["LOG_ORGANISATION"][0] ; } else { $log = "false" ; } $infos[type] = "Hopi" ; $infos[nom] = $log[nom] ; $infos[prenom] = $log[prenom] ; $infos[iduser] = $log[uid] ; $infos[pseudo] = "Hopi (".$log[uid].")" ; $infos[mail] = $log[uid]."@ch-hyeres.fr" ; $infos[uf] = explode ( ",", str_ireplace ( "'", '', $results["LOG_UF"][0] ) ) ; $infos[org] = $log[org] ; // Récupération de la liste des groupes. for ( $i = 0 ; isset ( $log[equipes][$i] ) ; $i++ ) $or_equipes .= " OR nomgroupe='".$log[equipes][$i]."'" ; for ( $i = 0 ; isset ( $log[fonctions][$i] ) ; $i++ ) $or_fonctions .= " OR nomgroupe='".$log[fonctions][$i]."'" ; $param[cw] = "where nomgroupe='HOPI' OR nomgroupe='".$log[uid]."' OR nomgroupe='".$log[fonction]."' $or_equipes $or_fonctions" ; $req = new clResultQuery ; $res = $req -> Execute ( "Fichier", "getGroupes", $param, "ResultQuery" ) ; $infos[idgroupe] = $res[idgroupe][0] ; for ( $j = 1 ; isset ( $res[idgroupe][$j] ) ; $j++ ) { $infos[idgroupe] .= ",".$res[idgroupe][$j] ; } //print "<br>Groupe(s) : ".$infos[idgroupe] ; */ @oci_close($conn); return $infos; } }
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; } }