Merge remote branch 'origin/platal-1.0.0'
authorStéphane Jacob <sj@m4x.org>
Mon, 9 Aug 2010 00:13:38 +0000 (02:13 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 9 Aug 2010 00:13:38 +0000 (02:13 +0200)
185 files changed:
ChangeLog
Makefile
bin/cron/profile_modification.php [new file with mode: 0755]
bin/marketPromo.php
classes/direnum.php
classes/profile.php
classes/user.php
classes/userfilter.php
classes/xnetpage.php
classes/xnetsession.php
classes/xorgsession.php
configs/mails.conf
configs/platal.cron.in
core
htdocs/javascript/do_challenge_response_logged.js
htdocs/javascript/jquery.autocomplete.js
htdocs/javascript/password.js [moved from htdocs/javascript/motdepasse.js with 61% similarity]
htdocs/javascript/xorg.js
include/banana/forum.inc.php
include/banana/hooks.inc.php
include/banana/moderate.inc.php
include/emails.combobox.inc.php
include/geocoding.inc.php
include/marketing.inc.php
include/name.func.inc.php
include/profilefields.inc.php
include/security.inc.php
include/ufbuilder.inc.php
include/validations.inc.php
include/validations/entreprises.inc.php
include/validations/evts.inc.php
include/validations/names.inc.php
include/webservices/ax/client.inc
modules/admin.php
modules/auth/auth.inc.php
modules/axletter.php
modules/axletter/axletter.inc.php
modules/carnet.php
modules/email.php
modules/events.php
modules/fusionax.php
modules/fusionax/Adresses.sql
modules/fusionax/formation.pl
modules/fusionax/import-ax.sh
modules/googleapps.php
modules/lists.php
modules/lists/lists.inc.php
modules/lists/platal.mrc
modules/marketing.php
modules/payment.php
modules/payment/money/bplccyberplus.inc.php
modules/platal.php
modules/profile.php
modules/profile/addresses.inc.php
modules/profile/decos.inc.php
modules/profile/general.inc.php
modules/profile/groups.inc.php
modules/profile/jobs.inc.php
modules/profile/mentor.inc.php
modules/profile/page.inc.php
modules/profile/skills.inc.php
modules/register.php
modules/search.php
modules/xnet.php
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php
modules/xnetgrp.php
plugins/function.profile.php
plugins/insert.getUserName.php
templates/admin/deces_promo.tpl
templates/admin/index.tpl
templates/admin/user.tpl
templates/admin/useredit.mail.tpl
templates/admin/validation.tpl
templates/admin/wiki.tpl
templates/axletter/letter.mail.tpl
templates/axletter/unsubscribe.tpl
templates/carnet/index.tpl
templates/carnet/mescontacts.tpl
templates/carnet/panel.tpl
templates/core/password_prompt.tpl
templates/emails/broken.tpl
templates/emails/imap_register.tpl
templates/emails/lost.tpl
templates/emails/send.tpl
templates/events/index.tpl
templates/forums/admin.tpl
templates/fusionax/ids.tpl
templates/fusionax/import.tpl
templates/fusionax/index.tpl
templates/gadgets/ig-minifiche.tpl
templates/googleapps/index.tpl
templates/include/field.promo.tpl
templates/include/form.valid.edit-entreprises.tpl
templates/include/form.valid.edit-paiements.tpl
templates/include/form.valid.entreprises.tpl
templates/include/minifiche.tpl
templates/include/plview.trombi.entry.tpl
templates/include/signature.mail.tpl
templates/include/trombi.tpl
templates/lists/header_listes.tpl
templates/lists/index.tpl
templates/lists/liste.inc.tpl
templates/lists/members.tpl
templates/lists/moderate.tpl
templates/lists/moderate_mail.tpl
templates/marketing/broken.tpl
templates/marketing/index.tpl
templates/marketing/marketing.mail.tpl
templates/marketing/promo.tpl
templates/marketing/public.tpl
templates/platal/acces_smtp.tpl
templates/platal/filrss.tpl
templates/platal/index.tpl
templates/platal/password.success.tpl [moved from templates/platal/motdepasse.success.tpl with 100% similarity]
templates/platal/password.tpl [moved from templates/platal/motdepasse.tpl with 90% similarity]
templates/platal/preferences.tpl
templates/profile/deco.tpl
templates/profile/education.js.tpl
templates/profile/general.tpl
templates/profile/groupesx.tpl
templates/profile/mentor.tpl
templates/profile/notification.mail.tpl [new file with mode: 0644]
templates/profile/profile.tpl
templates/profile/referent.tpl
templates/register/step2.tpl
templates/register/step3.tpl
templates/search/adv.form.tpl
templates/search/adv.links.tpl
templates/search/quick.tpl
templates/skin/common.bandeau.tpl
templates/skin/common.menu.tpl
templates/skin/common.title.header.tpl
templates/skin/default.tpl
templates/skin/espace.tpl
templates/skin/humlinux.tpl
templates/skin/keynote.tpl
templates/skin/linux.tpl
templates/skin/liteskin.tpl
templates/skin/nbviolet.tpl
templates/skin/newxorg.tpl
templates/skin/oldtimes.tpl
templates/skin/openweb.tpl
templates/skin/register.tpl
templates/skin/sharky.tpl
templates/skin/spectral.tpl
templates/skin/trapped.tpl
templates/stats/coupure.tpl
templates/survey/edit_question.tpl
templates/survey/edit_root.tpl
templates/survey/index.tpl
templates/survey/show_root.tpl
templates/xnet/groupes.tpl
templates/xnet/skin.tpl
templates/xnetevents/edit.tpl
templates/xnetevents/index.tpl
templates/xnetevents/subscribe.tpl
templates/xnetgrp/announce-edit.tpl
templates/xnetgrp/annuaire.tpl
templates/xnetgrp/asso.tpl
templates/xnetgrp/edit.tpl
templates/xnetgrp/form.announce.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/index.tpl
upgrade/0.9.11/07_emails.sql
upgrade/0.9.11/08_skins.sql
upgrade/0.9.14/04_newsletter.sql
upgrade/0.9.3/10_aliases.sql
upgrade/0.9.4/80_medals.sql
upgrade/0.9.5/30_entreprises.sql
upgrade/0.9.6/20_watch_cat.sql
upgrade/0.9.7/00_xnet.sql
upgrade/0.9.8/00_admin.sql
upgrade/1.0.1/00_job.sql [new file with mode: 0644]
upgrade/1.0.1/01_profiles.sql [new file with mode: 0644]
upgrade/1.0.1/02_accounts.sql [new file with mode: 0644]
upgrade/1.0.1/03_medals.sql [new file with mode: 0644]
upgrade/1.0.1/connect.db.inc.php [new symlink]
upgrade/1.0.1/phone.php [new file with mode: 0755]

index eeeefd6..e2a9d63 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,45 @@
 ================================================================================
+VERSION 1.0.1                                                         XX XX XXXX
+
+From 1.0.0 branch:
+    * AXLetter:
+        - Fix unsubscription                                               -XEL
+
+    * Carnet:
+        - Fix inaccessible carnet/panel in case of profile update          -FRU
+        - Fix notification email                                           -JAC
+
+    * Events:
+        - Fix promotion_ml reminder                                        -FRU
+
+    * Lists:
+        - Fix inclusion of banana for achives and moderation preview       -FRU
+
+    * Profile:
+        - Fix entreprise validation                                        -JAC
+        - Fix name validation                                              -XEL
+        - Fix orange validation                                            -XEL
+        - Fix vcards                                                       -FRU
+        - Fix geocoding                                                    -JAC
+
+    * Newsletter:
+        - Fix user selection                                               -FRU
+
+    * Register:
+        - Fix calls to missing functions                                   -JAC
+
+    * Search:
+        - Fix filtering by promotion                                       -XEL
+        - Fix search by address                                            -XEL
+
+    * XnetGrp:
+        - Fix name in unsubscription notification                          -JAC
+        - Fix mailer sending O(n^2) mails                                  -VZA
+
+    * XnetList:
+        - Fix group directory synchronization page                         -JAC
+
+================================================================================
 VERSION 1.0.0                                                         30 06 2010
 
 New:
index bb8ae77..55603ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,7 @@ core:
 ## conf
 ##
 
-conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp 
+conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp
 
 spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp spool/run:
        mkdir -p $@
diff --git a/bin/cron/profile_modification.php b/bin/cron/profile_modification.php
new file mode 100755 (executable)
index 0000000..0aa2172
--- /dev/null
@@ -0,0 +1,88 @@
+#!/usr/bin/php5 -q
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2010 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                *
+ ***************************************************************************/
+
+require_once 'connect.db.inc.php';
+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, al.alias
+                        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  aliases               AS al ON (ap.uid = al.uid AND FIND_IN_SET(\'bestalias\', al.flags))
+                    ORDER BY  pm.pid, pm.field');
+
+$date = time();
+$values = $res->next();
+
+$pid = $values['pid'];
+$sex = ($values['sex'] == 'female') ? 1 : 0;
+$yourself = $values['yourself'];
+$alias = $values['alias'];
+$hrpid = $values['hrpid'];
+$modifications = array();
+$modifications[] = array(
+    'full_name' => $values['full_name'],
+    'field'     => $values['field'],
+    'oldText'   => $values['oldText'],
+    'newText'   => $values['newText'],
+);
+
+while ($values = $res->next()) {
+    if ($values['pid'] != $pid) {
+        $mailer = new PlMailer('profile/notification.mail.tpl');
+        $mailer->addTo($alias . '@' . $globals->mail->domain);
+        $mailer->assign('modifications', $modifications);
+        $mailer->assign('yourself', $yourself);
+        $mailer->assign('hrpid', $hrpid);
+        $mailer->assign('sex', $sex);
+        $mailer->assign('date', $date);
+        $mailer->send();
+        $modifications = array();
+    }
+    $pid = $values['pid'];
+    $sex = ($values['sex'] == 'female') ? 1 : 0;
+    $yourself = $values['yourself'];
+    $alias = $values['alias'];
+    $hrpid = $values['hrpid'];
+    $modifications[] = array(
+        'full_name' => $values['full_name'],
+        'field'     => $values['field'],
+        'oldText'   => $values['oldText'],
+        'newText'   => $values['newText'],
+    );
+}
+$mailer = new PlMailer('profile/notification.mail.tpl');
+$mailer->addTo($alias . '@' . $globals->mail->domain);
+$mailer->assign('modifications', $modifications);
+$mailer->assign('yourself', $yourself);
+$mailer->assign('hrpid', $hrpid);
+$mailer->assign('sex', $sex);
+$mailer->assign('date', $date);
+$mailer->send();
+
+XDB::execute('DELETE FROM  profile_modifications');
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
index c385c1d..66f758d 100755 (executable)
@@ -6,8 +6,8 @@ require_once 'connect.db.inc.php';
 require_once 'marketing.inc.php';
 
 $opts = getopt('f:l:m:');
-if (($opts['f'] && $opts['f'] == '-') || empty($opts['f'])) { 
-    $file = 'php://stdin'; 
+if (($opts['f'] && $opts['f'] == '-') || empty($opts['f'])) {
+    $file = 'php://stdin';
 } else {
     $file = $opts['f'];
 }
index e0b485d..c6fbf0d 100644 (file)
@@ -40,6 +40,9 @@ class DirEnum
     const EDUDEGREES     = 'educationdegrees';
     const EDUFIELDS      = 'educationfields';
 
+    const CORPS          = 'corps';
+    const CORPSRANKS     = 'corpsranks';
+
     const NATIONALITIES  = 'nationalities';
     const COUNTRIES      = 'countries';
     const ADMINAREAS     = 'adminareas';
@@ -51,6 +54,8 @@ class DirEnum
 
     const NETWORKS       = 'networking';
 
+    const MEDALS         = 'medals';
+
     static private $enumerations = array();
 
     static private function init($type)
@@ -238,6 +243,9 @@ abstract class DirEnumeration
     }
     // }}}
 
+    /** Builds a list of query parts for searching @$text in @$field :
+     * field LIKE 'text%', field LIKE '% text%', field LIKE '%-text%'
+     */
     private function mkTests($field, $text)
     {
         $tests = array();
@@ -520,6 +528,32 @@ class DE_EducationFields extends DirEnumeration
 }
 // }}}
 
+// {{{ class DE_Corps
+class DE_Corps extends DirEnumeration
+{
+    protected $idfield   = 'corps_enum.id';
+    protected $valfield  = 'corps_enum.name';
+    protected $valfield2 = 'corps_enum.abbrev';
+    protected $from      = 'corps_enum';
+
+    protected $ac_unique = 'corps.pid';
+    protected $ac_join   = 'INNER JOIN corps ON (corps.current_corpsid = corps_enum.id)';
+}
+// }}}
+
+// {{{ class DE_CorpsRanks
+class DE_CorpsRanks extends DirEnumeration
+{
+    protected $idfield   = 'corps_rank_enum.id';
+    protected $valfield  = 'corps_rank_enum.name';
+    protected $valfield2 = 'corps_rank_enum.abbrev';
+    protected $from      = 'corps_rank_enum';
+
+    protected $ac_unique = 'corps.pid';
+    protected $ac_join   = 'INNER JOIN corps ON (corps.rankid = corps_rank_enum.id)';
+}
+// }}}
+
 /** GEOLOC
  */
 // {{{ class DE_Nationalities
@@ -627,5 +661,17 @@ class DE_Networking extends DirEnumeration
 }
 // }}}
 
+/** MEDALS
+ */
+// {{{ class DE_Medals
+class DE_Medals extends DirEnumeration
+{
+    protected $from = 'profile_medal_enum';
+
+    protected $ac_join = 'INNER JOIN profile_medals ON (profile_medals.mid = profile_medal_enum.id)';
+    protected $ac_unique = 'profile_medals.pid';
+}
+// }}}
+
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index ee23cab..10d625b 100644 (file)
@@ -198,6 +198,14 @@ class Profile
         return $this->owner;
     }
 
+    public function isActive()
+    {
+        if ($this->owner()) {
+            return $this->owner->isActive();
+        }
+        return false;
+    }
+
     public function promo()
     {
         return $this->promo;
@@ -371,14 +379,15 @@ class Profile
     public function nationalities()
     {
         $nats = array();
+        $countries = DirEnum::getOptions(DirEnum::COUNTRIES);
         if ($this->nationality1) {
-            $nats[] = $this->nationality1;
+            $nats[$this->nationality1] = $countries[$this->nationality1];
         }
         if ($this->nationality2) {
-            $nats[] = $this->nationality2;
+            $nats[$this->nationality2] = $countries[$this->nationality2];
         }
         if ($this->nationality3) {
-            $nats[] = $this->nationality3;
+            $nats[$this->nationality3] = $countries[$this->nationality3];
         }
         return $nats;
     }
@@ -841,8 +850,8 @@ class Profile
 
         $it = XDB::Iterator('SELECT  p.pid, p.hrpid, p.xorg_id, p.ax_id, p.birthdate, p.birthdate_ref,
                                      p.next_birthday, p.deathdate, p.deathdate_rec, p.sex = \'female\' AS sex,
-                                     p.cv, p.medals_pub, p.alias_pub, p.email_directory, p.last_change,
-                                     p.nationality1, p.nationality2, p.nationality3,
+                                     IF ({?}, p.cv, NULL) AS cv, p.medals_pub, p.alias_pub, p.email_directory,
+                                     p.last_change, p.nationality1, p.nationality2, p.nationality3,
                                      IF (p.freetext_pub IN {?}, p.freetext, NULL) AS freetext,
                                      pe.entry_year, pe.grad_year,
                                      IF ({?}, pse.text, NULL) AS section,
@@ -850,8 +859,9 @@ class Profile
                                      IF( {?}, pn_n.name, NULL) AS nickname,
                                      IF(pn_uf.name IS NULL, pn_f.name, pn_uf.name) AS firstname_ordinary,
                                      IF(pn_ul.name IS NULL, pn_l.name, pn_ul.name) AS lastname_ordinary,
-                                     pd.yourself, pd.promo, pd.short_name, pd.directory_name AS full_name,
-                                     pd.directory_name, IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile,
+                                     pd.yourself, pd.promo, pd.short_name, pd.public_name AS full_name,
+                                     pd.directory_name, pd.public_name, pd.private_name,
+                                     IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile,
                                      (ph.pub IN {?} AND ph.attach IS NOT NULL) AS has_photo,
                                      ph.x AS photo_width, ph.y AS photo_height,
                                      p.last_change < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_old,
@@ -878,11 +888,12 @@ class Profile
                               WHERE  p.pid IN {?}
                            GROUP BY  p.pid
                                      ' . $order,
-                           $visibility->levels(),
-                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
-                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
-                           $visibility->levels(),
-                           $visibility->levels(),
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // CV
+                           $visibility->levels(), // freetext
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // section
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // nickname
+                           $visibility->levels(), // mobile
+                           $visibility->levels(), // photo
                            $pids
                        );
         return new ProfileIterator($it, $pids, $fields, $visibility);
@@ -989,6 +1000,26 @@ class Profile
             || $name == self::DN_SHORT || $name == self::DN_SORT;
     }
 
+    /** Returns the closest "accounts only" name type for $name
+     */
+    public static function getAccountEquivalentName($name)
+    {
+        switch ($name)
+        {
+        case self::DN_DIRECTORY:
+        case self::DN_SORT:
+            return 'directory_name';
+        case self::DN_FULL:
+        case self::DN_PUBLIC:
+            return 'full_name';
+        case self::DN_PRIVATE:
+        case self::DN_SHORT:
+        case self::DN_YOURSELF:
+        default:
+            return 'display_name';
+        }
+    }
+
     public static function getNameTypeId($type, $for_sql = false)
     {
         if (!S::has('name_types')) {
@@ -1037,7 +1068,7 @@ class Profile
 
     /** The school identifier consists of 6 digits. The first 3 represent the
      * promotion entry year. The last 3 indicate the student's rank.
-     * 
+     *
      * Our identifier consists of 8 digits and both half have the same role.
      * This enables us to deal with bigger promotions and with a wider range
      * of promotions.
index f7f90fa..1c22fef 100644 (file)
@@ -91,16 +91,20 @@ class User extends PlUser
                 return $res->fetchOneCell();
             }
 
-            /** TODO: implements this by inspecting the profile.
             if (preg_match('/^(.*)\.([0-9]{4})$/u', $mbox, $matches)) {
                 $res = XDB::query('SELECT  a.uid
-                                     FROM  accounts AS a
-                               INNER JOIN  aliases AS al ON (al.id = a.uid AND al.type IN ('alias', 'a_vie'))
-                                    WHERE  al.alias = {?} AND a.promo = {?}', $matches[1], $matches[2]);
+                                     FROM  accounts          AS a
+                               INNER JOIN  aliases           AS al ON (al.uid = a.uid AND al.type IN (\'alias\', \'a_vie\'))
+                               INNER JOIN  account_profiles  AS ap ON (a.uid = ap.uid AND FIND_IN_SET(\'owner\', ap.perms))
+                               INNER JOIN  profiles          AS p  ON (p.pid = ap.pid)
+                               INNER JOIN  profile_education AS pe ON (p.pid = pe.pid AND FIND_IN_SET(\'primary\', pe.flags))
+                                    WHERE  p.hrpid = {?} OR ((pe.entry_year <= {?} AND pe.grad_year >= {?}) AND al.alias = {?})
+                                 GROUP BY  a.uid',
+                                   $matches[0], $matches[2], $matches[2], $matches[1]);
                 if ($res->numRows() == 1) {
                     return $res->fetchOneCell();
                 }
-            }*/
+            }
 
             throw new UserNotFoundException();
         }
@@ -175,17 +179,18 @@ class User extends PlUser
         $uids = array_map(array('XDB', 'escape'), $uids);
 
         return XDB::iterator('SELECT  a.uid, a.hruid, a.registration_date, ah.alias AS homonym,
-                                      IF (af.alias IS NULL, a.email, CONCAT(af.alias, \'@' . $globals->mail->domain . '\')) AS forlife,
-                                      CONCAT(af.alias, \'@' . $globals->mail->domain2 . '\') AS forlife_alternate,
-                                      IF (ab.alias IS NULL, a.email, CONCAT(ab.alias, \'@' . $globals->mail->domain . '\')) AS bestalias,
-                                      CONCAT(ab.alias, \'@' . $globals->mail->domain2 . '\') AS bestalias_alternate,
-                                      a.full_name, a.display_name, a.sex = \'female\' AS gender,
+                                      IF (af.alias IS NULL, NULL, CONCAT(af.alias, \'@' . $globals->mail->domain . '\')) AS forlife,
+                                      IF (af.alias IS NULL, NULL, CONCAT(af.alias, \'@' . $globals->mail->domain2 . '\')) AS forlife_alternate,
+                                      IF (ab.alias IS NULL, NULL, CONCAT(ab.alias, \'@' . $globals->mail->domain . '\')) AS bestalias,
+                                      IF (ab.alias IS NULL, NULL, CONCAT(ab.alias, \'@' . $globals->mail->domain2 . '\')) AS bestalias_alternate,
+                                      a.email, a.full_name, a.directory_name, a.display_name, a.sex = \'female\' AS gender,
                                       IF(a.state = \'active\', at.perms, \'\') AS perms,
                                       a.email_format, a.is_admin, a.state, a.type, a.skin,
                                       FIND_IN_SET(\'watch\', a.flags) AS watch, a.comment,
-                                      a.weak_password IS NOT NULL AS weak_access,
-                                      a.token IS NOT NULL AS token_access,
-                                      (e.email IS NULL AND NOT FIND_IN_SET(\'googleapps\', eo.storage)) AND a.state != \'pending\' AS lost
+                                      a.weak_password IS NOT NULL AS weak_access, g.g_account_name IS NOT NULL AS googleapps,
+                                      a.token IS NOT NULL AS token_access, a.token, a.last_version,
+                                      (e.email IS NULL AND NOT FIND_IN_SET(\'googleapps\', eo.storage)) AND a.state != \'pending\' AS lost,
+                                      UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, UNIX_TIMESTAMP(fp.last_seen) AS banana_last
                                       ' . $fields . '
                                 FROM  accounts AS a
                           INNER JOIN  account_types AS at ON (at.type = a.type)
@@ -194,6 +199,10 @@ class User extends PlUser
                            LEFT JOIN  aliases AS ah ON (ah.uid = a.uid AND ah.type = \'homonyme\')
                            LEFT JOIN  emails AS e ON (e.uid = a.uid AND e.flags = \'active\')
                            LEFT JOIN  email_options AS eo ON (eo.uid = a.uid)
+                           LEFT JOIN  gapps_accounts AS g ON (a.uid = g.l_userid AND g.g_status = \'active\')
+                           LEFT JOIN  log_last_sessions AS ls ON (ls.uid = a.uid)
+                           LEFT JOIN  log_sessions AS s ON (s.id = ls.id)
+                           LEFT JOIN  forum_profiles AS fp ON (fp.uid = a.uid)
                                    ' . $joins . '
                                WHERE  a.uid IN (' . implode(', ', $uids) . ')
                             GROUP BY  a.uid
@@ -212,35 +221,6 @@ class User extends PlUser
         $this->fillFromArray(self::loadMainFieldsFromUIDs(array($this->uid))->next());
     }
 
-    // Specialization of the fillFromArray method, to implement hacks to enable
-    // lazy loading of user's main properties from the session.
-    // TODO(vzanotti): remove the conversion hacks once the old codebase will
-    // stop being used actively.
-    protected function fillFromArray(array $values)
-    {
-        // Also, if display_name and full_name are not known, but the user's
-        // surname and last name are, we can construct the former two.
-        if (isset($values['prenom']) && isset($values['nom'])) {
-            if (!isset($values['display_name'])) {
-                $values['display_name'] = ($values['prenom'] ? $values['prenom'] : $values['nom']);
-            }
-            if (!isset($values['full_name'])) {
-                $values['full_name'] = $values['prenom'] . ' ' . $values['nom'];
-            }
-        }
-
-        // We also need to convert the gender (usually named "femme"), and the
-        // email format parameter (valued "texte" instead of "text").
-        if (isset($values['femme'])) {
-            $values['gender'] = (bool) $values['femme'];
-        }
-        if (isset($values['mail_fmt'])) {
-            $values['email_format'] = $values['mail_fmt'];
-        }
-
-        parent::fillFromArray($values);
-    }
-
     // Specialization of the buildPerms method
     // This function build 'generic' permissions for the user. It does not take
     // into account page specific permissions (e.g X.net group permissions)
@@ -264,6 +244,11 @@ class User extends PlUser
                                    WHERE  a.uid = {?}', $this->id());
     }
 
+    public function isActive()
+    {
+        return $this->state == 'active';
+    }
+
     /** Overload PlUser::promo(): there no promo defined for a user in the current
      * schema. The promo is a field from the profile.
      */
@@ -291,11 +276,35 @@ class User extends PlUser
         return $this->profile()->lastName();
     }
 
+    public function displayName()
+    {
+        if (!$this->hasProfile()) {
+            return $this->display_name;
+        }
+        return $this->profile()->yourself;
+    }
+
+    public function fullName($with_promo = false)
+    {
+        if (!$this->hasProfile()) {
+            return $this->full_name;
+        }
+        return $this->profile()->fullName($with_promo);
+    }
+
+    public function directoryName()
+    {
+        if (!$this->hasProfile()) {
+            return $this->directory_name;
+        }
+        return $this->profile()->directory_name;
+    }
+
     /** Return the main profile attached with this account if any.
      */
-    public function profile()
+    public function profile($forceFetch = false)
     {
-        if (!$this->_profile_fetched) {
+        if (!$this->_profile_fetched || $forceFetch) {
             $this->_profile_fetched = true;
             $this->_profile = Profile::get($this);
         }
@@ -380,32 +389,58 @@ class User extends PlUser
      */
     private function fetchMarketingData()
     {
-        if (isset($this->last_known_email)) {
+        if (isset($this->pending_registration_date)) {
             return;
         }
-        // FIXME: We should fetch the last known email as well as the pending registration email (they aren't the same !)
-        $infos = XDB::fetchOneAssoc('SELECT  IF (MAX(m.last) > p.relance, MAX(m.last), p.relance) AS last_relance,
-                                             p.email AS last_known_email
-                                       FROM  register_pending AS p
-                                  LEFT JOIN  register_marketing AS m ON (p.uid = m.uid)
-                                      WHERE  p.uid = {?}
-                                   GROUP BY  p.uid', $this->id());
-        if (!$infos) {
-            $infos = array('last_relance' => null, 'last_known_email' => null);
+        $infos = XDB::fetchOneAssoc('SELECT  rp.date AS pending_registration_date, rp.email AS pending_registration_email,
+                                             rm.last AS last_marketing_date, rm.email AS last_marketing_email
+                                       FROM  accounts           AS a
+                                  LEFT JOIN  register_pending   AS rp ON (rp.uid = a.uid)
+                                  LEFT JOIN  register_marketing AS rm ON (rm.uid = a.uid AND rm.last != \'0000-00-00\')
+                                      WHERE  a.uid = {?}
+                                   ORDER BY  rm.last DESC', $this->id());
+        if (is_null($infos)) {
+            $infos = array(
+                'pending_registration_date'  => null,
+                'pending_registration_email' => null,
+                'last_marketing_date'        => null,
+                'last_marketing_email'       => null
+            );
         }
         $this->fillFromArray($infos);
     }
 
-    public function lastMarketingRelance()
+    public function pendingRegistrationDate()
+    {
+        $this->fetchMarketingData();
+        return $this->pending_registration_date;
+    }
+
+    public function pendingRegistrationEmail()
     {
         $this->fetchMarketingData();
-        return $this->last_relance;
+        return $this->pending_registration_email;
+    }
+
+    public function lastMarketingDate()
+    {
+        $this->fetchMarketingData();
+        return $this->last_marketing_date;
+    }
+
+    public function lastMarketingEmail()
+    {
+        $this->fetchMarketingData();
+        return $this->last_marketing_email;
     }
 
     public function lastKnownEmail()
     {
         $this->fetchMarketingData();
-        return $this->last_known_email;
+        if ($this->pending_registration_email > $this->last_marketing_date) {
+            return $this->pending_registration_email;
+        }
+        return $this->last_marketing_email;
     }
 
 
@@ -422,7 +457,6 @@ class User extends PlUser
         $this->email_format = $format;
     }
 
-
     /** Get watch informations
      */
     private function fetchWatchData()
@@ -642,66 +676,98 @@ class User extends PlUser
         }
 
         $mmlist = new MMList($this);
-        $mmlist->kill($alias, $clearAll);
+        $mmlist->kill($this->hruid, $clearAll);
     }
 
     // Merge all infos in other user and then clean this one
     public function mergeIn(User &$newuser) {
-        if ($this->profile() || !$newuser->id()) {
-            // don't disable user with profile in this way
+        if ($this->profile()) {
+            // Don't disable user with profile in this way.
+            global $globals;
+            Platal::page()->trigError('Impossible de fusionner les comptes ' . $this->hruid . ' et ' . $newuser->hruid .
+                                      '. Contacte support@' . $globals->mail->domain . '.');
             return false;
         }
-        // TODO check all tables to see if there is no other info to use
 
-        $newemail = $newuser->forlifeEmail();
-        if (!$newemail && $this->forlifeEmail()) {
-            XDB::execute("UPDATE  accounts
-                             SET  email = {?}
-                           WHERE  uid = {?} AND email IS NULL",
-                    $this->forlifeEmail(), $newuser->id());
-            $newemail = $this->forlifeEmail();
-        }
-
-        // change email used in aliases and mailing lists
-        if ($this->forlifeEmail() != $newemail && $this->forlifeEmail()) {
-            // virtual_redirect (email aliases)
-            XDB::execute("DELETE  v1
-                            FROM  virtual_redirect AS v1, virtual_redirect AS v2
-                           WHERE  v1.vid = v2.vid AND v1.redirect = {?} AND v2.redirect = {?}",
-                    $this->forlifeEmail(), $newemail);
-            XDB::execute("UPDATE  virtual_redirect
-                             SET  redirect = {?}
-                           WHERE  redirect = {?}",
-                    $newemail, $this->forlifeEmail());
-
-            // require_once 'mmlist.php';
-
-            // group mailing lists
-            $group_domains = XDB::fetchColumn("SELECT  g.mail_domain
-                          FROM  groups AS g
-                    INNER JOIN  group_members AS gm ON(g.id = gm.asso_id)
-                         WHERE  g.mail_domain != '' AND gm.uid = {?}",
-                    $this->id());
-            foreach ($group_domains as $mail_domain) {
-                $mmlist = new MMList($this, $mail_domain);
-                $mmlist->replace_email_in_all($this->forlifeEmail(), $newmail);
+        if ($this->forlifeEmail()) {
+            // If the new user is not registered and does not have already an email address,
+            // we need to give him the old user's email address if he has any.
+            if (!$newuser->perms) {
+                XDB::execute('UPDATE  accounts
+                                 SET  email = {?}
+                               WHERE  uid = {?} AND email IS NULL',
+                             $this->forlifeEmail(), $newuser->id());
             }
-            // main domain lists
-            $mmlist = new MMList($this);
-            $mmlist->replace_email_in_all($this->forlifeEmail(), $newmail);
-        }
-
-        // group_members (xnet group membership)
-        XDB::execute("DELETE  g1
-                        FROM  group_members AS g1, group_members AS g2
-                       WHERE  g1.uid = {?} AND g2.uid = {?} AND g1.asso_id = g2.asso_id",
-                    $this->id(), $newuser->id());
-        XDB::execute("UPDATE  group_members
-                         SET  uid = {?}
-                       WHERE  uid = {?}",
-                    $this->id(), $newuser->id());
+            $newemail = XDB::fetchOneCell('SELECT  email
+                                             FROM  accounts
+                                            WHERE  uid = {?}',
+                                          $newuser->id());
+
+            // Change email used in aliases and mailing lists.
+            if ($this->forlifeEmail() != $newemail) {
+                // virtual_redirect (email aliases)
+                XDB::execute('DELETE  v1
+                                FROM  virtual_redirect AS v1, virtual_redirect AS v2
+                               WHERE  v1.vid = v2.vid AND v1.redirect = {?} AND v2.redirect = {?}',
+                             $this->forlifeEmail(), $newemail);
+                XDB::execute('UPDATE  virtual_redirect
+                                 SET  redirect = {?}
+                               WHERE  redirect = {?}',
+                             $newemail, $this->forlifeEmail());
+
+                // group mailing lists
+                $group_domains = XDB::fetchColumn('SELECT  g.mail_domain
+                                                     FROM  groups        AS g
+                                               INNER JOIN  group_members AS gm ON(g.id = gm.asso_id)
+                                                    WHERE  g.mail_domain != \'\' AND gm.uid = {?}',
+                                                  $this->id());
+                foreach ($group_domains as $mail_domain) {
+                    $mmlist = new MMList($this, $mail_domain);
+                    $mmlist->replace_email_in_all($this->forlifeEmail(), $newemail);
+                }
+                // main domain lists
+                $mmlist = new MMList($this);
+                $mmlist->replace_email_in_all($this->forlifeEmail(), $newemail);
+            }
+        }
+
+        // Updates user in following tables.
+        foreach (array('group_announces', 'payment_transactions', 'log_sessions') as $table) {
+            XDB::execute('UPDATE  ' . $table . '
+                             SET  uid = {?}
+                           WHERE  uid = {?}',
+                         $newuser->id(), $this->id());
+        }
+        XDB::execute('UPDATE  group_events
+                         SET  organisateur_uid = {?}
+                       WHERE  organisateur_uid = {?}',
+                     $newuser->id(), $this->id());
+
+        // Merges user in following tables, ie updates when possible, then deletes remaining occurences of the old user.
+        foreach (array('group_announces_read', 'group_event_participants', 'group_member_sub_requests', 'group_members') as $table) {
+            XDB::execute('UPDATE IGNORE  ' . $table . '
+                                    SET  uid = {?}
+                                  WHERE  uid = {?}',
+                         $newuser->id(), $this->id());
+            XDB::execute('DELETE FROM  ' . $table . '
+                                WHERE  uid = {?}',
+                         $this->id());
+        }
 
-        XDB::execute("DELETE FROM accounts WHERE uid = {?}", $this->id());
+        // Eventually updates last session id and deletes old user's accounts entry.
+        $lastSession = XDB::fetchOneCell('SELECT  id
+                                            FROM  log_sessions
+                                           WHERE  uid = {?}
+                                        ORDER BY  start DESC
+                                           LIMIT  1',
+                                         $newuser->id());
+        XDB::execute('UPDATE  log_last_sessions
+                         SET  id = {?}
+                       WHERE  uid = {?}',
+                     $newuser->id());
+        XDB::execute('DELETE FROM  accounts
+                            WHERE  uid = {?}',
+                     $this->id());
 
         return true;
     }
index 058def4..becf26b 100644 (file)
@@ -939,7 +939,7 @@ class UFC_Job_Company implements UserFilterCondition
     public function buildCondition(PlFilter &$uf)
     {
         $sub = $uf->addJobCompanyFilter();
-        $cond  = $sub . '.' . $this->type . ' = ' . XDB::format('{?}', $this->value);
+        $cond  = $sub . '.' . $this->type . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->value);
         return $cond;
     }
 }
@@ -1401,7 +1401,13 @@ class UFO_Name extends UserFilterOrder
     {
         if (Profile::isDisplayName($this->type)) {
             $sub = $uf->addDisplayFilter();
-            return 'pd' . $sub . '.' . $this->type;
+            $token = 'pd' . $sub . '.' . $this->type;
+            if ($uf->accountsRequired()) {
+                $account_token = Profile::getAccountEquivalentName($this->type);
+                return 'IFNULL(' . $token . ', a.' . $account_token . ')';
+            } else {
+                return $token;
+            }
         } else {
             $sub = $uf->addNameFilter($this->type, $this->variant);
             if ($this->particle) {
@@ -1578,7 +1584,7 @@ class UFO_Hrpid extends UserFilterOrder
  * when referring to the joined table.
  *
  * For example, if data from profile_job must be available to filter results,
- * the UFC object will call $uf-addJobFilter(), which will set the 'with_pj' var and 
+ * the UFC object will call $uf-addJobFilter(), which will set the 'with_pj' var and
  * return 'pj', the short name to use when referring to profile_job; when building
  * the query, calling the jobJoins function will return an array containing a single
  * row:
@@ -1980,11 +1986,21 @@ class UserFilter extends PlFilter
         $this->with_accounts = true;
     }
 
+    public function accountsRequired()
+    {
+        return $this->with_accounts;
+    }
+
     public function requireProfiles()
     {
         $this->with_profiles = true;
     }
 
+    public function profilesRequired()
+    {
+        return $this->with_profiles;
+    }
+
     protected function accountJoins()
     {
         $joins = array();
@@ -2286,7 +2302,7 @@ class UserFilter extends PlFilter
                 if (!is_array($key)) {
                     $key = array($key);
                 }
-                $joins['e' . $sub] = PlSqlJoin::left('emails', '$ME.uid = $UID AND $ME.flags != \'filter\' 
+                $joins['e' . $sub] = PlSqlJoin::left('emails', '$ME.uid = $UID AND $ME.flags != \'filter\'
                                                                AND $ME.email IN {?}', $key);
             }
         }
@@ -2301,7 +2317,7 @@ class UserFilter extends PlFilter
                 if (!is_array($key)) {
                     $key = array($key);
                 }
-                $joins['al' . $sub] = PlSqlJoin::left('aliases', '$ME.uid = $UID AND $ME.type IN (\'alias\', \'a_vie\') 
+                $joins['al' . $sub] = PlSqlJoin::left('aliases', '$ME.uid = $UID AND $ME.type IN (\'alias\', \'a_vie\')
                                                                   AND $ME.alias IN {?}', $key);
             }
         }
index f4d8e00..2a63e16 100644 (file)
@@ -55,6 +55,8 @@ class XnetPage extends PlPage
     {
         if (!$this->nomenu) {
             $this->useMenu();
+        } else {
+            $this->assign('menu', false);
         }
         $this->_run('xnet/skin.tpl');
     }
index 0ebc2e6..5d9e07c 100644 (file)
@@ -107,7 +107,7 @@ class XnetSession extends XorgSession
                              LIMIT  1", $user->id());
         $sess = $res->fetchOneAssoc();
         $_SESSION = array_merge($_SESSION, $sess);
-        $this->makePerms(S::s('perms'), S::b('is_admin'));
+        $this->makePerms(S::s('perms'), S::user()->is_admin);
         S::kill('challenge');
         S::kill('loginX');
         S::kill('may_update');
index 7789318..02e34e4 100644 (file)
@@ -86,7 +86,7 @@ class XorgSession extends PlSession
                           $login);
         if (list($uid, $password) = $res->fetchOneRow()) {
             $expected_response = sha1("$uname:$password:" . S::v('challenge'));
-            /* XXX: Deprecates len(password) > 10 conversion */
+            /* Deprecates len(password) > 10 conversion. */
             if ($response != $expected_response) {
                 if (!S::logged()) {
                     Platal::page()->trigError('Mot de passe ou nom d\'utilisateur invalide');
@@ -190,35 +190,8 @@ class XorgSession extends PlSession
             S::set('auth', AUTH_MDP);
         }
 
-        // Retrieves main user properties.
-        /** TODO: Move needed informations to account tables */
-        /** TODO: Currently suppressed data are matricule, promo */
-        /** TODO: Use the User object to fetch all this */
-        $res  = XDB::query("SELECT  a.uid, a.hruid, a.display_name, a.full_name,
-                                    a.sex = 'female' AS femme, a.email_format,
-                                    a.token, FIND_IN_SET('watch', a.flags) AS watch_account,
-                                    UNIX_TIMESTAMP(fp.last_seen) AS banana_last,
-                                    a.last_version, g.g_account_name IS NOT NULL AS googleapps,
-                                    UNIX_TIMESTAMP(s.start) AS lastlogin, s.host,
-                                    a.is_admin, at.perms
-                              FROM  accounts          AS a
-                        INNER JOIN  account_types     AS at ON (a.type = at.type)
-                         LEFT JOIN  watch             AS w  ON (w.uid = a.uid)
-                         LEFT JOIN  forum_profiles    AS fp ON (fp.uid = a.uid)
-                         LEFT JOIN  gapps_accounts    AS g  ON (a.uid = g.l_userid AND g.g_status = 'active')
-                         LEFT JOIN  log_last_sessions AS ls ON (ls.uid = a.uid)
-                         LEFT JOIN  log_sessions      AS s  ON(s.id = ls.id)
-                             WHERE  a.uid = {?} AND a.state = 'active'", $user->id());
-        if ($res->numRows() != 1) {
-            return false;
-        }
-
-        $sess = $res->fetchOneAssoc();
-        $perms = $sess['perms'];
-        unset($sess['perms']);
-
-        // Loads the data into the real session.
-        $_SESSION = array_merge($_SESSION, $sess);
+        // Loads uid and hruid into the session for developement conveniance.
+        $_SESSION = array_merge($_SESSION, array('uid' => $user->id(), 'hruid' => $user->hruid));
 
         // Starts the session's logger, and sets up the permanent cookie.
         if (S::suid()) {
@@ -235,7 +208,7 @@ class XorgSession extends PlSession
         }
 
         // Finalizes the session setup.
-        $this->makePerms($perms, S::b('is_admin'));
+        $this->makePerms($user->perms, $user->is_admin);
         $this->securityChecks();
         $this->setSkin();
         $this->updateNbNotifs();
index de5ac1b..059b0d9 100644 (file)
@@ -66,3 +66,8 @@ from="Gestion des groupes X sur Polytechnique.net" <support@polytechnique.org>
 from="Webmaster Polytechnique.org" <web@polytechnique.org>
 to=registration+watch@staff.m4x.org
 replyto=registration+watch@staff.m4x.org
+
+[profile]
+from="Polytechnique.org" <validation_modification@polytechnique.org>
+cc="Polytechnique.org" <validation_modification@polytechnique.org>
+
index efc0a14..bb88941 100644 (file)
@@ -17,6 +17,9 @@ WD=/home/web/prod/platal/bin/cron
 0  2 * * *     web     cd $WD; ./notifs.birthday.php
 0  4 * * 6     web     cd $WD; ./notifs.send.php
 
+# profile modification notifications
+0 23 * * *     web     cd $WD; ./profile_modification.php
+
 # validations
 0 */3 * * *    web     cd $WD; ./cron_validations.php
 
diff --git a/core b/core
index 786bffb..ef138fd 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 786bffb570bfc2f5ff1dad386a9558501d4c16e8
+Subproject commit ef138fdcc27646d255cb98615c3e64724496c9bd
index 8a28ca6..061d5c8 100644 (file)
@@ -20,7 +20,7 @@
 
 function doChallengeResponse() {
     var new_pass = hash_encrypt(document.forms.login.password.value);
-    
+
     str = document.forms.loginsub.username.value + ":" +
         hash_encrypt(document.forms.login.password.value) + ":" +
         document.forms.loginsub.challenge.value;
index 6cf3cb0..4e211a1 100644 (file)
                                        function() {
                                                $(this).removeClass("ac_over");
                                        }
-                               ).click(function(e) { 
+                               ).click(function(e) {
                                        e.preventDefault();
                                        e.stopPropagation();
                                        selectItem(this)
                };
 
                function makeUrl(q) {
-                       var sep = options.url.indexOf('?') == -1 ? '?' : '&'; 
+                       var sep = options.url.indexOf('?') == -1 ? '?' : '&';
                        var url = options.url + sep + "q=" + encodeURI(q);
                        for (var i in options.extraParams) {
                                url += "&" + i + "=" + encodeURI(options.extraParams[i]);
                        autoFill: false,
                        width: 0
                }, $.fn.autocomplete.defaults, options);
-           
+
                options.width = parseInt(options.width, 10);
                
                return this.each(function() {
similarity index 61%
rename from htdocs/javascript/motdepasse.js
rename to htdocs/javascript/password.js
index 17864f2..578e345 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-function EnCryptedResponse() {
-    pw1 = document.forms.changepass.nouveau.value;
-    pw2 = document.forms.changepass.nouveau2.value;
-    if (pw1 != pw2) {
-        alert ("\nErreur : les deux champs ne sont pas identiques !")
+function hashResponse(password1, password2, hasConfirmation) {
+    pw1 = $('[name=' + password1 + ']').val();
+
+    if (hasConfirmation) {
+        pw2 = $('[name=' + password2 + ']').val();
+        if (pw1 != pw2) {
+            alert("\nErreur : les deux champs ne sont pas identiques !");
             return false;
-        exit;
+        }
+        $('[name=' + password2 + ']').val('');
+    } else if (pw1 == '********') {
+        return true;
     }
+
     if (pw1.length < 6) {
-        alert ("\nErreur : le nouveau mot de passe doit faire au moins 6 caractères !")
-            return false;
-        exit;
+        alert("\nErreur : le nouveau mot de passe doit faire au moins 6 caractères !");
+        return false;
+    }
+    if (!differentTypes(pw1)) {
+        alert ("\nErreur : le nouveau mot de passe doit comporter au moins deux types de caractères parmi les suivants : lettres minuscules, lettres majuscules, chiffres, caractères spéciaux.");
+        return false;
     }
 
-    str = hash_encrypt(document.forms.changepass.nouveau.value);
-    document.forms.changepass2.response2.value = str;
-
-    alert ("Le mot de passe que tu as rentré va être chiffré avant de nous parvenir par Internet ! Ainsi il ne circulera pas en clair.");
-    document.forms.changepass2.submit();
+    alert("Le mot de passe que tu as rentré va être chiffré avant de nous parvenir par Internet ! Ainsi il ne circulera pas en clair.");
+    $('[name=' + password1 + ']').val('');
+    $('[name=pwhash]').val(hash_encrypt(pw1));
     return true;
 }
 
-function EncryptedResponseInNestedForm() {
-    $('[name=nouveau]').val($('[name=password]').val());
-    $('[name=nouveau2]').val($('[name=password2]').val());
-    EnCryptedResponse();
-}
-
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
index eb8996a..ccc9c0b 100644 (file)
@@ -271,27 +271,42 @@ function getType(c) {
     }
 }
 
-function checkPassword(box, okLabel) {
+function differentTypes(password) {
     var prev = 0;
+
+    for (i = 0 ; i < password.length ; ++i) {
+        var type = getType(password.charAt(i));
+        if (prev != 0 && prev != type) {
+            return true;
+        }
+        prev = type;
+    }
+    return false;
+}
+
+function passwordStrength(password) {
     var prop = 0;
-    var pass = box.value;
-    var types = Array(0, 0, 0, 0, 0);
+    var prev = 0;
     var firstType = true;
-    for (i = 0 ; i < pass.length ; ++i) {
-        type = getType(pass.charAt(i));
+    var types = Array(0, 0, 0, 0, 0);
+
+    for (i = 0 ; i < password.length ; ++i) {
+        var type = getType(password.charAt(i));
         if (prev != 0 && prev != type) {
             prop += 5;
+            firstType = false;
         }
         prop += i;
         if (types[type] == 0 && !firstType) {
             prop += 15;
-        } else {
-            firstType = false;
         }
         types[type]++;
         prev = type;
     }
-    if (pass.length < 6) {
+    if (password.length < 6) {
+        prop *= 0.75;
+    }
+    if (firstType) {
         prop *= 0.75;
     }
     if (prop > 100) {
@@ -299,6 +314,14 @@ function checkPassword(box, okLabel) {
     } else if (prop < 0) {
         prop = 0;
     }
+
+    return prop;
+}
+
+function checkPassword(box, okLabel) {
+    var password = box.value;
+    var prop = passwordStrength(password);
+
     if (prop >= 60) {
         color = "#4f4";
         bgcolor = "#050";
@@ -320,7 +343,7 @@ function checkPassword(box, okLabel) {
            .parent().stop()
                     .animate({ backgroundColor: bgcolor }, 750);
     var submitButton = $(":submit[name='" + passwordprompt_submit + "']");
-    if (ok && pass.length >= 6) {
+    if (ok && password.length >= 6 && differentTypes(password)) {
         submitButton.attr("value", okLabel);
         submitButton.removeAttr("disabled");
     } else {
index 6a6a869..b43ab28 100644 (file)
@@ -101,7 +101,7 @@ class ForumsBanana extends Banana
         $time = null;
         if (!is_null($this->params) && isset($this->params['updateall'])) {
             $time = intval($this->params['updateall']);
-            S::set('banana_last', $time);
+            S::user()->banana_last = $time;
         }
 
         $infos = $this->fetchProfile();
@@ -119,7 +119,7 @@ class ForumsBanana extends Banana
         Banana::$profile['signature']               = $infos['sig'];
         Banana::$profile['display']                 = $infos['threads'];
         Banana::$profile['autoup']                  = $infos['maj'];
-        Banana::$profile['lastnews']                = S::v('banana_last');
+        Banana::$profile['lastnews']                = S::user()->banana_last;
         Banana::$profile['subscribe']               = $req->fetchColumn();
         Banana::$tree_unread = $infos['tree_unread'];
         Banana::$tree_read = $infos['tree_read'];
index 9d42694..c08c983 100644 (file)
@@ -77,7 +77,7 @@ function hook_platalRSS($group)
     } else {
         $group = '';
     }
-    return '/rss/' . $group . S::v('hruid') . '/' . S::s('token') . '/rss.xml';
+    return '/rss/' . $group . S::v('hruid') . '/' . S::user()->token . '/rss.xml';
 }
 
 function hook_platalMessageLink($params)
index 48cc59a..307183e 100644 (file)
@@ -57,7 +57,7 @@ class ModerationBanana extends Banana
 
     function __construct(User &$user, $params = null)
     {
-        ini_set('memory_limit', '128M'); 
+        ini_set('memory_limit', '128M');
 
         global $globals;
         ModerationBanana::$client = $params['client'];
index 7626b33..288aa66 100644 (file)
@@ -23,9 +23,12 @@ function fill_email_combobox(PlPage& $page, $user = null, $profile = null)
 {
     global $globals;
 
-    if (is_null($user) && is_null($profile)) {
+    if (is_null($user)) {
         $user = S::user();
-        $profile = $user->profile();
+    }
+    if (is_null($profile)) {
+        /* Always refetch the profile. */
+        $profile = $user->profile(true);
     }
     $email_type = "directory";
 
index a828366..620ae56 100644 (file)
@@ -93,6 +93,10 @@ class GMapsGeocoder extends Geocoder {
 
     // Maximum number of Geocoding calls to the Google Maps API.
     const MAX_GMAPS_RPC_CALLS = 5;
+    // Maximum levenshtein distance authorized between input and geocoded text in a single line.
+    const MAX_LINE_DISTANCE = 5;
+    // Maximum levenshtein distance authorized between input and geocoded text in the whole text.
+    const MAX_TOTAL_DISTANCE = 6;
 
     public function getGeocodedAddress(array $address) {
         $address = $this->prepareAddress($address);
@@ -134,16 +138,7 @@ class GMapsGeocoder extends Geocoder {
     // cleans up the final informations.
     private function getUpdatedAddress(array $address, array $geocodedData, $extraLines) {
         $this->fillAddressWithGeocoding(&$address, $geocodedData);
-
-        // If the accuracy is 6, it means only the street has been gecoded
-        // but not the number, thus we need to fix it.
-        if ($address['accuracy'] == 6) {
-            $this->fixStreetNumber($address);
-        }
-
-        // We can now format the address.
         $this->formatAddress($address, $extraLines);
-
         return $address;
     }
 
@@ -323,20 +318,23 @@ class GMapsGeocoder extends Geocoder {
         $countGeoloc = count($arrayGeoloc);
         $countText   = count($arrayText);
 
+        $totalDistance = 0;
         if (($countText > $countGeoloc) || ($countText < $countGeoloc - 1)
             || (($countText == $countGeoloc - 1)
                 && ($arrayText[$countText - 1] == strtoupper($address['country'])))) {
             $same = false;
         } else {
             for ($i = 0; $i < $countGeoloc && $i < $countText; ++$i) {
-                if (levenshtein($arrayText[$i], trim($arrayGeoloc[$i])) > 3) {
+                $lineDistance = levenshtein($arrayText[$i], trim($arrayGeoloc[$i]));
+                $totalDistance += $lineDistance;
+                if ($lineDistance > self::MAX_LINE_DISTANCE || $totalDistance > self::MAX_TOTAL_DISTANCE) {
                     $same = false;
+                    break;
                 }
             }
         }
+
         if ($same) {
-            $address['text'] = $address['geoloc'];
-            $address['postalText'] = $address['geocodedPostalText'];
             unset($address['geoloc'], $address['geocodedPostalText']);
         } else {
             $address['geoloc'] = str_replace("\n", "\r\n", $address['geoloc']);
@@ -345,7 +343,7 @@ class GMapsGeocoder extends Geocoder {
         $address['text'] = str_replace("\n", "\r\n", $address['text']);
         $address['postalText'] = str_replace("\n", "\r\n", $address['postalText']);
     }
+
     // Returns the address formated for postal use.
     // The main rules are (cf AFNOR XPZ 10-011):
     // -everything in upper case;
@@ -419,38 +417,6 @@ class GMapsGeocoder extends Geocoder {
         }
         return $address['text'];
     }
-
-    // Search for the lign from the given address that is the closest to the geocoded thoroughfareName
-    // and replaces the corresponding lign in the geocoded text by it.
-    static protected function fixStreetNumber(&$address)
-    {
-        if (isset($address['thoroughfareName'])) {
-            $thoroughfareName  = $address['thoroughfareName'];
-            $thoroughfareToken = strtoupper(trim(preg_replace(array("/[,\"'#~:;_\-]/", "/\r\n/"),
-                                                              array("", "\n"), $thoroughfareName)));
-            $geolocLines = explode("\n", $address['geoloc']);
-            $textLines   = explode("\n", $address['text']);
-            $mindist = strlen($thoroughfareToken);
-            $minpos  = 0;
-            $pos     = 0;
-            foreach ($textLines as $i => $token) {
-                if (($l = levenshtein(strtoupper(trim(preg_replace(array("/[,\"'#~:;_\-]/", "/\r\n/"),
-                                                                   array("", "\n"), $token))),
-                                      $thoroughfareToken)) < $mindist) {
-                    $mindist = $l;
-                    $minpos  = $i;
-                }
-            }
-            foreach ($geolocLines as $i => $line) {
-                if (strtoupper(trim($thoroughfareName)) == strtoupper(trim($line))) {
-                    $pos = $i;
-                    break;
-                }
-            }
-            $geolocLines[$pos] = $textLines[$minpos];
-            $address['geoloc'] = implode("\n", $geolocLines);
-        }
-    }
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
index 7b50b25..a6948ac 100644 (file)
@@ -77,7 +77,7 @@ class Marketing
         global $globals;
 
         if ($from == 'staff' || !($user = User::getSilent($sender))) {
-            return '"L\'équipe de Polytechnique.org" <register@' . $globals->mail->domain . '>';
+            return "\"L'équipe de Polytechnique.org\" <register@" . $globals->mail->domain . '>';
         }
         return '"' . $user->fullName() . '" <' . $user->bestEmail() . '>';
     }
@@ -116,7 +116,7 @@ class Marketing
         }
         $sender = substr($this->sender_mail, 1, strpos($this->sender_mail, '"', 2)-1);
         $text = str_replace(array('%%hash%%', '%%sender%%', '%%personal_notes%%'),
-                            array($this->hash, $this->sender_mail, ''), $text);
+                            array($this->hash, "Cordialement,\n-- \n" . $this->sender_mail, ''), $text);
         $mailer = new PlMailer();
         $mailer->setFrom($this->sender_mail);
         $mailer->addTo($this->user['mail']);
@@ -136,7 +136,8 @@ class Marketing
         $this->engine->process($this->user);
         if ($valid) {
             require_once 'validations.inc.php';
-            $valid = new MarkReq(User::getSilent($this->sender), $this->user['user'], $this->user['mail'],
+            $sender = User::getSilent($this->sender);
+            $valid = new MarkReq($sender, $this->user['user'], $this->user['mail'],
                                  $this->from == 'user', $this->type, $this->data, $this->personal_notes);
             $valid->submit();
         }
@@ -186,18 +187,12 @@ class Marketing
         }
     }
 
-    static public function getAliveUsersCount()
-    {
-        $uf = new UserFilter(new PFC_Not(new UFC_Dead()));
-        return $uf->getTotalCount();
-    }
-
     static public function relance(PlUser &$user, $nbx = -1)
     {
         global $globals;
 
         if ($nbx < 0) {
-            $nbx = self::getAliveUsersCount();
+            $nbx = $globals->core->NbIns;
         }
 
         $res = XDB::fetchOneCell('SELECT  r.date, r.email, r.bestalias
@@ -254,10 +249,12 @@ class AnnuaireMarketing implements MarketingEngine
                      . "Pour y figurer, il te suffit de visiter cette page ou de copier cette adresse "
                      . "dans la barre de ton navigateur :";
         if ($from === null) {
-            $this->signature = "L'équipe de Polytechnique.org,\n"
-                             . "Le portail des élèves & anciens élèves de l'École polytechnique";
+            $page = new XorgPage();
+            $page->changeTpl('include/signature.mail.tpl', NO_SKIN);
+            $page->assign('mail_part', 'text');
+            $this->signature = $page->raw();
         } else {
-            $this->signature = "%%sender%%";
+            $this->signature = '%%sender%%';
         }
         if (is_null($personal_notes) || $personal_notes == '') {
             $this->personal_notes = '%%personal_notes%%';
@@ -291,7 +288,6 @@ class AnnuaireMarketing implements MarketingEngine
         $page->assign('intro', $this->getIntro());
         $page->assign('u', $user);
         $page->assign('sign', $this->getSignature());
-        $page->assign('num_users', Marketing::getAliveUsersCount());
         $page->assign('personal_notes', $this->getPersonalNotes());
     }
 
index 272f1e4..d954263 100644 (file)
@@ -189,7 +189,7 @@ function build_sort_name(&$search_names, &$sn_types)
     return $name;
 }
 
-function set_profile_display(&$display_names, $pid)
+function set_profile_display(&$display_names, Profile $profile)
 {
     XDB::execute("UPDATE  profile_display
                      SET  public_name = {?}, private_name = {?},
@@ -197,16 +197,14 @@ function set_profile_display(&$display_names, $pid)
                    WHERE  pid = {?}",
                  $display_names['public_name'], $display_names['private_name'],
                  $display_names['directory_name'], $display_names['short_name'],
-                 $display_names['sort_name'], $pid);
+                 $display_names['sort_name'], $profile->id());
 
-    /* XXX: Inefficient, should directly take the profile as parameter */
-    $profile = Profile::get($pid);
     $owner = $profile->owner();
     if ($owner) {
         XDB::execute('UPDATE  accounts
-                         SET  full_name = {?}
+                         SET  full_name = {?}, directory_name = {?}
                        WHERE  uid = {?}',
-                     $display_names['public_name'], $owner->id());
+                     $display_names['public_name'], $display_names['directory_name'], $owner->id());
     }
 }
 
index 75f770c..16b8e1e 100644 (file)
@@ -46,7 +46,8 @@ abstract class ProfileField
      * @param $pids An array of pids
      * @param $visibility The level of visibility fetched fields must have
      * @return a PlIterator yielding data suitable for a "new ProfileBlah($data)"
-     * XXX MUST be reimplemented for each kind of ProfileField
+     *
+     * MUST be reimplemented for each kind of ProfileField.
      */
     public static function fetchData(array $pids, ProfileVisibility $visibility)
     {
@@ -281,6 +282,11 @@ class Job
             $this->$key = $val;
         }
         $this->company = CompanyList::get($this->jobid);
+        if (is_null($this->company)) {
+            require_once 'validations.inc.php';
+            $entreprise = ProfileValidate::get_typed_requests($this->pid, 'entreprise');
+            $this->company = new Company(array('name' =>  $entreprise[$this->id]->name));
+        }
     }
 
     public function phones()
@@ -930,7 +936,6 @@ class CompanyList
             self::$companies[$row['id']] = $cp;
         }
 
-        // TODO: determine whether there can be phones attached to a hq's address
         // Add phones to hq
         if (count($newcompanies)) {
             $it = XDB::iterator('SELECT  search_tel AS search, display_tel AS display, comment, link_id, tel_type AS type, link_type, tel_id AS id
index 3def558..2f77f82 100644 (file)
@@ -78,7 +78,10 @@ function check_email($email, $message)
 
 function check_account()
 {
-    return S::v('watch_account');
+    if (S::user()) {
+        return S::user()->watch;
+    }
+    return false;
 }
 
 function check_redirect($red = null)
index 5924bf4..8ff76c2 100644 (file)
@@ -450,7 +450,7 @@ abstract class UFBF_Mixed extends UFB_Field
             }
             $this->val = array($index);
         } else {
-            $indexes = DirEnum::getIDs($this->direnum, $ufb->t($this->envfield), 
+            $indexes = DirEnum::getIDs($this->direnum, $ufb->t($this->envfield),
                 $ufb->b('exact') ? XDB::WILDCARD_EXACT : XDB::WILDCARD_CONTAINS);
             if (count($indexes) == 0) {
                 return false;
index dcc4b63..e04596a 100644 (file)
@@ -437,6 +437,7 @@ abstract class ProfileValidate extends Validate
     public $profile;
     public $profileOwner;
     public $userIsProfileOwner;
+    public $ownerIsRegistered;
 
     // }}}
     // {{{ constructor
@@ -453,11 +454,9 @@ abstract class ProfileValidate extends Validate
         parent::__construct($_user, $_unique, $_type);
         $this->profile = &$_profile;
         $this->profileOwner = $this->profile->owner();
-        if (!is_null($this->profileOwner) && $this->profileOwner->id() == $this->user->id()) {
-            $this->userIsProfileOwner = true;
-        } else {
-            $this->userIsProfileOwner = false;
-        }
+        $this->userIsProfileOwner = (!is_null($this->profileOwner)
+                                     && $this->profileOwner->id() == $this->user->id());
+        $this->ownerIsRegistered = $this->profile->isActive();
     }
 
     // }}}
@@ -525,24 +524,23 @@ abstract class ProfileValidate extends Validate
 
     protected function sendmail($isok)
     {
-        global $globals;
-        $mailer = new PlMailer();
-        $mailer->setSubject($this->_mail_subj());
-        $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
-        $mailer->addTo("\"{$this->profile->fullName()}\" <{$this->profileOwner->bestEmail()}>");
-        if (!$this->userIsProfileOwner) {
-            $mailer->addCc("\"{$this->user->fullName()}\" <{$this->user->bestEmail()}>");
-        }
-        $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}");
-
-        $body = ($this->profile->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n")
-              . $this->_mail_body($isok)
-              . (Env::has('comm') ? "\n\n" . Env::v('comm') : '')
-              . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n"
-              . $this->_mail_ps($isok);
+        // Only sends email if the profile's owner exists and is registered.
+        if ($this->ownerIsRegistered) {
+            global $globals;
 
-        $mailer->setTxtBody(wordwrap($body));
-        $mailer->send();
+            $mailer = new PlMailer();
+            $mailer->setSubject($this->_mail_subj());
+            $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
+            $mailer->addTo("\"{$this->profile->fullName()}\" <{$this->profileOwner->bestEmail()}>");
+            $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}");
+            $body = ($this->profile->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n")
+                  . $this->_mail_body($isok)
+                  . (Env::has('comm') ? "\n\n" . Env::v('comm') : '')
+                  . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n"
+                  . $this->_mail_ps($isok);
+            $mailer->setTxtBody(wordwrap($body));
+            $mailer->send();
+        }
     }
 
     // }}}
@@ -622,11 +620,7 @@ abstract class ProfileValidate extends Validate
 
     public function id()
     {
-        if (!is_null($this->profile)) {
-            return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
-        } else {
-            return $this->user->id() . '_' . $this->type . '_' . $this->stamp;
-        }
+        return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
     }
 
     // }}}
index cff4801..47e6a02 100644 (file)
@@ -68,12 +68,14 @@ class EntrReq extends ProfileValidate
                 $where .= "name LIKE '%" . $name_array[$i] . "%'";
             }
         }
-        $res = XDB::iterator('SELECT  name
-                                FROM  profile_job_enum
-                               WHERE  ' . $where);
-        $this->suggestions = "| ";
-        while ($sug = $res->next()) {
-            $this->suggestions .= $sug['name'] . " | ";
+        if ($where != '') {
+            $res = XDB::iterator('SELECT  name
+                                    FROM  profile_job_enum
+                                   WHERE  ' . $where);
+            $this->suggestions = "| ";
+            while ($sug = $res->next()) {
+                $this->suggestions .= $sug['name'] . " | ";
+            }
         }
     }
 
@@ -98,26 +100,37 @@ class EntrReq extends ProfileValidate
 
     protected function handle_editor()
     {
-        if (Env::has('holdingid')) {
-            $this->holdingid = Env::t('holdingid');
-        }
         if (Env::has('name')) {
             $this->name = Env::t('name');
-            if (Env::has('acronym')) {
-                $this->acronym = Env::t('acronym');
-                if (Env::has('url')) {
-                    $this->url = Env::t('url');
-                    if (Env::has('NAF_code')) {
-                        $this->NAF_code = Env::t('NAF_code');
-                        if (Env::has('AX_code')) {
-                            $this->AX_code = Env::t('AX_code');
-                            return true;
-                        }
-                    }
-                }
-            }
         }
-        return false;
+        if (Env::has('acronym')) {
+            $this->acronym = Env::t('acronym');
+        }
+        if (Env::has('url')) {
+            $this->url = Env::t('url');
+        }
+        if (Env::has('email')) {
+            $this->email = Env::t('email');
+        }
+        if (Env::has('holdingid')) {
+            $this->holdingid = Env::i('holdingid');
+        }
+        if (Env::has('NAF_code')) {
+            $this->NAF_code = Env::t('NAF_code');
+        }
+        if (Env::has('AX_code')) {
+            $this->AX_code = Env::i('AX_code');
+        }
+        if (Env::has('address')) {
+            $this->address['text'] = Env::t('address');
+        }
+        if (Env::has('tel')) {
+            $this->tel = Env::t('tel');
+        }
+        if (Env::has('fax')) {
+            $this->fax = Env::t('fax');
+        }
+        return true;
     }
 
     // }}}
index ddfdef5..4a7416f 100644 (file)
@@ -134,6 +134,7 @@ class EvtReq extends Validate
 
     public function commit()
     {
+        /* TODO: refines this filter on promotions by using userfilter. */
         if (XDB::execute("INSERT INTO  announces
                          SET  uid = {?}, creation_date=NOW(), titre={?}, texte={?},
                               expiration={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide,wiki')",
index 08fd85b..2893d65 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-// {{{ class NamesReq4
+// {{{ class NamesReq
 
 class NamesReq extends ProfileValidate
 {
@@ -130,7 +130,7 @@ class NamesReq extends ProfileValidate
     {
         require_once 'name.func.inc.php';
 
-        set_profile_display($this->display_names, $this->profile->id());
+        set_profile_display($this->display_names, $this->profile);
 
         if (!is_null($this->profileOwner)) {
             set_alias_names($this->sn_new, $this->sn_old, $this->profile->id(),
index 69dd47d..ebc9163 100755 (executable)
@@ -10,7 +10,7 @@ function ax_load_object(&$obj, $from)
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-class Ancien 
+class Ancien
 {
     public $NOM_PATR;
     public $PART_NOM;
@@ -34,7 +34,7 @@ class Ancien
     public $NUM_FORMATION = 0;
     public $Erreur;
 
-    public function __construct($aa) 
+    public function __construct($aa)
     {
         if ($aa<>'') {
             ax_load_object($this, $aa);
@@ -210,7 +210,7 @@ class Adresse
     public $TEL;
     public $FAX;
 
-    public function __construct($aa) 
+    public function __construct($aa)
     {
         ax_load_object($this, $aa);
     }
@@ -240,17 +240,17 @@ class Activite
     }
 }
 
-class Formation 
+class Formation
 {
     public $LIBELLE;
 
-    public function __construct($aa) 
+    public function __construct($aa)
     {
         ax_load_object($this, $aa);
     }
 }
 
-function xml_get_children($vals, &$i) 
+function xml_get_children($vals, &$i)
 {
     $children = array();
     if (isset($vals[$i]['value'])) $children[] = $vals[$i]['value'];
index 5970e89..caa412a 100644 (file)
@@ -413,22 +413,32 @@ class AdminModule extends PLModule
         if (Post::has('disable_weak_access')) {
             $to_update['weak_password'] = null;
         } else if (Post::has('update_account')) {
-            if (Post::s('full_name') != $user->fullName()) {
-                // XXX: Update profile if a profile is associated
-                $to_update['full_name'] = Post::s('full_name');
-            }
-            if (Post::s('display_name') != $user->displayName()) {
-                // XXX: Update profile if a profile is associated
-                $to_update['display_name'] = Post::s('display_name');
+            if (!$user->hasProfile()) {
+                if (Post::s('full_name') != $user->fullName()) {
+                    $to_update['full_name'] = Post::s('full_name');
+                }
+                if (Post::s('display_name') != $user->displayName()) {
+                    $to_update['display_name'] = Post::s('display_name');
+                }
+                if (Post::s('directory_name') != $user->directoryName()) {
+                    $to_update['directory_name'] = Post::s('directory_name');
+                }
             }
             if (Post::s('sex') != ($user->isFemale() ? 'female' : 'male')) {
                 $to_update['sex'] = Post::s('sex');
+                if ($user->hasProfile()) {
+                    XDB::execute('UPDATE  profiles
+                                     SET  sex = {?}
+                                   WHERE  pid = {?}',
+                                 Post::s('sex'), $user->profile()->id());
+                }
             }
-            if (!Post::blank('hashpass')) {
-                $to_update['password'] = Post::s('hashpass');
+            if (!Post::blank('pwhash')) {
+                $to_update['password'] = Post::s('pwhash');
+                require_once 'googleapps.inc.php';
                 $account = new GoogleAppsAccount($user);
                 if ($account->active() && $account->sync_password) {
-                    $account->set_password(Post::s('hashpass'));
+                    $account->set_password(Post::s('pwhash'));
                 }
             }
             if (!Post::blank('weak_password')) {
@@ -461,17 +471,43 @@ class AdminModule extends PLModule
             }
         }
         if (!empty($to_update)) {
-            // TODO: fetch the initial values of the fields, and eventually send
-            // a summary of the changes to an admin.
+            $res = XDB::query('SELECT  *
+                                 FROM  accounts
+                                WHERE  uid = {?}', $user->id());
+            $oldValues = $res->fetchAllAssoc();
+            $oldValues = $oldValues[0];
+
             $set = array();
+            $diff = array();
             foreach ($to_update as $k => $value) {
-                $set[] = XDB::format($k . ' = {?}', $value);
+                $value = XDB::format('{?}', $value);
+                $set[] = $k . ' = ' . $value;
+                $diff[$k] = array($oldValues[$k], trim($value, "'"));
+                unset($oldValues[$k]);
             }
             XDB::execute('UPDATE  accounts
-                             SET  ' . implode(', ', $set) . ' 
+                             SET  ' . implode(', ', $set) . '
                            WHERE  uid = ' . XDB::format('{?}', $user->id()));
             $page->trigSuccess('Données du compte mise à jour avec succès');
             $user = User::getWithUID($user->id());
+
+            /* Formats the $diff and send it to the site administrators. The rules are the folowing:
+             *  -formats: password, token, weak_password
+             */
+            foreach (array('password', 'token', 'weak_password') as $key) {
+                if (isset($diff[$key])) {
+                    $diff[$key] = array('old value', 'new value');
+                } else {
+                    $oldValues[$key] = 'old value';
+                }
+            }
+
+            $mail = new PlMailer('admin/useredit.mail.tpl');
+            $mail->assign('admin', S::user()->hruid);
+            $mail->assign('hruid', $user->hruid);
+            $mail->assign('diff', $diff);
+            $mail->assign('oldValues', $oldValues);
+            $mail->send();
         }
         // }}}
 
@@ -604,6 +640,7 @@ class AdminModule extends PLModule
 
         $page->addJsLink('jquery.ui.core.js');
         $page->addJsLink('jquery.ui.tabs.js');
+        $page->addJsLink('password.js');
 
         // Displays last login and last host information.
         $res = XDB::query("SELECT  start, host
@@ -638,6 +675,7 @@ class AdminModule extends PLModule
         }
 
         $page->assign('user', $user);
+        $page->assign('hasProfile', $user->hasProfile());
 
         // Displays forum bans.
         $res = XDB::query("SELECT  write_perm, read_perm, comment
@@ -741,7 +779,8 @@ class AdminModule extends PLModule
                     if ($infos = self::formatNewUser($page, $line, $separator, $promotion, 6)) {
                         $sex = self::formatSex($page, $infos[3], $line);
                         if (!is_null($sex)) {
-                            $name = $infos[1] . ' ' . $infos[0];
+                            $fullName = $infos[1] . ' ' . $infos[0];
+                            $directoryName = $infos[0] . ' ' . $infos[1];
                             $birthDate = self::formatBirthDate($infos[2]);
                             $xorgId = Profile::getXorgId($infos[4]);
                             if (is_null($xorgId)) {
@@ -762,13 +801,13 @@ class AdminModule extends PLModule
                             XDB::execute('INSERT INTO  profile_display (pid, yourself, public_name, private_name,
                                                                         directory_name, short_name, sort_name, promo)
                                                VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
-                                         $pid, $infos[1], $name, $name, $name, $name, $infos[0] . ' ' . $infos[1], $promo);
+                                         $pid, $infos[1], $fullName, $fullName, $directoryName, $fullName, $directoryName, $promo);
                             XDB::execute('INSERT INTO  profile_education (pid, eduid, degreeid, entry_year, grad_year, flags)
                                                VALUES  ({?}, {?}, {?}, {?}, {?}, {?})',
                                          $pid, $eduSchools[Profile::EDU_X], $degreeid, $entry_year, $grad_year, 'primary');
-                            XDB::execute('INSERT INTO  accounts (hruid, type, is_admin, state, full_name, display_name, sex)
+                            XDB::execute('INSERT INTO  accounts (hruid, type, is_admin, state, full_name, directory_name, display_name, sex)
                                                VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})',
-                                         $infos['hrid'], $type, 0, 'active', $name, $infos[1], $sex);
+                                         $infos['hrid'], $type, 0, 'active', $fullName, $directoryName, $infos[1], $sex);
                             $uid = XDB::insertId();
                             XDB::execute('INSERT INTO  account_profiles (uid, pid, perms)
                                                VALUES  ({?}, {?}, {?})',
@@ -783,9 +822,11 @@ class AdminModule extends PLModule
                     if ($infos = self::formatNewUser($page, $line, $separator, $type, 4)) {
                         $sex = self::formatSex($page, $infos[3], $line);
                         if (!is_null($sex)) {
-                            XDB::execute('INSERT INTO  accounts (hruid, type, is_admin, state, email, full_name, display_name, sex)
+                            $fullName = $infos[1] . ' ' . $infos[0];
+                            $directoryName = $infos[0] . ' ' . $infos[1];
+                            XDB::execute('INSERT INTO  accounts (hruid, type, is_admin, state, email, full_name, directory_name, display_name, sex)
                                                VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
-                                         $infos['hrid'], $type, 0, 'active', $infos[2], $infos[1] . ' ' . $infos[0], $infos[1], $sex);
+                                         $infos['hrid'], $type, 0, 'active', $infos[2], $fullName, $directoryName, $infos[1], $sex);
                             $newAccounts[$infos['hrid']] = $infos[1] . ' ' . $infos[0];
                         }
                     }
@@ -909,15 +950,19 @@ class AdminModule extends PLModule
                                   WHERE  pd.promo = {?}', $promo);
             while (list($pid, $name, $death) = $res->next()) {
                 $val = Env::v('death_' . $pid);
-                if($val == $death || empty($val)) {
+                if ($val == $death) {
                     continue;
                 }
 
+                if (empty($val)) {
+                    $val = null;
+                }
                 XDB::execute('UPDATE  profiles
                                  SET  deathdate = {?}, deathdate_rec = NOW()
                                WHERE  pid = {?}', $val, $pid);
-                $page->trigSuccess('Ajout du décès de ' . $name . ' le ' . $val . '.');
-                if($death == '0000-00-00' || empty($death)) {
+
+                $page->trigSuccess('Édition du décès de ' . $name . ' (' . ($val ? $val : 'ressuscité') . ').');
+                if ($val && ($death == '0000-00-00' || empty($death))) {
                     $profile = Profile::get($pid);
                     $profile->clear();
                     $profile->owner()->clear(false);
@@ -930,7 +975,7 @@ class AdminModule extends PLModule
                           INNER JOIN  profile_display AS pd ON (p.pid = pd.pid)
                                WHERE  pd.promo = {?}
                             ORDER BY  pd.sort_name', $promo);
-        $page->assign('decedes', $res);
+        $page->assign('profileList', $res);
     }
 
     function handler_dead_but_active(&$page)
@@ -1086,7 +1131,7 @@ class AdminModule extends PLModule
         $table_editor->apply($page, $action, $id);
     }
 
-    function handler_account_types(&$page, $action = 'list', $id = null) 
+    function handler_account_types(&$page, $action = 'list', $id = null)
     {
         $page->setTitle('Administration - Types de comptes');
         $page->assign('title', 'Gestion des types de comptes');
@@ -1100,7 +1145,7 @@ class AdminModule extends PLModule
     {
         if (S::hasAuthToken()) {
            $page->setRssLink('Changement Récents',
-                             '/Site/AllRecentChanges?action=rss&user=' . S::v('hruid') . '&hash=' . S::v('token'));
+                             '/Site/AllRecentChanges?action=rss&user=' . S::v('hruid') . '&hash=' . S::user()->token);
         }
 
         // update wiki perms
index f41b600..383745a 100644 (file)
@@ -34,7 +34,7 @@ function gpex_make($chlg, $privkey, $datafields, $charset)
 
     $user =& S::user();
     if ($user->hasProfile()) {
-        // XXX: Transition table for auth.
+        /* Transition table for authentification. */
         $personnal_data = $user->profile()->data();
         $personnal_data['matricule'] = $personnal_data['xorg_id'];
         $personnal_data['matricule_ax'] = $personnal_data['ax_id'];
index b47f1c5..d08b0bc 100644 (file)
@@ -179,7 +179,7 @@ class AXLetterModule extends PLModule
                     }
                     $page->trigSuccess("Les adresses soumises correspondent à un total de " . count(array_unique($ids)) . " camarades.");
                 }
-                // XXX : no break here, since Vérifier is a subcase of Aperçu.
+                // No break here, since Vérifier is a subcase of Aperçu.
               case 'Aperçu':
                 $this->load('axletter.inc.php');
                 $al = new AXLetter(array($id, $short_name, $subject, $title, $body, $signature,
index 761724c..f31f979 100644 (file)
@@ -175,6 +175,7 @@ class AXLetter extends MassMailer
         if (!$this->_promo_min && !$this->_promo_max && !$this->_subset) {
             return '1';
         }
+        /* TODO: refines this filter on promotions by using userfilter. */
         $where = array();
         if ($this->_promo_min) {
             $where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND u.promo >= {$this->_promo_min}))";
index 1d065af..276fabf 100644 (file)
@@ -45,7 +45,7 @@ class CarnetModule extends PLModule
             return;
         }
         $page->setRssLink('Polytechnique.org :: Carnet',
-                          '/carnet/rss/'.S::v('hruid').'/'.S::v('token').'/rss.xml');
+                          '/carnet/rss/' . S::v('hruid') . '/' . S::user()->token . '/rss.xml');
     }
 
     function handler_index(&$page)
@@ -275,7 +275,7 @@ class CarnetModule extends PLModule
 
         // For XSRF protection, checks both the normal xsrf token, and the special RSS token.
         // It allows direct linking to contact adding in the RSS feed.
-        if (Env::v('action') && Env::v('token') !== S::v('token')) {
+        if (Env::v('action') && Env::v('token') !== S::user()->token) {
             S::assert_xsrf_token();
         }
         switch (Env::v('action')) {
index 197ae8e..794ec39 100644 (file)
@@ -194,7 +194,7 @@ class EmailModule extends PLModule
             if ($user->hasProfile()) {
                 XDB::execute("UPDATE  profiles
                                  SET  alias_pub = {?}
-                               WHERE  pid = {?}", 
+                               WHERE  pid = {?}",
                             $value, $user->profile()->id());
             }
             $visibility = ($value == 'public');
@@ -619,13 +619,13 @@ class EmailModule extends PLModule
             $storage = new EmailStorage(S::user(), 'imap');
             $storage->activate();
             $page->assign('ok', true);
-            $page->assign('prenom', S::v('prenom'));
-            $page->assign('sexe', S::v('femme'));
+            $page->assign('yourself', S::user()->displayName());
+            $page->assign('sexe', S::user()->isFemale());
         } else if (!S::logged() && $user) {
             $storage = new EmailStorage($user, 'imap');
             $storage->activate();
             $page->assign('ok', true);
-            $page->assign('prenom', $user->displayName());
+            $page->assign('yourself', $user->displayName());
             $page->assign('sexe', $user->isFemale());
         }
     }
@@ -794,15 +794,16 @@ class EmailModule extends PLModule
     {
         $page->changeTpl('emails/lost.tpl');
 
-        // 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"));
+                      XDB::iterator('SELECT  a.uid, a.hruid, pd.promo
+                                       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))
+                                  LEFT JOIN  account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', perms))
+                                  LEFT JOIN  profile_display  AS pd ON (ap.pid = pd.pid)
+                                      WHERE  e.uid IS NULL AND FIND_IN_SET(\'googleapps\', eo.storage) = 0
+                                             AND a.state = \'active\'
+                                   ORDER BY  pd.promo, a.hruid'));
     }
 
     function handler_broken_addr(&$page)
index eebfa82..035f274 100644 (file)
@@ -40,7 +40,7 @@ class EventsModule extends PLModule
     {
         global $globals;
         // Add a new special tip when changing plat/al version
-        if ($globals->version != S::v('last_version') && is_null($exclude)) {
+        if ($globals->version != S::user()->last_version && is_null($exclude)) {
             XDB::execute('UPDATE accounts
                              SET last_version = {?}
                            WHERE uid = {?}',
@@ -126,7 +126,7 @@ class EventsModule extends PLModule
         // Direct link to the RSS feed, when available.
         if (S::hasAuthToken()) {
             $page->setRssLink('Polytechnique.org :: News',
-                              '/rss/'.S::v('hruid') .'/'.S::v('token').'/rss.xml');
+                              '/rss/' . S::v('hruid') . '/' . S::user()->token . '/rss.xml');
         }
 
         // Hide the read event, and reload the page to get to the next event.
index 237336c..ac22a02 100644 (file)
@@ -196,7 +196,7 @@ class FusionAxModule extends PLModule
         return XDB::affectedRows() / 2;
     }
 
-    /* Cherche les les anciens présents dans Xorg avec un matricule_ax ne correspondant à rien dans la base de l'AX 
+    /* Cherche les les anciens présents dans Xorg avec un matricule_ax ne correspondant à rien dans la base de l'AX
      * (mises à part les promo 1921 et 1923 qui ne figurent pas dans les données de l'AX)*/
     private static function find_wrong_in_xorg($limit = 10)
     {
index 23af228..172e071 100644 (file)
@@ -39,7 +39,7 @@ SET
 `Date_maj` = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
 
 LOAD DATA LOCAL INFILE 'Activites.txt' INTO TABLE `fusionax_adresses` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
-(provenance, id_ancien, @Code_etab, @Raison_sociale, @Libelle_fonctio, @Annuaire, 
+(provenance, id_ancien, @Code_etab, @Raison_sociale, @Libelle_fonctio, @Annuaire,
 Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @StringDate_maj)
 SET
 `Type_adr` = 'E',
index 0c61e53..14b72dc 100755 (executable)
@@ -265,7 +265,7 @@ while (<FILE>)
   s/\tès /\t/g;
   s/\tof /\t/g;
   s/( )+(\t)/\t/g;
-  
+
 
   # On remet dans l'ordre lorsque le diplôme se situe après l'université
   s/Manag\.Vanderblit/Vanderbilt University\tManagement/;
index fb3a6db..999c16f 100755 (executable)
@@ -5,7 +5,7 @@
 #unrar e -inul export_4D.txt.rar
 cp /home/x2004jacob/export*utf8.TXT .
 
-# séparation en fichiers de tables 
+# séparation en fichiers de tables
 cat export_total* | grep ^AD > Adresses.txt
 cat export_total* | grep ^AN > Anciens.txt
 cat export_total* | grep ^FO > Formations.txt
index 446d949..263a24d 100644 (file)
@@ -41,7 +41,7 @@ class GoogleAppsModule extends PLModule
         require_once("emails.inc.php");
         require_once("googleapps.inc.php");
         $page->changeTpl('googleapps/index.tpl');
-        $page->addJsLink('motdepasse.js');
+        $page->addJsLink('password.js');
         $page->setTitle('Compte Google Apps');
 
         $user = S::user();
@@ -69,9 +69,9 @@ class GoogleAppsModule extends PLModule
                 } else {
                     $account->set_password_sync(false);
                 }
-            } elseif ($action == 'password' && Post::has('response2') && !$account->sync_password) {
+            } elseif ($action == 'password' && Post::has('pwhash') && Post::t('pwhash') && !$account->sync_password) {
                 S::assert_xsrf_token();
-                $account->set_password(Post::v('response2'));
+                $account->set_password(Post::t('pwhash'));
             }
 
             if ($action == 'suspend' && Post::has('suspend') && $account->active()) {
@@ -104,7 +104,7 @@ class GoogleAppsModule extends PLModule
                 if ($password_sync) {
                     $password = $user->password();
                 } else {
-                    $password = Post::v('response2');
+                    $password = Post::t('pwhash');
                 }
 
                 $account->create($password_sync, $password, $redirect_mails);
index 1ebf75f..9979e84 100644 (file)
@@ -356,13 +356,11 @@ class ListsModule extends PLModule
         }
         $this->prepare_client($page);
         $members = $this->client->get_members($liste);
-        $list = list_fetch_names(list_extract_members($members[1]));
+        $list = list_fetch_basic_info(list_extract_members($members[1]));
         pl_content_headers("text/x-csv");
 
-        echo "email,nom,prenom,promo\n";
-        foreach ($list as $member) {
-            echo @$member['email'] . ',' . @$member['nom'] . ',' . @$member['prenom'] . ',' . @$member['promo'] . "\n";
-        }
+        echo "email,nom,promo\n";
+        echo implode("\n", $list);
         exit;
     }
 
index 2307d9d..217745a 100644 (file)
@@ -30,20 +30,19 @@ function list_sort_owners(&$members, $tri_promo = true)
     foreach($members as $mem) {
         $user = User::getSilent($mem);
         if (!$user) {
-            $membres[0][] = array('l' => $mem, 'p' => (!$tri_promo ? 'inconnue' : null));
+            $membres[0][] = array('l' => $mem, 'p' => (!$tri_promo ? 'inconnue' : null), 'n' => null, 'x' => null, 'b' => null);
         } else {
             $uid = $user->id();
-            $nom = $user->fullName(); # XXX: Get a notion of 'last name' here, I want to sort user by lastnames
+            $nom = $user->directoryName();
             $promo = $user->promo();
             if (!$promo) {
                 $promo = 'non-X';
             }
-            $broken = false; # XXX: fill it with the good value if the user has no valid email
             $key = $tri_promo ? ($promo != 'non-X' ? $promo : 0) : strtoupper(@$nom{0});
             if ($tri_promo) {
                 $promo = null;
             }
-            $membres[$key][$nom.$mem] = Array('n' => $nom, 'l' => $mem, 'p' => $promo, 'x' => $uid, 'b' => $broken);
+            $membres[$key][$nom.$mem] = array('n' => $nom, 'l' => $mem, 'p' => $promo, 'x' => $uid, 'b' => $user->lost);
         }
     }
 
@@ -75,16 +74,17 @@ function list_sort_members($members, $tri_promo = true)
 }
 
 // }}}
+// {{{ function list_fetch_basic_info
 
-function list_fetch_names($members)
+function list_fetch_basic_info($members)
 {
     $res = array();
     foreach ($members as $member) {
         $user = User::getSilent($member);
         if (!$user) {
-            $res[] = $member;
+            $res[] = $member . ',,';
         } else {
-            $res[] = $user->fullName();
+            $res[] = $user->forlifeEmail() . ',' . $user->directoryName() . ',' . $user->promo();
         }
     }
     return $res;
index a887369..ae73a19 100644 (file)
@@ -1,5 +1,5 @@
 <MultiPg>
-<NoDoc>    
+<NoDoc>
 <UseLocalTime>
 <MsgLocalDateFmt>
 %d-%m-%y
@@ -198,7 +198,7 @@ MY-SUBJNA
 <FieldsBeg>
     <table class="bicol" cellpadding="0" cellspacing="0">
 </FieldsBeg>
+
 <LabelBeg>
       <tr>
        <td class="right">
@@ -209,7 +209,7 @@ MY-SUBJNA
 <LabelEnd>
        </td>
 </LabelEnd>
-   
+
 <FldBeg>
        <td>
 </FldBeg>
@@ -227,7 +227,7 @@ subject:strong
         </td>
       </tr>
 </FldEnd>
-     
+
 <FieldsEnd>
     </table>
 </FieldsEnd>
@@ -259,7 +259,7 @@ subject:strong
 <!-- ------------------------------------------------------------------------ -->
 
 <TIdxPgSSMarkup>
-    
+
 </TIdxPgSSMarkup>
 
 <TIdxPgBegin>
@@ -437,7 +437,7 @@ date
 
 
 <IdxPgSSMarkup>
-    
+
 </IdxPgSSMarkup>
 
 <IdxPgBegin>
index d5f9ed8..b878478 100644 (file)
@@ -39,9 +39,62 @@ class MarketingModule extends PLModule
     function handler_marketing(&$page)
     {
         $page->changeTpl('marketing/index.tpl');
-
         $page->setTitle('Marketing');
-        $page->trigWarning("Les statistiques sont momentanéement désactivées");
+
+        $alive = new UserFilter(new PFC_Not(new UFC_Dead()));
+        $registered = new UserFilter(new PFC_And(new UFC_Registered(), new PFC_Not(new UFC_Dead())));
+        $alive72 = new UserFilter(new PFC_And(new UFC_Promo('>=', UserFilter::GRADE_ING, 1972), new PFC_Not(new UFC_Dead())));
+        $registered72 = new UserFilter(new PFC_And(new UFC_Registered(), new UFC_Promo('>=', UserFilter::GRADE_ING, 1972), new PFC_Not(new UFC_Dead())));
+        $aliveWomen = new UserFilter(new PFC_And(new UFC_Sex(User::GENDER_FEMALE) , new PFC_Not(new UFC_Dead())));
+        $registeredWomen = new UserFilter(new PFC_And(new UFC_Registered(), new UFC_Sex(User::GENDER_FEMALE), new PFC_Not(new UFC_Dead())));
+        $statistics = array(
+            'alive'           => $alive->getTotalCount(),
+            'registered'      => $registered->getTotalCount(),
+            'alive72'         => $alive72->getTotalCount(),
+            'registered72'    => $registered72->getTotalCount(),
+            'womenAlive'      => $aliveWomen->getTotalCount(),
+            'womenRegistered' => $registeredWomen->getTotalCount(),
+        );
+        $statistics['registeredRate']      = $statistics['registered'] / $statistics['alive'] * 100;
+        $statistics['registeredRate72']    = $statistics['registered72'] / $statistics['alive72'] * 100;
+        $statistics['womenRegisteredRate'] = $statistics['womenRegistered'] / $statistics['womenAlive'] * 100;
+
+        $registeredWeek = new UserFilter(new PFC_And(new UFC_Registered(false, '>=', strtotime('1 week ago')), new PFC_Not(new UFC_Dead())));
+        $registrationPending = XDB::fetchOneCell('SELECT  COUNT(*)
+                                                    FROM  register_pending');
+        $registrations = array(
+            'week'    => $registeredWeek->getTotalCount(),
+            'pending' => $registrationPending,
+        );
+
+        $ok = XDB::fetchOneCell('SELECT  COUNT(*)
+                                   FROM  register_mstats
+                                  WHERE  success != \'0000-00-00\'');
+        $okWeek = XDB::fetchOneCell('SELECT  COUNT(*)
+                                       FROM  register_mstats
+                                      WHERE  success >= {?}', strtotime('1 week ago'));
+        $res = XDB::fetchAllAssoc('SELECT  type, COUNT(*) as count
+                                     FROM  register_marketing
+                                 GROUP BY  type');
+        $no = array();
+        foreach ($res as $value) {
+            $no[$value['type']] = $value['count'];
+        }
+        $no['week'] = XDB::fetchOneCell('SELECT  COUNT(*)
+                                           FROM  register_marketing
+                                          WHERE  last >= {?}', strtotime('1 week ago'));
+        $marketings = array(
+            'ok'      => $ok,
+            'okWeek'  => $okWeek,
+            'noPerso' => (isset($no['user']) ? $no['user'] : 0),
+            'noXorg'  => (isset($no['staff']) ? $no['staff'] : 0),
+            'noAX'    => (isset($no['ax']) ? $no['ax'] : 0),
+            'noWeek'  => $no['week'],
+        );
+
+        $page->assign('statistics', $statistics);
+        $page->assign('registrations', $registrations);
+        $page->assign('marketings', $marketings);
     }
 
     function handler_private(&$page, $hruid = null,
@@ -260,6 +313,7 @@ class MarketingModule extends PLModule
             require_once 'marketing.inc.php';
 
             $sender = User::getSilent(S::v('uid'));
+            $perso_signature = 'Cordialement,<br />-- <br />' . $sender->fullName();
             $market = new AnnuaireMarketing(null, true);
             $text = $market->getText(array(
                 'sexe'           => $user->isFemale(),
@@ -269,11 +323,10 @@ class MarketingModule extends PLModule
             $text = str_replace('%%hash%%', '', $text);
             $text = str_replace('%%personal_notes%%', '<em id="personal_notes_display"></em>', $text);
             $text = str_replace('%%sender%%',
-                                "<span id=\"sender\">" . $sender->fullName() . '</span>', $text);
+                                '<span id="sender">' . $perso_signature . '</span>', $text);
             $page->assign('text', nl2br($text));
-            // TODO (JAC): define a unique Xorg signature for all the emails we send.
-            $page->assign('xorg_signature', "L'équipe de Polytechnique.org,<br />Le portail des élèves & anciens élèves de l'École polytechnique");
-            $page->assign('perso_signature', $sender->fullName());
+            $page->assign('perso_signature', $perso_signature);
+            $page->assign('mail_part', 'escaped_html');
         }
     }
 
@@ -317,7 +370,8 @@ class MarketingModule extends PLModule
         $page->changeTpl('marketing/relance.tpl');
 
         if (Post::has('relancer')) {
-            $nbdix = Marketing::getAliveUsersCount();
+            global $globals;
+            $nbdix = $globals->core->NbIns;
 
             $sent  = Array();
             $users = User::getBulkUsersWithUIDs($_POST['relance']);
index e2f57b4..1578a96 100644 (file)
@@ -226,7 +226,7 @@ class PaymentModule extends PLModule
         if ($eid = $res->fetchOneCell()) {
             require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
             $evt = get_event_detail($eid);
-            subscribe_lists_event(0, $uid, $evt, $montant, true);
+            subscribe_lists_event($uid, $evt, 1, $montant, true);
         }
 
         /* on genere le mail de confirmation */
@@ -264,7 +264,7 @@ class PaymentModule extends PLModule
     function handler_cyber2_return(&$page, $uid = null)
     {
         global $globals, $platal;
-        
+
         /* on vérifie la signature */
         $vads_params = array();
         foreach($_REQUEST as $key => $value)
@@ -275,7 +275,7 @@ class PaymentModule extends PLModule
         //if($signature != Env::v('signature')) {
         //    cb_erreur("signature invalide");
         //}
-        
+
         /* on extrait les informations sur l'utilisateur */
         $user = User::get(Env::v('vads_cust_id'));
         if (!$user) {
@@ -294,7 +294,7 @@ class PaymentModule extends PLModule
         if (!list($conf_mail, $conf_title, $conf_text) = $res->fetchOneRow()) {
             cb_erreur("référence de commande inconnue");
         }
-        
+
         /* on extrait le montant */
         if (Env::v('vads_currency') != "978") {
             cb_erreur("monnaie autre que l'euro");
@@ -305,13 +305,13 @@ class PaymentModule extends PLModule
         if (Env::v('vads_result') != "00") {
             cb_erreur("erreur lors du paiement : ?? (".Env::v('vads_result').")");
         }
-        
+
         /* on fait l'insertion en base de donnees */
         XDB::execute("INSERT INTO  payment_transactions (id, uid, ref, fullref, amount, pkey, comment)
                            VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
                      Env::v('vads_trans_date'), $user->id(), $ref, Env::v('vads_order_id'), $montant, "", Env::v('vads_order_info'));
         echo "Paiement stored.\n";
-        
+
         // We check if it is an Xnet payment and then update the related ML.
         $res = XDB::query('SELECT  eid
                              FROM  group_events
@@ -319,7 +319,7 @@ class PaymentModule extends PLModule
         if ($eid = $res->fetchOneCell()) {
             require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
             $evt = get_event_detail($eid);
-            subscribe_lists_event(0, $user->id(), $evt, $montant, true);
+            subscribe_lists_event($user->id(), $evt, 1, $montant, true);
         }
 
         /* on genere le mail de confirmation */
@@ -414,7 +414,7 @@ class PaymentModule extends PLModule
         if ($eid = $res->fetchOneCell()) {
             require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
             $evt = get_event_detail($eid);
-            subscribe_lists_event(0, $uid, $evt, $montant, true);
+            subscribe_lists_event($user->id(), $evt, 1, $montant, true);
         }
 
         /* on genere le mail de confirmation */
index 9ad8a34..96fe3c0 100644 (file)
@@ -65,10 +65,10 @@ class BPLCCyberPlus
         $prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id();
         $fullref = substr("$prefix-{$pay->id}",-12); // FIXME : check for duplicates
         $ts = time();
-               $trans_date = date("YmdHis", $ts); 
+               $trans_date = date("YmdHis", $ts);
                $trans_id = date("His", $ts); // FIXME : check for duplicates
                                                                
-        // contenu du formulaire        
+        // contenu du formulaire
         $this->urlform = "https://systempay.cyberpluspaiement.com/vads-payment/";
         $this->infos['commercant'] = Array(
             'vads_site_id' => $globals->money->cyperplus_account,
@@ -91,7 +91,7 @@ class BPLCCyberPlus
             'vads_ctx_mode' => $globals->money->cyperplus_prod,
             'vads_page_action' => 'PAYMENT',
             'vads_action_mode' => 'INTERACTIVE');
-        
+
         // calcul de la clé d'acceptation en entrée
         $all_params = array_merge($this->infos['commercant'],$this->infos['client'],$this->infos['commande'],$this->infos['divers']);
         ksort($all_params);
index 2ad9317..9d8c205 100644 (file)
@@ -113,10 +113,10 @@ class PlatalModule extends PLModule
     function __set_rss_state($state)
     {
         if ($state) {
-            S::set('token', rand_url_id(16));
+            S::user()->token = rand_url_id(16);
             XDB::execute('UPDATE  accounts
                              SET  token = {?}
-                           WHERE  uid = {?}', S::s('token'), S::i('uid'));
+                           WHERE  uid = {?}', S::user()->token, S::i('uid'));
         } else {
             S::kill('token');
             XDB::execute('UPDATE  accounts
@@ -133,7 +133,6 @@ class PlatalModule extends PLModule
         if (Post::has('email_format')) {
             $fmt = Post::s('email_format');
             S::user()->setEmailFormat($fmt);
-            S::set('email_format', $fmt);
         }
 
         if (Post::has('rss')) {
@@ -203,10 +202,10 @@ class PlatalModule extends PLModule
     {
         global $globals;
 
-        if (Post::has('response2'))  {
+        if (Post::has('pwhash') && Post::t('pwhash'))  {
             S::assert_xsrf_token();
 
-            S::set('password', $password = Post::v('response2'));
+            S::set('password', $password = Post::t('pwhash'));
             XDB::execute('UPDATE  accounts
                              SET  password = {?}
                            WHERE  uid={?}', $password,
@@ -225,12 +224,12 @@ class PlatalModule extends PLModule
             S::logger()->log('passwd');
             Platal::session()->setAccessCookie(true);
 
-            $page->changeTpl('platal/motdepasse.success.tpl');
+            $page->changeTpl('platal/password.success.tpl');
             $page->run();
         }
 
-        $page->changeTpl('platal/motdepasse.tpl');
-        $page->addJsLink('motdepasse.js');
+        $page->changeTpl('platal/password.tpl');
+        $page->addJsLink('password.js');
         $page->setTitle('Mon mot de passe');
     }
 
@@ -366,8 +365,8 @@ Adresse de secours : " . Post::v('email') : ""));
         }
 
         $uid = $ligne["uid"];
-        if (Post::has('response2')) {
-            $password = Post::v('response2');
+        if (Post::has('pwhash') && Post::t('pwhash')) {
+            $password = Post::t('pwhash');
             XDB::query('UPDATE  accounts
                            SET  password={?}
                          WHERE  uid = {?} AND state = \'active\'',
@@ -388,8 +387,8 @@ Adresse de secours : " . Post::v('email') : ""));
             S::logger($uid)->log("passwd", "");
             $page->changeTpl('platal/tmpPWD.success.tpl');
         } else {
-            $page->changeTpl('platal/motdepasse.tpl');
-            $page->addJsLink('motdepasse.js');
+            $page->changeTpl('platal/password.tpl');
+            $page->addJsLink('password.js');
         }
     }
 
@@ -450,7 +449,7 @@ Adresse de secours : " . Post::v('email') : ""));
         }
     }
 
-    function handler_review(&$page, $action = null, $mode = null) 
+    function handler_review(&$page, $action = null, $mode = null)
     {
         // Include X-XRDS-Location response-header for Yadis discovery
         global $globals;
index 20305e3..61d1596 100644 (file)
@@ -76,7 +76,9 @@ class ProfileModule extends PLModule
         );
     }
 
-    /* XXX COMPAT */
+    /* Function needed for compatibility reasons.
+     * TODO: removes calls to fiche.php?user=blah.machin.2083 and then removes this.
+     */
     function handler_fiche(&$page)
     {
         return $this->handler_profile($page, Env::v('user'));
@@ -259,6 +261,11 @@ class ProfileModule extends PLModule
             $view = 'private';
         }
 
+        // Display pending picture
+        if (S::logged() && Env::v('modif') == 'new') {
+            $page->assign('with_pending_pic', true);
+        }
+
         // Fetches profile's and profile's owner information and redirects to
         // marketing if the owner has not subscribed and the requirer has logged in.
         $profile = Profile::get($pid, Profile::FETCH_ALL, $view);
@@ -748,7 +755,7 @@ class ProfileModule extends PLModule
     function handler_admin_education_degree(&$page, $action = 'list', $id = null) {
         $page->setTitle('Administration - Niveau de formation');
         $page->assign('title', 'Gestion des niveau de formation');
-        $table_editor = new PLTableEditor('admin/education_degree', 'profile_education_degree_enum', 'id', true);
+        $table_editor = new PLTableEditor('admin/education_degree', 'profile_education_degree_enum', 'id');
         $table_editor->add_join_table('profile_education_degree', 'degreeid', true);
         $table_editor->add_join_table('profile_education', 'degreeid', true);
         $table_editor->describe('degree', 'niveau', true);
index 4e6d51b..37deea8 100644 (file)
@@ -127,6 +127,19 @@ class ProfileSettingAddress extends ProfileSettingGeocoding
             $profiletel->saveTels($page->pid(), 'tel', $address['tel']);
         }
     }
+
+    public function getText($value) {
+        $addresses = array();
+        foreach ($value as $addrid => $address) {
+            $phones = new ProfileSettingPhones('address', $addrid);
+            $addresses[] = 'Adresse : ' . $address['text'] . ', affichage : ' . $address['pub']
+                         . ', commentaire : ' . $address['comment'] . ', actuelle : ' . ($address['current'] ? 'oui' : 'non')
+                         . ', temporaire : ' . ($address['temporary'] ? 'oui' : 'non') . ', secondaire : '
+                         . ($address['secondary'] ? 'oui' : 'non') . ', conctactable par courier : '
+                         . ($address['mail'] ? 'oui' : 'non') . ', ' . $phones->getText($address['tel']);
+        }
+        return implode(' ; ' , $addresses);
+    }
 }
 
 class ProfileSettingAddresses extends ProfilePage
index 6dfc8e6..fa40cf9 100644 (file)
@@ -82,6 +82,15 @@ class ProfileSettingDeco implements ProfileSetting
             }
         }
     }
+
+    public function getText($value) {
+        $medalsList = DirEnum::getOptions(DirEnum::MEDALS);
+        $medals = array();
+        foreach ($value as $id => $medal) {
+            $medals[] = $medalsList[$id];
+        }
+        return implode(', ', $medals);
+    }
 }
 
 class ProfileSettingDecos extends ProfilePage
@@ -117,21 +126,24 @@ class ProfileSettingDecos extends ProfilePage
 
     public function _prepare(PlPage &$page, $id)
     {
-        $res    = XDB::iterator("SELECT  *, FIND_IN_SET('validation', flags) AS validate
-                                   FROM  profile_medal_enum
-                               ORDER BY  type, text");
-        $mlist  = array();
+        $res = XDB::iterator('SELECT  *, FIND_IN_SET(\'validation\', flags) AS validate
+                                FROM  profile_medal_enum
+                            ORDER BY  type, text');
+        $mlist = array();
         while ($tmp = $res->next()) {
             $mlist[$tmp['type']][] = $tmp;
         }
         $page->assign('medal_list', $mlist);
-        $trad = Array('ordre'      => 'Ordres',
-                      'croix'      => 'Croix',
-                      'militaire'  => 'Médailles militaires',
-                      'honneur'    => 'Médailles d\'honneur',
-                      'resistance' => 'Médailles de la résistance',
-                      'prix'       => 'Prix');
-        $page->assign('trad', $trad);
+        $fullType = array(
+            'ordre'      => 'Ordres',
+            'croix'      => 'Croix',
+            'militaire'  => 'Médailles militaires',
+            'honneur'    => 'Médailles d\'honneur',
+            'resistance' => 'Médailles de la résistance',
+            'prix'       => 'Prix',
+            'sport'      => 'Médailles sportives'
+        );
+        $page->assign('fullType', $fullType);
     }
 }
 
index a9afd28..817b9a9 100644 (file)
@@ -126,6 +126,11 @@ class ProfileSettingSearchNames implements ProfileSetting
                     $value[] = $sn;
                 } while ($sn = $sn_all->next());
             }
+            require_once 'validations.inc.php';
+            $namesRequest = ProfileValidate::get_typed_requests($page->pid(), 'usage');
+            if (count($namesRequest) > 0) {
+                Platal::page()->assign('validation', true);
+            }
             $value = $this->clean($value);
         } else {
             require_once 'name.func.inc.php';
@@ -226,8 +231,18 @@ class ProfileSettingSearchNames implements ProfileSetting
             $display_names = array();
             build_display_names($display_names, $this->search_names,
                                 $page->profile->isFemale(), $this->private_name_end);
-            set_profile_display($display_names, $page->pid());
+            set_profile_display($display_names, $page->profile);
+        }
+    }
+
+    public function getText($value) {
+        $names = array();
+        foreach ($value as $name) {
+            if ($name['name'] != '') {
+                $names[] = $name['type_name'] . ' : ' . $name['name'];
+            }
         }
+        return implode(', ' , $names);
     }
 }
 
@@ -291,6 +306,21 @@ class ProfileSettingEdu implements ProfileSetting
             }
         }
     }
+
+    public function getText($value) {
+        $schoolsList = DirEnum::getOptions(DirEnum::EDUSCHOOLS);
+        $degreesList = DirEnum::getOptions(DirEnum::EDUDEGREES);
+        $fieldsList = DirEnum::getOptions(DirEnum::EDUFIELDS);
+        $educations = array();
+        foreach ($value as $education) {
+            $educations[] = 'Université : ' . $schoolsList[$education['eduid']]
+                          . ', diplôme : ' . $degreesList[$education['degreeid']]
+                          . ', domaine : ' . $fieldsList[$education['fieldid']]
+                          . ', année d\'obtention : ' . $education['grad_year']
+                          . ', intitulé : ' . $education['program'];
+        }
+        return implode(', ', $educations);
+    }
 }
 
 class ProfileSettingEmailDirectory implements ProfileSetting
@@ -316,6 +346,10 @@ class ProfileSettingEmailDirectory implements ProfileSetting
         }
         return $value;
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 class ProfileSettingNetworking implements ProfileSetting
@@ -389,6 +423,15 @@ class ProfileSettingNetworking implements ProfileSetting
                          $page->pid(), $id, $network['type'], $network['address'], $network['pub']);
         }
     }
+
+    public function getText($value) {
+        $networkings = array();
+        foreach ($value as $network) {
+            $networkings[] = 'nom : ' . $network['name'] . ', adresse : ' . $network['address']
+                           . ', affichage : ' . $network['pub'];
+        }
+        return implode(' ; ' , $networkings);
+    }
 }
 
 class ProfileSettingPromo implements ProfileSetting
@@ -462,6 +505,10 @@ class ProfileSettingPromo implements ProfileSetting
         }
         return intval($value);
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 
@@ -511,9 +558,6 @@ class ProfileSettingGeneral extends ProfilePage
                         LEFT JOIN  profile_phones        AS pp ON (pp.pid = p.pid AND link_type = 'user')
                             WHERE  p.pid = {?}", $this->pid());
         $this->values = $res->fetchOneAssoc();
-        if ($this->owner) {
-            $this->values['yourself'] = $this->owner->displayName();
-        }
 
         // Retreive photo informations
         $res = XDB::query("SELECT  pub
@@ -618,7 +662,7 @@ class ProfileSettingGeneral extends ProfilePage
         $page->assign('edu_fields', $res->fetchAllAssoc());
 
         require_once "emails.combobox.inc.php";
-        fill_email_combobox($page, $this->owner, $this->profile);
+        fill_email_combobox($page, $this->owner);
 
         $res = XDB::query("SELECT  nw.nwid AS type, nw.name
                              FROM  profile_networking_enum AS nw
index 62489ed..f5e2941 100644 (file)
@@ -41,6 +41,11 @@ class ProfileSettingSection implements ProfileSetting
                        WHERE  pid = {?}",
                      $value, $page->pid());
     }
+
+    public function getText($value) {
+        $sectionsList = DirEnum::getOptions(DirEnum::SECTIONS);
+        return $sectionsList[$value];
+    }
 }
 
 class ProfileSettingBinets implements ProfileSetting
@@ -85,6 +90,10 @@ class ProfileSettingBinets implements ProfileSetting
         XDB::execute("INSERT INTO  profile_binets (pid, binet_id)
                            VALUES  " . implode(',', $insert));
     }
+
+    public function getText($value) {
+        return implode(', ', $value);
+    }
 }
 
 class ProfileSettingGroups extends ProfilePage
@@ -113,7 +122,7 @@ class ProfileSettingGroups extends ProfilePage
                                                     WHERE  a.inscriptible != 0
                                                            AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')
                                                  ORDER BY  a.cat, a.dom, a.nom"));
-        $page->assign('old', (int) date('Y') >= $page->profile->grad_year);
+        $page->assign('old', (int) date('Y') >= $this->profile->grad_year);
     }
 }
 
index f698485..ddb628f 100644 (file)
@@ -162,6 +162,7 @@ class ProfileSettingJob extends ProfileSettingGeocoding
                                    $job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']);
                 $req->submit();
                 $job['jobid'] = null;
+                sleep(1);
             } else {
                 $job['jobid'] = $res->fetchOneCell();
             }
@@ -263,6 +264,51 @@ class ProfileSettingJob extends ProfileSettingGeocoding
             }
         }
     }
+
+    public function getText($value) {
+        $jobs = array();
+        foreach ($value as $id => $job) {
+            $address = new ProfileSettingAddress();
+            $phones = new ProfileSettingPhones('pro', $id);
+            $jobs[] = 'Entreprise : ' . $job['name'] . ', secteur : ' . $job['subSubSectorName']
+                    . ', description : ' . $job['description'] . ', web : ' . $job['w_url']
+                    . ', email : ' . $job['w_email']
+                    . ', ' . $phones->getText($job['w_phone']) . ', ' .  $address->getText($job['w_address']);
+        }
+        return implode(' ; ' , $jobs);
+    }
+}
+
+class ProfileSettingCorps implements ProfileSetting
+{
+    public function value(ProfilePage &$page, $field, $value, &$success)
+    {
+        $success = true;
+        if (is_null($value)) {
+            $res = XDB::query("SELECT  original_corpsid AS original, current_corpsid AS current,
+                                       rankid AS rank, corps_pub AS pub
+                                 FROM  profile_corps
+                                WHERE  pid = {?}",
+                            $page->pid());
+            return $res->fetchOneAssoc();
+        }
+        return $value;
+    }
+
+    public function save(ProfilePage &$page, $field, $value)
+    {
+        XDB::execute('REPLACE INTO  profile_corps (original_corpsid, current_corpsid, rankid, corps_pub, pid)
+                            VALUES  ({?}, {?}, {?}, {?}, {?})',
+                      $value['original'], $value['current'], $value['rank'], $value['pub'], $page->pid());
+    }
+
+    public function getText($value)
+    {
+        $corpsList = DirEnum::getOptions(DirEnum::CORPS);
+        $rankList  = DirEnum::getOptions(DirEnum::CORPSRANKS);
+        return 'Corps actuel : ' . $corpsList[$value['current']] . ' , rang : ' . $corpsList[$value['rank']]
+            . ' , corps d\'origine : ' . $corpsList[$value['original']] . ' , affichage : ' . $value['pub'];
+    }
 }
 
 class ProfileSettingJobs extends ProfilePage
@@ -273,7 +319,7 @@ class ProfileSettingJobs extends ProfilePage
     {
         parent::__construct($wiz);
         $this->settings['cv'] = null;
-        $this->settings['corps'] = null;
+        $this->settings['corps'] = new ProfileSettingCorps();
         $this->settings['jobs'] = new ProfileSettingJob();
         $this->watched = array('cv' => true, 'jobs' => true, 'corps' => true);
     }
@@ -287,14 +333,6 @@ class ProfileSettingJobs extends ProfilePage
                           $this->pid());
         $this->values['cv'] = $res->fetchOneCell();
 
-        // Checkout the corps
-        $res = XDB::query("SELECT  original_corpsid AS original, current_corpsid AS current,
-                                   rankid AS rank, corps_pub AS pub
-                             FROM  profile_corps
-                            WHERE  pid = {?}",
-                        $this->pid());
-        $this->values['corps'] = $res->fetchOneAssoc();
-
         // Build the jobs tree
         $res = XDB::iterRow("SELECT  j.id, j.jobid, je.name, j.sectorid, j.subsectorid, j.subsubsectorid,
                                      s.name, j.description, j.email, j.email_pub, j.url, j.pub,
@@ -421,7 +459,7 @@ class ProfileSettingJobs extends ProfilePage
                     );
                 }
             }
+
             $job['w_email_new'] = '';
             if (!isset($job['hq_phone'])) {
                 $job['hq_phone'] = '';
@@ -470,19 +508,12 @@ class ProfileSettingJobs extends ProfilePage
                            WHERE  pid = {?}",
                          $this->values['cv'], $this->pid());
         }
-
-        if ($this->changed['corps']) {
-            XDB::execute('REPLACE INTO  profile_corps (original_corpsid, current_corpsid, rankid, corps_pub, pid)
-                                VALUES  ({?}, {?}, {?}, {?}, {?})',
-                          $this->values['corps']['original'], $this->values['corps']['current'],
-                          $this->values['corps']['rank'], $this->values['corps']['pub'], $this->pid());
-        }
     }
 
     public function _prepare(PlPage &$page, $id)
     {
         require_once 'emails.combobox.inc.php';
-        fill_email_combobox($page, $this->owner, $this->profile);
+        fill_email_combobox($page, $this->owner);
 
         $res = XDB::query("SELECT  id, name AS label
                              FROM  profile_job_sector_enum");
index 035bb47..17d9cdd 100644 (file)
@@ -69,6 +69,16 @@ class ProfileSettingSectors implements ProfileSetting
             }
         }
     }
+
+    public function getText($value) {
+        $sectors = array();
+        foreach ($value as $sector) {
+            foreach ($sector as $subsector) {
+                $sectors[] = $subsector;
+            }
+        }
+        return implode(', ', $sectors);
+    }
 }
 
 class ProfileSettingCountry implements ProfileSetting
@@ -107,6 +117,10 @@ class ProfileSettingCountry implements ProfileSetting
                          $page->pid(), $id);
         }
     }
+
+    public function getText($value) {
+        return implode(', ', $value);
+    }
 }
 
 
@@ -157,6 +171,7 @@ class ProfileSettingMentor extends ProfilePage
         $page->assign('countryList', XDB::iterator("SELECT  iso_3166_1_a2, countryFR
                                                       FROM  geoloc_countries
                                                   ORDER BY  countryFR"));
+        $page->assign('hrpid', $this->profile->hrpid);
     }
 }
 
index 9d0521e..8c17a05 100644 (file)
@@ -36,11 +36,19 @@ interface ProfileSetting
     /** Save the new value for the given field.
      */
     public function save(ProfilePage &$page, $field, $new_value);
+
+    /** Get text from the value.
+     */
+    public function getText($value);
 }
 
 abstract class ProfileNoSave implements ProfileSetting
 {
     public function save(ProfilePage &$page, $field, $new_value) { }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 class ProfileSettingWeb extends ProfileNoSave
@@ -200,6 +208,17 @@ class ProfileSettingPhones implements ProfileSetting
             $this->saveTel($pid, $telid, $phone);
         }
     }
+
+    public function getText($value) {
+        $phones = array();
+        foreach ($value as $phone) {
+            if ($phone['tel'] != '') {
+                $phones[] = 'type : ' . $phone['type'] .', numéro : ' . $phone['tel']
+                          . ', commentaire : « ' . $phone['comment'] . ' », affichage : ' . $phone['pub'];
+            }
+        }
+        return implode(' ; ' , $phones);
+    }
 }
 
 class ProfileSettingPub extends ProfileNoSave
@@ -217,6 +236,10 @@ class ProfileSettingPub extends ProfileNoSave
         }
         return $value;
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 class ProfileSettingBool extends ProfileNoSave
@@ -281,6 +304,10 @@ abstract class ProfileSettingGeocoding implements ProfileSetting
             $address = $gmapsGeocoder->stripGeocodingFromAddress($address);
         }
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 
@@ -336,12 +363,26 @@ abstract class ProfilePage implements PlWizardPage
     protected function saveData()
     {
         require_once 'notifs.inc.php';
+        $changedFields = array();
         foreach ($this->settings as $field=>&$setting) {
-            if (!is_null($setting) && $this->changed[$field]) {
-                $setting->save($this, $field, $this->values[$field]);
-            }
-            if ($this->changed[$field] && @$this->watched[$field]) {
-                WatchProfileUpdate::register($this->profile, $field);
+            if ($this->changed[$field]) {
+                if (!is_null($setting)) {
+                    $changedFields[$field] = array(
+                        str_replace("\n", " - ", $setting->getText($this->orig[$field])),
+                        str_replace("\n", " - ", $setting->getText($this->values[$field])),
+                    );
+                } else {
+                    $changedFields[$field] = array(
+                        str_replace("\n", " - ", $this->orig[$field]),
+                        str_replace("\n", " - ", $this->values[$field]),
+                    );
+                }
+                if (!is_null($setting)) {
+                    $setting->save($this, $field, $this->values[$field]);
+                }
+                if (isset($this->watched[$field]) && $this->watched[$field]) {
+                    WatchProfileUpdate::register($this->profile, $field);
+                }
             }
         }
         $this->_saveData();
@@ -352,6 +393,20 @@ abstract class ProfilePage implements PlWizardPage
                        WHERE  pid = {?}', $this->pid());
         global $platal;
         S::logger()->log('profil', $platal->pl_self(2));
+
+        /** If the update was made by a third party and the profile corresponds
+         * to a registered user, stores both former and new text.
+         * This will be daily sent to the user.
+         */
+        $owner = $this->profile->owner();
+        $user = S::user();
+        if ($owner->isActive() && $owner->id() != $user->id()) {
+            foreach ($changedFields as $field => $values) {
+                XDB::execute('REPLACE INTO  profile_modifications (pid, uid, field, oldText, newText)
+                                    VALUES  ({?}, {?}, {?}, {?}, {?})',
+                             $this->pid(), $user->id(), $field, $values[0], $values[1]);
+            }
+        }
     }
 
     protected function checkChanges()
index 4a8c579..1f18133 100644 (file)
@@ -76,6 +76,14 @@ class ProfileSettingSkill implements ProfileSetting
                          $page->pid(), $id, $skill['level']);
         }
     }
+
+    public function getText($value) {
+        $skills = array();
+        foreach ($value as $skill) {
+            $skills[] = 'Compétance : ' . $skill['text'] . ', niveau : ' . $skill['level'];
+        }
+        return implode(' ; ' , $skills);
+    }
 }
 
 class ProfileSettingSkills extends ProfilePage
index 22a206e..c09d68d 100644 (file)
@@ -179,7 +179,7 @@ class RegisterModule extends PLModule
                     $subState->set('services', $services);
 
                     // Validate the password.
-                    if (!Post::v('response2', false)) {
+                    if (!Post::v('pwhash', false)) {
                         $error[] = "Le mot de passe n'est pas valide.";
                     }
 
@@ -211,7 +211,7 @@ class RegisterModule extends PLModule
                         $subState->set('birthdate', sprintf("%04d-%02d-%02d",
                                                             intval($birth[2]), intval($birth[1]), intval($birth[0])));
                         $subState->set('email', Post::t('email'));
-                        $subState->set('password', Post::t('response2'));
+                        $subState->set('password', Post::t('pwhash'));
 
                         // Update the current alert if the birthdate is incorrect,
                         // or if the IP address of the user has been banned.
@@ -248,7 +248,7 @@ class RegisterModule extends PLModule
         }
 
         $page->changeTpl('register/step' . $subState->i('step') . '.tpl');
-        $page->addJsLink('motdepasse.js');
+        $page->addJsLink('password.js');
         if (isset($error)) {
             $page->trigError($error);
         }
@@ -329,7 +329,7 @@ class RegisterModule extends PLModule
         //
         XDB::execute("UPDATE  accounts
                          SET  password = {?}, state = 'active',
-                              registration_date = NOW()
+                              registration_date = NOW(), email = NULL
                        WHERE  uid = {?}", $password, $uid);
         XDB::execute("UPDATE  profiles
                          SET  birthdate = {?}, last_change = NOW()
index 4386c99..72a09ac 100644 (file)
@@ -169,6 +169,9 @@ class SearchModule extends PLModule
             if ($nb_tot > $globals->search->private_max) {
                 $this->form_prepare();
                 $page->trigError('Recherche trop générale.');
+            } else if ($nb_tot == 0) {
+                $this->form_prepare();
+                $page->trigError('Il n\'existe personne correspondant à ces critères dans la base !');
             }
         }
 
index 136382c..dbaa8a3 100644 (file)
@@ -187,7 +187,7 @@ class XnetModule extends PLModule
         $page->assign('cat', $cat);
         $page->assign('dom', $dom);
 
-        $res  = XDB::query("SELECT  id,nom 
+        $res  = XDB::query("SELECT  id,nom
                               FROM  group_dom
                              WHERE  FIND_IN_SET({?}, cat)
                           ORDER BY  nom", $cat);
index 4db4710..d5091c9 100644 (file)
@@ -269,7 +269,7 @@ class XnetEventsModule extends PLModule
         }
         if ($updated !== false) {
             $page->trigSuccess('Ton inscription à l\'événement a été mise à jour avec succès.');
-            subscribe_lists_event($total, S::i('uid'), $evt, $paid);
+            subscribe_lists_event(S::i('uid'), $evt, ($total > 0 ? 1 : 0), 0);
         }
         $page->assign('event', get_event_detail($eid));
     }
@@ -547,11 +547,12 @@ class XnetEventsModule extends PLModule
 
             // change the price paid by a participant
             if (Env::v('adm') == 'prix' && $member) {
+                $amount = strtr(Env::v('montant'), ',', '.');
                 XDB::execute("UPDATE group_event_participants
                                  SET paid = paid + {?}
                                WHERE uid = {?} AND eid = {?} AND item_id = 1",
-                        strtr(Env::v('montant'), ',', '.'),
-                        $member->uid, $evt['eid']);
+                             $amount, $member->uid, $evt['eid']);
+                subscribe_lists_event($member->uid, $evt, 1, $amount);
             }
 
             // change the number of personns coming with a participant
@@ -566,26 +567,28 @@ class XnetEventsModule extends PLModule
 
                 foreach ($nbs as $id => $nb) {
                     $nb = max(intval($nb), 0);
-                    XDB::execute("REPLACE INTO group_event_participants
-                                        VALUES ({?}, {?}, {?}, {?}, {?}, {?})",
-                                  $evt['eid'], $member->uid, $id, $nb, '', $id == 1 ? $paid : 0);
+                    XDB::execute('REPLACE INTO  group_event_participants
+                                        VALUES  ({?}, {?}, {?}, {?}, {?}, {?})',
+                                 $evt['eid'], $member->uid, $id, $nb, '', $id == 1 ? $paid : 0);
                 }
 
-                $res = XDB::query("SELECT COUNT(uid) AS cnt, SUM(nb) AS nb
-                                     FROM group_event_participants
-                                    WHERE uid = {?} AND eid = {?}
-                                 GROUP BY uid",
-                                            $member->uid, $evt['eid']);
+                $res = XDB::query('SELECT  COUNT(uid) AS cnt, SUM(nb) AS nb
+                                     FROM  group_event_participants
+                                    WHERE  uid = {?} AND eid = {?}
+                                 GROUP BY  uid',
+                                  $member->uid, $evt['eid']);
                 $u = $res->fetchOneAssoc();
                 if ($u['cnt'] == 1 && $paid == 0 && Post::v('cancel')) {
                     XDB::execute("DELETE FROM group_event_participants
                                         WHERE uid = {?} AND eid = {?}",
                                     $member->uid, $evt['eid']);
                     $u = 0;
+                    subscribe_lists_event($member->uid, $evt, -1, $paid);
                 } else {
+                    var_dump($u);
                     $u = $u['cnt'] ? $u['nb'] : null;
+                    subscribe_lists_event($member->uid, $evt, ($u > 0 ? 1 : 0), $paid);
                 }
-                subscribe_lists_event($u, $member->uid, $evt, $paid);
             }
 
             $evt = get_event_detail($eid, $item_id);
@@ -638,7 +641,7 @@ class XnetEventsModule extends PLModule
         $page->assign('absents', $absents);
         $page->assign('participants',
                       get_event_participants($evt, $item_id, UserFilter::sortByName(),
-                                             new PLLimit(NB_PER_PAGE), $ofs * NB_PER_PAGE));
+                                             NB_PER_PAGE, $ofs * NB_PER_PAGE));
     }
 }
 
index 93f011c..91bb45e 100644 (file)
@@ -124,7 +124,7 @@ function get_event_participants(&$evt, $item_id, array $tri = array(), $count =
                                          WHERE  ep.eid = {?} AND nb > 0 ' . $append . '
                                       GROUP BY  ep.uid', $eid);
     $uf = new UserFilter(new PFC_True(), $tri);
-    $users = User::getBulkUsersWithUIDs($uf->filter(array_keys($query), $count, $offset));
+    $users = User::getBulkUsersWithUIDs($uf->filter(array_keys($query), new PlLimit($count, $offset)));
     $tab = array();
     foreach ($users as $user) {
         $uid = $user->id();
@@ -173,11 +173,19 @@ function get_event_participants(&$evt, $item_id, array $tri = array(), $count =
 // }}}
 
 //  {{{ function subscribe_lists_event()
-function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
+/** Subscribes user to various event related mailing lists.
+ *
+ * @param $uid: user's id.
+ * @param evt: events data, in particular ids of the lists at stake.
+ * @param participate: indicates if the user takes part at the event or not;
+ *      -1 means he did not answer, 0 means no, and 1 means yes.
+ * @param paid: has the user already payed anything?
+ *      0 means no, a positive amount means yes.
+ * @param payment: is this function called from a payment page?
+ *      If true, only payment related lists should be updated.
+ */
+function subscribe_lists_event($uid, $evt, $participate, $paid, $payment = false)
 {
-    global $globals;
-    $page =& Platal::page();
-
     $participant_list  = $evt['participant_list'];
     $absent_list       = $evt['absent_list'];
     $unpayed_list      = $evt['booked_unpayed_list'];
@@ -189,8 +197,8 @@ function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
     function subscribe($list, $email)
     {
         if ($list && $email) {
-            XDB::execute("REPLACE INTO  virtual_redirect
-                                VALUES  ({?},{?})",
+            XDB::execute('REPLACE INTO  virtual_redirect
+                                VALUES  ({?}, {?})',
                          $list, $email);
         }
     }
@@ -198,31 +206,45 @@ function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
     function unsubscribe($list, $email)
     {
         if ($list && $email) {
-            XDB::execute("DELETE FROM  virtual_redirect
-                                WHERE  vid = {?} AND redirect = {?}",
+            XDB::execute('DELETE FROM  virtual_redirect
+                                WHERE  vid = {?} AND redirect = {?}',
                          $list, $email);
         }
     }
 
-    if (is_null($payment)) {
-        if (is_null($participate)) {
+    /** If $payment is not null, we do not retrieve the value of $participate,
+     * thus we do not alter participant and absent lists.
+     */
+    if ($payment === true) {
+        if ($paid > 0) {
+            unsubscribe($unpayed_list, $email);
+            subscribe($payed_list, $email);
+        }
+    } else {
+        switch ($participate) {
+          case -1:
             unsubscribe($participant_list, $email);
+            unsubscribe($unpayed_list, $email);
+            unsubscribe($payed_list, $email);
             subscribe($absent_list, $email);
-        } elseif ($participate) {
-            subscribe($participant_list, $email);
-            unsubscribe($absent_list, $email);
-        } else {
+            break;
+          case 0:
             unsubscribe($participant_list, $email);
             unsubscribe($absent_list, $email);
-        }
-    }
-    if ($paid > 0) {
-        unsubscribe($unpayed_list, $email);
-        subscribe($payed_list, $email);
-    } else {
-        unsubscribe($payed_list, $email);
-        if (!is_null($participate)) {
-            subscribe($unpayed_list, $email);
+            unsubscribe($unpayed_list, $email);
+            unsubscribe($payed_list, $email);
+            break;
+          case 1:
+            subscribe($participant_list, $email);
+            unsubscribe($absent_list, $email);
+            if ($paid > 0) {
+                unsubscribe($unpayed_list, $email);
+                subscribe($payed_list, $email);
+            } else {
+                subscribe($unpayed_list, $email);
+                unsubscribe($payed_list, $email);
+            }
+            break;
         }
     }
 }
index 7cf8d26..12585a6 100644 (file)
@@ -81,24 +81,34 @@ class XnetGrpModule extends PLModule
                             Env::i('unread'), S::i('uid'));
                 pl_redirect("#art" . Env::i('unread'));
             }
-            // XXX: Fix promo_min; promo_max
-            $arts = XDB::iterator("SELECT  a.*, FIND_IN_SET('photo', a.flags) AS photo
+
+            /* TODO: refines this filter on promotions by using userfilter. */
+            $user = S::user();
+            if ($user->hasProfile()) {
+                $promo = XDB::format('{?}', $user->profile()->entry_year);
+                $minCondition = ' OR promo_min <= ' . $promo;
+                $maxCondition = ' OR promo_max >= ' . $promo;
+            } else {
+                $minCondition = '';
+                $maxCondition = '';
+            }
+            $arts = XDB::iterator('SELECT  a.*, FIND_IN_SET(\'photo\', a.flags) AS photo
                                      FROM  group_announces      AS a
                                 LEFT JOIN  group_announces_read AS r ON (r.uid = {?} AND r.announce_id = a.id)
                                     WHERE  asso_id = {?} AND expiration >= CURRENT_DATE()
-                                           AND (promo_min = 0 OR promo_min <= {?})
-                                           AND (promo_max = 0 OR promo_max >= {?})
+                                           AND (promo_min = 0' . $minCondition . ')
+                                           AND (promo_max = 0' . $maxCondition . ')
                                            AND r.announce_id IS NULL
-                                 ORDER BY  a.expiration",
-                                   S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
-            $index = XDB::iterator("SELECT  a.id, a.titre, r.uid IS NULL AS nonlu
+                                 ORDER BY  a.expiration',
+                                   S::i('uid'), $globals->asso('id'));
+            $index = XDB::iterator('SELECT  a.id, a.titre, r.uid IS NULL AS nonlu
                                       FROM  group_announces      AS a
                                  LEFT JOIN  group_announces_read AS r ON (a.id = r.announce_id AND r.uid = {?})
                                      WHERE  asso_id = {?} AND expiration >= CURRENT_DATE()
-                                            AND (promo_min = 0 OR promo_min <= {?})
-                                            AND (promo_max = 0 OR promo_max >= {?})
-                                  ORDER BY  a.expiration",
-                                   S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
+                                            AND (promo_min = 0' . $minCondition . ')
+                                            AND (promo_max = 0' . $maxCondition . ')
+                                  ORDER BY  a.expiration',
+                                   S::i('uid'), $globals->asso('id'));
             $page->assign('article_index', $index);
         } else {
             $arts = XDB::iterator("SELECT  *, FIND_IN_SET('photo', flags) AS photo
@@ -120,7 +130,7 @@ class XnetGrpModule extends PLModule
                               $platal->ns . "rss/rss.xml");
         } else {
             $page->setRssLink("Polytechnique.net :: {$globals->asso("nom")} :: News",
-                              $platal->ns . 'rss/'.S::v('hruid') .'/'.S::v('token').'/rss.xml');
+                              $platal->ns . 'rss/' . S::v('hruid') . '/' . S::user()->token . '/rss.xml');
         }
 
         $page->assign('articles', $arts);
@@ -626,55 +636,66 @@ class XnetGrpModule extends PLModule
 
         S::assert_xsrf_token();
 
-        // Finds or creates account
+        // Finds or creates account: first cases are for users with an account.
         if (!User::isForeignEmailAddress($email)) {
-            // standard x account
+            // Standard account
             $user = User::get($email);
         } else if (!isvalid_email($email)) {
             // email might not be a regular email but an alias or a hruid
             $user = User::get($email);
             if (!$user) {
                 // need a valid email address
-                $page->trigError("«&nbsp;<strong>$email</strong>&nbsp;» n'est pas une adresse email valide.");
+                $page->trigError('«&nbsp;<strong>' . $email . '</strong>&nbsp;» n\'est pas une adresse email valide.');
                 return;
             }
         } else if (Env::v('x') && Env::i('userid')) {
-            // user is an x but might not yet be registered
             $user = User::getWithUID(Env::i('userid'));
             if (!$user) {
-                $page->trigError("Utilisateur invalide");
+                $page->trigError('Utilisateur invalide.');
                 return;
             }
-            // add email for marketing if unknown
-            if ($user->state == 'pending' && Env::v('market')) {
-                $market = Marketing::get($user->uid, $email);
-                if (!$market) {
-                    $market = new Marketing($user->uid, $email, 'group', $globals->asso('nom'),
-                                            Env::v('market_from'), S::v('uid'));
-                    $market->add();
+
+            // User has an account but is not yet registered.
+            if ($user->state == 'pending') {
+                // Add email in account table.
+                XDB::query('UPDATE  accounts
+                               SET  email = {?}
+                             WHERE  uid = {?} AND email IS NULL',
+                           Post::t('email'), $user->id());
+                // Add email for marketing if required.
+                if (Env::v('market')) {
+                    $market = Marketing::get($user->uid, $email);
+                    if (!$market) {
+                        $market = new Marketing($user->uid, $email, 'group', $globals->asso('nom'),
+                                                Env::v('market_from'), S::v('uid'));
+                        $market->add();
+                    }
                 }
             }
         } else {
-            // user is not an x
-            $hruid = strtolower(str_replace('@','.',$email).'.ext');
-            // might already exists (in another group for example)
+            // User is of type xnet.
+            list($firstname, $lastname) = explode('@', $email);
+            $hruid = User::makeHrid($firstname, $lastname, 'ext');
+            // User might already have an account (in another group for example).
             $user = User::get($hruid);
+
+            // If the user has no account yet, creates new account: build names from email address.
             if (empty($user)) {
-                // creates new account: build names from email address
                 $display_name = ucwords(strtolower(substr($hruid, strpos('.', $hruid))));
-                $full_name = ucwords(strtolower(str_replace('.', ' ',substr($email, strpos('@', $email)))));
-                XDB::execute("INSERT INTO accounts (hruid, display_name, full_name, email, type)
-                    VALUES({?}, {?}, {?}, {?}, 'xnet')",
-                    $hruid, $display_name, $full_name, $email);
+                $full_name = ucwords(strtolower(str_replace('.', ' ', substr($email, strpos('@', $email)))));
+                XDB::execute('INSERT INTO  accounts (hruid, display_name, full_name, email, type)
+                                   VALUES  ({?}, {?}, {?}, {?}, \'xnet\')',
+                             $hruid, $display_name, $full_name, $email);
                 $user = User::get($hruid);
             }
         }
+
         if ($user) {
-            XDB::execute("REPLACE INTO  group_members (uid, asso_id)
-                                VALUES  ({?}, {?})",
+            XDB::execute('REPLACE INTO  group_members (uid, asso_id)
+                                VALUES  ({?}, {?})',
                          $user->id(), $globals->asso('id'));
             $this->removeSubscriptionRequest($user->id());
-            pl_redirect("member/" . $user->login());
+            pl_redirect('member/' . $user->login());
         }
     }
 
@@ -690,16 +711,16 @@ class XnetGrpModule extends PLModule
             }
         }
         if (empty($users)) {
-            list($nom, $prenom) = str_replace(array('-', ' ', "'"), '%', array(Env::t('nom'), Env::t('prenom')));
+            list($lastname, $firstname) = str_replace(array('-', ' ', "'"), '%', array(Env::t('nom'), Env::t('prenom')));
             $cond = new PFC_And(new PFC_Not(new UFC_Registered()));
-            if (!empty($nom)) {
-                $cond->addChild(new UFC_Name(Profile::LASTNAME, $nom, UFC_Name::CONTAINS));
+            if (!empty($lastname)) {
+                $cond->addChild(new UFC_Name(Profile::LASTNAME, $lastname, UFC_Name::CONTAINS));
             }
-            if (!empty($prenom)) {
-                $cond->addChild(new UFC_Name(Profile::FIRSTNAME, $prenom, UFC_Name::CONTAINS));
+            if (!empty($firstname)) {
+                $cond->addChild(new UFC_Name(Profile::FIRSTNAME, $firstname, UFC_Name::CONTAINS));
             }
-            if (Env::i('promo')) {
-                $cond->addChild(new UFC_Promo('=', UserFilter::GRADE_ING, Env::i('promo')));
+            if (Env::t('promo')) {
+                $cond->addChild(new UFC_Promo('=', UserFilter::DISPLAY, Env::t('promo')));
             }
             $uf = new UserFilter($cond);
             $users = $uf->getUsers(new PlLimit(30));
@@ -814,7 +835,7 @@ class XnetGrpModule extends PLModule
 
     private function changeLogin(PlPage &$page, PlUser &$user, MMList &$mmlist, $login)
     {
-        // Search the uid of the user...
+        // Search the user's uid.
         $xuser = User::getSilent($login);
         if (!$xuser) {
             $accounts = User::getPendingAccounts($login);
@@ -826,16 +847,16 @@ class XnetGrpModule extends PLModule
                 return false;
             }
             $xuser = User::getSilent($accounts[0]['uid']);
-            $sub = false;
         }
 
         if (!$xuser) {
             return false;
         }
 
-        $user->mergeIn($xuser);
-
-        return $xuser->login();
+        if ($user->mergeIn($xuser)) {
+            return $xuser->login();
+        }
+        return $user->login();
     }
 
     function handler_admin_member(&$page, $user)
@@ -867,13 +888,20 @@ class XnetGrpModule extends PLModule
             $from_email = $user->forlifeEmail();
             if (!$user->profile()) {
                 XDB::query('UPDATE  accounts
-                               SET  full_name = {?}, display_name = {?}, sex = {?}, email = {?}, type = {?}
+                               SET  full_name = {?}, directory_name = {?}, display_name = {?},
+                                    sex = {?}, email = {?}, type = {?}
                              WHERE  uid = {?}',
-                            Post::v('full_name'), Post::v('display_name'), (Post::v('sex') == 'male')?'male':'female', Post::v('email'), (Post::v('type') == 'xnet')?'xnet':'virtual',
-                            $user->id());
-                if (XDB::affectedRows()) {
-                    $page->trigSuccess('Données de l\'utilisateur mise à jour.');
-                }
+                           Post::t('full_name'), Post::t('directory_name'), Post::t('display_name'),
+                           (Post::t('sex') == 'male') ? 'male' : 'female', Post::t('email'),
+                           (Post::t('type') == 'xnet') ? 'xnet' : 'virtual', $user->id());
+            } else if (!$user->perms) {
+                XDB::query('UPDATE  accounts
+                               SET  email = {?}
+                             WHERE  uid = {?}',
+                           Post::t('email'), $user->id());
+            }
+            if (XDB::affectedRows()) {
+                $page->trigSuccess('Données de l\'utilisateur mise à jour.');
             }
 
             // Update group params for user
@@ -885,11 +913,13 @@ class XnetGrpModule extends PLModule
                              WHERE  uid = {?} AND asso_id = {?}',
                             ($perms == 'admin') ? 'admin' : 'membre', $comm,
                             $user->id(), $globals->asso('id'));
-                if ($perms != $user->group_perms) {
-                    $page->trigSuccess('Permissions modifiées&nbsp;!');
-                }
-                if ($comm != $user->group_comm) {
-                    $page->trigSuccess('Commentaire mis à jour.');
+                if (XDB::affectedRows()) {
+                    if ($perms != $user->group_perms) {
+                        $page->trigSuccess('Permissions modifiées&nbsp;!');
+                    }
+                    if ($comm != $user->group_comm) {
+                        $page->trigSuccess('Commentaire mis à jour.');
+                    }
                 }
             }
 
index dfc4bf3..77909bd 100644 (file)
@@ -31,7 +31,7 @@ function smarty_function_profile($params, &$smarty)
         $user = User::getWithUID($user);
     }
 
-    $name = pl_entities($user->fullName());
+    $name = pl_entities($user->directoryName());
     if ($with_sex && $user->isFemale()) {
         $name = '&bull;' . $name;
     }
@@ -47,6 +47,9 @@ function smarty_function_profile($params, &$smarty)
             $name = '<a href="profile/' . $profile->hrid() . '" class="popup2">' . $name . '</a>';
         }
     }
+    if ($user->lost) {
+        $name .= ' <a href="https://www.polytechnique.org/marketing/broken/' . $user->hruid . '"><img src="images/icons/error.gif" alt="Patte cassée" /></a>';
+    }
     if ($with_groupperms && $user instanceof User && $user->group_perms == 'admin' && !empty($name)) {
         $name = '<strong>' . $name . '</strong>';
     }
index 769853b..7d69ee9 100644 (file)
@@ -24,7 +24,7 @@ function smarty_insert_getUsername()
     global $globals;
 
     $id = Cookie::i('uid', -1);
-    $id = S::v($_SESSION['uid'], $id);
+    $id = S::v('uid', $id);
 
     if ($id < 0) {
         return '';
index cf5a6c1..d11cf46 100644 (file)
       <td>
         Promotion&nbsp;:
         <input type="text" name="promo" value="{$promo}" size="5" maxlength="5" />
-        <input type="submit" value="GO" />
+        <input type="submit" value="Afficher" />
       </td>
     </tr>
   </table>
 </form>
 
-{if t($decedes)}
+{if t($profileList)}
 <form action="admin/deaths/{$promo}/validate" id="deathDateList" method="post">
   {xsrf_token_field}
   <table class="bicol" summary="liste des dates de décès">
       <th>Nom</th>
       <th>Date de décès</th>
     </tr>
-    {iterate item=x from=$decedes}
+    {iterate item=profile from=$profileList}
     <tr class="{cycle values="impair,pair"}">
-      <td>{$x.directory_name}</td>
+      <td>{$profile.directory_name}</td>
       <td class="center">
-        <input type="text" class="deathDate" name="death_{$x.pid}" value="{$x.deathdate}" size="10" maxlength="10" />
+        <input type="text" name="death_{$profile.pid}" value="{$profile.deathdate}" size="10" maxlength="10" />
       </td>
     </tr>
     {/iterate}
     </tr>
   </table>
 </form>
-
-<script type="text/javascript">//<![CDATA[
-  {literal}
-  $('input.deathDate').change(function () {
-    $(this).addClass('sendDate');
-  });
-  
-  $('#deathDateList').submit(function () {
-    // Avoid sending useless data to the webserver
-    $('input.deathDate').not('.sendDate').attr('disabled', true);
-  });
-  {/literal}
-//]]></script>
 {/if}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 9031343..e982af0 100644 (file)
@@ -81,7 +81,7 @@
       &nbsp;&nbsp;|&nbsp;&nbsp;
       <a href="admin/icons">Icônes</a>
       &nbsp;&nbsp;|&nbsp;&nbsp;
-      <a href="sql_errors">Erreurs MySQL</a>
+      <a href="site_errors">Erreurs d'exécution</a>
     </td>
   </tr>
 
@@ -94,6 +94,8 @@
   <tr class="impair">
     <td class="titre">Comptes</td>
     <td>
+      <a href="admin/account/types">Types de comptes</a>
+      &nbsp;&nbsp;|&nbsp;&nbsp;
       <a href="admin/add_accounts">Ajout de comptes</a>
       &nbsp;&nbsp;|&nbsp;&nbsp;
       <a href="admin/user">Édition</a>
index ecad244..7db27fa 100644 (file)
 
 <script type="text/javascript">
 //<![CDATA[
-function doEditUser() {
-  document.forms.auth.hashpass.value = hash_encrypt(document.forms.edit.password.value);
-  document.forms.auth.password.value = "";
-  document.forms.auth.submit();
-}
-
 function del_alias(alias) {
   document.forms.alias.del_alias.value = alias;
   document.forms.alias.submit();
@@ -113,7 +107,11 @@ $(document).ready(function() {
     <tr>
       <th colspan="2">
         <div style="float: right; text-align: right">
+          {if $user->state eq 'pending'}
+          Non-inscrit
+          {else}
           Inscrit le {$user->registration_date|date_format}
+          {/if}
         </div>
         <div style="float: left; text-align: left">
           {icon name=user_gray} {$user->hruid} (uid {$user->id()})
@@ -123,11 +121,15 @@ $(document).ready(function() {
     </tr>
     <tr>
       <td class="titre">Nom complet</td>
-      <td><input type="text" name="full_name" maxlength="255" value="{$user->fullName()}" /></td>
+      <td>{if $hasProfile}{$user->fullName()}{else}<input type="text" name="full_name" maxlength="255" value="{$user->fullName()}" />{/if}</td>
+    </tr>
+    <tr>
+      <td class="titre">Nom annuaire</td>
+      <td>{if $hasProfile}{$user->directoryName()}{else}<input type="text" name="directory_name" maxlength="255" value="{$user->directoryName()}" />{/if}</td>
     </tr>
     <tr>
       <td class="titre">Nom affiché</td>
-      <td><input type="text" name="display_name" maxlength="255" value="{$user->displayName()}" /></td>
+      <td>{if $hasProfile}{$user->displayName()}{else}<input type="text" name="display_name" maxlength="255" value="{$user->displayName()}" />{/if}</td>
     </tr>
     <tr>
       <td class="titre">Sexe</td>
@@ -140,11 +142,11 @@ $(document).ready(function() {
       <td class="titre">Mot de passe</td>
       <td>
         <div style="float: left">
-          <input type="text" name="newpass_clair" size="10" maxlength="256" value="********" />
-          <input type="hidden" name="hashpass" value="" />
+          <input type="text" name="new_plain_password" size="10" maxlength="256" value="********" />
+          <input type="hidden" name="pwhash" value="" />
         </div>
         <div style="float: left; margin-top: 5px;">
-          {checkpasswd prompt="newpass_clair" submit="dummy_none"}
+          {checkpasswd prompt="new_plain_password" submit="dummy_none"}
         </div>
       </td>
     </tr>
@@ -225,8 +227,7 @@ $(document).ready(function() {
     </tr>
     <tr class="impair">
       <td colspan="2" class="center">
-        {* TODO: on 'update_account', update the hashpass field before sending the form. *}
-        <input type="submit" name="update_account" value="Mettre à jour" />
+        <input type="submit" name="update_account" value="Mettre à jour" onclick="return hashResponse('new_plain_password', false, false);" />
         <input type="submit" name="su_account" value="Prendre l'identité" />
         <input type="submit" name="log_account" value="Consulter les logs" />
       </td>
index e576392..ad35662 100644 (file)
 {to addr=#to#}
 {subject text="INTERVENTION de $admin"}
 {elseif $mail_part eq 'wiki'}
-{if $deletion}
-L'utilisateur {$user} a été désinscrit de plat/al.
-{else}
-Le profil du camarade {$old.prenom} {$old.nom} ({$old.promo}) a été édité.\\
+
+Le compte de l'utilisateur {$hruid} a été édité.\\
 Les champs suivants ont été changés :
-{foreach from=$old item=value key=field}
-{if $value neq $new[$field]}
-* '''{$field}''' : {$value} -> {$new[$field]}
-{/if}
+{foreach from=$diff item=values key=field}
+* '''{$field}''' : {$values.0} -> {$values.1}
 {/foreach}
 
 Et ceux qui n'ont pas changé :
-{foreach from=$old item=value key=field}
-{if $value eq $new[$field]}
+{foreach from=$oldValues item=value key=field}
 * '''{$field}''' : {$value}
-{/if}
 {/foreach}
 {/if}
-{/if}
 
 {* vim:set et sw=2 sts=2 sws=2: *}
index 924bc0a..8c0cb21 100644 (file)
@@ -46,12 +46,15 @@ function toggleField(name, id, obj) {
   <tr>
     <td class="titre" style="width: 20%">Demandeur&nbsp;:</td>
     <td>
-      <a href="profile/{$valid->user->login()}" class="popup2">
-        {$valid->user->fullName()} ({$valid->user->promo()})
+      {if $valid->user->hasProfile()}
+      {assign var="profile" value=$valid->user->profile()}
+      <a href="profile/{$profile->hrpid}" class="popup2">
+      {/if}
+        {$valid->user->fullName("promo")}
       </a>
     </td>
   </tr>
-  {if $valid->profile}
+  {if $valid->profile && !$valid->userIsProfileOwner}
   <tr>
     <td class="titre" style="width: 20%">Profil concerné&nbsp;:</td>
     <td>
index abe4194..5e11294 100644 (file)
   function toggle_folder() {
     me = this;
     if ($(this).attr("class") == "wiki_category")
-        me = $("../img.wiki_root", me)[0]; 
+        me = $("../img.wiki_root", me)[0];
     var cat=$.trim($(me).parent().text().replace(/(.*)\([0-9]+\)/, "$1"));
     if ($(me).attr('src') == "images/k1.gif") {
-      deplie(me, cat);  
+      deplie(me, cat);
     }
     replie(me, cat);
     setTimeout("toggle = 0;", 10);
@@ -68,7 +68,7 @@
 {/literal}
 
 <p class="center">
-   <a href="Site/AllRecentChanges?action=rss&amp;user={$smarty.session.hruid}&amp;hash={$smarty.session.token}" style="display:block;float:right" title="Changements">{icon name=feed title='fil rss'}</a>
+   <a href="Site/AllRecentChanges?action=rss&amp;user={$smarty.session.hruid}&amp;hash={$smarty.session.user->token}" style="display:block;float:right" title="Changements">{icon name=feed title='fil rss'}</a>
    {icon name=magnifier} <a href="Site/AllRecentChanges">Voir les changements récents</a>
 </p>
 
index fc4d816..0aa9ac7 100644 (file)
@@ -58,8 +58,8 @@ ne plus recevoir : &lt;https://www.polytechnique.org/ax/out{if $hash}/{$hash}{/i
 {if $is_mail}
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"> 
-  <head>  
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
     <title>Lettre d'information de l'AX</title>
     <style type="text/css">
       {literal}
index 9fdf7e3..3f60dd0 100644 (file)
@@ -27,7 +27,7 @@
   Votre désinscription aux envois exceptionnels de l'AX a été réalisée avec
   succès. Si vous désirez vous réinscrire, merci de contacter
   <a href="mailto:info@amicale.polytechnique.org">l'AX</a>. Vous pouvez également
-  le faire en vous <a href="register">inscrivant à Polytechnique.org</a> (pour 
+  le faire en vous <a href="register">inscrivant à Polytechnique.org</a> (pour
   les X uniquement).
 </p>
 {else}
index b1d0630..b00d7fa 100644 (file)
@@ -53,8 +53,8 @@
 <table class="bicol">
   <tr>
     <th colspan="2">
-      {if $smarty.session.token}
-      <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" style="display:block;float:right" title="Notifications">
+      {if $smarty.session.user->token}
+      <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" style="display:block;float:right" title="Notifications">
         {icon name=feed title='fil rss'}
       </a>
       {else}
index c3be38b..d3231d2 100644 (file)
   </li>
   <li>
     Le calendrier des anniversaires&nbsp;:
-    <a href="carnet/contacts/ical/{$smarty.session.hruid}/{$smarty.session.token}/anniv-x.ics">
+    <a href="carnet/contacts/ical/{$smarty.session.hruid}/{$smarty.session.user->token}/anniv-x.ics">
       {icon name=calendar_view_day title='Anniversaires au format iCal'}
     </a>
-    <a href="carnet/contacts/csv/birthday/{$smarty.session.hruid}/{$smarty.session.token}/anniv-x.csv">
+    <a href="carnet/contacts/csv/birthday/{$smarty.session.hruid}/{$smarty.session.user->token}/anniv-x.csv">
       {icon name=outlook title='Anniversaires au format Outlook'}
     </a>
   </li>
@@ -75,7 +75,7 @@
       {icon name=vcard title='Carte de visite au format vCard'}
     </a>
     (<a href="carnet/contacts/vcard/MesContactsXorg.vcf">sans les photos</a>)
-    <a href="carnet/contacts/csv/{$smarty.session.hruid}/{$smarty.session.token}/MesContactsXorg.csv">
+    <a href="carnet/contacts/csv/{$smarty.session.hruid}/{$smarty.session.user->token}/MesContactsXorg.csv">
       {icon name=outlook title='Contacts au format Outlook'}
     </a>
   </li>
index eed3763..db12e22 100644 (file)
@@ -38,8 +38,8 @@ Il faut pour cela se rendre sur la page de <a href='carnet/notifs'>configuration
 </p>
 
 <div class="right">
-{if $smarty.session.token}
-<a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
+{if $smarty.session.user->token}
+<a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
 {/if}
 </div>
 
index 246f4b4..ddb4981 100644 (file)
@@ -20,7 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
-{if $referer || $platal->pl_self() neq 'login'}
+{if t($referer) || $platal->pl_self() neq 'login'}
 <h1>
   Accès restreint
 </h1>
@@ -52,7 +52,7 @@
       <td>
         <input type="text" name="username" size="20" maxlength="50" value="{insert name="getUserName"}" />&nbsp;@&nbsp;<select name="domain">
           <option value="login">{#globals.mail.domain#} / {#globals.mail.domain2#}</option>
-          <option value="alias" {if $smarty.cookies.ORGdomain eq alias}selected="selected"{/if}>
+          <option value="alias" {if t($smarty.cookies.ORGdomain) eq "alias"}selected="selected"{/if}>
             {#globals.mail.alias_dom#} / {#globals.mail.alias_dom2#}
           </option>
         </select>
   en clair entre chez toi et Polytechnique.org, ce qui assure une confidentialité maximale.
   {else}
   {icon name=lock_open} Tu utilises actuellement une connexion HTTP non sécurisée. Toutes les informations
-  (<strong>excepté le mot de passe de connexion au site</strong>) circulent en clair entre chez toi et 
+  (<strong>excepté le mot de passe de connexion au site</strong>) circulent en clair entre chez toi et
   Polytechnique.org. Tu peux basculer sur une connexion sécurisée en cliquant sur le lien
   <div class="center">
   <a href="https://{#globals.core.secure_domain#}{$smarty.server.REQUEST_URI}">
index 0a66890..18a17e5 100644 (file)
@@ -50,7 +50,7 @@ correspondant si tu veux que nous puissions te répondre.
 <h2>Patte cassée</h2>
   <p>
     Désolé, mais ton correspondant, {$x.user->fullName()},
-    n'a actuellement <span class="erreur">aucune adresse email de redirection 
+    n'a actuellement <span class="erreur">aucune adresse email de redirection
       active autre que celle que tu viens de rentrer.</span>
     Nous t'invitons à prendre contact avec lui autrement que par email,
     l'idéal étant de l'informer si possible que sa patte Polytechnique.org est cassée&nbsp;!
index 2975e84..af8c048 100644 (file)
@@ -22,7 +22,7 @@
 
 {if $ok}
 <p>
-  {if $sexe}Chère{else}Cher{/if} {$prenom},
+  {if $sexe}Chère{else}Cher{/if} {$yourself},
 </p>
 
 <p>
index cdf4d1e..c9bf0cf 100644 (file)
 
 <h1>Perdus de vue</h1>
 
-<p>Ces {$lost_emails->total()} camarades n'ont pas ou plus d'adresse email valides</p>
+<p>Ces {$lost_emails->total()} camarades n'ont pas ou plus d'adresse email valides.</p>
 
 <table class="bicol">
   <tr>
-    <th>Utilisateur</th>
+    <th colspan="2">Utilisateur</th>
   </tr>
+  {assign var="promo" value=""}
   {iterate from=$lost_emails item="looser"}
     <tr class="{cycle values="pair,impair"}">
+      <td>{if $promo neq $looser.promo}{assign var="promo" value=$looser.promo}{$promo}{/if}</td>
       <td>
         <a href="profile/{$looser.hruid}" class="popup2">{$looser.hruid}</a>
       </td>
index 3b4d0e1..a8628b4 100644 (file)
 <form action="emails/send" method="post" enctype="multipart/form-data" id="form_mail" onsubmit="return check(this);">
   {xsrf_token_field}
   <table class="bicol" cellpadding="2" cellspacing="0">
-    <tr> 
+    <tr>
       <th colspan="2">Destinataires</th>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">de&nbsp;:</td>
       <td>
         <input type='hidden' name='signature' value='1' />
 {/if}' />
       </td>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">à&nbsp;:</td>
       <td>
         <input type='text' name='to' size='60' value="{$smarty.request.to}" />
       </td>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">copie&nbsp;:</td>
       <td>
         <input type='text' name='cc' size='60' value="{$smarty.request.cc}" />
       </td>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">copie cachée&nbsp;:</td>
       <td>
         <input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" />
         <div style="float: right; width: 40%;">
           <select id="to_contacts" name="to_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
           {foreach key=key item=contact from=$contacts}
-          {if in_array($contact->hrpid,$smarty.request.to_contacts)}
+          {if t($smarty.request.to_contacts) && in_array($contact->hrpid,$smarty.request.to_contacts)}
           <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
           <br />
           <select id="cc_contacts" name="cc_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
           {foreach key=key item=contact from=$contacts}
-          {if in_array($contact->hrpid,$smarty.request.cc_contacts)}
+          {if t($smarty.request.cc_contacts) && in_array($contact->hrpid,$smarty.request.cc_contacts)}
           <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
         <div style="float: right; width: 40%">
           <select id="contacts" name="all_contacts[]" multiple="multiple" style="height: 10em; width: 100%">
             {foreach item=contact from=$contacts}
-            {if !in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts)}
+            {if !(isset($smarty.request.to_contacts|smarty:nodefaults) && isset($smarty.request.cc_contacts|smarty:nodefaults)) ||
+                (!in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts))}
             <option value="{$contact->hrpid}">
               {$contact->full_name}
             </option>
index 5a5744c..83eb602 100644 (file)
 {else}
 
 <h1 id='pagetop'>
-Bienvenue {$smarty.session.display_name}{if $birthday}
+Bienvenue {$smarty.session.user->displayName()}{if $birthday}
   &nbsp;et joyeux anniversaire de la part de toute l'équipe&nbsp;!
 {else},
 {/if}
 </h1>
 
-{if $smarty.session.host}
+{if $smarty.session.user->host}
 <div class="smaller">
   {if $birthday}T{else}t{/if}a connexion précédente date du
-  <strong>{$smarty.session.lastlogin|date_format:"%x, %X"}</strong>
-  depuis la machine <strong>{$smarty.session.host}</strong>.
+  <strong>{$smarty.session.user->lastlogin|date_format:"%x, %X"}</strong>
+  depuis la machine <strong>{$smarty.session.user->host}</strong>.
 </div>
 {/if}
 
@@ -52,8 +52,8 @@ Bienvenue {$smarty.session.display_name}{if $birthday}
     <tr class="pair" style="height: 18px">
       <td class="half titre" style="height: 18px; padding-top: 1px; padding-bottom: 1px;">
         {if $smarty.foreach.events.first}
-        {if $smarty.session.token}
-        <a href="rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" style="display:block;float:right" title="Annonces">
+        {if $smarty.session.user->token}
+        <a href="rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" style="display:block;float:right" title="Annonces">
           {icon name=feed title='fil rss'}
         </a>
         {else}
@@ -92,8 +92,8 @@ Bienvenue {$smarty.session.display_name}{if $birthday}
     {if !$has_evts}
     <tr>
       <td class="half">
-        {if $smarty.session.token}
-        <a href="rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" style="display:block;float:right" title="Annonces">
+        {if $smarty.session.user->token}
+        <a href="rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" style="display:block;float:right" title="Annonces">
           {icon name=feed title='fil rss'}
         </a>
         {else}
index c15d41a..f845cb9 100644 (file)
@@ -42,7 +42,7 @@ Les différentes règles sont appliquées par ordre de priorité décroissante.
 
 {literal}
 <script type="text/javascript">
-  $('#body td table tr').each(function() { 
+  $('#body td table tr').each(function() {
     var uidcell = $('td:eq(3)',this);
     if (uidcell.length != 1) {
       return;
index 0a38678..a2bb9fd 100644 (file)
@@ -73,7 +73,7 @@ $(document).ready(function() {
             $('#fusion-reload a').click(function(a) {
                 document.location = a.currentTarget.href;
                 document.location.reload();
-            }); 
+            });
         });
         return false;
     });
index 9d46f58..e6a0478 100644 (file)
@@ -32,7 +32,7 @@
     });
 //-->
 {/literal}
-</script> 
+</script>
 <h2><a href="fusionax">Fusion des annuaires X.org - AX</a></h2>
 
 <h2>Import de l'annuaire AX</h2>
index dc01339..55731d7 100644 (file)
@@ -23,7 +23,7 @@
 <h2>Fusion des annuaires X.org - AX</h2>
 <ul>
 <li>Voir la <a href="Fusion">documentation</a></li>
-<li><a href="fusionax/import">Import de la base AX</a> {if $lastimport} - (dernier import le {$lastimport}){/if}</li> 
+<li><a href="fusionax/import">Import de la base AX</a> {if $lastimport} - (dernier import le {$lastimport}){/if}</li>
 <li>Mise en <a href="fusionax/ids">correspondance simple</a></li>
 <li>Création des <a href="fusionax/view">VIEW annexes nécessaires aux corrélations</a></li>
 <li>Corrélation des <a href="fusionax/deceased">dates de décès</a></li>
index c5e8069..b88b872 100644 (file)
@@ -51,8 +51,8 @@
     {if !$dead && $registered}</a>{/if}
   </div>
   <div class="autre">
-    {foreach from=$profile->nationalities() item=nat}
-    <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />&nbsp;
+    {foreach from=$profile->nationalities() item=country key=code}
+    <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
     {/foreach}
     {$profile->promo()}{*
     *}{if $dead}, {"décédé"|sex:"décédée":$profile} le {$profile->deathdate|date_format}{/if}
index 2d7846d..643acf7 100644 (file)
       </tr>
       <tr class="impair">
         <td colspan="2">
-          <form action="#" method="post" id="changepass">
+          <form action="#" method="post">
           <table class="tinybicol">
             <tr>
               <td class="titre">Nouveau mot de passe</td>
-              <td><input type="password" name="nouveau" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
+              <td><input type="password" name="new1" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
             </tr>
             <tr>
               <td class="titre">Vérification</td>
-              <td><input type="password" name="nouveau2" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
+              <td><input type="password" name="new2" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
             </tr>
             <tr>
               <td class="titre">Sécurité</td>
-              <td>{checkpasswd prompt="nouveau" submit="create_account" text="Créer mon compte !"}</td>
+              <td>{checkpasswd prompt="new" submit="create_account" text="Créer mon compte !"}</td>
             </tr>
           </table>
           </form>
         {if $password_sync}
           <input type="submit" value="Créer mon compte !" />
         {else}
-          <input type="hidden" name="response2"  value="" />
-          <input type="submit" name="create_account" value="Créer mon compte !" onclick="EnCryptedResponse(); return false;" />
+          <input type="hidden" name="pwhash" value="" />
+          <input type="submit" name="create_account" value="Créer mon compte !" onclick="return hashResponse('new1', 'new2', true);" />
         {/if}
       </td>
     </tr>
   {else}
   <tr class="impair"><td colspan="2">
     Changer le mot de passe de ton compte Google Apps&nbsp;:<br /><br />
-    <form action="googleapps/password" method="post" id="changepass">
+    <form action="googleapps/password" method="post">
+      {xsrf_token_field}
       <table class="bicol">
         <tr>
           <td class="titre">Nouveau mot de passe</td>
-          <td><input type="password" name="nouveau" /></td>
+          <td><input type="password" name="new1" /></td>
         </tr>
         <tr>
           <td class="titre">Vérification</td>
-          <td><input type="password" name="nouveau2" /></td>
+          <td><input type="password" name="new2" /></td>
         </tr>
         <tr>
           <td class="titre">Sécurité</td>
-          <td>{checkpasswd prompt="nouveau" submit="create_account" text="Changer mon mot de passe"}</td>
+          <td>{checkpasswd prompt="new1" submit="create_account" text="Changer mon mot de passe"}</td>
         </tr>
         <tr>
           <td></td>
-          <td><input type="submit" name="create_account" value="Changer" onclick="EnCryptedResponse(); return false;" /></td>
+          <td>
+            <input type="hidden" name="pwhash" value="" />
+            <input type="submit" name="create_account" value="Changer" onclick="return hashResponse('new1', 'new2', true);" />
+          </td>
         </tr>
       </table>
     </form>
-    <form action="googleapps/password" method="post" id="changepass2">
-      {xsrf_token_field}
-      <input type="hidden" name="response2"  value="" />
-    </form><br />
+    <br />
     Pour une sécurité optimale, ton mot de passe circule de manière sécurisée (https).
     Il est chiffré irréversiblement sur nos serveurs, ainsi que sur ceux de Google.
   </td></tr>
index ac5d69d..536985c 100644 (file)
@@ -55,9 +55,9 @@
         range.innerHTML = "L\'annonce est destinée à la promotion " + min + ".";
       } else {
         range.innerHTML = "L\'annonce est destinée aux promotions de " + min + " à " + max + ' (incluses).';
-      } 
+      }
       return true;
-    } 
+    }
     {/literal}
 //]]></script>
       <input type="text" name="{$min_field_name|default:"promo_min"}" id="{$prefix}promo_min"
index 1fce6e7..7b59719 100644 (file)
@@ -27,7 +27,7 @@
 <strong>Site web&nbsp;:</strong>
 <input type="text" name="url" size="25" maxlength="200" value="{$valid->url}" /><br />
 <strong>Email&nbsp;:</strong>
-<input type="text" name="url" size="25" maxlength="200" value="{$valid->email}" /><br />
+<input type="text" name="email" size="25" maxlength="200" value="{$valid->email}" /><br />
 <strong>Holding&nbsp;:</strong>
 <input type="text" name="holdingid" size="25" maxlength="200" value="{$valid->holdingid}" /><br />
 <strong>Code NAF&nbsp;:</strong>
@@ -35,7 +35,7 @@
 <strong>Code AX&nbsp;:</strong>
 <input type="text" name="AX_code" size="25" maxlength="200" value="{$valid->AX_code}" /><br />
 <strong>Adresse&nbsp;:</strong>
-<textarea cols="30" rows="4" name="address">{$valid->address['text']}</textarea><br />
+<textarea cols="30" rows="4" name="address">{$valid->address.text}</textarea><br />
 <strong>Téléphone&nbsp;:</strong>
 <input type="text" name="tel" size="25" maxlength="200" value="{$valid->tel}" /><br />
 <strong>Fax&nbsp;:</strong>
index 377a77c..8d92f73 100644 (file)
@@ -28,7 +28,7 @@
 <input type="submit" name="preview" value="Aperçu" onclick="previewWiki('msg_{$valid->id()}', 'preview_{$valid->id()}', true, 'preview_{$valid->id()}'); return false;" /><br />
 <strong>Site&nbsp;:</strong> <input type="text" name="pay_site" size="45" value="{$valid->site}" />
 <br>
-<strong>Montant&nbsp;:</strong> <input type="text" name="pay_montant" size="5" value="{$valid->montant}" /> 
+<strong>Montant&nbsp;:</strong> <input type="text" name="pay_montant" size="5" value="{$valid->montant}" />
 (min <input type="text" name="pay_montant_min" size="5" value="{$valid->montant_min}" />
 &nbsp;->&nbsp; max <input type="text" name="pay_montant_max" size="5" value="{$valid->montant_max}" />)
 
index 58112e1..855ade8 100644 (file)
@@ -55,7 +55,7 @@
 </tr>
 <tr class="pair">
   <td class="titre">Adresse&nbsp;:</td>
-  <td>{$valid->address[text]}</td>
+  <td>{$valid->address.text}</td>
 </tr>
 <tr class="pair">
   <td class="titre">Téléphone&nbsp;:</td>
index d41a48c..e018b4b 100644 (file)
     <div class="nom">
       {if $profile->isFemale()}&bull;{/if}
       {if !$dead && $registered}<a href="profile/{$profile->hrid()}" class="popup2">{/if}
-      {$profile->full_name}
+      {$profile->directory_name}
       {if !$dead && $registered}</a>{/if}
     </div>
 
     <div class="edu">
-      {foreach from=$profile->nationalities() item=nat}
-      <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />&nbsp;
+      {foreach from=$profile->nationalities() item=country key=code}
+      <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
       {/foreach}
       {$profile->promo()}{*
       *}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile}{/foreach}{*
index ea6dbcc..24e157d 100644 (file)
@@ -33,9 +33,7 @@
 {else}
 <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
   <a href="profile/{$profile->hrid()}" class="popup2">
-    <span {if $profile->name_tooltip}class="hinted"
-    title="{$profile->directory_name}"{/if}>{$profile->directory_name}</span> 
-    {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if}
+    {$profile->private_name} {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if}
   </a>
 </td>
 {/if}
index 5e39a92..dc4cee0 100644 (file)
@@ -35,6 +35,6 @@ Cordialement,<br />
 -- <br />
 l'équipe de Polytechnique.org<br />
 Le portail des élèves & anciens élèves de l'École polytechnique
-{/if}
+{elseif $mail_part eq "escaped_html"}Cordialement,<br />-- <br />l&#39;équipe de Polytechnique.org<br />Le portail des élèves & anciens élèves de l&#39;École polytechnique{/if}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index e389a9d..b6cde5b 100644 (file)
@@ -20,7 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
+
 <table cellpadding="8" cellspacing="2" style="width:100%;">
   {foreach from=$trombi_list item=p}
   {cycle values="1,2,3" assign="loop"}
@@ -37,7 +37,7 @@
       {/if}
       <br />
       <a href="{if $urlmainsite}{$urlmainsite}{/if}profile/{$p.forlife}" class="popup2">
-        <span {if $p.name_tooltip}class="hinted" title="{$p.name_tooltip}"{/if}>{$p.name_display}</span>{if $trombi_show_promo} ({$p.promo_display}){/if}
+        {$p.name_display}{if $trombi_show_promo} ({$p.promo_display}){/if}
       </a>
     </td>
   {if $loop eq "3"}
index 3bf7a4f..6c73b39 100644 (file)
   <tr>
     <td><strong>Liste {$platal->argv[1]}&nbsp;:</strong></td>
     <td>
-      {if $on neq members}
+      {if $on neq 'members'}
       [<a href='{$platal->ns}lists/members/{$platal->argv[1]}'>liste des membres</a>]
       {else}
       [liste des membres]
       {/if}
-      {if $on neq trombi}
+      {if $on neq 'trombi'}
       [<a href='{$platal->ns}lists/annu/{$platal->argv[1]}'>annuaire/trombi</a>]
       {else}
       [annuaire/trombi]
       {/if}
-      {if $on neq archives}
+      {if $on neq 'archives'}
       [<a href='{$platal->ns}lists/archives/{$platal->argv[1]}'>archives</a>]
       {else}
       [archives]
   <tr>
     <td><strong>Administrer la liste&nbsp;:</strong></td>
     <td>
-      {if $on neq moderate}
+      {if $on neq 'moderate'}
       [<a href='{$platal->ns}lists/moderate/{$platal->argv[1]}'>modération</a>]
       {else}
       [modération]
       {/if}
-      {if $on neq admin}
+      {if $on neq 'admin'}
       [<a href='{$platal->ns}lists/admin/{$platal->argv[1]}'>ajout/retrait de membres</a>]
       {else}
       [ajout/retrait de membres]
       {/if}
-      {if $on neq options}
+      {if $on neq 'options'}
       [<a href='{$platal->ns}lists/options/{$platal->argv[1]}'>options</a>]
       {else}
       [options]
       {/if}
-      {if $on neq delete}
+      {if $on neq 'delete'}
       [<a href='{$platal->ns}lists/delete/{$platal->argv[1]}'>détruire</a>]
       {else}
       [détruire liste]
   <tr>
     <td><strong>Administrer (avancé)&nbsp;:</strong></td>
     <td>
-      {if $on neq soptions}
+      {if $on neq 'soptions'}
       [<a href='{$platal->ns}lists/soptions/{$platal->argv[1]}'>options avancées</a>]
       {else}
       [options avancées]
       {/if}
-      {if $on neq check}
+      {if $on neq 'check'}
       [<a href='{$platal->ns}lists/check/{$platal->argv[1]}'>vérifications</a>]
       {else}
       [vérifications]
@@ -94,7 +94,7 @@
   {if $it_is_xnet && ($details.own || $is_admin)}
   <tr>
     <td><strong>Synchroniser&nbsp;:</strong></td>
-    {if $on neq sync}
+    {if $on neq 'sync'}
     <td>[<a href="{$platal->ns}lists/sync/{$platal->argv[1]}">synchroniser avec l'annuaire</a>]</td>
     {else}
     <td>[synchroniser avec l'annuaire]</td>
index 4a7034e..726446c 100644 (file)
@@ -29,7 +29,7 @@
 <ul>
   <li>Pour demander ton inscription à une liste de diffusion, il suffit
     de cliquer sur l'icône {icon name=add} située en fin de ligne.</li>
-  <li>Si la liste est à inscription modérée, l'icône {icon name=flag_orange title="en cours"} 
+  <li>Si la liste est à inscription modérée, l'icône {icon name=flag_orange title="en cours"}
     apparaîtra tant que ton inscription n'aura pas été validée par un modérateur.</li>
   <li>Pour te désinscrire d'une liste dont tu es membre, il suffit de cliquer sur la croix
     {icon name=cross title="désinscription"} située en fin de ligne.</li>
index 83440b9..575f8a6 100644 (file)
@@ -30,7 +30,7 @@
   {/if}
 </td>
 <td>
-  <a href='{$platal->ns}lists/members/{$liste.list}'>{$liste.list}</a> 
+  <a href='{$platal->ns}lists/members/{$liste.list}'>{$liste.list}</a>
 </td>
 <td>
   {$liste.desc|smarty:nodefaults}<br/>
index adaa262..1a56e74 100644 (file)
 
   </tr>
 
-  {foreach from=$members item=xs key=promo}
-  {foreach from=$xs item=x name=all}
+  {assign var=lostUsers value=false}
+  {foreach from=$members item=users key=promo}
+  {foreach from=$users item=user name=all}
   <tr>
     <td class='titre' style="width: 20%">
       {if $smarty.foreach.all.first}
       {/if}
     </td>
     <td>
-      {if $promo && strpos($x.l, '@') === false}
-      {if $x.b}<a href="https://www.polytechnique.org/marketing/broken/{$x.l}">{icon name=error}</a>{/if}
-      <a href="profile/{$x.l}" class="popup2">{$x.n}</a>
-      {elseif $x.x}
-      <a href="{$platal->ns}member/{$x.x}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
-      {elseif $x.n}
-      {$x.n}
+      {if $promo && $user.x}
+      {if $user.b}{assign var=lostUsers value=true}{/if}
+      {profile user=$user.x promo=false}
+      {elseif $user.x}
+      <a href="{$platal->ns}member/{$user.x}">{if $user.n|trim}{$x.n}{else}{$user.l}{/if}</a>
+      {elseif $user.n}
+      {$user.n}
       {else}
-      {$x.l}
+      {$user.l}
       {/if}
     </td>
-    {if $x.p}
+    {if $user.p}
     <td class="right">
-      {$x.p}
+      {$user.p}
     </td>
     {/if}
   </tr>
   {/foreach}
   {/foreach}
 </table>
+
+{if $lostUsers}
+<p class="smaller">
+  {icon name=error}&nbsp;Un camarade signalé par ce symbole n'a plus d'adresse de redirection et ne peut donc
+  plus être contacté via son adresse polytechnique.org. Si tu connais sa nouvelle adresse, tu peux nous la communiquer en
+  cliquant sur le symbole.
+</p>
+{/if}
+
 {/if}
 
 
index 4e725c5..5607d4e 100644 (file)
@@ -188,11 +188,11 @@ $('.checkboxToggle').click(function (event)
     if (event.target.tagName === 'INPUT') {
       return;
     }
-    
+
     var checkbox = $(this).parent().find(':checkbox');
-    
+
     checkbox = checkbox.attr('checked', !checkbox.attr('checked'));
-    
+
     event.stopPropagation();
   });
 {/literal}
index 526cf88..b8a4cd7 100644 (file)
@@ -45,7 +45,7 @@
         <input type='hidden' name='mid' value='{$smarty.get.mid}' />
         <input type='submit' name='mok' value='Accepter !'
           onclick="return confirm('Es-tu sûr de vouloir Envoyer cet email sur la liste&nbsp;?')"/>&nbsp;
-        <input type='submit' name='mno' value='Refuser !' 
+        <input type='submit' name='mno' value='Refuser !'
           onclick="return confirm('Es-tu sûr de vouloir Refuser cet email&nbsp;?')"/>&nbsp;
         <input type='submit' name='mdel' value='Spam !' style='color:red;'
           onclick="return confirm('Es-tu sûr de vouloir Détruire cet email&nbsp;?')"/>
index 1c9f0e2..f1bbc02 100644 (file)
@@ -28,7 +28,7 @@
 
 {elseif $user && !$user->alive}
 <p class="erreur">
-  {$user->fullName()} (X{$user->promo()}) est malheureusement décédé{if $user->isFemale()}e{/if}.
+  {$user->fullName("promo")} est malheureusement décédé{if $user->isFemale()}e{/if}.
   Nous ne réaliserons maintenance sur son adresse Polytechnique.org qu'à la demande explicite
   de sa famille. Pour tout renseignement, merci de <a href="mailto:contact@polytechnique.org">
   contacter le support</a>.
@@ -36,7 +36,7 @@
 
 {elseif $user}
 <h1>
-  Recherche d'adresses pour {$user->fullName()} (X{$user->promo()}).
+  Recherche d'adresses pour {$user->fullName("promo")}.
 </h1>
 
 {if !$user->email}
 {elseif $user->last}
 <p>
   {$user->fullName()} a encore des adresses de redirection actives malgré des pannes détectées sur certaines d'entre elles. Si
-  tu es sûr{if $smarty.session.femme}e{/if} que son adresse Polytechnique.org est en panne, tu peux proposer une nouvelle
+  tu es sûr{if $smarty.session.user->gender}e{/if} que son adresse Polytechnique.org est en panne, tu peux proposer une nouvelle
   adresse email à ajouter à ses redirections. Merci d'ajouter un commentaire pour nous indiquer la raison de cette proposition.
 </p>
 {else}
 <p>
-  Nous n'avons actuellement enregistré aucune panne sur les adresses de redirection de {$user->fullName()}. Si tu es 
-  sûr{if $smarty.session.femme}e{/if} que son adresse de redirection actuelle est en panne, tu peux nous proposer
+  Nous n'avons actuellement enregistré aucune panne sur les adresses de redirection de {$user->fullName()}. Si tu es
+  sûr{if $smarty.session.user->gender}e{/if} que son adresse de redirection actuelle est en panne, tu peux nous proposer
   une nouvelle adresse, accompagnée d'un commentaire nous expliquant les raisons exactes de cette proposition.
 </p>
 {/if}
@@ -70,7 +70,7 @@
 <form method="post" action="{$platal->path}">
   {xsrf_token_field}
   <table class="bicol" summary="Fiche camarade">
-    <tr><th colspan="2">Proposition d'adresse pour<br />{$user->fullName()} (X{$user->promo()})</th></tr>
+    <tr><th colspan="2">Proposition d'adresse pour<br />{$user->fullName("promo")}</th></tr>
     <tr class="pair">
       <td>Adresse email&nbsp;:</td>
       <td>
index 1694238..c5d27aa 100644 (file)
 <br />
 
 <p>
-Nombre d'X vivants d'après notre base de données&nbsp;: {$stats.vivants}<br />
-Nombre d'X vivants inscrits à Polytechnique.org&nbsp;: {$stats.inscrits}<br />
-Soit un pourcentage d'inscrits de&nbsp;: {$stats.ins_rate} %<br />
+nombre d'X vivants d'après notre base de données&nbsp;: {$statistics.alive}<br />
+nombre d'X vivants inscrits à Polytechnique.org&nbsp;: {$statistics.registered}<br />
+Soit un pourcentage d'inscrits de&nbsp;: {$statistics.registeredRate} %<br />
 </p>
 
 <p>
 Parmi ceux-ci&nbsp;:<br />
-Nombre d'X vivants depuis 1972 d'après notre base de données&nbsp;: {$stats.vivants72}<br />
-Nombre d'X vivants depuis 1972 inscrits à Polytechnique.org&nbsp;: {$stats.inscrits72}<br />
-Soit un pourcentage d'inscrits de&nbsp;: {$stats.ins72_rate} %<br />
+nombre d'X vivants depuis 1972 d'après notre base de données&nbsp;: {$statistics.alive72}<br />
+nombre d'X vivants depuis 1972 inscrits à Polytechnique.org&nbsp;: {$statistics.registered72}<br />
+Soit un pourcentage d'inscrits de&nbsp;: {$statistics.registeredRate72} %<br />
 </p>
 
 <p>
-Nombre de Polytechniciennes vivantes&nbsp;: {$stats.vivantes}<br />
-Nombre de Polytechniciennes vivantes et inscrites&nbsp;: {$stats.inscrites}<br />
-Soit un pourcentage d'inscrites de&nbsp;: {$stats.inse_rate} %<br />
+nombre de Polytechniciennes vivantes&nbsp;: {$statistics.womenAlive}<br />
+nombre de Polytechniciennes vivantes et inscrites&nbsp;: {$statistics.womenRegistered}<br />
+Soit un pourcentage d'inscrites de&nbsp;: {$statistics.womenRegisteredRate} %<br />
 </p>
 
 <p>
-Nombre d'<a href="marketing/this_week">inscrits ces 7 derniers jours</a>&nbsp;: {$nbInsSem}<br />
-Nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non terminée)&nbsp;: {$nbInsEnCours}
+nombre d'<a href="marketing/this_week">inscrits ces 7 derniers jours</a>&nbsp;: {$registrations.week}<br />
+nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non terminée)&nbsp;: {$registrations.pending}
 </p>
 
 <table class="bicol">
@@ -69,34 +69,37 @@ Nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non
   </tr>
   <tr>
     <td>&nbsp;</td>
-    <td class="titre">Abouti</td>
     <td class="titre">Non abouti</td>
+    <td class="titre">Abouti</td>
     <td class="titre">Total</td>
   </tr>
   <tr>
     <td>Personnel</td>
-    <td>{$nbInsMarketOkPerso}</td>
-    <td>{$nbInsMarketNoPerso}</td>
-    <td>{$nbInsMarketOkPerso+$nbInsMarketNoPerso}</td>
+    <td>{$marketings.noPerso}</td>
+    <td rowspan="3" style="vertical-align: middle">{$marketings.ok}</td>
+    <td rowspan="3" style="vertical-align: middle">{$marketings.ok+$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
   </tr>
   <tr>
     <td>Par Polytechnique.org</td>
-    <td>{$nbInsMarketOkXorg}</td>
-    <td>{$nbInsMarketNoXorg}</td>
-    <td>{$nbInsMarketOkXorg+$nbInsMarketNoXorg}</td>
+    <td>{$marketings.noXorg}</td>
+  </tr>
+  <tr>
+    <td>Par l'AX</td>
+    <td>{$marketings.noAX}</td>
   </tr>
   <tr>
     <td>Cette semaine</td>
-    <td>{$nbInsMarketOkWeek}</td>
-    <td>{$nbInsMarketNoWeek}</td>
-    <td>{$nbInsMarketOkWeek+$nbInsMarketNoWeek}</td>
+    <td>{$marketings.noWeek}</td>
+    <td>{$marketings.okWeek}</td>
+    <td>{$marketings.okWeek+$marketings.noWeek}</td>
   </tr>
   <tr>
     <td class="titre">Total</td>
-    <td>{$nbInsMarketOkPerso+$nbInsMarketOkXorg}</td>
-    <td>{$nbInsMarketNoPerso+$nbInsMarketNoXorg}</td>
-    <td>{$nbInsMarketOkPerso+$nbInsMarketOkXorg+$nbInsMarketNoPerso+$nbInsMarketNoXorg}</td>
+    <td>{$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
+    <td>{$marketings.ok}</td>
+    <td>{$marketings.ok+$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
   </tr>
 </table>
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+
index 6b786c9..e7fdb79 100644 (file)
@@ -27,7 +27,7 @@
 {#globals.baseurl#}/register/%%hash%%
 ==========================================================
 
-Il ne te faut que 5 minutes sur https://www.polytechnique.org/ pour rejoindre la communauté polytechnicienne sur le web grâce aux services de Polytechnique.org dont profitent déjà {$num_users} camarades. Cela te permettra, entre autres, de contacter un X en connaissant seulement son nom et son prénom et de bénéficier à vie d'une adresse prestigieuse {$u.forlife_email} et de son alias discret {$u.forlife_email2} (m4x = mail for X).
+Il ne te faut que 5 minutes sur https://www.polytechnique.org/ pour rejoindre la communauté polytechnicienne sur le web grâce aux services de Polytechnique.org dont profitent déjà {$globals->core->NbIns|number_format} camarades. Cela te permettra, entre autres, de contacter un X en connaissant seulement son nom et son prénom et de bénéficier à vie d'une adresse prestigieuse {$u.forlife_email} et de son alias discret {$u.forlife_email2} (m4x = mail for X).
 
 Pas de nouvelle boîte aux lettres à relever, il suffit de la rediriger vers ton adresse personnelle et/ou professionnelle que tu indiques et que tu peux changer à ta guise, sans que tes correspondants n'aient à actualiser leur carnet d'adresses.
 
@@ -37,8 +37,6 @@ N'hésite pas à parler de Polytechnique.org à nos camarades pas encore inscrit
 {$personal_notes}
 À bientôt sur Polytechnique.org <https://www.polytechnique.org>,
 
-Bien cordialement,
--- 
 {$sign}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 0cdf5a2..f157b6c 100644 (file)
       <td>{profile user=$it}</td>
       <td>{if $it->lastKnownEmail()}{mailto address=$it->lastKnownEmail()}{/if}</td>
       <td class="center">
-        {if $it->lastMarketingRelance() && $it->lastMarketingRelance() != '0000-00-00'}
-        Relance le&nbsp;: {$it->lastMarketingRelance()}
-        {elseif $it->lastKnownEmail()}
-        En cours&nbsp;: {$it->lastKnownEmail()}
+        {if $it->pendingRegistrationDate() > $it->lastMarketingDate()}
+        En cours&nbsp;: {$it->pendingRegistrationEmail()}
+        {elseif $it->lastMarketingDate() && $it->lastMarketingDate() != '0000-00-00'}
+        Relance le&nbsp;: {$it->lastMarketingDate()}
         {else}
         -
         {/if}
index e0951c5..e20cfb5 100644 (file)
@@ -95,8 +95,8 @@ peut sans aucun doute l'aider à se décider&nbsp;!
         </label><br />
         <label>
           <input type="radio" name="origine" value="staff"
-                 onclick='$("#sender").html("{$xorg_signature}"); $("#tr_perso").hide();
-                          $("#personal_notes_display").hide();' />
+                 onclick='$("#sender").html("{include file=include/signature.mail.tpl mail_part=$mail_part}");
+                          $("#tr_perso").hide(); $("#personal_notes_display").hide();' />
           au nom de l'équipe Polytechnique.org
         </label>
       </td>
index 30b571b..e1a86be 100644 (file)
@@ -22,7 +22,7 @@
 
 
 <h1>
-{if $actif}Modification du mot de passe SMTP/NNTP{else}Activation de ton compte SMTP/NNTP{/if}  
+{if $actif}Modification du mot de passe SMTP/NNTP{else}Activation de ton compte SMTP/NNTP{/if}
 </h1>
 
 {literal}
 <p>
   {icon name=error title="Attention"} Nous te déconseillons fortement d'utiliser le même
   mot de passe que pour la connexion au site. En effet, ce mot de passe sert à accéder à des
-  services <em>moins</em> sécurisés, ce qui nécessite son enregistrement en clair dans 
+  services <em>moins</em> sécurisés, ce qui nécessite son enregistrement en clair dans
   notre base de données.
 </p>
 
 </p>
 {include wiki=Xorg.NNTPSecurise}
 {elseif $smarty.request.doc eq "smtp"}
-<p> 
+<p>
   <a href="{$platal->pl_self()}?doc=nntp">Pourquoi et comment</a> utiliser le serveur NNTP de {#globals.core.sitename#}.<br />
 </p>
 {include wiki=Xorg.SMTPSecurise}
index d25c94c..83d5d24 100644 (file)
@@ -22,7 +22,7 @@
 
 <h1>Fil RSS</h1>
 
-{if !$smarty.session.token}
+{if !$smarty.session.user->token}
 <p>
   Tu viens de cliquer sur le lien d'activation des fils RSS. Les fils RSS du site
   ne sont pas activés dans tes préférences.
@@ -52,11 +52,11 @@ En voici les adresses&nbsp;:
 <ul>
   <li>
   Anonces sur la page d'entrée&nbsp;:
-  <a href="rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" title="Annonces">{icon name=feed title='fil rss'}</a>
+  <a href="rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" title="Annonces">{icon name=feed title='fil rss'}</a>
   </li>
   <li>
   Ton carnet polytechnicien&nbsp;:
-  <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
+  <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
   </li>
 </ul>
 <p>
index 063ad73..a88b734 100644 (file)
@@ -33,7 +33,7 @@
 <strong>Si vous êtes un recruteur ou une entreprise, / if you are a recruiter or a company,</strong>
 <ul>
   <li class="spaced">
-    vous avez la possibilité 
+    vous avez la possibilité
     <strong><a href="http://www.manageurs.com/?langue=fr">d'utiliser le site
         Manageurs.com</a></strong> pour rentrer en contact avec les
     polytechniciens, mettre en ligne des offres d'emploi, consulter l'annuaire
similarity index 90%
rename from templates/platal/motdepasse.tpl
rename to templates/platal/password.tpl
index 0343c03..07b01b2 100644 (file)
 <br />
 <fieldset style="width: 70%; margin-left: 15%">
   <legend>{icon name=lock} Saisie du nouveau mot de passe</legend>
-  <form action="{$smarty.server.REQUEST_URI}" method="post" id="changepass">
+  <form action="{$smarty.server.REQUEST_URI}" method="post">
+  {xsrf_token_field}
     <table style="width: 100%">
       <tr>
         <td class="titre">
           Mot de passe&nbsp;:
         </td>
         <td>
-          <input type="password" size="10" maxlength="256" name="nouveau" />
+          <input type="password" size="10" maxlength="256" name="new1" />
         </td>
       </tr>
       <tr>
@@ -52,7 +53,7 @@
           Retape-le une fois&nbsp;:
         </td>
         <td>
-          <input type="password" size="10" maxlength="256" name="nouveau2" />
+          <input type="password" size="10" maxlength="256" name="new2" />
         </td>
       </tr>
       <tr>
           Sécurité
         </td>
         <td>
-          {checkpasswd prompt="nouveau" submit="submitn"}
+          {checkpasswd prompt="new1" submit="submitn"}
         </td>
       </tr>
       <tr>
         <td colspan="2" class="center">
-          <input type="submit" value="Changer" name="submitn" onclick="EnCryptedResponse(); return false;" />
+          <input type="hidden" name="pwhash" value="" />
+          <input type="submit" value="Changer" name="submitn" onclick="return hashResponse('new1', 'new2', true);" />
         </td>
       </tr>
     </table>
   </form>
-  <form action="{$smarty.server.REQUEST_URI}" method="post" id="changepass2">
-  <div>
-  {xsrf_token_field}
-  <input type="hidden" name="response2"  value="" />
-  </div>
-  </form>
 </fieldset>
 
 <p>
index 05b8d4e..590cf80 100644 (file)
@@ -61,7 +61,7 @@
   </tr>
   <tr class="impair">
     <td class="half">
-      {if $smarty.session.email_format eq html}
+      {if $smarty.session.user->email_format eq 'html'}
       <h3>
         <a href="javascript:dynpostkv('prefs','email_format','text')">Recevoir les emails en format texte</a>
       </h3>
@@ -83,7 +83,7 @@
     </td>
     <td class="half">
       <h3>
-        {if $smarty.session.token}
+        {if $smarty.session.user->token}
         <a href="javascript:dynpostkv('prefs','rss',0)">Désactiver les fils rss</a>
         {else}
         <a href="javascript:dynpostkv('prefs','rss',1)">Activer les fils rss</a>
index ae484a7..f284018 100644 (file)
@@ -36,7 +36,7 @@
         <select name="medal_sel" onchange="updateMedal()">
           <option value=''>&nbsp;</option>
           {foreach from=$medal_list key=type item=list}
-          <optgroup label="{$trad[$type]}&hellip;">
+          <optgroup label="{$fullType[$type]}&hellip;">
             {foreach from=$list item=m}
             <option value="{$m.id}">{$m.text}</option>
             {/foreach}
@@ -50,8 +50,8 @@
       {foreach from=$medals item=medal key=id}
       {include file="profile/deco.medal.tpl" medal=$medal id=$id}
       {/foreach}
-      <div class="center"><small>Si ta décoration ou ta médaille ne figure pas dans la liste,
-      <a href="mailto:support@{#globals.mail.domain#}">contacte-nous</a>.</small></div>
+      <p class="center"><small>Si ta décoration ou ta médaille ne figure pas dans la liste,
+      <a href="mailto:support@{#globals.mail.domain#}">contacte-nous</a>.</small></p>
     </td>
   </tr>
 </table>
index 1cd0112..e5df00c 100644 (file)
@@ -22,6 +22,6 @@
 
 educationDegree     = new Array({education_degree});
 educationDegreeAll  = new Array({education_degree_all});
-educationDegreeName = new Array({education_degree_name}); 
+educationDegreeName = new Array({education_degree_name});
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index aae79e1..cdac3c3 100644 (file)
@@ -22,7 +22,7 @@
 
 <table class="bicol" style="margin-bottom: 1em" summary="Profil : Noms">
   <tr>
-    <th colspan="3">Noms</th>
+    <th colspan="3">Noms{if $validation} <small>(validations en attente de modération)</small>{/if}</th>
   </tr>
   <tr>
     <td class="titre">
index bdcc013..77641e6 100644 (file)
@@ -22,9 +22,9 @@
 
 <h1>Mes groupes X sur Polytechnique.net</h1>
 
-<p class="center"> 
-[<a href="http://www.polytechnique.net/login/plan">Tous les groupes X</a>] 
-</p> 
+<p class="center">
+[<a href="http://www.polytechnique.net/login/plan">Tous les groupes X</a>]
+</p>
 
 {foreach from=$assos item="asso"}
 <div style="width:48%;float:left" >
index 52688b9..44ea740 100644 (file)
@@ -20,7 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
-<div>{icon name=information title="Afficher ma fiche référent"}Tu peux consulter ta <a class="popup2" href="referent/{$smarty.session.hruid}">fiche référent</a> qui n'est accessible que par les X.
+<div>{icon name=information title="Afficher ma fiche référent"}Tu peux consulter ta <a class="popup2" href="referent/{$hrpid}">fiche référent</a> qui n'est accessible que par les X.
 </div>
 {if (!$expertise)||(!($sectors|@count))}
   <br /><div>
diff --git a/templates/profile/notification.mail.tpl b/templates/profile/notification.mail.tpl
new file mode 100644 (file)
index 0000000..26c3cb4
--- /dev/null
@@ -0,0 +1,45 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2010 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="profile"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{cc full=#cc#}
+{subject text="Modification de ton profil"}
+{elseif $mail_part eq 'wiki'}
+{if $sex}Chère{else}Cher{/if} {$yourself},
+
+Les champs suivants de ton profil ont été modifiés le {$date|date_format:"%x"} :
+{foreach from=$modifications item=modification}
+*{$modification.field} : « {$modification.oldText} » est devenu « {$modification.newText} » (effectuée par {$modification.full_name}).
+{/foreach}
+
+Tu peux voir ta fiche là :
+*{$globals->baseurl}/profile/{$hrpid}
+Tu peux aussi l'éditer toi-même là :
+*{$globals->baseurl}/profile/edit/{$hrpid}
+
+{include file="signature.mail.tpl"}
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 4402224..53eecf4 100644 (file)
@@ -42,7 +42,7 @@ function chgMainWinLoc(strPage)
 <div id="fiche">
   <div id="photo" class="part">
     {assign var=photo value=$profile->getPhoto(false)}
-    {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}" width="{$photo->width()}"/>{/if}
+    {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}{if $with_pending_pic}/req{/if}" width="{$photo->width()}"/>{/if}
 
     {if $logged && $view eq 'private' && ( $profile->section|smarty:nodefaults || $profile->getBinets()|smarty:nodefaults || ($owner && $owner->groups()|smarty:nodefaults))}
       <h2>À l'X&hellip;</h2>
@@ -87,10 +87,7 @@ function chgMainWinLoc(strPage)
   <div id="fiche_identite" class="part">
     <div class="civilite">
       {if $profile->isFemale()}&bull;{/if}
-        <span {if $profile->name_tooltip neq ""}class="hinted" title="{$profile->name_tooltip}"{/if}>{$profile->shortName()}</span>
-      {if $logged}
-        {if $profile->nickname} (alias {$profile->nickname}){/if}
-      {/if}
+        {if $logged}{$profile->private_name}{else}{$profile->public_name}{/if}
 
       {if $logged}
         &nbsp;{if !$profile->isDead()}<a href="vcard/{$owner->login()}.vcf">{*
@@ -155,11 +152,13 @@ function chgMainWinLoc(strPage)
       {/if}
       <div class='spacer'></div>
     </div>
+    {else}
+    <div class='spacer'></div>
     {/if}
 
     <div class='formation'>
-      {foreach from=$profile->nationalities() item=nat}
-        <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />&nbsp;
+      {foreach from=$profile->nationalities() item=country key=code}
+      <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
       {/foreach}
 
       {$profile->promo()}
@@ -180,14 +179,17 @@ function chgMainWinLoc(strPage)
 
       {assign var=corps value=$profile->getCorps()}
       {if $corps && ($corps->current || $corps->original)}
-      <ul>
+        <ul>
         {if $corps->current}
-          <li>Corps actuel&nbsp;: {$corps->current_name} {$corps->current_rank}</li>
+          <li>
+            Corps actuel&nbsp;: {$corps->current_name}
+            {if $corps->current_rank}({$corps->current_rank}){/if}
+          </li>
         {/if}
-        {if $corps->original}
+        {if $corps->current != $corps->original && $corps->original}
           <li>Corps d'origine&nbsp;: {$corps->original_name}</li>
         {/if}
-      </ul>
+        </ul>
       {/if}
 
     </div>
index 1265508..5c04863 100644 (file)
@@ -50,9 +50,9 @@ function setSector(sector)
     } else {
         Ajax.update_html('ssect_chg', baseurl + 'ssect/' + sector);
         Ajax2.update_html('country_chg', baseurl + 'country/' + sector);
-        document.getElementById('scat').style.display = ''; 
-        document.getElementById('country').style.display = ''; 
-        document.getElementById('keywords').style.display = ''; 
+        document.getElementById('scat').style.display = '';
+        document.getElementById('country').style.display = '';
+        document.getElementById('keywords').style.display = '';
         document.getElementById('search_referent').disabled = '';
     }
 }
index bd86370..ee2ce77 100644 (file)
@@ -69,7 +69,7 @@
       </th>
     </tr>
     <tr>
-      <td class="titre"> 
+      <td class="titre">
         Nom <span class="smaller">(à l'X)</span>
       </td>
       <td>
index d781942..960b8ef 100644 (file)
@@ -32,7 +32,7 @@
   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> 
+  Note que tu pourrais perdre l'adresse <strong>{$smarty.session.subState.bestalias}@{#globals.mail.domain#}</strong>
   si un homonyme s'inscrivait, même si cela reste assez rare.
   </p>
   {else}
   de ton adresse à vie <strong>{$smarty.session.subState.forlife}@{#globals.mail.domain#}</strong>.
   </p>
   {/if}
-  
+
   <p>
   Ces adresses sont des redirections vers une ou plusieurs adresses email de ton choix.
   Indiques-en une pour terminer ton inscription. Tu pourras la modifier ou ajouter d'autres
   adresses une fois inscrit.
   </p>
   <p>
-  Attention, cette adresse doit <strong>impérativement être valide</strong> pour que nous puissions 
+  Attention, cette adresse doit <strong>impérativement être valide</strong> pour que nous puissions
   t'envoyer tes informations de connexion.
   </p>
 
         <span class="smaller">au moins 6 caractères</span>
       </td>
       <td>
-        <input type="hidden" name="response2" />
-        <input type="password" size="10" maxlength="256" name="password" /><br/>
+        <input type="hidden" name="pwhash" />
+        <input type="password" size="10" maxlength="256" name="password1" /><br/>
         <input type="password" size="10" maxlength="256" name="password2" /> (retape ton mot de passe)<br />
-        {checkpasswd prompt="password" text="Terminer la pré-inscription"}
+        {checkpasswd prompt="password1" text="Terminer la pré-inscription"}
       </td>
     </tr>
   </table>
     </tr>
     <tr class="impair">
       <td class="center">
-        <input type="submit" name="submitn" value="Continuer" onclick="EncryptedResponseInNestedForm(); return false;" />
+        <input type="submit" name="submitn" value="Continuer" onclick="return hashResponse('password1', 'password2', true);" />
       </td>
     </tr>
   </table>
 </form>
-<form action="register" id="changepass">
-  <div>
-    <input type="hidden" name="nouveau" />
-    <input type="hidden" name="nouveau2" />
-  </div>
-</form>
 {/if}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 478c428..ff73a1c 100644 (file)
     </tr>
     <tr>
       <td colspan="2">
-      <label for="only_current"><input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current}  
-checked="checked"{/if}/>Chercher uniquement les adresses où les camarades sont actuellement.</label></td>
+        <label for="only_current">
+          <input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current} checked="checked"{/if}/>
+          Chercher uniquement les adresses où les camarades sont actuellement.
+        </label>
+      </td>
     </tr>
     <tr>
       <th colspan="2">Activité</th>
index ee1045a..58afd76 100644 (file)
     <a href="search/adv">recherche avancée</a>
   </strong>
   </li>
-  
+
   <li>Effectuer une nouvelle <strong>
     <a href="search">recherche simple</a>
   </strong>
   </li>
 </ul>
-  
+
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index cc3de24..8cdeac7 100644 (file)
@@ -47,7 +47,7 @@ Parfois on ne sait plus si le nom qu'on recherche s'écrit «&nbsp;Lenormand&nbs
 </p>
 <p>
 Pour éviter ce genre d'écueils, il suffit de chercher&nbsp;: <code>Le Normand</code><br />
-En effet, le moteur de recherche va alors chercher tous les utilisateurs dont le nom 
+En effet, le moteur de recherche va alors chercher tous les utilisateurs dont le nom
 contient 'Le' <strong>et</strong> 'Normand' sans distinction de casse et sans tenir compte des accents.
 </p>
 <p>
index 25275c7..f36feab 100644 (file)
@@ -27,7 +27,7 @@
   http://www.polytechnique.org/bandeau.css.
   Pour avoir l'icone, pour des raisons de sécurité il n'y a pas d'accès
   direct, il faut alors rediriger bandeau/icone.png vers celle du site&nbsp;:
-  http://www.polytechnique.org/bandeau/icone.png 
+  http://www.polytechnique.org/bandeau/icone.png
 -->
 
 <!-- Don't copy this list of emails!!!
index 2ab77f8..9b61516 100644 (file)
@@ -55,7 +55,7 @@
 <div class="menu_title">Services</div>
 <div class="menu_item"><a href="emails/send">Envoyer un email</a></div>
 <div class="menu_item"><a href="banana/">Forums &amp; PA</a></div>
-{if $smarty.session.googleapps}
+{if $smarty.session.user->googleapps}
 <div class="menu_item"><a href="http://gmail.polytechnique.org/">Emails Google Apps</a></div>
 {/if}
 <div class="menu_item"><a href="lists">Listes de diffusion</a></div>
index 184f8f8..16d869a 100644 (file)
               </td>
               <td class="inscrits">
                 {$globals->core->NbIns|number_format} polytechniciens sur le web
+                {if t($smarty.request.quick)}
+                  {assign var=requestQuick value=$smarty.request.quick}
+                {else}
+                  {assign var=requestQuick value="Recherche dans l\'annuaire"}
+                {/if}
                 <form action="search" method="get">
                     <div>
-                        <input type="text" size="20" name="quick" id="quick" class="quick_search"
-                               value="{$smarty.request.quick|default:'Recherche dans l\'annuaire'}"
-                               onfocus="if (this.value === 'Recherche dans l\'annuaire') this.value='';
-                                        $('#quick_button').show()"
-                               onblur="if (this.value === '') this.value='{$smarty.request.quick|default:'Recherche dans l\'annuaire'|escape:javascript}'"
-                               />
                         <button id="quick_button" type="submit" style="display: none"
                                 onclick="if ($('#quick').val() === 'Recherche dans l\'annuaire') $('#quick').val('')">
                           OK
                         </button>
+                        <input type="text" size="20" name="quick" id="quick" class="quick_search"
+                               value="{$requestQuick}"
+                               onfocus="if (this.value === 'Recherche dans l\'annuaire') this.value='';
+                                        $('#quick_button').show()"
+                               onblur="if (this.value === '') this.value='{$requestQuick|escape:javascript}'"
+                               />
                     </div>
                 </form>
                 {if $smarty.session.auth gt AUTH_PUBLIC && $smarty.session.notifs}
index c929dc1..66e41e2 100644 (file)
@@ -30,7 +30,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index fd314ef..ce82b94 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index a1e2280..8857323 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index 773b903..dd63773 100644 (file)
@@ -30,7 +30,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index e983733..fe108ed 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index b61e0cd..35c62dc 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index 568b79c..41f517c 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index 017c769..a262554 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index 1a1cb5c..d34754d 100644 (file)
@@ -29,7 +29,7 @@
   <body>
     {include core=plpage.devel.tpl}
 
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <table id="suid" cellpadding="0" cellspacing="0">
       <tr>
         <td>
index 78d358e..3953c99 100644 (file)
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid} 
-    <div id="suid"> 
-      <a href="exit"> 
-        Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()}) 
-      </a> 
-    </div> 
-    {/if} 
+    {if t($smarty.session.suid)}
+    <div id="suid">
+      <a href="exit">
+        Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
+      </a>
+    </div>
+    {/if}
 
   {if $simple}
 
index b06dbc8..58562a8 100644 (file)
@@ -30,7 +30,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index c3e897e..637090b 100644 (file)
@@ -35,7 +35,7 @@
     {else}
 
     {include file=skin/common.bandeau.tpl}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index 1dad2ae..24c785b 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index 7ea2fa1..9fc4419 100644 (file)
@@ -31,7 +31,7 @@
     {if !$simple}
       {include file=skin/common.bandeau.tpl}
     {/if}
-    {if $smarty.session.suid}
+    {if t($smarty.session.suid)}
     <div id="suid">
       <a href="exit">
         Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
index e349535..6de1aae 100644 (file)
@@ -60,7 +60,7 @@
 <p>
   Tu trouveras ici les interruptions de service de Polytechnique.org qui ont été
   constatées <strong>durant les trois dernières semaines</strong>, ou qui sont prévues dans le futur.
-  Il est à noter qu'à ce jour la quasi-totalité des coupures proviennent 
+  Il est à noter qu'à ce jour la quasi-totalité des coupures proviennent
   de défaillances du réseau de l'École, où nos serveurs sont hébergés (rupture de la
   connexion internet de l'École, problème électrique&hellip;).
 </p>
index cc63cdd..11e0858 100644 (file)
@@ -36,7 +36,7 @@
         </a>
       </td>
     </tr>
-    <script type="text/javascript">//<![CDATA[ 
+    <script type="text/javascript">//<![CDATA[
       var id = new Array();
       id['choices'] = {$survey_current.choices|@count};
       id['subquestions'] = {$survey_current.subquestions|@count};
       function newField(name, tid)
       {
         fid = "t" + id[name];
-        $("#" + name + "_" + tid).before('<div id="' + name + '_' + fid + '">' 
+        $("#" + name + "_" + tid).before('<div id="' + name + '_' + fid + '">'
             + '<input id="' + name + '_' + fid + '_field" type="text" name="survey_question[' + name + '][' + fid + ']" size="50" maxlength="200" value="" />&nbsp;'
             + '<a href="javascript:removeField(&quot;' + name + '&quot;,&quot;' + fid + '&quot;)"><img src="images/icons/delete.gif" alt="" title="Supprimer" /></a>'
-            + '</div>'); 
-        id[name]++; 
+            + '</div>');
+        id[name]++;
         $("#" + name + "_" + fid + "_field").focus();
       }
       function removeField(name, tid)
       {
         $("#" + name + "_" + tid).remove();
       }
-      {/literal} 
-    //]]></script> 
+      {/literal}
+    //]]></script>
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
index b57f4ae..3bc93cf 100644 (file)
       {literal}
       $(document).ready(function() {
         function hidePromo(value) {
-          if (value == "0" || value == "") { 
-            $("#ln_promo").hide(); 
+          if (value == "0" || value == "") {
+            $("#ln_promo").hide();
             $("#ln_promo_exp").hide();
-          } else { 
+          } else {
             $("#ln_promo").show();
             $("#ln_promo_exp").show();
-          } 
+          }
         }
         $("[name='survey_question[mode]']").change(function() { hidePromo(this.value); });
         hidePromo({/literal}"{$survey_current.mode}"{literal});
index 29aa292..9a97536 100644 (file)
@@ -22,6 +22,8 @@
 
 <h1>Sondages</h1>
 
+{* Survey::MODE_ALL equals 0. *}
+{assign var=SurveyMODE_ALL value=0}
 <table class="bicol">
   <tr>
     <th>
@@ -29,7 +31,7 @@
     </th>
   </tr>
   {iterate item=s from=$survey_current}
-  {if $smarty.session.auth || $s.mode == Survey::MODE_ALL}
+  {if $smarty.session.auth || $s.mode == $SurveyMODE_ALL}
   <tr class="{cycle name=cs_cycle values="impair,pair"}">
     <td class="half">
       &bull;
@@ -58,7 +60,7 @@
     </th>
   </tr>
   {iterate item=s from=$survey_old}
-    {if $smarty.session.auth || $s.mode == Survey::MODE_ALL}
+    {if $smarty.session.auth || $s.mode == $SurveyMODE_ALL}
   <tr class="{cycle name=os_cycle values="impair,pair"}">
     <td class="half">
       &bull;
index 0b18177..7ce6cf6 100644 (file)
       <tr>
         <td class="titre">Promotions&nbsp;:</td>
         <td>
-          {if $survey.promos eq "#"} 
+          {if $survey.promos eq "#"}
           <span class="erreur">erreur</span>
-          {elseif $survey.promos eq ""} 
-          aucune restriction 
-          {else} 
-          {$survey.promos} 
+          {elseif $survey.promos eq ""}
+          aucune restriction
+          {else}
+          {$survey.promos}
           {/if}
         </td>
       </tr>
index 9c6ffaf..a75ad85 100644 (file)
@@ -30,7 +30,7 @@
       <div class="cat {if $cat eq institutions}sel{/if}"><a href="groups/institutions">Institutions</a></div>
       <div class="cat {if $cat eq promotions}sel{/if}"><a href="groups/promotions">Promotions</a></div>
     </td>
-    
+
     {if $doms}
     <td style="vertical-align: top">
       {foreach from=$doms item=g}
index 00b8fa8..b8a29af 100644 (file)
               {/if}
             {/foreach}
           {/foreach}
-          {assign var=asso_id value=$asso->id}
+          {if t($asso)}{assign var=asso_id value=$asso->id}{/if}
+          {if t($smarty.session.suid)}{assign var=suid value=true}{else}{assign var=suid value=false}{/if}
           {if $asso && $is_admin ||
-                      ($smarty.session.suid && ($smarty.session.suid.perms->hasFlag('admin') ||
+                      ($suid && ($smarty.session.suid.perms->hasFlag('admin') ||
                                                 $smarty.session.suid.may_update[$asso_id]))}
           <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">
-                {if hasPerm('admin') || ($smarty.session.suid && $smarty.session.suid.perms->hasFlag('admin'))}
+                {if hasPerm('admin') || ($suid && $smarty.session.suid.perms->hasFlag('admin'))}
                 <option value="admin" {if hasPerm('admin')}selected="selected"{/if}>Administrateur</option>
                 {/if}
                 <option value="anim" {if $is_admin && !hasPerm('admin')}selected="selected"{/if}>Animateur</option>
index 759323f..4e2f4cd 100644 (file)
@@ -249,7 +249,7 @@ Ton inscription à [METS LE NOM DE L'ÉVÉNEMENT ICI] a bien été enregistrée
     </tr>
   {/foreach}
   </table>
+
   <div class="center">
     {if $evt.eid}<input type="hidden" name="organisateur_uid" value="{$evt.organisateur_uid}" />{/if}
     <input type="submit" name="valid" value="Valider" />
index 16f6c84..3db8f45 100644 (file)
@@ -24,7 +24,7 @@
 <h1>{$asso->nom}&nbsp;: Événements</h1>
 {else}
 <h1>
-  {$asso->nom}&nbsp;: 
+  {$asso->nom}&nbsp;:
   {if $archive}[<a href="{$platal->ns}events">Événements</a>] {else}Événements {/if}
   {if $archive}Archives {else}[<a href="{$platal->ns}events/archive">Archives</a>] {/if}
 </h1>
index db519ae..c28bd86 100644 (file)
@@ -39,7 +39,7 @@
 
 {if $admin || $event.show_participants}
 <p class='descr'>
-  Tu peux 
+  Tu peux
   <a href="{$platal->ns}events/admin/{$event.eid}">
     consulter la liste des participants
     {icon name=group title="Liste des participants"}</a>
@@ -98,7 +98,7 @@
           {elseif $event.paid < $event.topay}
           Tu dois encore payer {math equation="a-b" a=$event.topay b=$event.paid|replace:'.':','}&nbsp;&euro;
           (tu as déjà payé {$event.paid|replace:'.':','}&nbsp;&euro;).
-          {else} 
+          {else}
           Tu as déjà payé {$event.paid|replace:'.':','}&nbsp;&euro; pour ton inscription.
           {/if}
         </div>
index 92ecf00..b387273 100644 (file)
@@ -26,6 +26,7 @@ function visibilityChange(box)
 {
     var state = (box.checked ? 'none' : '');
     document.getElementById('promo_titre').style.display = state;
+    document.getElementById('promo_explanation').style.display = state;
     document.getElementById('promo_min_tr').style.display = state;
     document.getElementById('promo_max_tr').style.display = state;
     document.getElementById('promo_range_tr').style.display = state;
@@ -163,7 +164,10 @@ function visibilityChange(box)
       </td>
     </tr>
     <tr id="promo_titre" {if $art.public}style="display: none"{/if}>
-      <th colspan="2">Promotions cibles</th>
+      <th colspan="2">Promotions d'entrée cibles</th>
+    </tr>
+    <tr id="promo_explanation" {if $art.public}style="display: none"{/if}>
+      <td colspan="2"><span class="smaller">{icon name=information} par exemple 2004 pour les X2004</span></td>
     </tr>
     {include file="include/field.promo.tpl" promo_min=$art.promo_min promo_max=$art.promo_max}
     {if $art.public}
index 08ae87f..a190767 100644 (file)
@@ -30,14 +30,14 @@ Le groupe {$asso->nom} compte {$nb_tot} membres&nbsp;:
   {if $is_admin}
   <li>
     <a href="{$platal->ns}member/new">
-      {icon name=add title="Ajouter un membre"} 
+      {icon name=add title="Ajouter un membre"}
       Ajouter un membre
     </a>
   </li>
   {if $asso->has_ml}
   <li>
     <a href="{$platal->ns}admin/annuaire">
-      {icon name=wand title="Synchroniser"} 
+      {icon name=wand title="Synchroniser"}
       Synchroniser annuaire et listes de diffusion
     </a>
   </li>
@@ -45,13 +45,13 @@ Le groupe {$asso->nom} compte {$nb_tot} membres&nbsp;:
   {/if}
   <li>
     <a href="{$platal->ns}annuaire/csv/{$asso->diminutif}.csv">
-      {icon name=page_excel title="Fichier Excel"} 
+      {icon name=page_excel title="Fichier Excel"}
       Obtenir au format Excel
     </a>
   </li>
   <li>
     <a href="{$platal->ns}annuaire/vcard/photos/{$asso->diminutif}.vcf">
-      {icon name=vcard title="Carte de visite"} 
+      {icon name=vcard title="Carte de visite"}
       Ajouter les membres à ton carnet d'adresse
     </a>
     (<a href="{$platal->ns}annuaire/vcard/{$asso->diminutif}.vcf">sans les photos</a>)
@@ -102,9 +102,11 @@ Le groupe {$asso->nom} compte {$nb_tot} membres&nbsp;:
     <th>Actions</th>
     {/if}
   </tr>
+  {assign var=lostUsers value=false}
   {foreach from=$users item=user}
   <tr>
     <td>
+      {if $user->lost}{assign var=lostUsers value=true}{/if}
       {profile user=$user promo=false}
     </td>
     <td>
@@ -149,7 +151,7 @@ Le groupe {$asso->nom} compte {$nb_tot} membres&nbsp;:
 </p>
 {/if}
 
-{if $broken}
+{if $lostUsers}
 <p class="smaller">
   {icon name=error}&nbsp;Un camarade signalé par ce symbole n'a plus d'adresse de redirection et ne peut donc
   plus être contacté via son adresse polytechnique.org. Si tu connais sa nouvelle adresse, tu peux nous la communiquer en
index 35e08c6..0119ece 100644 (file)
 <table class="tinybicol">
   <tr>
     <th>
-      {if $smarty.session.token}
-      <a href='{$platal->ns}rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml' style="display:block;float:right">
+      {if $smarty.session.user->token}
+      <a href='{$platal->ns}rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml' style="display:block;float:right">
         {icon name=feed title='fil rss'}
       </a>
       {else}
   </tr>
   {iterate item=art from=$article_index}
   <tr>
-    <td>&bull; 
+    <td>&bull;
     {if $art.nonlu}
       <a href="{$platal->ns}#art{$art.id}"><strong>
     {else}
index 0308240..ffd10e6 100644 (file)
       </td>
       <td>
         <select name="cat">
-          <option value="groupesx" {if $asso->cat eq GroupesX}selected="selected"{/if}>Groupes X</option>
-          <option value="binets" {if $asso->cat eq Binets}selected="selected"{/if}>Binets</option>
-          <option value="promotions" {if $asso->cat eq Promotions}selected="selected"{/if}>Promotions</option>
-          <option value="institutions" {if $asso->cat eq Institutions}selected="selected"{/if}>Institutions</option>
+          <option value="groupesx" {if $asso->cat eq 'GroupesX'}selected="selected"{/if}>Groupes X</option>
+          <option value="binets" {if $asso->cat eq 'Binets'}selected="selected"{/if}>Binets</option>
+          <option value="promotions" {if $asso->cat eq 'Promotions'}selected="selected"{/if}>Promotions</option>
+          <option value="institutions" {if $asso->cat eq 'Institutions'}selected="selected"{/if}>Institutions</option>
         </select>
       </td>
     </tr>
index 1a5eccc..acab579 100644 (file)
@@ -39,7 +39,7 @@
   <tr>
     {if $art.photo}
     <td rowspan="{if ($is_logged || $admin) && $art.contacts}3{else}2{/if}" style="width: 100px">
-      <img src="{$platal->ns}announce/photo/{$art.id}" alt="{$art.titre}" style="width: 100px" /> 
+      <img src="{$platal->ns}announce/photo/{$art.id}" alt="{$art.titre}" style="width: 100px" />
     </td>
     {/if}
     <td style="padding-bottom: 1em">
index f20f07e..3553465 100644 (file)
@@ -60,7 +60,7 @@
 {elseif $smarty.post.inscrire}
 
 <p class="descr">
-<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.
+<strong>Ta demande d'inscription a bien été envoyée&nbsp;!</strong> Tu seras averti{if $smarty.session.user->gender}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>
 
index b5f5d1b..50fa429 100644 (file)
@@ -49,7 +49,7 @@ masculin ou féminin, par son prénom, ou son nom.
   }
   {/literal}
 //]]></script>
+
 <form action="{$platal->ns}mail" method="post" enctype="multipart/form-data" onsubmit="return check(this);">
   {xsrf_token_field}
   <table class='bicol'>
index a6db51e..05b9b09 100644 (file)
@@ -80,6 +80,7 @@ function searchX()
     <tr>
       <td colspan="2">
         <input type="checkbox" id="x" name="x" onchange="xStateChange(this);" />
+        {* TODO: adapts text for masters and doctorates when required. *}
         <label for="x">Coche cette case s'il s'agit d'un X non inscrit à Polytechnique.org.</label>
       </td>
     </tr>
@@ -93,7 +94,8 @@ function searchX()
     </tr>
     <tr id="xpromo" style="display: none">
       <td class="titre">Promotion&nbsp;:</td>
-      <td><input type="text" id="promo" name="promo" size="4" value="" onkeyup="searchX();" /></td>
+      {* TODO: add examples for masters and doctorates when required. *}
+      <td><input type="text" id="promo" name="promo" size="4" value="" onkeyup="searchX();" /> <small>(X2004)</small></td>
     </tr>
     <tr id="xsearch" style="display: none" class="pair">
       <td colspan="2" id="search_result">
index 30ca337..9bc5502 100644 (file)
@@ -31,7 +31,7 @@
 </p>
 
 {else}
+
 <h1>{$asso->nom}&nbsp;: gestion des membres</h1>
 
 <h2>
index 1b506c6..596f8ac 100644 (file)
@@ -71,7 +71,7 @@
         Type d'utilisateur&nbsp;:
       </td>
       <td>
-        <select name="type" onchange="showInformations(this); return true"{if $user->profile()} disabled="disabled"{/if}>
+        <select name="type" onchange="showInformations(this); return true">
           <option value="xnet" {if $user->type neq 'virtual'}selected="selected"{/if}>Personne physique</option>
           <option value="virtual" {if $user->type eq "virtual"}selected="selected"{/if}>Personne morale</option>
         </select>
@@ -82,7 +82,7 @@
         Nom affiché&nbsp;:
       </td>
       <td>
-        <input type="text" value="{$user->displayName()}" name="display_name" size="40"{if $user->profile()} disabled="disabled"{/if} />
+        <input type="text" value="{$user->displayName()}" name="display_name" size="40" />
       </td>
     </tr>
     <tr class="impair">
         Nom complet&nbsp;:
       </td>
       <td>
-        <input type="text" value="{$user->fullName()}" name="full_name" size="40"{if $user->profile()} disabled="disabled"{/if} />
+        <input type="text" value="{$user->fullName()}" name="full_name" size="40" />
+      </td>
+    </tr>
+    <tr class="impair">
+      <td class="titre">
+        Nom annuaire&nbsp;:
+      </td>
+      <td>
+        <input type="text" value="{$user->directoryName()}" name="directory_name" size="40" />
       </td>
     </tr>
     <tr id="sexe" class="impair" {if $user->type eq "virtual"}style="display: none"{/if}>
         Sexe&nbsp;:
       </td>
       <td>
-        <select name="sex"{if $user->profile()} disabled="disabled"{/if}>
+        <select name="sex">
           <option value="male"{if !$user->isFemale()} selected="selected"{/if}>Homme</option>
           <option value="female"{if $user->isFemale()} selected="selected"{/if}>Femme</option>
         </select>
       </td>
     </tr>
+    {/if}
+    {if !$user->profile() || !$user->perms}
     <tr class="impair">
       <td class="titre">
         Email&nbsp;:
       </td>
       <td>
-        <input type="text" value="{$user->forlifeEmail()}" name="email" size="40"{if $user->profile()} disabled="disabled"{/if} />
+        <input type="text" value="{$user->forlifeEmail()}" name="email" size="40" />
       </td>
     </tr>
     {/if}
     <input type="submit" name='change' value="Valider ces changements" />
     &nbsp;
     <input type="reset" value="Annuler ces changements" />
-  </div>                                                                      
+  </div>
 
 </form>
 
index 15d1806..ad23030 100644 (file)
@@ -42,7 +42,7 @@
 <form action="{$platal->ns}subscribe/valid" method="post">
   <table class="tinybicol">
     <tr>
-      <th><a href="javascript:toggleSelection()">{icon name="arrow_refresh" title="Inverser la sélection"}</a></th> 
+      <th><a href="javascript:toggleSelection()">{icon name="arrow_refresh" title="Inverser la sélection"}</a></th>
       <th>Prénom Nom (Promotion)</th>
       <th>Date de demande</th>
       <th></th>
index cdba5f4..9e677bc 100644 (file)
@@ -23,7 +23,7 @@
 <p>[<a href='{$platal->ns}lists'>retour à la page des listes</a>]</p>
 
 <h1>Membres de {$platal->argv[1]}</h1>
-      
+
 <table class='tinybicol'>
   {if $mem|@count}
   {foreach from=$mem item=m}
index 678a6f3..177ec28 100644 (file)
@@ -45,7 +45,7 @@ par les administrateurs avant d'être transmis aux membres de la liste.  Une lis
 l'accord préalable des responsables du groupe.
 </p>
 <p class="descr">
-La dernière colonne du tableau t'indique si tu es inscrit{if $smarty.session.femme}e{/if} ou non à
+La dernière colonne du tableau t'indique si tu es inscrit{if $smarty.session.user->gender}e{/if} ou non à
 la liste. Dans le premier cas, une croix rouge te permet de te désabonner. Dans le second cas, une
 croix verte te permet de t'inscrire, après accord des responsables si l'inscription est modérée.
 </p>
@@ -101,11 +101,11 @@ croix verte te permet de t'inscrire, après accord des responsables si l'inscrip
 </table>
 
 <p class="descr">
-{icon name=wrench title="Modérateur"} tu es {if $smarty.session.femme}modératrice{else}moderateur{/if} sur cette liste.<br />
+{icon name=wrench title="Modérateur"} tu es {if $smarty.session.user->gender}modératrice{else}moderateur{/if} sur cette liste.<br />
 {icon name=weather_cloudy title="Liste privée"} cette liste est invisible aux non-membres de la liste. S'en désabonner
 t'empêcherait de t'y réabonner par la suite sans l'aide d'un administrateur.
 </p>
-        
+
 <h2>Voici les alias existants pour le groupe {$asso->nom}&nbsp;:</h2>
 
 <table cellspacing="0" cellpadding="0" class='large'>
index 9897c8a..1cb69c1 100644 (file)
@@ -2,7 +2,7 @@ alter table emails add column panne_level tinyint(1) not null default 0 after pa
 alter table emails change flags flags enum('active', 'filter', 'panne') not null default 'active';
 UPDATE emails SET last = panne WHERE last = 0 AND panne != 0;
 UPDATE emails
-   SET panne_level = 1 
- WHERE flags = 'active' 
+   SET panne_level = 1
+ WHERE flags = 'active'
        AND DATE_ADD(panne, INTERVAL 2 MONTH) > CURDATE();
 
index 6892cba..c7cebde 100644 (file)
@@ -1,4 +1,4 @@
-alter table skins change date date date not null default 0; 
+alter table skins change date date date not null default 0;
 INSERT INTO skins (id, name, date, comment, auteur, skin_tpl, ext)
      VALUES (13, 'Keynote', '2006-08-09', 'Skin inspirée d\'un thème de Keynote',
              'Florent Bruneau', 'keynote.tpl', 'png');
index 991e529..cf0592d 100644 (file)
@@ -1,5 +1,5 @@
 UPDATE newsletter_art SET body =
-REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(body, 
+REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(body,
 "[b]", "'''"),
 "[/b]", "'''"),
 "[i]", "''"),
index 4217921..051da0c 100644 (file)
@@ -5,7 +5,7 @@ alter table aliases change column type type enum('a_vie','alias','homonyme','lis
 alter table aliases add index (flags);
 
     update  aliases AS a
-left  join  aliases AS b 
+left  join  aliases AS b
        ON(a.id=b.id and b.alias like '%.%' and length(b.alias)<length(a.alias) and b.type!='homonyme')
        set  a.flags=CONCAT(a.flags,',bestalias')
      where  a.alias LIKE '%.%' and b.alias IS NULL and a.type!='homonyme';
index 8176088..7cb27bd 100644 (file)
@@ -36,7 +36,6 @@ insert into profile_medals (type, text, img)
             ('ordre',     'Ordre du Mérite Agricole',                   'ordre_ma.jpg'),
             ('ordre',     'Ordre du Mérite Maritime',                   'ordre_mm.jpg'),
             ('ordre',     'Ordre des Arts et des Lettres',              'ordre_al.jpg'),
-            
             ('croix',     'Croix de Guerre 1914 - 1918',                'croix_1418.jpg'),
             ('croix',     'Croix de Guerre 1939 - 1945',                'croix_3945.jpg'),
             ('croix',     'Croix des T. O. E.',                         'croix_toe.jpg'),
index ceb670d..09f4540 100644 (file)
@@ -3,8 +3,8 @@ ADD pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL,
 ADD adr_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL,
 ADD tel_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL;
 UPDATE entreprises SET
-pub = IF(FIND_IN_SET('entreprise_public', visibilite), 'public', IF(FIND_IN_SET('entreprise_ax', visibilite), 'ax', 'private')), 
-adr_pub = IF(FIND_IN_SET('adr_public', visibilite), 'public', IF(FIND_IN_SET('adr_ax', visibilite), 'ax', 'private')), 
+pub = IF(FIND_IN_SET('entreprise_public', visibilite), 'public', IF(FIND_IN_SET('entreprise_ax', visibilite), 'ax', 'private')),
+adr_pub = IF(FIND_IN_SET('adr_public', visibilite), 'public', IF(FIND_IN_SET('adr_ax', visibilite), 'ax', 'private')),
 tel_pub = IF(FIND_IN_SET('tel_public', visibilite), 'public', IF(FIND_IN_SET('tel_ax', visibilite),'ax', 'private'));
 ALTER TABLE entreprises DROP visibilite;
 ALTER TABLE entreprises
index b24b372..3d3cac0 100644 (file)
@@ -1 +1 @@
-UPDATE watch_cat SET mail = "Ces camarades nous ont quittés", mail_sg = "Ce camarade nous a quittés" WHERE id = 3; 
+UPDATE watch_cat SET mail = "Ces camarades nous ont quittés", mail_sg = "Ce camarade nous a quittés" WHERE id = 3;
index 668c6a8..0172ca9 100644 (file)
@@ -1,7 +1,7 @@
 ALTER TABLE virtual CHANGE `type` `type` ENUM('user', 'list', 'dom', 'evt') DEFAULT 'user' NOT NULL;
 
 ALTER TABLE groupex.asso ADD `pub` ENUM( 'public', 'private' ) DEFAULT 'public' NOT NULL AFTER `ax` ;
-INSERT INTO virtual_domains VALUES ('evts.polytechnique.org'); 
+INSERT INTO virtual_domains VALUES ('evts.polytechnique.org');
 
 use groupex;
 
index ae7fd08..e48c48e 100644 (file)
@@ -1,2 +1,2 @@
 INSERT INTO admin_h2 VALUES(2, 11, 'Géoloc', 70);
-INSERT INTO admin_a VALUES(11, 'Synchro', 'admin/geoloc.php',0); 
+INSERT INTO admin_a VALUES(11, 'Synchro', 'admin/geoloc.php',0);
diff --git a/upgrade/1.0.1/00_job.sql b/upgrade/1.0.1/00_job.sql
new file mode 100644 (file)
index 0000000..4b6b5dd
--- /dev/null
@@ -0,0 +1,6 @@
+ALTER TABLE profile_job_enum MODIFY COLUMN acronym VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN url VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN email VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN NAF_code CHAR(5) DEFAULT NULL;
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.1/01_profiles.sql b/upgrade/1.0.1/01_profiles.sql
new file mode 100644 (file)
index 0000000..c7187ae
--- /dev/null
@@ -0,0 +1,13 @@
+DROP TABLE IF EXISTS profile_modifications;
+
+CREATE TABLE profile_modifications (
+  pid INT(11) NOT NULL,
+  uid INT(11) NOT NULL,
+  field VARCHAR(60) NOT NULL,
+  oldText TEXT NOT NULL,
+  newText TEXT NOT NULL,
+  pub ENUM('private', 'ax', 'public') NOT NULL DEFAULT 'private',
+  PRIMARY KEY(pid, uid, field)
+) ENGINE=InnoDB, CHARSET=utf8;
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.1/02_accounts.sql b/upgrade/1.0.1/02_accounts.sql
new file mode 100644 (file)
index 0000000..342e174
--- /dev/null
@@ -0,0 +1,8 @@
+ALTER TABLE accounts ADD COLUMN directory_name VARCHAR(255) DEFAULT NULL;
+UPDATE  accounts AS a
+   SET  a.directory_name = (SELECT  pd.directory_name
+                              FROM  profile_display  AS pd
+                        INNER JOIN  account_profiles AS ap ON (ap.uid = pd.pid AND FIND_IN_SET('owner', perms))
+                             WHERE  a.uid = ap.uid);
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.1/03_medals.sql b/upgrade/1.0.1/03_medals.sql
new file mode 100644 (file)
index 0000000..6dcc331
--- /dev/null
@@ -0,0 +1,29 @@
+ALTER TABLE profile_medal_enum MODIFY COLUMN type ENUM('ordre','croix','militaire','honneur','resistance','prix','sport') NOT NULL DEFAULT 'ordre';
+
+INSERT INTO  profile_medal_enum (type, text, flags)
+     VALUES  ('sport', 'Championnat du monde de vol à voile', 'validation'),
+             ('sport', 'Championnat d\'Europe de vol à voile', 'validation'),
+             ('sport', 'Championnat de France de vol à voile', 'validation');
+
+INSERT INTO  profile_medal_grade_enum (mid, gid, text, pos)
+     SELECT  id, 1, 'Or', 1
+       FROM  profile_medal_enum
+      WHERE  text = 'Championnat du monde de vol à voile'
+             OR text = 'Championnat d\'Europe de vol à voile'
+             OR text = 'Championnat de France de vol à voile';
+
+INSERT INTO  profile_medal_grade_enum (mid, gid, text, pos)
+     SELECT  id, 2, 'Argent', 2
+       FROM  profile_medal_enum
+      WHERE  text = 'Championnat du monde de vol à voile'
+             OR text = 'Championnat d\'Europe de vol à voile'
+             OR text = 'Championnat de France de vol à voile';
+
+INSERT INTO  profile_medal_grade_enum (mid, gid, text, pos)
+     SELECT  id, 3, 'Bronze', 3
+       FROM  profile_medal_enum
+      WHERE  text = 'Championnat du monde de vol à voile'
+             OR text = 'Championnat d\'Europe de vol à voile'
+             OR text = 'Championnat de France de vol à voile';
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.1/connect.db.inc.php b/upgrade/1.0.1/connect.db.inc.php
new file mode 120000 (symlink)
index 0000000..442fab7
--- /dev/null
@@ -0,0 +1 @@
+../../bin/connect.db.inc.php
\ No newline at end of file
diff --git a/upgrade/1.0.1/phone.php b/upgrade/1.0.1/phone.php
new file mode 100755 (executable)
index 0000000..4239ece
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/php5
+<?php
+require_once 'connect.db.inc.php';
+
+$globals->debug = 0; //do not store backtraces
+
+$phones = array(
+    'AF' => '93',
+    'AN' => '599',
+    'BY' => '375',
+    'FM' => '691',
+    'GE' => '995',
+    'GL' => '299',
+    'ID' => '62',
+    'IL' => '972',
+    'IN' => '91',
+    'IQ' => '964',
+    'IR' => '98',
+    'JO' => '962',
+    'JP' => '81',
+    'KG' => '996',
+    'KW' => '965',
+    'KZ' => '7',
+    'LA' => '856',
+    'LB' => '961',
+    'LK' => '94',
+    'MM' => '95',
+    'MN' => '976',
+    'MV' => '960',
+    'MY' => '60',
+    'NP' => '977',
+    'OM' => '968',
+    'PH' => '63',
+    'PK' => '92',
+    'QA' => '974',
+    'SA' => '966',
+    'SG' => '65',
+    'SY' => '963',
+    'TH' => '66',
+    'TJ' => '992',
+    'TM' => '993',
+    'TR' => '90',
+    'TW' => '886',
+    'UZ' => '998',
+    'VG' => '1284',
+    'VN' => '84',
+    'YE' => '967',
+);
+
+foreach ($phones as $country => $phone) {
+    XDB::execute('UPDATE  geoloc_countries
+                     SET  phonePrefix = {?}
+                   WHERE  iso_3166_1_a2 = {?}',
+                 $phone, $country);
+}
+
+/* vim:set et sw=4 sts=4 ts=4: */
+?>