From: Stéphane Jacob Date: Sun, 6 Mar 2011 17:16:47 +0000 (+0100) Subject: Adds specific function to build homonyms hrmid. X-Git-Tag: xorg/1.1.0~68 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f88d915428d9375442839f4528313f4ffe2b778e;p=platal.git Adds specific function to build homonyms hrmid. Signed-off-by: Stéphane Jacob --- diff --git a/bin/cron/homonyms.php b/bin/cron/homonyms.php index cfc5b0d..f70ee30 100755 --- a/bin/cron/homonyms.php +++ b/bin/cron/homonyms.php @@ -33,8 +33,8 @@ while ($old = $resRobot->next()) { $res = XDB::query('SELECT a.hruid FROM homonyms_list AS h INNER JOIN accounts AS a ON (h.uid = a.uid) - WHERE hrmid = {?}', - 'h.' . $old['email'] . '.' . Platal::globals()->mail->domain); + WHERE h.hrmid = {?}', + User::makeHomonymHrmid($old['email']); $hruids = $res->fetchColumn(); $homonym = User::getSilent($old['uid']); diff --git a/classes/user.php b/classes/user.php index 1eaa12f..039fec6 100644 --- a/classes/user.php +++ b/classes/user.php @@ -824,6 +824,11 @@ class User extends PlUser } } + public static function makeHomonymHrmid($alias) + { + return 'h.' . $alias . '.' . Platal::globals()->mail->domain; + } + public static function isMainMailDomain($domain) { global $globals; diff --git a/include/validations/homonymes.inc.php b/include/validations/homonymes.inc.php index 14a6f49..7256112 100644 --- a/include/validations/homonymes.inc.php +++ b/include/validations/homonymes.inc.php @@ -124,8 +124,7 @@ est ambigu pour des raisons d'homonymie et signalera ton email exact."; SELECT {?}, {?}, id, \'homonym\', NOW() FROM email_virtual_domains WHERE name = {?}', - 'h.' . $this->loginbis . '.' . Platal::globals()->mail->domain, - $this->loginbis, $this->user->mainEmailDomain()); + User::makeHomonymHrmid($this->loginbis), $this->loginbis, $this->user->mainEmailDomain()); fix_bestalias($this->user); } diff --git a/modules/admin.php b/modules/admin.php index d063d71..f97f83a 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -979,8 +979,7 @@ class AdminModule extends PLModule SELECT {?}, {?}, id, \'homonym\', NOW() FROM email_virtual_domains WHERE name = {?}', - 'h.' . $loginbis . '.' . Platal::globals()->mail->domain, - $loginbis, $user->mainEmailDomain()); + User::makeHomonymHrmid($loginbis), $loginbis, $user->mainEmailDomain()); fix_bestalias($user); send_robot_homonyme($user, $loginbis); $op = 'list'; diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php index 7a8b21f..83f5ea2 100644 --- a/modules/register/register.inc.php +++ b/modules/register/register.inc.php @@ -163,7 +163,7 @@ function createAliases($subState) SET expire = ADDDATE(NOW(), INTERVAL 1 MONTH) WHERE email = {?} AND type != \'alias_aux\'', $emailXorg); - $hrmid = 'h.' . $emailXorg . '.' . $globals->mail->domain; + $hrmid = User::makeHomonymHrmid($emailXorg); XDB::execute('INSERT IGNORE INTO homonyms_list (hrmid, uid) VALUES ({?}, {?}), ({?}, {?})', $hrmid, $h_id, $hrmid, $subState->i('uid'));