X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fhomonymes.inc.php;h=6ebb4d15917b90b12e6190ae9d3bb1a0507b6368;hb=77254e96f9bb2fd88258f00bd72719b60dcd0456;hp=c6bf25c058a206e7ee3551be0c41762d7d5e3dc8;hpb=50a40a33a496131e817df875607ea5542d096a64;p=platal.git diff --git a/include/homonymes.inc.php b/include/homonymes.inc.php index c6bf25c..6ebb4d1 100644 --- a/include/homonymes.inc.php +++ b/include/homonymes.inc.php @@ -20,8 +20,7 @@ ***************************************************************************/ function select_if_homonyme($uid) { - global $globals; - $res = $globals->xdb->query("SELECT prenom,nom,a.alias AS forlife,h.alias AS loginbis + $res = XDB::query("SELECT prenom,nom,a.alias AS forlife,h.alias AS loginbis FROM auth_user_md5 AS u INNER JOIN aliases AS a ON (a.id=u.user_id AND a.type='a_vie') INNER JOIN aliases AS h ON (h.id=u.user_id AND h.expire!='') @@ -38,7 +37,7 @@ function send_warning_homonyme($prenom, $nom, $forlife, $loginbis) { $mymail->setSubject("Dans 2 semaines, suppression de $loginbis@polytechnique.org"); $mymail->addTo("$prenom $nom <$forlife@polytechnique.org>"); $mymail->addCc($cc); - $mymail->setTxtBody(Env::get('mailbody')); + $mymail->setTxtBody(Env::v('mailbody')); $mymail->send(); } @@ -51,22 +50,21 @@ function send_robot_homonyme($prenom, $nom, $forlife, $loginbis) { $mymail->setSubject("Mise en place du robot $loginbis@polytechnique.org"); $mymail->addTo("$prenom $nom <$forlife@polytechnique.org>"); $mymail->addCc($cc); - $mymail->setTxtBody(Env::get('mailbody')); + $mymail->setTxtBody(Env::v('mailbody')); $mymail->send(); } function switch_bestalias($uid, $loginbis) { - global $globals; // check if loginbis was the bestalias - $res = $globals->xdb->query("SELECT alias FROM aliases WHERE id = {?} AND FIND_IN_SET('bestalias', flags)", $uid); + $res = XDB::query("SELECT alias FROM aliases WHERE id = {?} AND FIND_IN_SET('bestalias', flags)", $uid); $bestalias = $res->fetchOneCell(); if ($bestalias && $bestalias != $loginbis) return false; // select the shortest alias still alive - $res = $globals->xdb->query("SELECT alias FROM aliases WHERE id = {?} AND alias != {?} AND expire IS NULL ORDER BY LENGTH(alias) LIMIT 1", $uid, $loginbis); + $res = XDB::query("SELECT alias FROM aliases WHERE id = {?} AND alias != {?} AND expire IS NULL ORDER BY LENGTH(alias) LIMIT 1", $uid, $loginbis); $newbest = $res->fetchOneCell(); // change the bestalias flag - $globals->xdb->execute("UPDATE aliases SET flags = (flags & (255 - 1)) | IF(alias = {?}, 1, 0) WHERE id = {?}", $newbest, $uid); + XDB::execute("UPDATE aliases SET flags = (flags & (255 - 1)) | IF(alias = {?}, 1, 0) WHERE id = {?}", $newbest, $uid); return $newbest; }