Merge commit 'origin/master' into fusionax
authorStéphane Jacob <jacou@melix.net>
Tue, 16 Dec 2008 15:45:40 +0000 (16:45 +0100)
committerStéphane Jacob <jacou@melix.net>
Tue, 16 Dec 2008 15:45:40 +0000 (16:45 +0100)
ChangeLog
htdocs/javascript/profile.js
include/geoloc.inc.php
include/validations/listes.inc.php
modules/auth.php
modules/platal.php

index 778ee12..6248cdf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,17 @@ Bug/Wish:
 ================================================================================
 VERSION 0.10.1                                                        XX XX XXXX
 
+From 0.10.0 branch:
+
+    * Auth:
+        - Fix use of deprecated PlLogger in password recovery              -JAC
+
+    * Lists:
+        - #942: Fix missing MLs in ML listing                              -FRU
+        - #943: Fix adding member to a list                                -FRU
+
+    * Profile:
+        - Fix malformed query leading to error when adding an address      -FRU
 
 ================================================================================
 VERSION 0.10.0                                                        11 12 2008
index 7fa8081..42921df 100644 (file)
@@ -352,8 +352,7 @@ function validGeoloc(id, pref)
     document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
     document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
     document.forms.prof_annu[pref + "[cityid]"].value = document.forms.prof_annu[pref + "[geoloc_cityid]"].value;
-    attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
-                function() { document.forms.prof_annu[pref + "[text]"].blur(); });
+    $(document.forms.prof_annu[pref + "[text]"]).click(function() { document.forms.prof_annu[pref + "[text]"].blur(); });
     document.forms.prof_annu[pref + "[text]"].className = '';
 }
 
@@ -363,8 +362,7 @@ function validAddress(id, pref)
     document.getElementById(id + '_geoloc_error').style.display = 'none';
     document.getElementById(id + '_geoloc_valid').style.display = 'none';
     document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
-    attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
-                function() { document.forms.prof_annu[pref + "[text]"].blur(); });
+    $(document.forms.prof_annu[pref + "[text]"]).click(function() { document.forms.prof_annu[pref + "[text]"].blur(); });
     document.forms.prof_annu[pref + "[text]"].className = '';
 }
 
index 8511a4e..28ffe51 100644 (file)
@@ -326,8 +326,10 @@ function fix_cities_not_on_map($limit=false, $cityid=false)
                 $values .= ",($cityid, $map_id, '')";
             }
         }
-        XDB::execute("REPLACE INTO  geoloc_city_in_maps
-                            VALUES  ".substr($values, 1));
+        if (strlen($values) > 1) {
+            XDB::execute("REPLACE INTO  geoloc_city_in_maps
+                                VALUES  ".substr($values, 1));
+        }
     } else {
         return false;
     }
index 25bb4a0..7b803fa 100644 (file)
@@ -125,20 +125,16 @@ class ListeReq extends Validate
 
         if ($this->asso == "alias") {
             $new = $this->liste . '@' . $this->domain;
-            XDB::query('INSERT INTO x4dat.virtual (alias,type) VALUES({?}, "user")', $new);
+            XDB::query('INSERT INTO x4dat.virtual (alias, type) VALUES({?}, "user")', $new);
             foreach ($this->members as $member) {
-                $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'", $member);
-                list($alias, $blias) = $res->fetchOneRow();
-                $alias = empty($blias) ? $alias : $blias;
-                XDB::query(
-                    "INSERT INTO  x4dat.virtual_redirect (vid,redirect)
-                          SELECT  vid, {?}
-                            FROM  x4dat.virtual
-                           WHERE  alias={?}", $alias . "@" . $globals->mail->domain, $new);
+                $user = User::get($member);
+                if ($user != null) {
+                    XDB::query(
+                        "INSERT INTO  x4dat.virtual_redirect (vid, redirect)
+                              SELECT  vid, {?}
+                                FROM  x4dat.virtual
+                               WHERE  alias = {?}", $user->forlifeEmail(), $new);
+                }
             }
             return 1;
         }
@@ -150,7 +146,7 @@ class ListeReq extends Validate
         $liste = strtolower($this->liste);
         if ($ret && !$this->asso) {
             foreach(Array($liste, $liste . "-owner", $liste . "-admin", $liste . "-bounces", $liste . "-unsubscribe") as $l) {
-                XDB::execute("INSERT INTO aliases (alias,type) VALUES({?}, 'liste')", $l);
+                XDB::execute("INSERT INTO aliases (alias, type) VALUES({?}, 'liste')", $l);
             }
         } elseif ($ret) {
             foreach (Array('', 'owner', 'admin', 'bounces', 'unsubscribe') as $app) {
@@ -159,9 +155,9 @@ class ListeReq extends Validate
                     $app  = '-' . $app;
                 }
                 $red = $this->domain . '_' . $liste;
-                XDB::execute('INSERT INTO x4dat.virtual (alias,type)
-                                        VALUES({?},{?})', $liste . $app . '@' . $this->domain, 'list');
-                XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
+                XDB::execute('INSERT INTO x4dat.virtual (alias, type)
+                                        VALUES({?}, {?})', $liste . $app . '@' . $this->domain, 'list');
+                XDB::execute('INSERT INTO x4dat.virtual_redirect (vid, redirect)
                                         VALUES ({?}, {?})', XDB::insertId(),
                                        $red . $mdir . '@listes.polytechnique.org');
                 $list->mass_subscribe($liste, join(' ', $this->members));
index 5b9748f..e68ca82 100644 (file)
@@ -152,10 +152,8 @@ class AuthModule extends PLModule
         // mise à jour de l'heure et de la machine de dernier login sauf quand on est en suid
         $uid = S::i('uid');
         if (!isset($_SESSION['suid'])) {
-            $logger = (isset($_SESSION['log']) && $_SESSION['log']->uid == $uid)
-                            ? $_SESSION['log'] : new PlLogger($uid);
             global $platal;
-            S::logger()->log('connexion_auth_ext', $platal->path);
+            S::logger(uid)->log('connexion_auth_ext', $platal->path);
         }
 
         /* on parcourt les entrees de groupes_auth */
index 1249335..27fd7ff 100644 (file)
@@ -356,8 +356,7 @@ Adresse de secours : " . Post::v('email') : ""));
             $mymail->send();
 
             // on cree un objet logger et on log l'evenement
-            $logger = $_SESSION['log'] = new PlLogger($uid);
-            S::logger()->log('recovery', $mails);
+            S::logger(uid)->log('recovery', $mails);
         } else {
             $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');
@@ -395,8 +394,7 @@ Adresse de secours : " . Post::v('email') : ""));
                 }
             }
 
-            $logger = new PlLogger($uid);
-            S::logger()->log("passwd","");
+            S::logger($uid)->log("passwd", "");
             $page->changeTpl('platal/tmpPWD.success.tpl');
         } else {
             $page->changeTpl('platal/motdepasse.tpl');