Merge commit 'origin/fusionax' into account
authorStéphane Jacob <sj@m4x.org>
Sun, 8 Nov 2009 13:27:30 +0000 (14:27 +0100)
committerStéphane Jacob <sj@m4x.org>
Sun, 8 Nov 2009 13:27:30 +0000 (14:27 +0100)
63 files changed:
1  2 
configs/platal.ini
include/emails.inc.php
include/marketing.inc.php
include/validations.inc.php
include/validations/aliases.inc.php
include/validations/homonymes.inc.php
include/validations/listes.inc.php
include/validations/marketing.inc.php
modules/admin.php
modules/axletter.php
modules/axletter/axletter.inc.php
modules/carnet.php
modules/email.php
modules/lists.php
modules/marketing.php
modules/newsletter.php
modules/payment.php
modules/platal.php
modules/profile.php
modules/profile/general.inc.php
modules/profile/page.inc.php
modules/register.php
modules/register/register.inc.php
modules/stats.php
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php
modules/xnetgrp.php
modules/xnetlists.php
templates/admin/dead_but_active.tpl
templates/admin/wiki.tpl
templates/carnet/index.tpl
templates/carnet/notifs.tpl
templates/core/password_prompt.tpl
templates/emails/alias.tpl
templates/emails/broken.tpl
templates/emails/send.tpl
templates/events/index.tpl
templates/include/minifiche.tpl
templates/marketing/promo.tpl
templates/marketing/this_week.tpl
templates/newsletter/nl.mail.tpl
templates/payment/xnet.tpl
templates/platal/filrss.tpl
templates/platal/preferences.tpl
templates/platal/webredirect.tpl
templates/xnet/skin.tpl
templates/xnetevents/admin.tpl
templates/xnetevents/edit.tpl
templates/xnetevents/index.tpl
templates/xnetevents/subscribe.tpl
templates/xnetgrp/annuaire.tpl
templates/xnetgrp/asso.tpl
templates/xnetgrp/edit.tpl
templates/xnetgrp/inscrire.tpl
templates/xnetgrp/mail.tpl
templates/xnetgrp/membres-add.tpl
templates/xnetgrp/membres-del.tpl
templates/xnetgrp/membres-edit.tpl
templates/xnetgrp/subscribe-valid.tpl
templates/xnetlists/alias-admin.tpl
templates/xnetlists/alias-create.tpl
templates/xnetlists/create.tpl
templates/xnetlists/index.tpl

Simple merge
Simple merge
@@@ -280,7 -287,9 +291,8 @@@ class AnnuaireMarketing implements Mark
          $page->assign('intro', $this->getIntro());
          $page->assign('u', $user);
          $page->assign('sign', $this->getSignature());
 -        $res = XDB::query("SELECT COUNT(*) FROM auth_user_md5 WHERE perms IN ('user', 'admin') AND deces = 0");
 -        $page->assign('num_users', $res->fetchOneCell());
 +        $page->assign('num_users', self::getAliveUsersCount());
+         $page->assign('personal_notes', $this->getPersonalNotes());
      }
  
      public function getText(array $user)
Simple merge
@@@ -27,14 -29,16 +27,14 @@@ class AliasReq extends Validat
      public $raison;
      public $unique = true;
  
 -    public $old='';
 -    public $public='private';
 +    public $old    = '';
 +    public $public = 'private';
  
-     public $rules = "Interdire ce qui peut nous servir (virus@, postmaster@, ...),
+     public $rules = "Interdire ce qui peut nous servir (virus@, postmaster@&hellip;),
                    les alias vulgaires, et les prenom.nom (sauf si c'est pour l'utilisateur prenom.nom).
-                   Pas de contrainte pour les tirets ou les points, en revanche le souligné (_) est interdit";
+                   Pas de contrainte pour les tirets ou les points, en revanche le souligné (_) est interdit.";
  
 -    // }}}
 -    // {{{ constructor
 -
 +    // constructor {{{2
      public function __construct(User &$_user, $_alias, $_raison, $_public, $_stamp=0)
      {
          global $globals;
@@@ -70,8 -92,7 +70,8 @@@
      protected function _mail_body($isok)
      {
          if ($isok) {
 -            return "  L'adresse email {$this->alias} que tu avais demandée vient d'être créée, tu peux désormais l'utiliser à ta convenance." . (($this->public == 'public') ? " À ta demande, cette adresse apparaît maintenant sur ta fiche." : "");
 +            return "  L'adresse email {$this->alias} que tu avais demandée vient d'être créée, tu peux désormais l'utiliser à ta convenance."
-                  . ($this->public == 'public' ? ' A ta demande, cette adresse apparaît maintenant sur ta fiche.' : '');
++                 . ($this->public == 'public' ? ' À ta demande, cette adresse apparaît maintenant sur ta fiche.' : '');
          } else {
              return "  La demande que tu avais faite pour l'alias {$this->alias} a été refusée.";
          }
Simple merge
Simple merge
Simple merge
@@@ -368,11 -355,12 +368,11 @@@ class AdminModule extends PLModul
      function handler_user(&$page, $login = false)
      {
          global $globals;
 -        $page->changeTpl('admin/utilisateurs.tpl');
 -        $page->setTitle('Administration - Edit/Su/Log');
 -        require_once("emails.inc.php");
 +        $page->changeTpl('admin/user.tpl');
 +        $page->setTitle('Administration - Compte');
  
 -        if (S::has('suid')) {
 +        if (S::suid()) {
-             $page->kill("Déjà en SUID !!!");
+             $page->kill("Déjà en SUID&nbsp;!!!");
          }
  
          // Loads the user identity using the environment.
          $page->setTitle('Administration - Décédés');
  
          $res = XDB::iterator(
-                 'SELECT  a.hruid, pd.promo, p.ax_id, pd.directory_name, p.deathdate, DATE(MAX(s.start)) AS last
 -                "SELECT  u.promo, u.nom, u.prenom, u.deces, u.hruid, DATE(MAX(s.start)) AS last
 -                   FROM  auth_user_md5 AS u
 -              LEFT JOIN  logger.sessions AS s ON (s.uid = u.user_id AND suid = 0)
 -                  WHERE  perms IN ('admin', 'user') AND deces <> 0
 -               GROUP BY  u.user_id
 -               ORDER BY  u.promo, u.nom");
++                "SELECT  a.hruid, pd.promo, p.ax_id, pd.directory_name, p.deathdate, DATE(MAX(s.start)) AS last
 +                   FROM  accounts AS a
-              INNER JOIN  account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', ap.perms))
++             INNER JOIN  account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms))
 +             INNER JOIN  profiles AS p ON (p.pid = ap.pid)
 +             INNER JOIN  profile_display AS pd ON (pd.pid = p.pid)
 +              LEFT JOIN  logger.sessions AS s ON (s.uid = a.uid AND suid = 0)
-                   WHERE  a.state = \'active\' AND p.deathdate IS NOT NULL
++                  WHERE  a.state = 'active' AND p.deathdate IS NOT NULL
 +               GROUP BY  a.uid
-                ORDER BY  pd.promo, pd.sort_name');
++               ORDER BY  pd.promo, pd.sort_name");
          $page->assign('dead', $res);
      }
  
Simple merge
Simple merge
@@@ -77,91 -73,52 +77,91 @@@ class CarnetModule extends PLModul
          $this->_add_rss_link($page);
      }
  
 -    function _handler_notifs_promos(&$page, &$watch, $action, $arg)
 +    private function getSinglePromotion(PlPage &$page, $promo)
      {
 -        if(preg_match('!^ *(\d{4}) *$!', $arg, $matches)) {
 -            $p = intval($matches[1]);
 -            if($p<1900 || $p>2100) {
 -                $page->trigError('La promo entrée est invalide.');
 -            } else {
 -                if ($action == 'add_promo') {
 -                    $watch->_promos->add($p);
 -                } else {
 -                    $watch->_promos->del($p);
 -                }
 -            }
 -        } elseif (preg_match('!^ *(\d{4}) *- *(\d{4}) *$!', $arg, $matches)) {
 -            $p1 = intval($matches[1]);
 -            $p2 = intval($matches[2]);
 -            if($p1<1900 || $p1>2100) {
 -                $page->trigError('La première promo de la plage entrée est invalide.');
 -            } elseif($p2<1900 || $p2>2100) {
 -                $page->trigError('La seconde promo de la plage entrée est invalide.');
 +        if (!ctype_digit($promo) || $promo < 1920 || $promo > date('Y')) {
-             $page->trigError('Promotion invalide : ' . $promo);
++            $page->trigError('Promotion invalide&nbsp;: ' . $promo . '.');
 +            return null;
 +        }
 +        return (int)$promo;
 +    }
 +
 +    private function getPromo(PlPage &$page, $promo)
 +    {
 +        if (strpos($promo, '-') === false) {
 +            $promo = $this->getSinglePromotion($page, $promo);
 +            if (!$promo) {
 +                return null;
              } else {
 -                if ($action == 'add_promo') {
 -                    $watch->_promos->addRange($p1, $p2);
 -                } else {
 -                    $watch->_promos->delRange($p1, $p2);
 -                }
 +                return array($promo);
              }
 -        } else {
 -            $page->trigError("La promo (ou la plage de promo) entrée est dans un format incorrect.");
          }
-             $page->trigError("Intervale non valide : " . $promo);
 +
 +        list($promo1, $promo2) = explode('-', $promo);
 +        $promo1 = $this->getSinglePromotion($page, $promo1);
 +        if (!$promo1) {
 +            return null;
 +        }
 +        $promo2 = $this->getSinglePromotion($page, $promo2);
 +        if (!$promo2) {
 +            return null;
 +        }
 +        if ($promo1 > $promo2) {
++            $page->trigError('Intervalle non valide :&nbsp;' . $promo . '.');
 +            return null;
 +        }
 +        $array = array();
 +        for ($i = $promo1 ; $i <= $promo2 ; ++$i) {
 +            $array[] = $i;
 +        }
 +        return $array;
      }
  
 -    function handler_notifs(&$page, $action = null, $arg = null)
 +    private function addPromo(PlPage &$page, $promo)
      {
 -        $page->changeTpl('carnet/notifs.tpl');
 +        $promos = $this->getPromo($page, $promo);
 +        if (!$promos || count($promos) == 0) {
 +            return;
 +        }
 +        $to_add = array();
 +        foreach ($promos as $promo) {
 +            $to_add[] = XDB::format('({?}, {?})', S::i('uid'), $promo);
 +        }
 +        XDB::execute('INSERT IGNORE INTO  watch_promo (uid, promo)
 +                                  VALUES  ' . implode(', ', $to_add));
 +    }
  
 -        require_once 'notifs.inc.php';
 +    private function delPromo(PlPage &$page, $promo)
 +    {
 +        $promos = $this->getPromo($page, $promo);
 +        if (!$promos || count($promos) == 0) {
 +            return;
 +        }
 +        $to_delete = array();
 +        foreach ($promos as $promo) {
 +            $to_delete[] = XDB::format('{?}', $promo);
 +        }
 +        XDB::execute('DELETE FROM  watch_promo
 +                            WHERE  ' . XDB::format('uid = {?}', S::i('uid')) . '
 +                                   AND promo IN (' . implode(', ', $to_delete) . ')');
 +    }
  
 -        $watch = new Watch(S::v('uid'));
 +    public function addNonRegistered(PlPage &$page, PlUser &$user)
 +    {
 +        XDB::execute('INSERT IGNORE INTO  watch_nonins (uid, ni_id)
 +                                  VALUES  ({?}, {?})', S::i('uid'), $user->id());
 +    }
  
 -        $res = XDB::query("SELECT promo_sortie
 -                                       FROM auth_user_md5
 -                                      WHERE user_id = {?}",
 -                                    S::v('uid', -1));
 -        $promo_sortie = $res->fetchOneCell();
 -        $page->assign('promo_sortie', $promo_sortie);
 +    public function delNonRegistered(PlPage &$page, PlUser &$user)
 +    {
 +        XDB::execute('DELETE FROM  watch_nonins
 +                            WHERE  uid = {?} AND ni_id = {?}',
 +                    S::i('uid'), $user->id());
 +    }
 +
 +    public function handler_notifs(&$page, $action = null, $arg = null)
 +    {
 +        $page->changeTpl('carnet/notifs.tpl');
  
          if ($action) {
              S::assert_xsrf_token();
@@@ -627,17 -636,37 +628,17 @@@ class EmailModule extends PLModul
  
              $email = valide_email($email);
              // vérifications d'usage
 -            $sel = XDB::query("SELECT uid FROM emails WHERE email = {?}", $email);
 -            if (($uid = $sel->fetchOneCell())) {
 -                $dest = User::getSilent($uid);
 -
 -                // envoi du mail
 -                $message = "Bonjour !
 -
 -Cet email a été généré automatiquement par le service de patte cassée de
 -Polytechnique.org car un autre utilisateur, " . S::user()->fullName() . ",
 -nous a signalé qu'en t'envoyant un email, il avait reçu un message d'erreur
 -indiquant que ton adresse de redirection $email
 -ne fonctionnait plus !
 -
 -Nous te suggérons de vérifier cette adresse, et le cas échéant de mettre
 -à jour sur le site <{$globals->baseurl}/emails> tes adresses
 -de redirection...
 -
 -Pour plus de renseignements sur le service de patte cassée, n'hésite pas à
 -consulter la page <{$globals->baseurl}/emails/broken>.
 -
 -
 -À bientôt sur Polytechnique.org !
 -L'équipe d'administration <support@" . $globals->mail->domain . '>';
 -
 -                $mail = new PlMailer();
 -                $mail->setFrom('"Polytechnique.org" <support@' . $globals->mail->domain . '>');
 -                $mail->addTo($dest->bestEmail());
 -                $mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!");
 -                $mail->setTxtBody($message);
 -                $mail->send();
 +            $uid = XDB::fetchOneCell("SELECT  uid
 +                                        FROM  emails
 +                                       WHERE  email = {?}", $email);
 +            if ($uid) {
 +                $dest = User::getWithUID($uid);
 +
 +                $mail = new PlMailer('emails/broken-web.mail.tpl');
 +                $mail->assign('email', $email);
 +                $mail->assign('request', S::user());
 +                $mail->sendTo($dest);
-                 $page->trigSuccess("Email envoyé !");
+                 $page->trigSuccess('Email envoyé&nbsp;!');
              }
          } elseif (Post::has('email')) {
              S::assert_xsrf_token();
      {
          $page->changeTpl('emails/lost.tpl');
  
 -        $page->assign('lost_emails', XDB::iterator("
 -            SELECT  u.user_id, u.hruid
 -              FROM  auth_user_md5 AS u
 -         LEFT JOIN  emails        AS e ON (u.user_id = e.uid AND FIND_IN_SET('active', e.flags))
 -             WHERE  e.uid IS NULL AND FIND_IN_SET('googleapps', u.mail_storage) = 0 AND
 -                    u.deces = 0 AND u.perms IN ('user', 'admin', 'disabled')
 -          ORDER BY  u.promo DESC, u.nom, u.prenom"));
 +        // TODO: Order by promo.
 +        $page->assign('lost_emails',
 +                      XDB::iterator("SELECT  a.uid, a.hruid
 +                                       FROM  accounts AS a
 +                                 INNER JOIN  email_options AS eo ON (eo.uid = a.uid)
 +                                  LEFT JOIN  emails   AS e ON (a.uid = e.uid AND FIND_IN_SET('active', e.flags))
 +                                      WHERE  e.uid IS NULL AND FIND_IN_SET('googleapps', eo.storage) = 0 AND
 +                                             a.state = 'active'
 +                                   ORDER BY  a.hruid"));
      }
+     function handler_broken_addr(&$page)
+     {
+         require_once 'emails.inc.php';
+         $page->changeTpl('emails/broken_addr.tpl');
+         if (Env::has('sort_broken')) {
+             S::assert_xsrf_token();
+             $list = trim(Env::v('list'));
+             if ($list == '') {
+                 $page->trigError('La liste est vide.');
+             } else {
+                 $valid_emails = array();
+                 $invalid_emails = array();
+                 $broken_list = explode("\n", $list);
+                 sort($broken_list);
+                 foreach ($broken_list as $orig_email) {
+                     $email = valide_email(trim($orig_email));
+                     if (empty($email) || $email == '@') {
+                         $invalid_emails[] = "$orig_email: invalid email";
+                     } else {
+                         $res = XDB::query('SELECT  COUNT(*)
+                                              FROM  emails
+                                             WHERE  email = {?}', $email);
+                         if ($res->fetchOneCell() > 0) {
+                             $valid_emails[] = $email;
+                         } else {
+                             $invalid_emails[] = "$orig_email: no such redirection";
+                         }
+                     }
+                 }
+                 $page->assign('valid_emails', $valid_emails);
+                 $page->assign('invalid_emails', $invalid_emails);
+             }
+         }
+         if (Env::has('process_broken')) {
+             S::assert_xsrf_token();
+             $list = trim(Env::v('list'));
+             if ($list == '') {
+                 $page->trigError('La liste est vide.');
+             } else {
+                 global $platal;
+                 $broken_user_list = array();
+                 $broken_list = explode("\n", $list);
+                 sort($broken_list);
+                 foreach ($broken_list as $orig_email) {
+                     $email = valide_email(trim($orig_email));
+                     if (empty($email) || $email == '@') {
+                         continue;
+                     }
+                     $sel = XDB::query(
+                         "SELECT  e1.uid, e1.panne != 0 AS panne, count(e2.uid) AS nb_mails,
+                                  u.nom, u.prenom, u.promo, a.alias
+                            FROM  emails        AS e1
+                       LEFT JOIN  emails        AS e2 ON (e1.uid = e2.uid AND FIND_IN_SET('active', e2.flags)
+                                                          AND e1.email != e2.email)
+                      INNER JOIN  auth_user_md5 AS u  ON (e1.uid = u.user_id)
+                      INNER JOIN  aliases       AS a  ON (u.user_id = a.id AND FIND_IN_SET('bestalias', a.flags))
+                           WHERE  e1.email = {?}
+                        GROUP BY  e1.uid", $email);
+                     if ($x = $sel->fetchOneAssoc()) {
+                         if (!$x['panne']) {
+                             XDB::execute('UPDATE  emails
+                                              SET  panne=NOW(), last=NOW(), panne_level = 1
+                                            WHERE  email = {?}',
+                                           $email);
+                         } else {
+                             XDB::execute('UPDATE  emails
+                                              SET  last = CURDATE(), panne_level = panne_level + 1
+                                            WHERE  email = {?}
+                                                   AND DATE_ADD(last, INTERVAL 14 DAY) < CURDATE()',
+                                          $email);
+                         }
+                         if (!empty($x['nb_mails'])) {
+                             $mail = new PlMailer('emails/broken.mail.tpl');
+                             $mail->addTo("\"{$x['prenom']} {$x['nom']}\" <{$x['alias']}@"
+                                          . $globals->mail->domain . '>');
+                             $mail->assign('x', $x);
+                             $mail->assign('email', $email);
+                             $mail->send();
+                         }
+                         if (!isset($broken_user_list[$x['alias']])) {
+                             $broken_user_list[$x['alias']] = array($email);
+                         } else {
+                             $broken_user_list[$x['alias']][] = $email;
+                         }
+                     }
+                 }
+                 XDB::execute("UPDATE  emails
+                                  SET  panne_level = panne_level - 1
+                                WHERE  flags = 'active' AND panne_level > 1
+                                       AND DATE_ADD(last, INTERVAL 1 MONTH) < CURDATE()");
+                 XDB::execute("UPDATE  emails
+                                  SET  panne_level = 0
+                                WHERE  flags = 'active' AND panne_level = 1
+                                       AND DATE_ADD(last, INTERVAL 1 YEAR) < CURDATE()");
+                 // Output the list of users with recently broken addresses,
+                 // along with the count of valid redirections.
+                 header('Content-Type: text/x-csv; charset=utf-8;');
+                 header('Cache-Control: no-cache');
+                 $csv = fopen('php://output', 'w');
+                 fputcsv($csv, array('nom', 'prenom', 'alias', 'bounce', 'nbmails', 'url'), ';');
+                 foreach ($broken_user_list as $alias => $mails) {
+                     $sel = Xdb::query(
+                         "SELECT  u.user_id, count(e.email) AS nb_mails, u.nom, u.prenom, u.promo
+                            FROM  aliases       AS a
+                      INNER JOIN  auth_user_md5 AS u ON a.id = u.user_id
+                       LEFT JOIN  emails        AS e ON (e.uid = u.user_id
+                                                         AND FIND_IN_SET('active', e.flags) AND e.panne = 0)
+                           WHERE  a.alias = {?}
+                        GROUP BY  u.user_id", $alias);
+                     if ($x = $sel->fetchOneAssoc()) {
+                         fputcsv($csv, array($x['nom'], $x['prenom'], $x['promo'], $alias,
+                                             join(',', $mails), $x['nb_mails']),
+                                             'https://www.polytechnique.org/marketing/broken/' . $alias, ';');
+                     }
+                 }
+                 fclose($csv);
+                 exit;
+             }
+         }
+     }
  }
  
  // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
Simple merge
Simple merge
Simple merge
@@@ -213,16 -217,28 +213,26 @@@ class PaymentModule extends PLModul
          }
  
          /* on fait l'insertion en base de donnees */
 -        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle,comment)
 -                           VALUES  ({?},{?},{?},{?},{?},{?},{?})",
 -                     $champ901, $uid, $ref, $champ200, $montant, $champ905,Env::v('comment'));
 +        XDB::execute("INSERT INTO  paiement.transactions (id, uid, ref, fullref, montant, cle, comment)
 +                           VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
 +                     $champ901, $user->id(), $ref, $champ200, $montant, $champ905, Env::v('comment'));
  
+         // We check if it is an Xnet payment and then update the related ML.
+         $res = XDB::query('SELECT  eid
+                              FROM  groupex.evenements
+                             WHERE  paiement_id = {?}', $ref);
+         if ($eid = $res->fetchOneCell()) {
+             $this->load('xnetevents.inc.php');
+             $evt = get_event_detail($eid);
+             subscribe_lists_event(0, $uid, $evt, $montant, true);
+         }
          /* on genere le mail de confirmation */
 -        $conf_text = str_replace("<prenom>",$prenom,$conf_text);
 -        $conf_text = str_replace("<nom>",$nom,$conf_text);
 -        $conf_text = str_replace("<promo>",$promo,$conf_text);
 -        $conf_text = str_replace("<montant>",$montant,$conf_text);
 -        $conf_text = str_replace("<comment>", Env::v('comment'), $conf_text);
 -        $conf_text = str_replace("<salutation>",$femme ? "Chère" : "Cher",$conf_text);
 -        $conf_text = str_replace("<cher>",$femme ? "Chère" : "Cher",$conf_text);
 +        $conf_text = str_replace(
 +            array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>', 'comment>'),
 +            array($user->firstName(), $user->lastName(), $user->promo(), $montant,
 +                  $user->isFemale() ? 'Chère' : 'Cher', $user->isFemale() ? 'Chère' : 'Cher',
 +                  Env::v('comment')), $conf_text);
  
          global $globals;
          $mymail = new PlMailer();
          }
  
          /* on fait l'insertion en base de donnees */
 -        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle,comment)
 -                           VALUES  ({?},{?},{?},{?},{?},{?},{?})",
 -                    $no_transaction, $uid, $ref, $fullref, $montant, $clef, Env::v('comment'));
 +        XDB::execute("INSERT INTO  paiement.transactions (id, uid, ref, fullref, montant, cle, comment)
 +                           VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
 +                    $no_transaction, $user->id(), $ref, $fullref, $montant, $clef, Env::v('comment'));
  
+         // We check if it is an Xnet payment and then update the related ML.
+         $res = XDB::query('SELECT  eid
+                              FROM  groupex.evenements
+                             WHERE  paiement_id = {?}', $ref);
+         if ($eid = $res->fetchOneCell()) {
+             $this->load('xnetevents.inc.php');
+             $evt = get_event_detail($eid);
+             subscribe_lists_event(0, $uid, $evt, $montant, true);
+         }
          /* on genere le mail de confirmation */
 -        $conf_text = str_replace("<prenom>",$prenom,$conf_text);
 -        $conf_text = str_replace("<nom>",$nom,$conf_text);
 -        $conf_text = str_replace("<promo>",$promo,$conf_text);
 -        $conf_text = str_replace("<montant>",$montant,$conf_text);
 -        $conf_text = str_replace("<salutation>",$femme ? "Chère" : "Cher",$conf_text);
 -        $conf_text = str_replace("<cher>",$femme ? "Chère" : "Cher",$conf_text);
 +        $conf_text = str_replace(array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>'),
 +                                 array($user->firstName(), $user->lastName(), $user->promo(), $montant,
 +                                       $user->isFemale() ? 'Chère' : 'Cher',
 +                                       $user->isFemale() ? 'Chère' : 'Cher'), $conf_text);
  
          global $globals;
          $mymail = new PlMailer();
@@@ -299,50 -296,54 +299,50 @@@ class PlatalModule extends PLModul
  
          $mailorg = strtok(Env::v('login'), '@');
  
 -        // paragraphe rajouté : si la date de naissance dans la base n'existe pas, on l'update
 -        // avec celle fournie ici en espérant que c'est la bonne
 -
 -        $res = XDB::query(
 -                "SELECT  user_id, naissance
 -                   FROM  auth_user_md5 AS u
 -             INNER JOIN  aliases       AS a ON (u.user_id=a.id AND type != 'homonyme')
 -                  WHERE  a.alias={?} AND u.perms IN ('admin','user') AND u.deces=0", $mailorg);
 -        list($uid, $naissance) = $res->fetchOneRow();
 -
 -        if ($naissance == $birth) {
 -            $res = XDB::query("SELECT  COUNT(*)
 -                                 FROM  emails
 -                                WHERE  uid = {?} AND flags != 'panne' AND flags != 'filter'", $uid);
 -            $count = intval($res->fetchOneCell());
 -            if ($count == 0) {
 -                $page->assign('no_addr', true);
 -                return;
 -            }
 +        $profile = Profile::get(Env::t('login'));
 +        if (is_null($profile) || $profile->birthdate != $birth) {
 +            $page->trigError('Les informations que tu as rentrées ne permettent pas de récupérer ton mot de passe.<br />'.
 +                        'Si tu as un homonyme, utilise prenom.nom.promo comme login');
 +            return;
 +        }
 +
 +        $user = $profile->owner();
 +        if ($user->state != 'active') {
 +            $page->trigError('Ton compte n\'est pas activé.');
 +            return;
 +        }
  
 -            $page->assign('ok', true);
 +        $res = XDB::query("SELECT  COUNT(*)
 +                             FROM  emails
 +                            WHERE  uid = {?} AND flags != 'panne' AND flags != 'filter'", $user->id());
 +        $count = intval($res->fetchOneCell());
 +        if ($count == 0) {
 +            $page->assign('no_addr', true);
 +            return;
 +        }
  
 -            $url   = rand_url_id();
 -            XDB::execute('INSERT INTO  perte_pass (certificat,uid,created)
 -                               VALUES  ({?},{?},NOW())', $url, $uid);
 -            $res   = XDB::query('SELECT  email
 +        $page->assign('ok', true);
 +
 +        $url   = rand_url_id();
 +        XDB::execute('INSERT INTO  perte_pass (certificat,uid,created)
 +                           VALUES  ({?},{?},NOW())', $url, $user->id());
 +        $res   = XDB::query('SELECT  email
 +                               FROM  emails
 +                              WHERE  uid = {?} AND email = {?}',
 +                            $user->id(), Post::v('email'));
 +        if ($res->numRows()) {
 +            $mails = $res->fetchOneCell();
 +        } else {
-             $res   = XDB::query('SELECT  email
++            $res   = XDB::query("SELECT  email
                                     FROM  emails
-                                   WHERE  uid = {?} AND NOT FIND_IN_SET("filter", flags)', $user->id());
 -                                  WHERE  uid = {?} AND email = {?}',
 -                                $uid, Post::v('email'));
 -            if ($res->numRows()) {
 -                $mails = $res->fetchOneCell();
 -            } else {
 -                $user  = User::getSilent($uid);
 -                $mails = $user->bestEmail();
 -                $res   = XDB::query("SELECT  email
 -                                       FROM  emails
 -                                      WHERE  uid = {?} AND NOT FIND_IN_SET('filter', flags)
 -                                             AND NOT FIND_IN_SET('active', flags)",
 -                                    $uid);
 -                if ($res->numRows() > 0) {
 -                    $mails .= ', ' . implode(', ', $res->fetchColumn());
 -                }
 -            }
 -            $mymail = new PlMailer();
 -            $mymail->setFrom('"Gestion des mots de passe" <support+password@' . $globals->mail->domain . '>');
 -            $mymail->addTo($mails);
 -            $mymail->setSubject('Ton certificat d\'authentification');
 -            $mymail->setTxtBody("Visite la page suivante qui expire dans six heures :
++                                  WHERE  uid = {?} AND NOT FIND_IN_SET('filter', flags)", $user->id());
 +            $mails = implode(', ', $res->fetchColumn());
 +        }
 +        $mymail = new PlMailer();
 +        $mymail->setFrom('"Gestion des mots de passe" <support+password@' . $globals->mail->domain . '>');
 +        $mymail->addTo($mails);
-         $mymail->setSubject('Ton certificat d\'authentification');
++        $mymail->setSubject("Ton certificat d'authentification");
 +        $mymail->setTxtBody("Visite la page suivante qui expire dans six heures :
  {$globals->baseurl}/tmpPWD/$url
  
  Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur. Si tu n'as pas utilisé ce lien dans six heures, tu peux tout simplement recommencer cette procédure.
@@@ -332,13 -340,18 +333,13 @@@ class ProfileModule extends PLModul
          if (!$user) {
              return PL_NOT_FOUND;
          }
 -
 -        $res = XDB::query("SELECT  matricule_ax
 -                             FROM  auth_user_md5
 -                            WHERE  user_id = {?}", $user->id());
 -        $mat = $res->fetchOneCell();
 -        if (!intval($mat)) {
 -            $page->kill("Le matricule AX de {$user->login()} est inconnu");
 +        if (!$user->ax_id) {
 +            $page->kill("Le matricule AX de {$user->hrid()} est inconnu");
          }
-         http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id=" . $user->ax_id);
 -        http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&ancc_id=$mat");
++        http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&ancc_id=" . $user->ax_id);
      }
  
 -    function handler_p_edit(&$page, $opened_tab = null, $mode = null, $success = null)
 +    function handler_p_edit(&$page, $user = null, $opened_tab = null, $mode = null, $success = null)
      {
          global $globals;
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -593,26 -596,63 +592,25 @@@ class XnetEventsModule extends PLModul
              $page->assign('moments', $evt['moments']);
          }
  
-         $page->assign('alphabet', array());
 -        $tri = (Env::v('order') == 'alpha' ? 'promo, nom, prenom' : 'nom, prenom, promo');
 -        $whereitemid = is_null($item_id) ? '' : "AND ep.item_id = $item_id";
 -        $res = XDB::iterRow(
 -                    'SELECT  UPPER(SUBSTRING(IF(u.nom IS NULL, m.nom,
 -                                                IF(u.nom_usage<>"", u.nom_usage, u.nom)), 1, 1)),
 -                             COUNT(DISTINCT ep.uid)
 -                       FROM  groupex.evenements_participants AS ep
 -                 INNER JOIN  groupex.evenements AS e ON (ep.eid = e.eid)
 -                  LEFT JOIN  groupex.membres AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
 -                  LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = ep.uid )
 -                      WHERE  ep.eid = {?} '.$whereitemid . '
 -                   GROUP BY  UPPER(SUBSTRING(IF(u.nom IS NULL,m.nom,u.nom), 1, 1))', $evt['eid']);
 -
 -        $alphabet = array();
 -        $nb_tot = 0;
 -        while (list($char, $nb) = $res->next()) {
 -            $alphabet[ord($char)] = $char;
 -            $nb_tot += $nb;
 -            if (Env::has('initiale') && $char == mb_strtoupper(Env::v('initiale'))) {
 -                $tot = $nb;
 -            }
 -        }
 -        ksort($alphabet);
 -        $page->assign('alphabet', $alphabet);
 -
          if ($evt['paiement_id']) {
 -            $res = XDB::iterator(
 -                "SELECT IF(u.nom_usage<>'', u.nom_usage, u.nom) AS nom, u.prenom,
 -                        u.promo, a.alias AS email, t.montant
 -                   FROM {$globals->money->mpay_tprefix}transactions AS t
 -             INNER JOIN auth_user_md5 AS u ON(t.uid = u.user_id)
 -             INNER JOIN aliases AS a ON (a.id = t.uid AND a.type='a_vie' )
 -              LEFT JOIN groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
 -                  WHERE t.ref = {?} AND ep.uid IS NULL",
 -                  $evt['eid'], $evt['paiement_id']);
 -            $page->assign('oublis', $res->total());
 -            $page->assign('oubliinscription', $res);
 -        }
 -
 -        $absents = XDB::iterator("SELECT  p.uid,
 -                                          IF(m.origine = 'X', IF(u.nom_usage != '', u.nom_usage, u.nom), m.nom) AS nom,
 -                                          IF(m.origine = 'X', u.prenom, u.prenom) AS prenom,
 -                                          IF(m.origine = 'X', u.promo, m.origine) AS promo,
 -                                          IF(m.origine = 'X', FIND_IN_SET('femme', u.flags), m.sexe) AS sexe,
 -                                          IF(m.origine = 'X', a.alias, m.email) AS email
 -                                    FROM  groupex.evenements_participants AS p
 -                              INNER JOIN  groupex.membres                 AS m USING(uid)
 -                               LEFT JOIN  groupex.evenements_participants AS p2 ON (p2.uid = m.uid AND p2.eid = p.eid
 -                                                                                    AND p2.nb != 0)
 -                               LEFT JOIN  auth_user_md5                   AS u ON (u.user_id = m.uid)
 -                               LEFT JOIN  aliases                         AS a ON (a.id = u.user_id AND a.type = 'a_vie')
 -                                   WHERE  p.eid = {?} AND p2.eid IS NULL
 -                                       " . (Env::v('initiale') ? " AND IF(u.nom IS NULL, m.nom,
 -                                          IF(u.nom_usage<>'', u.nom_usage, u.nom)) LIKE '" . Env::v('initiale') . "%'"
 -                                         : "") . "
 -                                GROUP BY  m.uid
 -                                ORDER BY  nom, prenom, promo", $evt['eid']);
 +            $infos = User::getBulkUsersWithUIDs(
 +                            XDB::fetchAllAssoc('SELECT  t.uid, t.montant
 +                                                  FROM  ' . $globals->money->mpay_tprefix . 'transactions AS t
 +                                             LEFT JOIN  groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
 +                                                 WHERE  t.ref = {?} AND ep.uid IS NULL',
 +                                               $evt['eid'], $evt['paiement_id']),
 +                            'uid', 'user');
 +            $page->assign('oublis', count($infos));
 +            $page->assign('oubliinscription', $infos);
 +        }
 +
 +        $absents = User::getBulkUsersFromDB('SELECT  p.uid
 +                                               FROM  groupex.evenements_participants AS p
 +                                          LEFT JOIN  groupex.evenements_participants AS p2 ON (p2.uid = p.uid
 +                                                                                               AND p2.eid = p.eid
 +                                                                                               AND p2.nb != 0)
 +                                              WHERE  p.eid = {?} AND p2.eid IS NULL
 +                                           GROUP BY  p.uid', $evt['eid']);
  
          $ofs   = Env::i('offset');
          $tot   = (Env::v('initiale') ? $tot : $nb_tot);
@@@ -27,23 -27,31 +27,25 @@@ function get_event_detail($eid, $item_i
      if (is_null($asso_id)) {
          $asso_id = $globals->asso('id');
      }
 -    $res = XDB::query(
 -        "SELECT  SUM(nb) AS nb_tot, COUNT(DISTINCT ep.uid) AS nb, e.*,
 -                 IF(e.deadline_inscription, e.deadline_inscription >= LEFT(NOW(), 10), 1) AS inscr_open,
 -                 LEFT(10, e.debut) AS first_day, LEFT(10, e.fin) AS last_day,
 -                 LEFT(NOW(), 10) AS now, ei.titre,
 -                 al.vid AS absent_list, pl.vid AS participant_list,
 -                 bl.vid AS payed_list, ul.vid AS booked_unpayed_list,
 -                 a.nom, a.prenom, a.promo, aa.alias
 -           FROM  groupex.evenements              AS e
 -     INNER JOIN  x4dat.auth_user_md5             AS a  ON a.user_id = e.organisateur_uid
 -     INNER JOIN  x4dat.aliases                   AS aa ON (aa.type = 'a_vie' AND aa.id = a.user_id)
 -     INNER JOIN  groupex.evenements_items        AS ei ON (e.eid = ei.eid)
 -      LEFT JOIN  groupex.evenements_participants AS ep ON (e.eid = ep.eid AND ei.item_id = ep.item_id)
 -      LEFT JOIN  virtual AS al ON (al.type = 'evt' AND al.alias = CONCAT(short_name, {?}))
 -      LEFT JOIN  virtual AS pl ON (pl.type = 'evt' AND pl.alias = CONCAT(short_name, {?}))
 -      LEFT JOIN  virtual AS bl ON (bl.type = 'evt' AND bl.alias = CONCAT(short_name, {?}))
 -      LEFT JOIN  virtual AS ul ON (ul.type = 'evt' AND ul.alias = CONCAT(short_name, {?}))
 -          WHERE  (e.eid = {?} OR e.short_name = {?}) AND ei.item_id = {?} AND e.asso_id = {?}
 -       GROUP BY  ei.item_id",
 -        '-absents@' . $globals->xnet->evts_domain,
 -        '-participants@' . $globals->xnet->evts_domain,
 -        '-paye@' . $globals->xnet->evts_domain,
 -        '-participants-non-paye@' . $globals->xnet->evts_domain,
 -        $eid, $eid, $item_id ? $item_id : 1, $asso_id);
 -
 +    $res = XDB::query('SELECT  SUM(nb) AS nb_tot, COUNT(DISTINCT ep.uid) AS nb, e.*,
 +                               IF(e.deadline_inscription,
 +                                     e.deadline_inscription >= LEFT(NOW(), 10),
 +                                     1) AS inscr_open,
 +                               LEFT(10, e.debut) AS start_day, LEFT(10, e.fin) AS last_day,
 +                               LEFT(NOW(), 10) AS now,
 +                               ei.titre, al.vid AS absent_list, pl.vid AS participant_list
 +                         FROM  groupex.evenements              AS e
 +                   INNER JOIN  groupex.evenements_items        AS ei ON (e.eid = ei.eid)
 +                    LEFT JOIN  groupex.evenements_participants AS ep ON(e.eid = ep.eid AND ei.item_id = ep.item_id)
 +                    LEFT JOIN  virtual AS al ON(al.type = \'evt\' AND al.alias = CONCAT(short_name, {?}))
 +                    LEFT JOIN  virtual AS pl ON(pl.type = \'evt\' AND pl.alias = CONCAT(short_name, {?}))
 +                        WHERE  (e.eid = {?} OR e.short_name = {?}) AND ei.item_id = {?} AND e.asso_id = {?}
 +                     GROUP BY  ei.item_id',
 +                   '-absents@'.$globals->xnet->evts_domain,
 +                   '-participants@'.$globals->xnet->evts_domain,
++                   '-paye@' . $globals->xnet->evts_domain,
++                   '-participants-non-paye@' . $globals->xnet->evts_domain,
 +                   $eid, $eid, $item_id ? $item_id : 1, $asso_id);
      $evt = $res->fetchOneAssoc();
  
      if (!$evt) {
@@@ -269,33 -320,41 +283,40 @@@ function event_change_shortname(&$page
  
      if (!$old && $new) {
          // if we have a first new short_name create the lists
+         $lastid = array();
+         $where = array(
+             '-participants@'          => 'ep.nb > 0',
+             '-paye@'                  => 'ep.paid > 0',
+             '-participants-non-paye@' => 'ep.nb > 0 AND ep.paid = 0'
+         );
+         foreach (array('-absents@', '-participants@', '-paye@', '-participants-non-paye@') as $v) {
+             XDB::execute("INSERT INTO  virtual
+                                   SET  type = 'evt', alias = {?}",
+                          $new . $v . $globals->xnet->evts_domain);
+             $lastid[$v] = XDB::insertId();
+         }
  
-         XDB::execute("INSERT INTO virtual SET type = 'evt', alias = {?}",
-                 $new.'-participants@'.$globals->xnet->evts_domain);
-         $lastid = XDB::insertId();
-         XDB::execute('INSERT IGNORE INTO  virtual_redirect (
-                                   SELECT  {?} AS vid, IF(al.alias IS NULL, a.email, CONCAT(al.alias, {?})) AS redirect
-                                     FROM  groupex.evenements_participants AS ep
-                                LEFT JOIN  accounts        AS a ON (ep.uid = a.uid)
-                                LEFT JOIN  aliases         AS al ON (al.id = a.uid AND al.type = \'a_vie\')
-                                    WHERE  ep.eid = {?} AND ep.nb > 0
-                                 GROUP BY  ep.uid)',
-               $lastid, '@'.$globals->mail->domain, $eid);
-         XDB::execute("INSERT INTO virtual SET type = 'evt', alias = {?}",
-                 $new.'-absents@'.$globals->xnet->evts_domain);
-         $lastid = XDB::insertId();
+         foreach (array('-participants@', '-paye@', '-participants-non-paye@') as $v) {
 -            XDB::execute("INSERT IGNORE INTO virtual_redirect (
 -                SELECT  {?} AS vid, IF(a.alias IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
 -                  FROM  groupex.evenements_participants AS ep
 -             LEFT JOIN  groupex.membres AS m ON (ep.uid = m.uid)
 -             LEFT JOIN  auth_user_md5   AS u ON (u.user_id = ep.uid)
 -             LEFT JOIN  aliases         AS a ON (a.id = ep.uid AND a.type = 'a_vie')
 -                 WHERE  ep.eid = {?} AND " . $where[$v] . "
 -              GROUP BY  ep.uid)",
 -                $lastid[$v], '@' . $globals->mail->domain, $eid);
++            XDB::execute("INSERT IGNORE INTO  virtual_redirect (
++                                      SELECT  {?} AS vid, IF(al.alias IS NULL, a.email, CONCAT(al.alias, {?})) AS redirect
++                                        FROM  groupex.evenements_participants AS ep
++                                   LEFT JOIN  accounts        AS a  ON (ep.uid = a.uid)
++                                   LEFT JOIN  aliases         AS al ON (al.id = a.uid AND al.type = 'a_vie')
++                                       WHERE  ep.eid = {?} AND " . $where[$v] . "
++                                    GROUP BY  ep.uid)",
++                         $lastid[$v], '@' . $globals->mail->domain, $eid);
+         }
 -        XDB::execute("INSERT IGNORE INTO virtual_redirect (
 -            SELECT  {?} AS vid, IF(a.alias IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
 -              FROM  groupex.membres AS m
 -         LEFT JOIN  groupex.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?})
 -         LEFT JOIN  auth_user_md5   AS u ON (u.user_id = m.uid)
 -         LEFT JOIN  aliases         AS a ON (a.id = m.uid AND a.type = 'a_vie ')
 -             WHERE  m.asso_id = {?} AND ep.uid IS NULL
 -          GROUP BY  m.uid)",
 -            $lastid['-absents@'], '@' . $globals->mail->domain, $eid, $globals->asso('id'));
 +        XDB::execute("INSERT IGNORE INTO  virtual_redirect (
 +                                  SELECT  {?} AS vid, IF(al.alias IS NULL, a.email, CONCAT(al.alias, {?})) AS redirect
 +                                    FROM  groupex.membres AS m
 +                               LEFT JOIN  groupex.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?})
-                                LEFT JOIN  accounts        AS a ON (a.uid = m.uid)
++                               LEFT JOIN  accounts        AS a  ON (a.uid = m.uid)
 +                               LEFT JOIN  aliases         AS al ON (al.id = a.uid AND al.type = 'a_vie')
 +                                   WHERE  m.asso_id = {?} AND ep.uid IS NULL
 +                                GROUP BY  m.uid)",
-              $lastid, "@".$globals->mail->domain, $eid, $globals->asso('id'));
++                     $lastid['-absents@'], '@' . $globals->mail->domain, $eid, $globals->asso('id'));
  
          return $new;
      }
@@@ -181,9 -238,9 +181,9 @@@ class XnetGrpModule extends PLModul
              } else {
                  $site = "";
              }
 -            if (S::admin()) {
 +            if (S::has_perms()) {
                  if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) {
-                     $page->trigError("Le domaine doit être un FQDN (aucune modification effectuée) !!!");
+                     $page->trigError('Le domaine doit être un FQDN (aucune modification effectuée)&nbsp;!!!');
                      return;
                  }
                  XDB::execute(
          }
  
          if ($this->unsubscribe($user)) {
-             $page->trigSuccess("{$user->fullName()} a été désinscrit du groupe !");
 -            $page->trigSuccess("{$user['prenom']} {$user['nom']} a été désabonné du groupe&nbsp;!");
++            $page->trigSuccess("{$user->fullName()} a été désinscrit du groupe&nbsp;!");
          } else {
-             $page->trigWarning("{$user->fullName()} a été désinscrit du groupe, mais des erreurs subsistent !");
 -            $page->trigWarning("{$user['prenom']} {$user['nom']} a été désabonné du groupe, mais des erreurs subsistent&nbsp;!");
++            $page->trigWarning("{$user->fullName()} a été désinscrit du groupe, mais des erreurs subsistent&nbsp;!");
          }
      }
  
@@@ -247,21 -256,37 +247,21 @@@ class XnetListsModule extends ListsModu
          if (Env::has('add_member')) {
              S::assert_xsrf_token();
  
 -            $add = Env::v('add_member');
 -            if (strstr($add, '@')) {
 -                list($mbox,$dom) = explode('@', strtolower($add));
 -            } else {
 -                $mbox = $add;
 -                $dom = 'm4x.org';
 +            $add = Env::t('add_member');
 +            $user = User::getSilent($add);
 +            if ($user) {
 +                $add = $user->forlifeEmail();
 +            } else if (!User::isForeignEmailAddress($add)) {
 +                $add = null;
              }
 -            if ($dom == 'polytechnique.org' || $dom == 'm4x.org') {
 -                $res = XDB::query(
 -                        "SELECT  a.alias, b.alias
 -                           FROM  x4dat.aliases AS a
 -                      LEFT JOIN  x4dat.aliases AS b ON (a.id=b.id AND b.type = 'a_vie')
 -                          WHERE  a.alias={?} AND a.type!='homonyme'", $mbox);
 -                if (list($alias, $blias) = $res->fetchOneRow()) {
 -                    $alias = empty($blias) ? $alias : $blias;
 -                    XDB::query(
 -                        "INSERT IGNORE INTO  x4dat.virtual_redirect (vid,redirect)
 -                                     SELECT  vid, {?}
 -                                       FROM  x4dat.virtual
 -                                      WHERE  alias={?}", "$alias@m4x.org", $lfull);
 -                   $page->trigSuccess("$alias@m4x.org ajouté");
 -                } else {
 -                    $page->trigError("$mbox@{$globals->mail->domain} n'existe pas.");
 -                }
 +            if (!empty($add)) {
 +                XDB::execute('INSERT INTO  x4dat.virtual_redirect (vid, redirect)
 +                                   SELECT  vid, {?},
 +                                     FROM  x4dat.virtual
 +                                    WHERE  alias = {?}', strtolower($add), $lfull);
 +                $page->trigSuccess($add . ' ajouté.');
              } else {
-                 $page->trigError($add . ' n\'existe pas.');
 -                XDB::query(
 -                        "INSERT IGNORE INTO  x4dat.virtual_redirect (vid,redirect)
 -                                     SELECT  vid,{?}
 -                                       FROM  x4dat.virtual
 -                                      WHERE  alias={?}", "$mbox@$dom", $lfull);
 -                $page->trigSuccess("$mbox@$dom ajouté");
++                $page->trigError($add . " n'existe pas.");
              }
          }
  
      <td style="text-align: center">{$d.promo}</td>
      <td>
        <a href="profile/{$d.hruid}" class="popup2">{icon name=user_suit title='Afficher la fiche'}</a>
-       <a href="http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&amp;anc_id={$d.ax_id}">{*
-         *}{icon name=user_gray title="fiche AX"}</a>
+       <a href="profile/ax/{$d.hruid}">{icon name=user_gray title="fiche AX"}</a>
        <a href="admin/user/{$d.hruid}">{icon name=wrench title='Administrer user'}</a>
      </td>
 -    <td>{$d.prenom} {$d.nom}</td>
 -    <td style="text-align: center">{$d.deces}</td>
 +    <td>{$d.directory_name}</td>
 +    <td style="text-align: center">{$d.deathdate}</td>
      <td style="text-align: center">
 -      {if $d.last gt $d.deces}<strong>{$d.last}</strong>{elseif $d.last}{$d.last}{else}-{/if}
 +      {if $d.last gt $d.deathdate}<strong>{$d.last}</strong>{elseif $d.last}{$d.last}{else}-{/if}
      </td>
    </tr>
    {/iterate}
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -27,8 -27,8 +27,8 @@@
  {else}
  
  <h1 id='pagetop'>
 -Bienvenue {$smarty.session.yourself_name}{if $birthday}
 +Bienvenue {$smarty.session.display_name}{if $birthday}
-   &nbsp;et joyeux anniversaire de la part de toute l'équipe !
+   &nbsp;et joyeux anniversaire de la part de toute l'équipe&nbsp;!
  {else},
  {/if}
  </h1>
  
      {if hasPerm('admin')}
      <div>
 -      [{if !$c.wasinscrit && !$c.dcd}
 -      <a href="marketing/private/{$c.hruid}">{*
 +      [{if $registered && !$dead}
 +      <a href="marketing/private/{$user->login()}">{*
          *}{icon name=email title="marketter user"}</a>
        {/if}
 -      <a href="admin/user/{$c.hruid}">{*
 +      <a href="admin/user/{$user->login()}">{*
        *}{icon name=wrench title="administrer user"}</a>
-       <a href="http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&amp;anc_id={$profile->ax_id}">{*
 -      <a href="profile/ax/{$c.hruid}">{*
++      <a href="profile/ax/{$user->login()}">{*
        *}{icon name=user_gray title="fiche AX"}</a>]
      </div>
      {/if}
@@@ -67,7 -75,7 +67,7 @@@
  </form>
  
  <p>
- {$nonins|@count} Polytechniciens de la promo {$promo} ne sont pas inscrits !
 -{$nonins->total()} Polytechniciens de la promo {$promo} ne sont pas inscrits&nbsp;!
++{$nonins|@count} Polytechniciens de la promo {$promo} ne sont pas inscrits&nbsp;!
  </p>
  
  
@@@ -24,7 -24,7 +24,7 @@@
  <h1>Inscrits des 7 derniers jours</h1>
  
  <p>
- {$users|@count} Polytechniciens se sont inscrits ces 7 derniers jours !
 -{$ins->total()} Polytechniciens se sont inscrits ces 7 derniers jours&nbsp;!
++{$users|@count} Polytechniciens se sont inscrits ces 7 derniers jours&nbsp;!
  </p>
  
  <div class="right">
@@@ -92,8 -92,8 +92,8 @@@ ne plus recevoir : &lt;https://www.poly
      <div class='nl_background'>
  {/if}
      <div class='nl'>
-       <div class="title">{$nl->title()}</div>
+       <div class="title"><a href="{$globals->baseurl}">{$nl->title()}</a></div>
 -      <div class="intro">{$nl->head($prenom, $nom, $sexe, 'html')|smarty:nodefaults}</div>
 +      <div class="intro">{$nl->head($user, 'html')|smarty:nodefaults}</div>
        <a id="top_lnk"></a>
        {foreach from=$nl->_arts key=cid item=arts name=cats}
        <div class="lnk">
  {*                                                                        *}
  {**************************************************************************}
  
 -<h1>{$asso.nom}&nbsp;: Gestion des télépaiements </h1>
 +<h1>{$asso->nom}&nbsp;: Gestion des télépaiements </h1>
  
  <p class="descr">
- Voici la liste des paiements en ligne possible pour le groupe {$asso->nom} :
 -Voici la liste des paiements en ligne possible pour le groupe {$asso.nom}&nbsp;:
++Voici la liste des paiements en ligne possible pour le groupe {$asso->nom}&nbsp;:
  </p>
  
  {foreach from=$titres item=p}
Simple merge
Simple merge
  <h1>
    Mise en place de la redirection
  </h1>
 -</p>
+ <p>
+ {if $carva}
+   Actuellement, les adresses
+   <a href="http://www.carva.org/{$bestalias}">http://www.carva.org/{$bestalias}</a> et
+   <a href="http://www.carva.org/{$smarty.session.hruid}">http://www.carva.org/{$smarty.session.hruid}</a>
+   sont redirigées sur <a href="http://{$carva}">http://{$carva}</a>
+ {else}
+   La redirection n'est pas utilisée&hellip;
+ {/if}
  
  <p>
 -  Pour modifier cette redirection remplis le champ suivant et clique sur <strong>Valider</strong>.
 +  Pour modifier ta redirection remplis le champ suivant et clique sur <strong>Valider</strong>.
  {if $carva}
    Si tu veux annuler ta redirection, clique sur <strong>Supprimer</strong>.
  {/if}
                {/if}
              {/foreach}
            {/foreach}
 -          {if $asso && ($is_admin ||
 +          {assign var=asso_id value=$asso->id}
 +          {if $asso && $is_admin ||
                        ($smarty.session.suid && ($smarty.session.suid.perms->hasFlag('admin') ||
 -                                                $smarty.session.suid.may_update[$asso.id])))}
 +                                                $smarty.session.suid.may_update[$asso_id]))}
-           <h1>Voir le site comme...</h1>
+           <h1>Voir le site comme&hellip;</h1>
            <form method="post" action="{$platal->ns}change_rights">
              <div>
                <select name="right" onchange="this.form.submit()" style="margin: 0; padding: 0">
@@@ -83,15 -87,15 +87,15 @@@ Ils ont payé mais ont oublié de s'ins
    {iterate from=$oubliinscription item=m}
    <tr class="pair">
      <td>
-       <a href="" {if $is_admin}onclick="return remplitAuto('{$m.user->login()}')"{/if}>
 -      {if $is_admin}<a href="javascript:remplitAuto('{$m.email}')">{/if}
 -        {if $m.femme}&bull;{/if}{if !$m.prenom && !$m.nom}{$m.email}{else}{$m.prenom} {$m.nom}{/if}
++      {if $is_admin}<a href="javascript:remplitAuto('{$m.user->login()}')">{/if}
 +        {profile user=$m.user link=false}
-       </a>
+       {if $is_admin}</a>{/if}
      </td>
 -    <td>{$m.promo}</td>
 +    <td>{$m.user->promo()}</td>
      <td>
 -      <a href="https://www.polytechnique.org/profile/{$m.email}">{icon name=user_suit title="fiche"}</a>
 -      <a href="https://www.polytechnique.org/vcard/{$m.email}.vcf">{icon name=vcard title="vcard"}</a>
 -      <a href="mailto:{$m.email}@{#globals.mail.domain#}">{icon name=email title="email"}</a>
 +      <a href="https://www.polytechnique.org/profile/{$m.user->login()}">{icon name=user_suit title="fiche"}</a>
 +      <a href="https://www.polytechnique.org/vcard/{$m.user->login()}.vcf">{icon name=vcard title="vcard"}</a>
 +      <a href="mailto:{$m.user->bestEmail()}">{icon name=email title="email"}</a>
      </td>
      <td>{$m.montant}</td>
    </tr>
@@@ -35,11 -35,11 +35,11 @@@ function deadlineChange(box
  {/literal}
  </script>
  
 -<h1>{$asso.nom}&nbsp;: {$evt.intitule|default:"Nouvel événement"}</h1>
 +<h1>{$asso->nom}&nbsp;: {$evt.intitule|default:"Nouvel événement"}</h1>
  
  <p class="descr">
-   Un événement peut être une réunion, un séminaire, une conférence, un voyage promo,
-   etc... Pour en organiser un et bénéficier des outils de suivi d'inscription et de
+   Un événement peut être une réunion, un séminaire, une conférence, un voyage promo&hellip;
+   Pour en organiser un et bénéficier des outils de suivi d'inscription et de
    paiement offerts, il te faut remplir les quelques champs du formulaire ci-dessous.
  </p>
  <p class="descr">
Simple merge
Simple merge
@@@ -102,23 -99,33 +102,23 @@@ Le groupe {$asso->nom} compte {$nb_tot
      <th>Actions</th>
      {/if}
    </tr>
 -  {iterate from=$ann item=m}
 +  {foreach from=$users item=user}
    <tr>
      <td>
 -      {if $m.admin}<strong>{/if}
 -      {if $m.inscrit}
 -      <a href="https://www.polytechnique.org/profile/{$m.email}" class="popup2">
 -      {elseif $m.x}
 -      <a href="https://www.polytechnique.org/marketing/public/{$m.uid}">
 -      {/if}
 -      {if $m.femme}&bull;{/if}{if $m.prenom || $m.nom}{$m.prenom} {$m.nom|mb_strtoupper}{else}{$m.email}{/if}
 -      {if $m.x}</a>{/if} 
 -      {if $m.admin}</strong>{/if}
 -      {if $m.inscrit && !$m.actif}
 -      <a href="https://www.polytechnique.org/marketing/broken/{$m.email}">{icon name=error title="Recherche d'email"}</a>
 -      {assign var=broken value=true}
 -      {/if}</td>
 -    <td>{if $m.admin}<strong>{/if}{$m.promo}{if $m.admin}</strong>{/if}</td>
 -    {if $m.comm}
 -    <td>{$m.comm}</td>
 +      {profile user=$user promo=false}
 +    <td>
 +      {if $user->group_perms eq 'admin'}<strong>{/if}
 +      {$user->promo()}
 +      {if $user->group_perms eq 'admin'}</strong>{/if}
 +    </td>
 +    {if $user->group_comm}
 +    <td>{$user->group_comm}</td>
      {/if}
-     <td class="right" {if !$user->group_comm}colspan="2"{/if}>
 -    <td class="right" {if !$m.comm}colspan="2"{/if}>
 -      {if $m.inscrit}
 -      <a href="https://www.polytechnique.org/vcard/{$m.email}.vcf">{icon name=vcard title="[vcard]"}</a>
 -      <a href="mailto:{$m.email}@polytechnique.org">{icon name=email title="email"}</a>
 -      {else}
 -      <a href="mailto:{$m.email}">{icon name=email title="email"}</a>
++    <td class="right"{if !$user->group_comm} colspan="2"{/if}>
 +      {if $user->hasProfile()}
 +      <a href="https://www.polytechnique.org/vcard/{$user->login()}.vcf">{icon name=vcard title="[vcard]"}</a>
        {/if}
 +      <a href="mailto:{$user->bestEmail()}">{icon name=email title="email"}</a>
      </td>
      {if $is_admin}
      <td class="center">
  <br />
  
  <div style="text-align: justify">
-   {if $asso->wiki_desc}
 -  {$asso.descr|miniwiki:title|smarty:nodefaults}
 +  {$asso->descr|miniwiki:title|smarty:nodefaults}
-   {else}
-   {$asso->descr|smarty:nodefaults}
-   {/if}
  </div>
  
  <br />
      <a href="wiki_help" class="popup3">
        {icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki autorisée pour la description.
      </a>
-     <textarea name="descr" cols="70" rows="15" id="descr"
-               {if !$asso->wiki_desc && $asso->descr}class="error"{/if}>{$asso->descr}</textarea>
 -    <textarea name="descr" cols="70" rows="15" id="descr">{$asso.descr}</textarea>
++    <textarea name="descr" cols="70" rows="15" id="descr">{$asso->descr}</textarea>
      <input type="submit" name="preview" value="Aperçu de la description"
             onclick="previewWiki('descr', 'preview_descr', true, 'preview_descr'); return false;" /><br />
      <input type="submit" name="submit" value="Enregistrer" />
@@@ -60,9 -60,9 +60,9 @@@
  {elseif $smarty.post.inscrire}
  
  <p class="descr">
- <strong>Ta demande d'inscription a bien été envoyée !</strong> Tu seras averti{if $user->isFemale()}e{/if} par email de la suite qui lui sera donnée.
+ <strong>Ta demande d'inscription a bien été envoyée&nbsp;!</strong> Tu seras averti{if $smarty.session.femme}e{/if} par email de la suite qui lui sera donnée.
  <p>
 -<p class="descr">[<a href="{$platal->ns}">Retour à la page d'accueil de {$asso.nom}</a>]</p>
 +<p class="descr">[<a href="{$platal->ns}">Retour à la page d'accueil de {$asso->nom}</a>]</p>
  
  {else}
  
@@@ -131,11 -131,11 +131,11 @@@ masculin ou féminin, par son prénom, 
  {else}
  &lt;cher&gt; &lt;prenom&gt;,
  
 -Nous avons le plaisir de t'adresser la lettre mensuelle du groupe {$asso.nom}.
 +Nous avons le plaisir de t'adresser la lettre mensuelle du groupe {$asso->nom}.
  
- (insérer le texte...)
+ (insérer le texte&hellip;)
  
 -Le bureau du groupe {$asso.nom}.
 +Le bureau du groupe {$asso->nom}.
  {/if}</textarea>
        </td>
      </tr>
Simple merge
@@@ -44,8 -44,8 +44,8 @@@
    <div class="center">
      <p class="descr">
      {if $self}
 -    Êtes-vous sûr de vouloir vous désinscrire du groupe {$asso.nom} et de toutes
 +    Êtes-vous sûr de vouloir vous désinscrire du groupe {$asso->nom} et de toutes
-     les listes de diffusion associées ?
+     les listes de diffusion associées&nbsp;?
      {else}
      Êtes-vous sûr de vouloir supprimer {$user.prenom} {$user.nom} du groupe,
      lui retirer tous les droits associés à son statut de membre
          Commentaire&nbsp;:
        </td>
        <td>
 -        <input type="text" name="comm" value="{$user.comm}" size="40" maxlength="255" /><br />
 +        <input type="text" name="comm" value="{$user->group_comm}" size="40" maxlength="255" /><br />
-         <small>Poste, origine, ... (accessible à toutes les personnes autorisées à consulter l'annuaire)</small>
+         <small>Poste, origine&hellip; (accessible à toutes les personnes autorisées à consulter l'annuaire)</small>
        </td>
      </tr>
 -    {if $user.origine neq X}
 -    <tr id="make_X" {if $user.origine eq "groupe"}style="display: none"{/if}>
 +    {if $user->type eq 'ext'}
 +    <tr id="make_X">
        <td colspan="2">
          <span id="make_X_cb">
            <input type="checkbox" name="is_x" id="is_x" onclick="showXInput(this);" onchange="showXInput(this);" />
@@@ -20,7 -20,7 +20,7 @@@
  {*                                                                        *}
  {**************************************************************************}
  
- <h1>{$asso->nom}&nbsp;: Validation des inscriptions</h1>
 -<h1>{$asso.nom}&nbsp;: validation des inscriptions</h1>
++<h1>{$asso->nom}&nbsp;: validation des inscriptions</h1>
  
  <script type="text/javascript">//<![CDATA[
  {literal}
Simple merge
Simple merge
Simple merge
Simple merge