FROM homonyms_list AS h
INNER JOIN accounts AS a ON (h.uid = a.uid)
WHERE hrmid = {?}',
- 'h.' . $old['email'] . '.polytechnique.org');
+ 'h.' . $old['email'] . '.' . Platal::globals()->mail->domain);
$hruids = $res->fetchColumn();
$homonym = User::getSilent($old['uid']);
require_once 'plmailer.php';
global $globals;
-$res = XDB::iterator('SELECT p.hrpid, pm.pid, a.full_name, pm.field, pm.oldText, pm.newText, p.sex, pd.yourself, s.email
+$res = XDB::iterator('SELECT p.hrpid, pm.pid, a.full_name, pm.field, pm.oldText, pm.newText, p.sex, pd.yourself, ap.uid
FROM profile_modifications AS pm
INNER JOIN accounts AS a ON (pm.uid = a.uid)
INNER JOIN profiles AS p ON (pm.pid = p.pid)
INNER JOIN profile_display AS pd ON (pm.pid = pd.pid)
INNER JOIN account_profiles AS ap ON (pm.pid = ap.pid AND FIND_IN_SET(\'owner\', ap.perms))
- INNER JOIN email_source_account AS s ON (a.uid = s.uid AND FIND_IN_SET(\'bestalias\', s.flags))
WHERE pm.type = \'third_party\' AND pm.field != \'deathdate\'
ORDER BY pm.pid, pm.field, pm.timestamp');
$pid = $values['pid'];
$sex = ($values['sex'] == 'female') ? 1 : 0;
$yourself = $values['yourself'];
- $alias = $values['email'];
+ $user = User::getSilentWithUID($values['uid']);
$hrpid = $values['hrpid'];
$modifications = array();
$modifications[] = array(
while ($values = $res->next()) {
if ($values['pid'] != $pid) {
$mailer = new PlMailer('profile/notification.mail.tpl');
- $mailer->addTo($alias . '@' . $globals->mail->domain);
+ $mailer->addTo($user);
$mailer->assign('modifications', $modifications);
$mailer->assign('yourself', $yourself);
$mailer->assign('hrpid', $hrpid);
$pid = $values['pid'];
$sex = ($values['sex'] == 'female') ? 1 : 0;
$yourself = $values['yourself'];
- $alias = $values['alias'];
+ $user = User::getSilentWithUID($values['uid']);
$hrpid = $values['hrpid'];
$modifications[] = array(
'full_name' => $values['full_name'],
);
}
$mailer = new PlMailer('profile/notification.mail.tpl');
- $mailer->addTo($alias . '@' . $globals->mail->domain);
+ $mailer->addTo($user);
$mailer->assign('modifications', $modifications);
$mailer->assign('yourself', $yourself);
$mailer->assign('hrpid', $hrpid);
const PERM_MAIL = 'mail';
const PERM_PAYMENT = 'payment';
+ public static $sub_mail_domains = array(
+ 'x' => '',
+ 'master' => 'master.',
+ 'phd' => 'doc.',
+ 'all' => 'alumni.'
+ );
+
private $_profile_fetched = false;
private $_profile = null;
$login = trim(strtolower($login));
if (strstr($login, '@') === false) {
$email = $login;
- $domain = $globals->mail->domain;
+ $domain = $this->mainEmailDomain();
} else {
list($email, $domain) = explode('@', $login);
}
$uids = array_map(array('XDB', 'escape'), $uids);
return XDB::iterator('SELECT a.uid, a.hruid, a.registration_date, h.uid IS NOT NULL AS homonym,
- IF(ef.email IS NULL, NULL, CONCAT(ef.email, \'@\', MAX(df.name))) AS forlife,
- IF(ef.email IS NULL, NULL, CONCAT(ef.email, \'@\', MIN(df.name))) AS forlife_alternate,
- IF(eb.email IS NULL, NULL, CONCAT(eb.email, \'@\', MAX(db.name))) AS bestalias,
- IF(eb.email IS NULL, NULL, CONCAT(eb.email, \'@\', MIN(db.name))) AS bestalias_alternate,
+ IF(ef.email IS NULL, NULL, CONCAT(ef.email, \'@\', mf.name)) AS forlife,
+ IF(ef.email IS NULL, NULL, CONCAT(ef.email, \'@\', df.name)) AS forlife_alternate,
+ IF(eb.email IS NULL, NULL, CONCAT(eb.email, \'@\', mb.name)) AS bestalias,
+ IF(eb.email IS NULL, NULL, CONCAT(eb.email, \'@\', db.name)) AS bestalias_alternate,
(er.redirect IS NULL AND a.state = \'active\') AS lost,
a.email, a.full_name, a.directory_name, a.display_name, a.sex = \'female\' AS gender,
IF(a.state = \'active\', CONCAT(at.perms, \',\', IF(a.user_perms IS NULL, \'\', a.user_perms)), \'\') AS perms,
INNER JOIN account_types AS at ON (at.type = a.type)
LEFT JOIN email_source_account AS ef ON (ef.uid = a.uid AND ef.type = \'forlife\')
LEFT JOIN email_virtual_domains AS mf ON (ef.domain = mf.id)
- LEFT JOIN email_virtual_domains AS df ON (df.aliasing = mf.id)
+ LEFT JOIN email_virtual_domains AS df ON (df.aliasing = mf.id AND
+ df.name LIKE CONCAT(\'%\', {?}) AND df.name NOT LIKE \'alumni.%\')
LEFT JOIN email_source_account AS eb ON (eb.uid = a.uid AND eb.flags = \'bestalias\')
LEFT JOIN email_virtual_domains AS mb ON (eb.domain = mb.id)
- LEFT JOIN email_virtual_domains AS db ON (db.aliasing = mb.id)
+ LEFT JOIN email_virtual_domains AS db ON (db.aliasing = mb.id AND
+ db.name LIKE CONCAT(\'%\', {?}) AND db.name NOT LIKE \'alumni.%\')
LEFT JOIN email_redirect_account AS er ON (er.uid = a.uid AND er.flags = \'active\' AND er.broken_level < 3
AND er.type != \'imap\' AND er.type != \'homonym\')
LEFT JOIN homonyms_list AS h ON (h.uid = a.uid)
' . $joins . '
WHERE a.uid IN (' . implode(', ', $uids) . ')
GROUP BY a.uid
- ' . $order);
+ ' . $order, $globals->mail->domain2, $globals->mail->domain2);
}
// Implementation of the data loader.
$this->id(), $profile->id());
}
+ /** Determines main email domain for this user.
+ */
+ public function mainEmailDomain()
+ {
+ if (array_key_exists($this->type, self::$sub_mail_domains)) {
+ return self::$sub_mail_domains[$this->type] . Platal::globals()->mail->domain;
+ }
+ }
+
+ /** Determines alternate email domain for this user.
+ */
+ public function alternateEmailDomain()
+ {
+ if (array_key_exists($this->type, self::$sub_mail_domains)) {
+ return self::$sub_mail_domains[$this->type] . Platal::globals()->mail->domain2;
+ }
+ }
+
/** Fetch existing auxiliary alias.
*/
public function emailAlias()
}
}
- // Implementation of the static email locality checker.
- public static function isForeignEmailAddress($email)
+ public static function isMainMailDomain($domain)
{
global $globals;
- if (strpos($email, '@') === false) {
- return false;
- }
- list($user, $dom) = explode('@', $email);
- return $dom != $globals->mail->domain &&
- $dom != $globals->mail->domain2 &&
- $dom != $globals->mail->alias_dom &&
- $dom != $globals->mail->alias_dom2;
+ $is_main_domain = false;
+ foreach (self::$sub_mail_domains as $sub_domain) {
+ $is_main_domain = $is_main_domain || $domain != ($sub_domain . $globals->mail->domain) && $domain != ($sub_domain . $globals->mail->domain2);
+ }
+ return $is_main_domain;
}
- public static function isVirtualEmailAddress($email)
+ public static function isAliasMailDomain($domain)
{
global $globals;
+
+ return $domain == $globals->mail->alias_dom || $domain == $globals->mail->alias_dom2;
+ }
+
+ // Implementation of the static email locality checker.
+ public static function isForeignEmailAddress($email)
+ {
if (strpos($email, '@') === false) {
return false;
}
- list($user, $dom) = explode('@', $email);
- return $dom == $globals->mail->alias_dom
- || $dom == $globals->mail->alias_dom2;
+ list(, $domain) = explode('@', $email);
+ return !(self::isMainMailDomain($domain) || self::isAliasMailDomain($domain));
}
/* Tries to find pending accounts with an hruid close to $login. */
public static function getPendingAccounts($login, $iterator = false)
{
- global $globals;
-
if (strpos($login, '@') === false) {
return null;
}
list($login, $domain) = explode('@', $login);
- if ($domain && $domain != $globals->mail->domain && $domain != $globals->mail->domain2) {
+ if ($domain && !self::isMainMailDomain($domain)) {
return null;
}
{
if ($login_type == 'alias') {
$res = XDB::query('SELECT a.uid, a.password
- FROM accounts AS a
- INNER JOIN email_source_account AS e ON (e.uid = a.uid)
- INNER JOIN email_virtual_domains AS d ON (e.domain = d.id)
- WHERE e.email = {?} AND d.name = {?}',
- $login, Platal::globals()->mail->domain);
+ FROM accounts AS a
+ INNER JOIN email_source_account AS e ON (e.uid = a.uid)
+ WHERE e.email = {?}',
+ $login);
} else {
$res = XDB::query('SELECT uid, password
FROM accounts
-Subproject commit feb45d1d9fc152beff746c83048ff7704cc27ea2
+Subproject commit a6522bb9e59e898a417a7da1acdd31ba45838c86
return;
}
list($ident, $dom) = explode('@', $em);
- if ($dom == $globals->mail->domain || $dom == $globals->mail->domain2) {
+ if (User::isMainMailDomain($dom)) {
list($ident1) = explode('_', $ident);
list($ident) = explode('+', $ident1);
}
*/
function isvalid_email_redirection($email)
{
- return isvalid_email($email) &&
- !preg_match("/@(polytechnique\.(org|edu)|melix\.(org|net)|m4x\.org)$/", $email);
+ return isvalid_email($email) && !preg_match("/@polytechnique\.edu$/", $email) && User::isForeignEmailAddress($email);
}
// function ids_from_mails() {{{1
// given email when we found a matching user.
function ids_from_mails(array $emails)
{
- global $globals;
-
// Removes duplicates, if any.
$emails = array_unique($emails);
// Formats and splits by domain type (locally managed or external) emails.
- $domain_emails = array();
- $other_emails = array();
+ $main_domain_emails = array();
+ $aux_domain_emails = array();
+ $other_emails = array();
foreach ($emails as $email) {
if (strpos($email, '@') === false) {
- $user = $email;
- $domain = $globals->mail->domain2;
+ $main_domain_emails[] = $email;
} else {
- list($user, $domain) = explode('@', $email);
- }
- if ($domain == $globals->mail->alias_dom || $domain == $globals->mail->alias_dom2
- || $domain == $globals->mail->domain || $domain == $globals->mail->domain2) {
- list($user) = explode('+', $user);
- list($user) = explode('_', $user);
- $domain_emails[$email] = strtolower($user . '@' . $domain);
- } else {
- $other_emails[$email] = strtolower($user . '@' . $domain);
+ if (User::isForeignEmailAddress($email)) {
+ $other_emails[$email] = strtolower($user . '@' . $domain);
+ } else {
+ list($local_part, $domain) = explode('@', $email);
+ list($local_part) = explode('+', $local_part);
+ list($local_part) = explode('_', $local_part);
+ if (User::isMainMailDomain($domain)) {
+ $main_domain_emails[$email] = strtolower($local_part);
+ } elseif (User::isAliasMailDomain($domain)) {
+ $aux_domain_emails[$email] = strtolower($local_part);
+ }
+ }
}
}
// Retrieves emails from our domains.
- $domain_uids = XDB::fetchAllAssoc('email',
- 'SELECT email, uid
- FROM email_source_account
- WHERE email IN {?}',
- array_unique($domain_emails));
+ $main_domain_uids = XDB::fetchAllAssoc('email',
+ 'SELECT email, uid
+ FROM email_source_account
+ WHERE email IN {?} AND type != \'alias_aux\'',
+ array_unique($main_domain_emails));
+ $aux_domain_uids = XDB::fetchAllAssoc('email',
+ 'SELECT email, uid
+ FROM email_source_account
+ WHERE email IN {?} AND type = \'alias_aux\'',
+ array_unique($aux_domain_emails));
// Retrieves emails from redirections.
$other_uids = XDB::fetchAllAssoc('redirect',
// Associates given emails with the corresponding uid.
$uids = array();
- foreach (array_merge($domain_emails, $other_emails) as $email => $canonical_email) {
- if (array_key_exists($canonical_email, $domain_uids)) {
- $uids[$email] = $domain_uids[$canonical_email];
- } elseif (array_key_exists($canonical_email, $other_uids)) {
- $uids[$email] = $other_uids[$canonical_email];
- }
+ foreach ($main_domain_emails as $email => $key) {
+ $uids[$email] = $main_domain_uids[$key];
+ }
+ foreach ($aux_domain_emails as $email => $key) {
+ $uids[$email] = $aux_domain_uids[$key];
+ }
+ foreach ($other_emails as $email => $key) {
+ $uids[$email] = $other_uids[$key];
}
- return $uids;
+ return array_unique($uids);
}
// class Bogo {{{1
'sexe' => $user->isFemale(),
'mail' => $email,
'to' => '"' . $user->fullName() . '" <' . $email . '>',
- 'forlife_email' => $user->login() . '@' . $globals->mail->domain,
- 'forlife_email2' => $user->login() . '@' . $globals->mail->domain2,
+ 'forlife_email' => $user->forlifeEmail(),
+ 'forlife_email2' => $user->forlifeEmailAlternate()
);
}
$mymail->assign('baseurl', $globals->baseurl);
$mymail->assign('lins_id', $hash);
$mymail->assign('lemail', $email);
- $mymail->assign('subj', $alias.'@'.$globals->mail->domain);
+ $mymail->assign('subj', ucfirst($globals->mail->domain) . ' : ' . $alias);
$mymail->send();
XDB::execute('UPDATE register_pending
SET hash={?}, password={?}, relance=NOW()
return name_to_basename($a) == name_to_basename($b);
}
-function set_alias_names(&$sn_new, $sn_old, $pid, $uid, $update_new = false, $new_alias = null)
+function set_alias_names(&$sn_new, $sn_old, $pid, PlUser $user, $update_new = false, $new_alias = null)
{
$has_new = false;
foreach ($sn_new as $typeid => $sn) {
}
}
if ($update_new) {
- XDB::execute('DELETE s
- FROM email_source_account AS s
- INNER JOIN email_virtual_domains AS d ON (s.domain = d.id)
- WHERE FIND_IN_SET(\'usage\', s.flags) AND s.uid = {?} AND d.name = {?}',
- $uid, Platal::globals()->mail->domain);
+ XDB::execute('DELETE FROM email_source_account
+ WHERE FIND_IN_SET(\'usage\', flags) AND uid = {?} AND type = \'alias\'',
+ $user->id());
}
if ($new_alias) {
XDB::execute('INSERT INTO email_source_account (email, uid, type, flags, domain)
SELECT {?}, {?}, \'alias\', \'usage\', id
FROM email_virtual_domains
WHERE name = {?}',
- $new_alias, $uid, Platal::globals()->mail->domain);
+ $new_alias, $user->id(), $user->mainEmailDomain());
}
Profile::rebuildSearchTokens($pid, false);
return $has_new;
// {{{ properties
public $loginbis;
-
public $warning = true;
-
- public $homonymes_hruid;
-
public $rules = "Accepter, sauf cas particulier d'utilisateur dont l'homonymie est traité plus … manuellement.";
// }}}
$this->refuse = false;
$this->loginbis = $_loginbis;
- $this->homonymes_hruid = $_homonymes_hruid;
}
// }}}
protected function _mail_subj()
{
- global $globals;
return "[Polytechnique.org/Support] "
. ($this->warning ? "Dans une semaine : suppression de l'alias " : "Mise en place du robot")
- . " $loginbis@" . $globals->mail->domain;
+ . " $loginbis@" . $this->user->mainEmailDomain();
}
// }}}
protected function _mail_body($isok)
{
- global $globals;
return
"
Comme nous t'en avons informé par email il y a quelques temps,
pour respecter nos engagements en terme d'adresses email devinables,
-tu te verras bientôt retirer l'alias ".$this->loginbis."@".$globals->mail->domain." pour
+tu te verras bientôt retirer l'alias " . $this->loginbis . "@" . $this->user->mainEmailDomain() . " pour
ne garder que " . $this->user->forlifeEmail() . ".
-Toute personne qui écrira à ".$this->loginbis."@".$globals->mail->domain." recevra la
-réponse d'un robot qui l'informera que ".$this->loginbis."@".$globals->mail->domain."
+Toute personne qui écrira à " . $this->loginbis . "@" . $this->user->mainEmailDomain() . " recevra la
+réponse d'un robot qui l'informera que " . $this->loginbis . "@" . $this->user->mainEmailDomain() . "
est ambigu pour des raisons d'homonymie et signalera ton email exact.";
}
{
Platal::load('admin', 'homonyms.inc.php');
if (!$this->warning) {
- global $globals;
require_once 'emails.inc.php';
- XDB::execute('DELETE e
- FROM email_source_account AS e
- INNER JOIN email_virtual_domains AS d ON (e.domain = d.id)
- WHERE e.email = {?} AND d.name = {?}',
- $this->loginbis, $globals->mail->domain);
+ XDB::execute('DELETE FROM email_source_account
+ WHERE email = {?} AND type = \'alias\'',
+ $this->loginbis);
XDB::execute('INSERT INTO email_source_other (hrmid, email, domain, type, expire)
- SELECT CONCAT(\'h.\', {?}, \'.\', {?}), {?}, id, \'homonym\', NOW()
+ SELECT {?}, {?}, id, \'homonym\', NOW()
FROM email_virtual_domains
WHERE name = {?}',
- $this->loginbis, $globals->mail->domain, $this->loginbis, $globals->mail->domain);
- XDB::execute('INSERT IGNORE INTO homonyms_list (hrmid, uid)
- VALUES ({?}, {?})',
- 'h.' . $this->loginbis . '.' . $globals->mail->domain, $this->user->id());
+ 'h.' . $this->loginbis . '.' . Platal::globals()->mail->domain,
+ $this->loginbis, $this->user->mainEmailDomain());
fix_bestalias($this->user);
}
public $sn_old;
public $sn_new;
public $display_names;
+ public $mail_domain;
public $old_alias;
public $new_alias;
public $sn_types;
$this->sn_new = $_search_names;
$this->new_alias = true;
$this->display_names = array();
+ $this->mail_domain = $this->profileOwner->mainEmailDomain();
build_display_names($this->display_names, $_search_names,
$this->profile->isFemale(), $_private_name_end, $this->new_alias);
}
if (!is_null($this->profileOwner)) {
- $this->old_alias = XDB::fetchOneCell('SELECT s.email
- FROM email_source_account AS s
- INNER JOIN email_virtual_domains AS d ON (s.domain = d.id)
- WHERE s.uid = {?} AND s.type = \'alias\' AND FIND_IN_SET(\'usage\', s.flags) AND d.name = {?}',
- $this->profileOwner->id(), Platal::globals()->mail->domain);
+ $this->old_alias = XDB::fetchOneCell('SELECT email
+ FROM email_source_account
+ WHERE uid = {?} AND type = \'alias\' AND FIND_IN_SET(\'usage\', flags)',
+ $this->profileOwner->id());
if ($this->old_alias != $this->new_alias) {
- $used = XDB::fetchOneCell('SELECT COUNT(s.uid)
- FROM email_source_account AS s
- INNER JOIN email_virtual_domains AS d ON (s.domain = d.id)
- WHERE s.email = {?} AND d.name = {?}',
- $this->new_alias, Platal::globals()->mail->domain);
+ $used = XDB::fetchOneCell('SELECT COUNT(uid)
+ FROM email_source_account
+ WHERE email = {?} AND type != \'alias_aux\'',
+ $this->new_alias);
if ($used) {
$this->new_alias = null;
}
protected function _mail_body($isok)
{
- global $globals;
if ($isok) {
$res = " Le changement de nom que tu as demandé vient d'être effectué.";
if (!is_null($this->profileOwner)) {
if ($this->old_alias != $this->new_alias) {
if ($this->old_alias) {
- $res .= "\n\n Les alias {$this->old_alias}@{$globals->mail->domain} et @{$globals->mail->domain2} ont été supprimés.";
+ $res .= "\n\n L'alias {$this->old_alias}@{$this->mail_domain} a été supprimé.";
}
if ($this->new_alias) {
- $res .= "\n\n Les alias {$this->new_alias}@{$globals->mail->domain} et @{$globals->mail->domain2} sont maintenant à ta disposition !";
+ $res .= "\n\n L'alias {$this->new_alias}@{$this->mail_domain} est maintenant à ta disposition !";
}
}
if ($globals->mailstorage->googleapps_domain) {
if (!is_null($this->profileOwner)) {
set_alias_names($this->sn_new, $this->sn_old, $this->profile->id(),
- $this->profileOwner->id(), true, $this->new_alias);
+ $this->profileOwner, true, $this->new_alias);
// Update the local User object, to pick up the new bestalias.
$this->profileOwner = User::getSilentWithUID($this->profileOwner->id());
list($nom, $diminutif, $evt) = $res->fetchOneRow();
require_once dirname(__FILE__) . '/../../modules/xnetevents/xnetevents.inc.php';
$participants = get_event_participants(get_event_detail($this->evt, false, $this->asso_id), null);
- foreach ($participants as &$u) {
+ foreach ($participants as $u) {
if (!$u['notify_payment']) {
continue;
}
$topay = $u['montant'] - $u['paid'];
if ($topay > 0) {
$mailer = new PlMailer('xnetevents/newpayment.mail.tpl');
+ $mail->addTo($u['user']);
$mailer->assign('asso', $nom);
$mailer->assign('diminutif', $diminutif);
$mailer->assign('evt', $evt);
$mailer->assign('payment', $id);
- $mailer->assign('prenom', $u['prenom']);
+ $mailer->assign('prenom', $u['user']->firstName());
$mailer->assign('topay', $topay);
-
- if (strpos($u['email'], '@') === false) {
- $mailer->assign('to', $u['email'] . '@' . $globals->mail->domain);
- } else {
- $mailer->assign('to', $u['email']);
- }
$mailer->send();
}
}
if (strpos($alias, '@') !== false) {
list($alias, $domain) = explode('@', $alias);
} else {
- $domain = $globals->mail->domain;
+ $domain = $user->mainEmailDomain();
}
// Checks for alias' user validity.
} else {
$page->trigError("Impossible d'ajouter l'alias '$alias@$domain', il est probablement déjà attribué.");
}
- } elseif ($domain == $globals->mail->domain || $domain == $globals->mail->domain2) {
+ } elseif ($domain == $user->mainEmailDomain()) {
XDB::execute('INSERT INTO email_source_account (email, uid, domain, type, flags)
- SELECT {?}, {?}, id, \'alias_aux\', \'\'
+ SELECT {?}, {?}, id, \'alias\', \'\'
FROM email_virtual_domains
WHERE name = {?}',
- $alias, $user->id(), $globals->mail->alias_dom);
+ $alias, $user->id(), $domain);
$page->trigSuccess("Nouvel alias '$alias' ajouté");
} else {
- $page->trigError("Le domaine '$domain' n'est pas valide");
+ $page->trigError("Le domaine '$domain' n'est pas valide pour cet utilisateur.");
}
} else if (!Post::blank('del_alias')) {
$delete_alias = Post::t('del_alias');
FROM email_source_account AS s
INNER JOIN email_virtual_domains AS m ON (s.domain = m.id)
INNER JOIN email_virtual_domains AS d ON (d.aliasing = m.id)
- WHERE s.email = {?} AND s.uid = {?} AND d.name = {?} AND type = \'alias\'',
+ WHERE s.email = {?} AND s.uid = {?} AND d.name = {?} AND type != \'forlife\'',
$email, $user->id(), $domain);
XDB::execute('UPDATE email_redirect_account AS r
INNER JOIN email_virtual_domains AS m ON (m.name = {?})
function handler_homonyms($page, $op = 'list', $target = null)
{
- global $globals;
$page->changeTpl('admin/homonymes.tpl');
$page->setTitle('Administration - Homonymes');
$this->load("homonyms.inc.php");
case 'correct':
S::assert_xsrf_token();
- XDB::execute('DELETE e
- FROM email_source_account AS e
- INNER JOIN email_virtual_domains AS d ON (e.domain = d.id)
- WHERE e.email = {?} AND d.name = {?}',
- $loginbis, $globals->mail->domain);
+ XDB::execute('DELETE FROM email_source_account
+ WHERE email = {?} AND type = \'alias\'',
+ $loginbis);
XDB::execute('INSERT INTO email_source_other (hrmid, email, domain, type, expire)
- SELECT CONCAT(\'h.\', {?}, \'.\', {?}), {?}, id, \'homonym\', NOW()
+ SELECT {?}, {?}, id, \'homonym\', NOW()
FROM email_virtual_domains
WHERE name = {?}',
- $loginbis, $globals->mail->domain, $loginbis, $globals->mail->domain);
- XDB::execute('INSERT IGNORE INTO homonyms_list (hrmid, uid)
- VALUES ({?}, {?})',
- 'h.' . $loginbis . '.' . $globals->mail->domain, $target);
+ 'h.' . $loginbis . '.' . Platal::globals()->mail->domain,
+ $loginbis, $user->mainEmailDomain());
fix_bestalias($user);
send_robot_homonyme($user, $loginbis);
$op = 'list';
FROM email_source_other AS o
INNER JOIN homonyms_list AS h ON (o.hrmid = h.hrmid)
INNER JOIN email_source_account AS f ON (h.uid = f.uid AND f.type = \'forlife\')
- INNER JOIN email_virtual_domains AS d ON (f.domain = d.id)
- WHERE o.expire IS NOT NULL AND d.name = {?}
- ORDER BY homonym, forlife',
- $globals->mail->domain);
+ WHERE o.expire IS NOT NULL
+ ORDER BY homonym, forlife');
$homonyms = array();
while ($item = $res->next()) {
$homonyms[$item['homonym']][] = $item;
INNER JOIN homonyms_list AS l ON (e.uid = l.uid)
INNER JOIN homonyms_list AS h ON (l.hrmid = h.hrmid)
INNER JOIN email_source_account AS f ON (h.uid = f.uid AND f.type = \'forlife\')
- INNER JOIN email_virtual_domains AS d ON (f.domain = d.id)
- WHERE e.expire IS NOT NULL AND d.name = {?}
- ORDER BY homonym, forlife',
- $globals->mail->domain);
+ WHERE e.expire IS NOT NULL
+ ORDER BY homonym, forlife');
$homonyms_to_fix = array();
while ($item = $res->next()) {
$homonyms_to_fix[$item['homonym']][] = $item;
$mymail = new PlMailer();
$mymail->setFrom($FROM);
$mymail->addCc($cc);
- $mymail->setSubject("Dans 2 semaines, suppression de $loginbis@" . $globals->mail->domain);
+ $mymail->setSubject("Dans 2 semaines, suppression de $loginbis@" . $user->mainEmailDomain());
$mymail->setTxtBody(Env::v('mailbody'));
$mymail->sendTo($user);
}
$FROM = "\"Support Polytechnique.org\" <$cc>";
$mymail = new PlMailer();
$mymail->setFrom($FROM);
- $mymail->setSubject("Mise en place du robot $loginbis@" . $globals->mail->domain);
+ $mymail->setSubject("Mise en place du robot $loginbis@" . $user->mainEmailDomain());
$mymail->addCc($cc);
$mymail->setTxtBody(Env::v('mailbody'));
$mymail->sendTo($user);
'timestamp' => $date,
'date' => date('Ymd', $date),
'tomorrow' => date('Ymd', $tomorrow),
- 'hruid' => $profile->hrid(),
+ 'email' => $profile->owner()->bestEmail(),
'summary' => 'Anniversaire de ' . $profile->fullName(true)
);
}
// Display active redirections.
$redirect = new Redirect($user);
$page->assign('mails', $redirect->active_emails());
+
+ // User's mail domains.
+ $mail_domains = array($user->alternateEmailDomain());
+ $mail_domains[] = User::$sub_mail_domains['all'] . $globals->mail->domain;
+ $mail_domains[] = User::$sub_mail_domains['all'] . $globals->mail->domain2;
+ $page->assign('main_email_domain', $user->mainEmailDomain());
+ $page->assign('mail_domains', $mail_domains);
}
function handler_alias($page, $action = null, $value = null)
S::assert_xsrf_token();
$email = Post::t('email');
- list(, $domain) = explode('@', $email);
- $domain = strtolower($domain);
- if ($domain == $globals->mail->alias_dom || $domain == $globals->mail->alias_dom2
- || $domain == $globals->mail->domain || $domain == $globals->mail->domain2) {
+ if (!User::isForeignEmailAddress($email)) {
$page->assign('neuneu', true);
} else {
$user = mark_broken_email($email);
if ($user = mark_broken_email($email, true)) {
if ($user['nb_mails'] > 0) {
$mail = new PlMailer('emails/broken.mail.tpl');
- $mail->addTo('"' . $user['full_name'] . '" <' . $user['alias'] . '@' . Platal::globals()->mail->domain . '>');
+ $mail->addTo($user);
$mail->assign('user', $user);
$mail->assign('email', $email);
$mail->send();
static public function no_login_callback($login)
{
- global $list_unregistered, $globals;
+ global $list_unregistered;
$users = User::getPendingAccounts($login, true);
if ($users && $users->total()) {
}
$list_unregistered[$login] = $users;
} else {
- list($name, $dom) = @explode('@', $login);
- if ($dom == $globals->mail->domain || $dom == $globals->mail->domain2) {
+ list($name, $domain) = @explode('@', $login);
+ if (User::isMainMailDomain($domain)) {
User::_default_user_callback($login);
}
}
S::assert_xsrf_token();
if (strpos(Env::v('del_member'), '@') === false) {
- $this->client->mass_unsubscribe(
- $liste, array(Env::v('del_member').'@'.$globals->mail->domain));
+ if ($del_member = User::getSilent(Env::t('del_member'))) {
+ $this->client->mass_unsubscribe($liste, array($del_member->forlifeEmail()));
+ }
} else {
$this->client->mass_unsubscribe($liste, array(Env::v('del_member')));
}
S::assert_xsrf_token();
if (strpos(Env::v('del_owner'), '@') === false) {
- $this->client->del_owner($liste, Env::v('del_owner').'@'.$globals->mail->domain);
+ if ($del_owner = User::getSilent(Env::t('del_owner'))) {
+ $this->client->mass_unsubscribe($liste, array($del_owner->forlifeEmail()));
+ }
} else {
$this->client->del_owner($liste, Env::v('del_owner'));
}
$market = new AnnuaireMarketing(null, true);
$text = $market->getText(array(
'sexe' => $user->isFemale(),
- 'forlife_email' => $user->login() . '@' . $globals->mail->domain,
- 'forlife_email2' => $user->login() . '@' . $globals->mail->domain2
+ 'forlife_email' => $user->forlifeEmail(),
+ 'forlife_email2' => $user->forlifeEmailAlternate()
));
$text = str_replace('%%hash%%', '', $text);
$text = str_replace('%%personal_notes%%', '<em id="personal_notes_display"></em>', $text);
INNER JOIN profile_name_enum AS e ON (s.typeid = e.id)
WHERE s.pid = {?} AND NOT FIND_IN_SET('not_displayed', e.flags)",
$page->pid());
- $has_new = set_alias_names($this->search_names, $sn_old, $page->pid(), $page->owner->id());
+ $has_new = set_alias_names($this->search_names, $sn_old, $page->pid(), $page->owner);
// Only requires validation if modification in public names
if ($has_new) {
$nameTypes = DirEnum::getOptions(DirEnum::NAMETYPES);
$nameTypes = array_flip($nameTypes);
$res = XDB::query("SELECT a.uid, pd.promo, pnl.name AS lastname, pnf.name AS firstname, p.xorg_id AS xorgid,
- p.birthdate_ref AS birthdateRef, FIND_IN_SET('watch', a.flags) AS watch, m.hash
+ p.birthdate_ref AS birthdateRef, FIND_IN_SET('watch', a.flags) AS watch, m.hash, a.type
FROM register_marketing AS m
INNER JOIN accounts AS a ON (m.uid = a.uid)
INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms))
if ($res->numRows() == 1) {
$subState->merge($res->fetchOneRow());
+ $subState->set('main_mail_domain', User::$sub_mail_domains[$subState->v('type')]);
$subState->set('yearpromo', substr($subState->s('promo'), 1, 4));
XDB::execute('INSERT INTO register_mstats (uid, sender, success)
$birthdate, $lastname, $firstname, $promo, $sex, $birthdate_ref, $eduType) = $res->fetchOneRow();
$isX = ($eduType == 'x');
$yearpromo = substr($promo, 1, 4);
+ $mail_domain = User::$sub_mail_domains[$eduType];
// Prepare the template for display.
$page->changeTpl('register/end.tpl');
SELECT {?}, {?}, \'forlife\', \'\', id
FROM email_virtual_domains
WHERE name = {?}',
- $forlife, $uid, $globals->mail->domain);
+ $forlife, $uid, $mail_domain);
XDB::execute('INSERT INTO email_source_account (email, uid, type, flags, domain)
SELECT {?}, {?}, \'alias\', \'bestalias\', id
FROM email_virtual_domains
WHERE name = {?}',
- $bestalias, $uid, $globals->mail->domain);
+ $bestalias, $uid, $mail_domain);
if ($emailXorg2) {
XDB::execute('INSERT INTO email_source_account (email, uid, type, flags, domain)
SELECT {?}, {?}, \'alias\', \'\', id
FROM email_virtual_domains
WHERE name = {?}',
- $emailXorg2, $uid, $globals->mail->domain);
+ $emailXorg2, $uid, $mail_domain);
}
XDB::commit();
. "<a href=\"mailto:support@{$globals->mail->domain}\">support@{$globals->mail->domain}</a>.";
}
- $count = XDB::numRows('SELECT *
- FROM email_source_account AS s
- INNER JOIN email_virtual_domains AS d ON (s.domain = d.id)
- WHERE s.email = {?} AND d.name = {?}',
- $emailXorg, $globals->mail->domain);
+ $count = XDB::numRows('SELECT uid, expire
+ FROM email_source_account
+ WHERE email = {?} AND type != \'alias_aux\'',
+ $emailXorg);
if ($count) {
- list($h_id, $h_type, $expire) = $res->fetchOneRow();
- if ($h_type != 'homonyme' and empty($expire)) {
- XDB::execute('UPDATE email_source_account AS e
- INNER JOIN email_virtual_domains AS d ON (e.domain = d.id)
- SET e.expire = ADDDATE(NOW(), INTERVAL 1 MONTH)
- WHERE e.email = {?} AND d.name = {?}',
- $emailXorg, $globals->mail->domain);
+ list($h_id, $expire) = $res->fetchOneRow();
+ if (empty($expire)) {
+ XDB::execute('UPDATE email_source_account
+ SET expire = ADDDATE(NOW(), INTERVAL 1 MONTH)
+ WHERE email = {?} AND type != \'alias_aux\'',
+ $emailXorg);
$hrmid = 'h.' . $emailXorg . '.' . $globals->mail->domain;
XDB::execute('INSERT IGNORE INTO homonyms_list (hrmid, uid)
VALUES ({?}, {?}), ({?}, {?})',
$hrmid, $h_id, $hrmid, $subState->i('uid'));
- $als = XDB::fetchColumn('SELECT *
- FROM email_source_account AS s
- INNER JOIN email_virtual_domains AS d ON (s.domain = d.id)
- WHERE s.uid = {?} AND d.name = {?} AND s.expire IS NULL',
- $h_id, $globals->mail->domain);
+ $als = XDB::fetchColumn('SELECT email
+ FROM email_source_account
+ WHERE uid = {?} AND type != \'alias_aux\' AND expire IS NULL',
+ $h_id);
+ $homonym = User::getSilentWithUID($h_id);
$mailer = new PlMailer('register/lostalias.mail.tpl');
- $mailer->addTo($emailXorg . '@' . $globals->mail->domain);
+ $mailer->addTo($homonym);
$mailer->setSubject("Perte de ton alias $emailXorg dans un mois !");
$mailer->assign('emailXorg', $emailXorg);
$mailer->assign('als', join(', ', $als));
$mymail->assign('to', $subState->s('email'));
$mymail->assign('baseurl', $globals->baseurl);
$mymail->assign('hash', $hash);
- $mymail->assign('subject', $subState->s('bestalias') . '@' . $globals->mail->domain);
+ $mymail->assign('subject', ucfirst($globals->mail->domain) . ' : ' . $subState->s('bestalias'));
$mymail->send();
}
Comme nous t'en avons informé par email il y a quelques temps,
pour respecter nos engagements en terme d'adresses email devinables,
-tu te verras bientôt retirer l'alias {$loginbis}@{#globals.mail.domain#} pour
+tu te verras bientôt retirer l'alias {$loginbis}@{$user->mainEmailDomain()} pour
ne garder que {$user->forlifeEmail()}.
-Toute personne qui écrira à {$loginbis}@{#globals.mail.domain#} recevra la
-réponse d'un robot qui l'informera que {$loginbis}@{#globals.mail.domain#}
+Toute personne qui écrira à {$loginbis}@{$user->mainEmailDomain()} recevra la
+réponse d'un robot qui l'informera que {$loginbis}@{$user->mainEmailDomain()}
est ambigu pour des raisons d'homonymie et signalera ton email exact.
L'équipe Polytechnique.org
{xsrf_token_field}
<table class="bicol">
<tr>
- <th>Mettre en place le robot {$loginbis}@{#globals.mail.domain#}</th>
+ <th>Mettre en place le robot {$loginbis}@{$user->mainEmailDomain()}</th>
</tr>
<tr>
<td>
Comme nous t'en avons informé par email il y a quelques temps,
nous t'avons retiré de façon définitive l'adresse
-{$loginbis}@{#globals.mail.domain#}.
+{$loginbis}@{$user->mainEmailDomain()}.
-Toute personne qui écrit à {$loginbis}@{#globals.mail.domain#} reçoit la
-réponse d'un robot qui l'informe que {$loginbis}@{#globals.mail.domain#}
+Toute personne qui écrit à {$loginbis}@{$user->mainEmailDomain()} reçoit la
+réponse d'un robot qui l'informe que {$loginbis}@{$user->mainEmailDomain()}
est ambigu pour des raisons d'homonymie et indique ton email exact.
-Tu peux faire l'essai toi-même en écrivant à {$loginbis}@{#globals.mail.domain#}.
+Tu peux faire l'essai toi-même en écrivant à {$loginbis}@{$user->mainEmailDomain()}.
L'équipe Polytechnique.org
{#globals.baseurl#}
-{**************************************************************************}\r
-{* *}\r
-{* Copyright (C) 2003-2011 Polytechnique.org *}\r
-{* http://opensource.polytechnique.org/ *}\r
-{* *}\r
-{* This program is free software; you can redistribute it and/or modify *}\r
-{* it under the terms of the GNU General Public License as published by *}\r
-{* the Free Software Foundation; either version 2 of the License, or *}\r
-{* (at your option) any later version. *}\r
-{* *}\r
-{* This program is distributed in the hope that it will be useful, *}\r
-{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}\r
-{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}\r
-{* GNU General Public License for more details. *}\r
-{* *}\r
-{* You should have received a copy of the GNU General Public License *}\r
-{* along with this program; if not, write to the Free Software *}\r
-{* Foundation, Inc., *}\r
-{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}\r
-{* *}\r
-{**************************************************************************}\r
-BEGIN:VCALENDAR\r
-{display_ical name="prodid" value="-//Polytechnique.org//Plat-al//FR"}\r
-VERSION:2.0\r
-CALSCALE:GREGORIAN\r
-METHOD:PUBLISH\r
-{display_ical name="x-wr-calname" value="Anniversaires des X"}\r
-X-WR-TIMEZONE:Europe/Paris\r
-{iterate from=$events item=e}\r
-BEGIN:VEVENT\r
-DTSTAMP:{$e.timestamp|date_format:"%Y%m%dT%H%M%SZ"}\r
-DTSTART;VALUE=DATE:{$e.date}\r
-DTEND;VALUE=DATE:{$e.tomorrow}\r
-UID:anniv-{$e.date}-{$e.hruid}@{#globals.mail.domain#}\r
-RRULE:FREQ=YEARLY;INTERVAL=1\r
-CLASS:PUBLIC\r
-{display_ical name="summary" value=$e.summary}\r
-END:VEVENT\r
-{/iterate}\r
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+BEGIN:VCALENDAR
+{display_ical name="prodid" value="-//Polytechnique.org//Plat-al//FR"}
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:PUBLISH
+{display_ical name="x-wr-calname" value="Anniversaires des X"}
+X-WR-TIMEZONE:Europe/Paris
+{iterate from=$events item=e}
+BEGIN:VEVENT
+DTSTAMP:{$e.timestamp|date_format:"%Y%m%dT%H%M%SZ"}
+DTSTART;VALUE=DATE:{$e.date}
+DTEND;VALUE=DATE:{$e.tomorrow}
+UID:anniv-{$e.date}-{$e.email}
+RRULE:FREQ=YEARLY;INTERVAL=1
+CLASS:PUBLIC
+{display_ical name="summary" value=$e.summary}
+END:VEVENT
+{/iterate}
END:VCALENDAR{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<td>
<input type="text" name="username" size="20" maxlength="50" value="{insert name="getUserName"}" />
<select name="domain">
- <option value="login">@ {#globals.mail.domain#} / {#globals.mail.domain2#}</option>
+ <option value="login">@alumni. {#globals.mail.domain#} / {#globals.mail.domain2#}</option>
<option value="alias" {if t($smarty.cookies.ORGdomain) eq "alias"}selected="selected"{/if}>
@ {#globals.mail.alias_dom#} / {#globals.mail.alias_dom2#}
</option>
+++ /dev/null
-{**************************************************************************}
-{* *}
-{* Copyright (C) 2003-2011 Polytechnique.org *}
-{* http://opensource.polytechnique.org/ *}
-{* *}
-{* This program is free software; you can redistribute it and/or modify *}
-{* it under the terms of the GNU General Public License as published by *}
-{* the Free Software Foundation; either version 2 of the License, or *}
-{* (at your option) any later version. *}
-{* *}
-{* This program is distributed in the hope that it will be useful, *}
-{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
-{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
-{* GNU General Public License for more details. *}
-{* *}
-{* You should have received a copy of the GNU General Public License *}
-{* along with this program; if not, write to the Free Software *}
-{* Foundation, Inc., *}
-{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
-{* *}
-{**************************************************************************}
-{iterate from=$users item=vcard}
-BEGIN:VCARD
-VERSION:3.0
-{if $vcard.nom_usage}
-FN:{$vcard.prenom|vcard_enc} {$vcard.nom_usage|vcard_enc} ({$vcard.nom|vcard_enc})
-{else}
-FN:{$vcard.prenom|vcard_enc} {$vcard.nom|vcard_enc}
-{/if}
-N:{$vcard.nom|vcard_enc};{$vcard.prenom|vcard_enc};{$vcard.nom_usage|vcard_enc};;
-{if $vcard.nickname}
-NICKNAME:{$vcard.nickname|vcard_enc}
-{/if}
-EMAIL;TYPE=internet,pref:{$vcard.bestalias}@{#globals.mail.domain#}
-EMAIL;TYPE=internet:{$vcard.bestalias}@{#globals.mail.domain2#}
-{if $vcard.bestalias neq $vcard.forlife}
-EMAIL;TYPE=internet:{$vcard.forlife}@{#globals.mail.domain#}
-EMAIL;TYPE=internet:{$vcard.forlife}@{#globals.mail.domain2#}
-{/if}
-{if $vcard.virtualalias}
-EMAIL;TYPE=internet:{$vcard.virtualalias}
-{/if}
-{if $vcard.tels}
-{foreach item=tel from=$vcard.tels}
-{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=home{/if}:{$tel.display|vcard_enc}
-{/foreach}
-{/if}
-{if $vcard.adr_pro}
-{if $vcard.adr_pro[0].entreprise}
-ORG:{$vcard.adr_pro[0].entreprise|vcard_enc}
-{/if}
-{if $vcard.adr_pro[0].poste}
-TITLE:{$vcard.adr_pro[0].poste|vcard_enc}
-{/if}
-{if $vcard.adr_pro[0].fonction}
-ROLE:{$vcard.adr_pro[0].fonction|vcard_enc}
-{/if}
-{if $vcard.adr_pro[0].tels}
-{foreach item=tel from=$vcard.adr_pro[0].tels}
-{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell,work{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=work{/if}:{$tel.display|vcard_enc}
-{/foreach}
-{/if}
-ADR;TYPE=work:{format_adr adr=$vcard.adr_pro[0]}
-{/if}
-{foreach item=adr from=$vcard.adr}
-ADR;TYPE=home{if $adr.courier},postal{/if}:{format_adr adr=$adr}
-{if $adr.tels}
-{foreach item=tel from=$adr.tels}
-{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell,home{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=home{/if}:{$tel.display|vcard_enc}
-{/foreach}
-{/if}
-{/foreach}
-{foreach from=$vcard.networking item=nw}
-{if $nw.filter eq 'web'}
-URL:{$nw.address}
-{/if}
-{/foreach}
-{if strlen(trim($vcard.freetext)) == 0}
-NOTE:(X{$vcard.promo})
-{else}
-NOTE:(X{$vcard.promo})\n{$vcard.freetext|miniwiki:'no_title':'text'|vcard_enc}
-{/if}
-{if $vcard.section}
-X-SECTION:{$vcard.section}
-{/if}
-{if $vcard.binets_vcardjoin}
-X-BINETS:{$vcard.binets_vcardjoin}
-{/if}
-{if $vcard.gpxs_vcardjoin}
-X-GROUPS:{$vcard.gpxs_vcardjoin}
-{/if}
-{if $vcard.photo}
-PHOTO;ENCODING=b;TYPE={$vcard.photo.attachmime}:{$vcard.photo.attach|base64_encode|vcard_enc}
-{/if}
-SORT-STRING:{$vcard.nom|vcard_enc}
-REV:{$vcard.date|date_format:"%Y%m%dT000000Z"}
-END:VCARD{"\n"}
-{/iterate}
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
Nous t'écrivons car lors de l'envoi de la lettre d'information mensuelle
de Polytechnique.org à ton adresse polytechnicienne :
- {$user.alias}@{$globals->mail->domain},
+ {$user->bestAlias()},
l'adresse {$email}, sur laquelle tu rediriges tes emails, ne fonctionnait pas.
<h2 class='erreur'>Erreur !</h2>
<p>
-Tu as entré une adresse @{#globals.mail.domain#}, @{#globals.mail.domain2#} ou @{#globals.mail.alias_dom#},
-ce qui est invalide.
+Tu as entré une adresse sur un de nos domaines ({#globals.mail.domain#}, {#globals.mail.domain2#}, {#globals.mail.alias_dom#},
+{#globals.mail.alias_dom2#}) ce qui est invalide.
</p>
<p>
Tes adresses polytechniciennes sont :<br />
<div>
{iterate from=$aliases item=a}
- <label><input type='radio' {if $a.bestalias}checked="checked"{/if} name='best' value='{$a.email}' />
- <strong>{$a.email}</strong> et <strong>{if $a.alias}@{#globals.mail.alias_dom2#}{else}@{#globals.mail.domain2#}{/if}</strong></label> {if $a.forlife}(**){/if}{if $a.hundred_year}(*){/if}
+ <label>
+ <input type='radio' {if $a.bestalias}checked="checked"{/if} name='best' value='{$a.email}' />
+ <strong>{$a.email}</strong>{if $a.alias} et <strong>@{#globals.mail.alias_dom2#}</strong>{else}
+ {foreach from=$mail_domains item=domain} et <strong>@{$domain}</strong>{/foreach}{/if}
+ </label> {if $a.forlife}(**){/if}{if $a.hundred_year}(*){/if}
{if $a.expire}<span class='erreur'>(expire le {$a.expire|date_format})</span>{/if}
{if $a.alias}<a href="emails/alias">(changer ou supprimer mon alias melix)</a>{/if}
<br />
<hr />
<div>
(M4X signifie <em>mail for X</em>, son intérêt est de te doter d'une adresse à vie
- moins "voyante" que l'adresse @{#globals.mail.domain#}).
+ moins "voyante" que l'adresse {$main_email_domain}).
{if !$alias}
- Tu peux ouvrir en supplément une adresse synonyme de ton adresse @{#globals.mail.domain#},
+ Tu peux ouvrir en supplément une adresse synonyme de ton adresse @{$main_email_domain},
sur les domaines @{#globals.mail.alias_dom#} et @{#globals.mail.alias_dom2#} (melix = Mél X).<br />
<div class="center"><a href="emails/alias">Créer un alias melix</a></div>
{/if}
</p>
<p class="smaller">
{if $homonyme}
-Tu as un homonyme X donc tu ne peux pas profiter de l'alias {$homonyme}@{#globals.mail.domain#}. Si quelqu'un essaie
+Tu as un homonyme donc tu ne peux pas profiter de l'alias {$homonyme}@{$main_email_domain}. Si quelqu'un essaie
d'envoyer un email à cette adresse par mégarde il recevra une réponse d'un robot lui expliquant l'ambiguité et lui
proposant les adresses des différents homonymes.
{else}
-Si tu venais à avoir un homonyme X, l'alias «prenom.nom»@{#globals.mail.domain#} sera désactivé. Si bien que
-ton homonyme et toi-même ne disposeraient plus que des adresses de la forme «prenom.nom.promo»@{#globals.mail.domain#}.
+Si tu venais à avoir un homonyme, l'alias «prenom.nom»@{$main_email_domain} sera désactivé. Si bien que
+ton homonyme et toi-même ne disposeraient plus que des adresses de la forme «prenom.nom.promo»@{$main_email_domain}.
{/if}
</p>
<p>
<strong>Un certificat d'authentification</strong> vient de t'être attribué et a été envoyé vers les redirections de
-ton adresse en {#globals.mail.domain#}. Ce certificat te permet d'accéder à un formulaire de changement de mot de passe.
+ton adresse {#globals.mail.domain#}. Ce certificat te permet d'accéder à un formulaire de changement de mot de passe.
<span class="erreur"> Il expire dans six heures.</span> Tu dois donc <strong>consulter tes emails avant son
expiration</strong> et utiliser le certificat comme expliqué dans l'email pour changer ton mot de passe.
</p>
Tu gardes tout de même l'usage de cet alias pour un mois encore à compter de ce jour.
-Lorsque cet alias sera désactivé, l'adresse {$emailXorg}@polytechnique.org renverra vers un robot qui indiquera qu'il y a plusieurs personnes portant le même nom ; cela évite que l'un des homonymes reçoive des courriels destinés à l'autre.
+Lorsque cet alias sera désactivé, l'adresse {$emailXorg} renverra vers un robot qui indiquera qu'il y a plusieurs personnes portant le même nom ; cela évite que l'un des homonymes reçoive des courriels destinés à l'autre.
Pour te connecter au site, tu pourras utiliser comme identifiant n'importe lequel de tes autres alias : {$als}.
Commence dès aujourd'hui à communiquer à tes correspondants la nouvelle adresse que tu comptes utiliser !
{if $smarty.session.subState.emailXorg2}
<p>
Tu n'as pour le moment aucun homonyme dans notre base de données. Nous allons
- donc te donner l'adresse <strong>{$smarty.session.subState.bestalias}@{#globals.mail.domain#}</strong>,
- en plus de ton adresse à vie <strong>{$smarty.session.subState.forlife}@{#globals.mail.domain#}</strong>.
- Note que tu pourrais perdre l'adresse <strong>{$smarty.session.subState.bestalias}@{#globals.mail.domain#}</strong>
+ donc te donner l'adresse <strong>{$smarty.session.subState.bestalias}@{$smarty.session.subState.main_mail_domain}</strong>,
+ en plus de ton adresse à vie <strong>{$smarty.session.subState.forlife}@{$smarty.session.subState.main_mail_domain}</strong>.
+ Note que tu pourrais perdre l'adresse <strong>{$smarty.session.subState.bestalias}@{$smarty.session.subState.main_mail_domain}</strong>
si un homonyme s'inscrivait, même si cela reste assez rare.
</p>
{else}
<p>
Tu as déjà un homonyme inscrit dans notre base de données, dans une autre promotion. Nous allons
- donc te donner l'adresse <strong>{$smarty.session.subState.bestalias}@{#globals.mail.domain#}</strong>, en plus
- de ton adresse à vie <strong>{$smarty.session.subState.forlife}@{#globals.mail.domain#}</strong>.
+ donc te donner l'adresse <strong>{$smarty.session.subState.bestalias}@{$smarty.session.subState.main_mail_domain}</strong>, en plus
+ de ton adresse à vie <strong>{$smarty.session.subState.forlife}@{$smarty.session.subState.main_mail_domain}</strong>.
</p>
{/if}
UID:event-{$e.short_name}-{$e.eid}@{$asso->diminutif}.polytechnique.org
{if $admin}
{foreach from=$participants item=m}
-{if $m.x}
-ATTENDEE;CN="{$m.prenom} {$m.nom} (X{$m.promo})":MAILTO:{$m.email}@{#globals.mail.domain#}
-{else}
-ATTENDEE;CN="{$m.prenom} {$m.nom} (non-X)":MAILTO:{$m.email}
-{/if}
+ATTENDEE;CN="{$m.user->fullName('promo')}":MAILTO:{$m.user->bestEmail()}
{/foreach}
{/if}
{if $e.accept_nonmembre}
FROM email_virtual_domains
WHERE name = 'x-consult.polytechnique.org';
+INSERT INTO email_virtual_domains (name, aliasing)
+ VALUES ('alumni.polytechnique.org', @p_domain_id), ('alumni.m4x.org', @p_domain_id),
+ ('master.polytechnique.org', 1), ('doc.polytechnique.org', 1);
+SET @master_domain_id = 0;
+SET @doc_domain_id = 0;
+SELECT @master_domain_id := id
+ FROM email_virtual_domains
+ WHERE name = 'master.polytechnique.org';
+SELECT @doc_domain_id := id
+ FROM email_virtual_domains
+ WHERE name = 'doc.polytechnique.org';
+UPDATE email_virtual_domains
+ SET aliasing = @master_domain_id
+ WHERE name = 'master.polytechnique.org';
+UPDATE email_virtual_domains
+ SET aliasing = @doc_domain_id
+ WHERE name = 'doc.polytechnique.org';
+INSERT INTO email_virtual_domains (name, aliasing)
+ VALUES ('alumni.polytechnique.org', @master_domain_id), ('alumni.m4x.org', @master_domain_id),
+ ('alumni.polytechnique.org', @doc_domain_id), ('alumni.m4x.org', @doc_domain_id),
+ ('master.m4x.org', @master_domain_id), ('doc.m4x.org', @doc_domain_id);
+
-- 2/ Feeds email_source_account
INSERT INTO email_source_account (uid, domain, email, type, flags, expire)
SELECT uid, @p_domain_id, alias, IF(type = 'a_vie', 'forlife', 'alias'), REPLACE(flags, 'epouse', 'marital'), expire