melix bug backport + use bestaliases
authorx2000habouzit <x2000habouzit>
Wed, 17 Nov 2004 12:21:47 +0000 (12:21 +0000)
committerx2000habouzit <x2000habouzit>
Wed, 17 Nov 2004 12:21:47 +0000 (12:21 +0000)
15 files changed:
htdocs/newsletter/show.php
include/newsletter.inc.php
include/valid_aliases.inc.php
include/valid_evts.inc.php
include/valid_listes.inc.php
include/valid_photos.inc.php
templates/include/form.valid.aliases.tpl
templates/include/form.valid.evts.tpl
templates/include/form.valid.listes.tpl
templates/include/form.valid.ml.tpl
templates/include/form.valid.photos.tpl
templates/mails/valid.alias.tpl
templates/mails/valid.evts.tpl
templates/mails/valid.liste.tpl
templates/mails/valid.photos.tpl

index 01268de..3d0f7c6 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: show.php,v 1.3 2004-11-13 14:16:24 x2000habouzit Exp $
+        $Id: show.php,v 1.4 2004-11-17 12:21:47 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
@@ -32,7 +32,7 @@ $page->assign_by_ref('nl',$nl);
 if(isset($_POST['send'])) {
     $res = $globals->db->query("SELECT pref FROM newsletter_ins WHERE user_id='{$_SESSION['uid']}'");
     if(!(list($format) = mysql_fetch_row($res))) $format = 'html';
-    $nl->sendTo($_SESSION['prenom'], $_SESSION['nom'], $_SESSION['forlife'], $_SESSION['femme'], $format=='html');
+    $nl->sendTo($_SESSION['prenom'], $_SESSION['nom'], $_SESSION['bestalias'], $_SESSION['femme'], $format=='html');
 }
 
 $page->run();
index c1741a3..2be3a58 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: newsletter.inc.php,v 1.33 2004-11-16 21:02:46 x2000habouzit Exp $
+        $Id: newsletter.inc.php,v 1.34 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************/
 
 define('FEMME', 1);
@@ -254,12 +254,12 @@ EOF;
        return $res;
     }
     
-    function sendTo($prenom,$nom,$forlife,$sex,$html) {
+    function sendTo($prenom,$nom,$login,$sex,$html) {
        require_once('diogenes.hermes.inc.php');
        $mailer = new HermesMailer();
        $mailer->setFrom("\"Lettre Mensuelle Polytechnique.org\" <info_newsletter@polytechnique.org>");
        $mailer->setSubject($this->title());
-       $mailer->addTo("\"$prenom $nom\" <$forlife@polytechnique.org>");
+       $mailer->addTo("\"$prenom $nom\" <$login@polytechnique.org>");
        $mailer->addHeader('Reply-To','info+nlp@polytechnique.org');
        $mailer->setTxtBody($this->toText($prenom,$nom,$sex));
        if($html) {
index db59d17..c1b5db4 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid_aliases.inc.php,v 1.19 2004-11-15 08:30:15 x2000habouzit Exp $
+        $Id: valid_aliases.inc.php,v 1.20 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************/
 
 class AliasReq extends Validate {
@@ -26,9 +26,10 @@ class AliasReq extends Validate {
     var $raison;
 
     var $forlife;
+    var $bestalias;
     var $prenom;
     var $nom;
-    var $old;
+    var $old='';
     
     function AliasReq ($_uid, $_alias, $_raison, $_stamp=0) {
         global $globals;
@@ -37,13 +38,20 @@ class AliasReq extends Validate {
         $this->raison = $_raison;
         
         $sql = $globals->db->query("
-           SELECT  l.alias,prenom,nom,v.alias
+           SELECT  l.alias,m.alias,prenom,nom
              FROM  auth_user_md5    AS u
        INNER JOIN  aliases          AS l  ON (u.user_id=l.id AND l.type='a_vie')
-        LEFT JOIN  virtual_redirect AS vr ON (CONCAT(l.alias,'@m4x.org') = vr.redirect)
-        LEFT JOIN  virtual          AS v  ON(v.vid=vr.vid AND v.alias LIKE '%@melix.net')
+       INNER JOIN  aliases          AS m  ON (u.user_id=m.id AND FIND_IN_SET('bestalias',m.flags))
              WHERE  user_id='".$this->uid."'");
-        list($this->forlife,$this->prenom,$this->nom,$this->old) = mysql_fetch_row($sql);
+        list($this->forlife,$this->bestalias,$this->prenom,$this->nom) = mysql_fetch_row($sql);
+        mysql_free_result($sql);
+
+       $sql = $globals->db->query("
+           SELECT  v.alias
+             FROM  virtual_redirect AS vr
+       INNER JOIN  virtual          AS v  ON (v.vid=vr.vid AND v.alias LIKE '%@melix.net')
+            WHERE  vr.redirect='{$this->forlife}@m4x.org'");
+       if(mysql_num_rows($sql)) list($this->old) = mysql_fetch_row($sql);
         mysql_free_result($sql);
     }
 
@@ -61,7 +69,7 @@ class AliasReq extends Validate {
         require_once("tpl.mailer.inc.php");
         $mymail = new TplMailer('valid.alias.tpl');
         $mymail->assign('alias', $this->alias);
-        $mymail->assign('forlife', $this->forlife);
+        $mymail->assign('bestalias', $this->bestalias);
 
         if($_REQUEST['submit']=="Accepter") {
             $mymail->assign('answer', 'yes');
index f8cad1e..dcf77d3 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid_evts.inc.php,v 1.11 2004-09-02 21:09:32 x2000habouzit Exp $
+        $Id: valid_evts.inc.php,v 1.12 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************/
 
 
@@ -31,7 +31,7 @@ class EvtReq extends Validate {
     var $peremption;    
     var $comment;
     
-    var $forlife;
+    var $bestalias;
     var $promo;
     var $nom;
     var $prenom;
@@ -50,9 +50,9 @@ class EvtReq extends Validate {
         $req = $globals->db->query("
            SELECT  a.alias,promo,nom,prenom
              FROM  auth_user_md5 AS u
-        INNER JOIN  aliases       AS a ON ( u.user_id=a.id AND type='a_vie')
+        INNER JOIN  aliases       AS a ON ( u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags))
             WHERE  user_id='$_uid'");
-        list($this->forlife,$this->promo,$this->nom,$this->prenom) 
+        list($this->bestalias,$this->promo,$this->nom,$this->prenom) 
             = mysql_fetch_row($req);
         mysql_free_result($req);
     }
@@ -68,7 +68,7 @@ class EvtReq extends Validate {
         if (isset($_POST['action'])) {
             require("tpl.mailer.inc.php");
             $mymail = new TplMailer('valid.evts.tpl');
-            $mymail->assign('forlife',$this->forlife);
+            $mymail->assign('bestalias',$this->bestalias);
             $mymail->assign('titre',$this->titre);
 
             if($_REQUEST['action']=="Valider") {
index bc87a81..701d2af 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid_listes.inc.php,v 1.4 2004-11-10 10:59:10 x2000habouzit Exp $
+        $Id: valid_listes.inc.php,v 1.5 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************/
 
 class ListeReq extends Validate {
-    var $forlife;
+    var $bestalias;
     var $liste;
     var $desc;
 
@@ -49,9 +49,9 @@ class ListeReq extends Validate {
         $sql = $globals->db->query("
            SELECT  l.alias
              FROM  auth_user_md5   AS u
-       INNER JOIN  aliases         AS l ON (u.user_id=l.id AND type='a_vie')
+       INNER JOIN  aliases         AS l ON (u.user_id=l.id AND FIND_IN_SET('bestalias',l.flags))
              WHERE  user_id='".$this->uid."'");
-        list($this->forlife) = mysql_fetch_row($sql);
+        list($this->bestalias) = mysql_fetch_row($sql);
         mysql_free_result($sql);
     }
 
@@ -69,7 +69,7 @@ class ListeReq extends Validate {
         require_once("tpl.mailer.inc.php");
         $mymail = new TplMailer('valid.liste.tpl');
         $mymail->assign('alias', $this->liste);
-        $mymail->assign('forlife', $this->forlife);
+        $mymail->assign('bestalias', $this->bestalias);
        $mymail->assign('motif', stripslashes($_REQUEST['motif']));
 
         if($_REQUEST['submit']=="Accepter") {
index 79b216f..d6a5d2f 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid_photos.inc.php,v 1.15 2004-11-06 17:37:22 x2000habouzit Exp $
+        $Id: valid_photos.inc.php,v 1.16 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************/
 
 
@@ -28,7 +28,7 @@ class PhotoReq extends Validate {
     var $x;
     var $y;
 
-    var $forlife;
+    var $bestalias;
     var $prenom;
     var $nom;
    
@@ -39,9 +39,9 @@ class PhotoReq extends Validate {
         $sql = $globals->db->query("
            SELECT  a.alias, prenom, nom
              FROM  auth_user_md5 AS u
-        INNER JOIN  aliases       AS a ON ( a.id=u.user_id AND type='a_vie' )
+        INNER JOIN  aliases       AS a ON ( a.id=u.user_id AND FIND_IN_SET('bestalias',a.flags) )
             WHERE  user_id=".$this->uid);
-        list($this->forlife,$this->prenom,$this->nom) = mysql_fetch_row($sql);
+        list($this->bestalias,$this->prenom,$this->nom) = mysql_fetch_row($sql);
         mysql_free_result($sql);
         
         if(!file_exists($_file)) {
@@ -88,7 +88,7 @@ class PhotoReq extends Validate {
         
         require_once("tpl.mailer.inc.php");
         $mymail = new TplMailer('valid.photos.tpl');
-        $mymail->assign('forlife', $this->forlife);
+        $mymail->assign('bestalias', $this->bestalias);
 
         if($_REQUEST['submit']=="Accepter") {
             $mymail->assign('answer','yes');
index 9dde6c0..edf38b5 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: form.valid.aliases.tpl,v 1.10 2004-11-13 15:56:36 x2000habouzit Exp $
+        $Id: form.valid.aliases.tpl,v 1.11 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -27,7 +27,7 @@
       <td>Demandeur&nbsp;:
       </td>
       <td>
-        <a href="{"fiche.php"|url}?user={$valid->forlife}" class='popup2'>
+        <a href="{"fiche.php"|url}?user={$valid->bestalias}" class='popup2'>
           {$valid->prenom} {$valid->nom}</a> {$valid->old}
       </td>
     </tr>
index bdc597e..a9baff7 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: form.valid.evts.tpl,v 1.8 2004-11-13 15:56:37 x2000habouzit Exp $
+        $Id: form.valid.evts.tpl,v 1.9 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************}
 
 
     </tr>
     <tr>
       <td  colspan="2">
-        Posté par <a href="{"fiche.php"|url}?user={$valid->forlife}" class="popup2">
+        Posté par <a href="{"fiche.php"|url}?user={$valid->bestalias}" class="popup2">
           {$valid->prenom} {$valid->nom} (X{$valid->promo})
         </a>
-        [<a href="mailto:{$valid->forlife}@polytechnique.org">lui écrire</a>]
+        [<a href="mailto:{$valid->bestalias}@polytechnique.org">lui écrire</a>]
       </td>
     </tr>
     <tr>
index 1ade650..e12a920 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: form.valid.listes.tpl,v 1.2 2004-11-13 15:56:37 x2000habouzit Exp $
+        $Id: form.valid.listes.tpl,v 1.3 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -27,8 +27,8 @@
       <td>Demandeur&nbsp;:
       </td>
       <td>
-        <a href="{"fiche.php"|url}?user={$valid->forlife}" class="popup2">
-          {$valid->forlife}</a>
+        <a href="{"fiche.php"|url}?user={$valid->bestalias}" class="popup2">
+          {$valid->bestalias}</a>
       </td>
     </tr>
     <tr>
index 5fc6f7c..67aa95f 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: form.valid.ml.tpl,v 1.9 2004-11-13 15:56:37 x2000habouzit Exp $
+        $Id: form.valid.ml.tpl,v 1.10 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -26,7 +26,7 @@
     <tr>
       <td>Demandeur&nbsp;:</td>
       <td>
-        <a href="{"fiche.php"|url}?user={$valid->forlife}" class="popup2">
+        <a href="{"fiche.php"|url}?user={$valid->bestalias}" class="popup2">
           {$valid->prenom} {$valid->nom}
         </a>
       </td>
index 75210cc..db8ac95 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: form.valid.photos.tpl,v 1.9 2004-11-13 15:56:37 x2000habouzit Exp $
+        $Id: form.valid.photos.tpl,v 1.10 2004-11-17 12:21:48 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -25,7 +25,7 @@
 <table class="bicol" summary="Demande d'alias">
 <tr>
   <td>Demandeur&nbsp;:</td>
-  <td><a href="{"fiche.php"|url}?user={$valid->forlife}" class="popup2">
+  <td><a href="{"fiche.php"|url}?user={$valid->bestalias}" class="popup2">
       {$valid->prenom} {$valid->nom}
       </a>
   </td>
index b900cda..759344c 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid.alias.tpl,v 1.3 2004-09-02 21:09:33 x2000habouzit Exp $
+        $Id: valid.alias.tpl,v 1.4 2004-11-17 12:21:49 x2000habouzit Exp $
  ***************************************************************************}
 
 {config_load file="mails.conf" section="valid_alias"}
-{subject text="[Polytechnique.org/MELIX] Demande de l'alias $alias@melix.net par $forlife"}
+{subject text="[Polytechnique.org/MELIX] Demande de l'alias $alias@melix.net par $bestalias"}
 {from full=#from#}
-{to addr="$forlife@polytechnique.org"}
+{to addr="$bestalias@polytechnique.org"}
 {cc full=#cc#}
 {if $answer eq "yes"}
 Cher(e) camarade,
index 393857f..871321e 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid.evts.tpl,v 1.3 2004-09-02 21:09:33 x2000habouzit Exp $
+        $Id: valid.evts.tpl,v 1.4 2004-11-17 12:21:49 x2000habouzit Exp $
  ***************************************************************************}
 
 {config_load file="mails.conf" section="valid_evts"}
 {subject text="[Polytechnique.org/EVENEMENTS] Proposition d'événement"}
 {from full=#from#}
-{to addr="$forlife@polytechnique.org"}
+{to addr="$bestalias@polytechnique.org"}
 {cc full=#cc#}
 {if $answer eq "yes"}
 Cher(e) camarade,
index 6e73b95..c60a694 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid.liste.tpl,v 1.1 2004-09-25 20:11:36 x2000habouzit Exp $
+        $Id: valid.liste.tpl,v 1.2 2004-11-17 12:21:49 x2000habouzit Exp $
  ***************************************************************************}
 
 {config_load file="mails.conf" section="valid_liste"}
-{subject text="[Polytechnique.org/LISTES] Demande de la liste $alias par $forlife"}
+{subject text="[Polytechnique.org/LISTES] Demande de la liste $alias par $bestalias"}
 {from full=#from#}
-{to addr="$forlife@polytechnique.org"}
+{to addr="$bestalias@polytechnique.org"}
 {cc full=#cc#}
 {if $answer eq "yes"}
 Cher(e) camarade,
index 1d8e663..928d262 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: valid.photos.tpl,v 1.3 2004-09-02 21:09:33 x2000habouzit Exp $
+        $Id: valid.photos.tpl,v 1.4 2004-11-17 12:21:49 x2000habouzit Exp $
  ***************************************************************************}
 
 {config_load file="mails.conf" section="valid_photos"}
-{subject text="[Polytechnique.org/PHOTO] Changement de photo de $forlife"}
+{subject text="[Polytechnique.org/PHOTO] Changement de photo de $bestalias"}
 {from full=#from#}
-{to addr="$forlife@polytechnique.org"}
+{to addr="$bestalias@polytechnique.org"}
 {cc full=#cc#}
 {if $answer eq "yes"}
 Cher(e) camarade,