- //verif du mdp
- if(!isset($params[0]) || ($params[0] != $globals->manageurs->manageurs_pass)){return false;}
- if( !empty($params[1]) ){ // on verifie qu'on a bien un matricule
-
- $res = XDB::query(
- "SELECT a.nom, a.nom_usage,a.prenom, FIND_IN_SET('femme', a.flags) as femme ,a.deces!= 0 as decede ,
- a.naissance, a.promo, concat(al.alias, '@m4x.org') as mail
- FROM auth_user_md5 AS a
- INNER JOIN aliases as al ON a.user_id=al.id
- WHERE al.flags='bestalias' and a.matricule = {?}",$params[1]);
- $data=$res->fetchOneAssoc();
- //$data['mail'].='@polytechnique.org';
-
-
- //on commence le cryptage des donnees
- if (manageurs_encrypt_init($params[1]) == 1) {//on a pas trouve la cle pour crypter
+ // Password verification.
+ if(!isset($params[0]) || ($params[0] != $globals->manageurs->manageurs_pass)) {
+ return false;
+ }
+ // We check we actually have an identification number.
+ if(!empty($params[1])) {
+ $nameTypes = DirEnum::getOptions(DirEnum::NAMETYPES);
+ $nameTypes = array_flip($nameTypes);
+
+ $res = XDB::query("SELECT pnl.name AS nom, pnu.name AS nom_usage, pnf.name AS prenom,
+ p.sex = 'female' AS femme, p.deathdate IS NOT NULL AS decede,
+ p.birthdate, pd.promo, CONCAT(e.email, '@', d.name) AS mail
+ FROM profiles AS p
+ INNER JOIN account_profiles AS ap ON (p.pid = ap.pid AND FIND_IN_SET('owner', perms)
+ INNER JOIN email_source_account AS s ON (s.uid = ap.uid AND FIND_IN_SET('bestalias', s.flags))
+ INNER JOIN email_virtual_domains AS d ON (s.domain = s.id)
+ INNER JOIN profile_display AS pd PN (p.pid = pd.pid)
+ INNER JOIN profile_name AS pnl ON (p.pid = pnl.pid AND pnl.typeid = {?})
+ INNER JOIN profile_name AS pnf ON (p.pid = pnf.pid AND pnf.typeid = {?})
+ INNER JOIN profile_name AS pnu ON (p.pid = pnu.pid AND pnu.typeid = {?})
+ WHERE a.flags = 'bestalias' AND p.xorg_id = {?}",
+ $nameTypes['name_ini'], $nameTypes['lastname_ordinary'],
+ $nameTypes['firstname_ini'], $params[1]);
+ // $data['mail'] .= '@polytechnique.org';
+
+
+ // We start the encryption of the data.
+ if (manageurs_encrypt_init($params[1]) == 1) {
+ // We did not find the key to encryptthe data.