Merge commit 'origin/fusionax' into account
authorStéphane Jacob <sj@m4x.org>
Tue, 21 Jul 2009 13:49:45 +0000 (15:49 +0200)
committerStéphane Jacob <sj@m4x.org>
Tue, 21 Jul 2009 13:49:45 +0000 (15:49 +0200)
47 files changed:
1  2 
Makefile
classes/user.php
classes/xnetpage.php
classes/xorgsession.php
include/banana/forum.inc.php
include/banana/hooks.inc.php
include/banana/ml.inc.php
include/emails.inc.php
include/googleapps.inc.php
include/vcard.inc.php
modules/admin.php
modules/auth.php
modules/auth/auth.inc.php
modules/axletter.php
modules/axletter/axletter.inc.php
modules/carnet.php
modules/email.php
modules/events.php
modules/forums.php
modules/gadgets.php
modules/googleapps.php
modules/lists.php
modules/newsletter.php
modules/payment.php
modules/platal.php
modules/profile.php
modules/profile/addresses.inc.php
modules/profile/general.inc.php
modules/profile/jobs.inc.php
modules/profile/page.inc.php
modules/register.php
modules/register/register.inc.php
modules/search.php
modules/stats.php
modules/xnetgrp.php
modules/xnetlists.php
templates/admin/deces_promo.tpl
templates/admin/utilisateurs.tpl
templates/core/password_prompt.tpl
templates/emails/broken.tpl
templates/events/index.tpl
templates/include/minifiche.tpl
templates/payment/xnet.tpl
templates/xnetevents/edit.tpl
templates/xnetgrp/annuaire.tpl
templates/xnetgrp/edit.tpl
templates/xnetgrp/membres-add.tpl

diff --cc Makefile
Simple merge
  
  class User extends PlUser
  {
 +    private $_profile_fetched = false;
 +    private $_profile = null;
 +
+     // Additional fields (non core)
+     protected $promo = null;
      // Implementation of the login to uid method.
      protected function getLogin($login)
      {
Simple merge
@@@ -191,24 -206,21 +191,28 @@@ class XorgSession extends PlSessio
          }
  
          // Retrieves main user properties.
 -        $res  = XDB::query("SELECT  u.user_id AS uid, u.hruid, prenom, prenom_ini, nom, nom_ini, nom_usage, perms, promo, promo_sortie,
 -                                    matricule, password, FIND_IN_SET('femme', u.flags) AS femme,
 -                                    q.core_mail_fmt AS mail_fmt, UNIX_TIMESTAMP(q.banana_last) AS banana_last, q.watch_last, q.core_rss_hash,
 -                                    FIND_IN_SET('watch', u.flags) AS watch_account, q.last_version, g.g_account_name IS NOT NULL AS googleapps,
 -                                    UNIX_TIMESTAMP(s.start) AS lastlogin, s.host
 -                              FROM  auth_user_md5   AS u
 -                        INNER JOIN  auth_user_quick AS q  USING(user_id)
 -                         LEFT JOIN  gapps_accounts  AS g  ON (u.user_id = g.l_userid AND g.g_status = 'active')
 -                         LEFT JOIN  logger.last_sessions AS ls ON (ls.uid = u.user_id)
 +        /** 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, UNIX_TIMESTAMP(w.last) AS watch_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)
 +                        INNER 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  logger.last_sessions AS ls ON (ls.uid = a.uid)
                           LEFT JOIN  logger.sessions AS s  ON(s.id = ls.id)
-                              WHERE  a.uid = {?} AND a.state = 'active'", $user->id());
 -                             WHERE  u.user_id = {?} AND u.perms IN('admin', 'user')", $uid);
++                             WHERE  a.uid = {?} AND u.perms IN('admin', 'user')", $user->id());
+         if ($res->numRows() != 1) {
+             return false;
+         }
          $sess = $res->fetchOneAssoc();
          $perms = $sess['perms'];
          unset($sess['perms']);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -24,33 -24,31 +24,33 @@@ class AdminModule extends PLModul
      function handlers()
      {
          return array(
-             'phpinfo'                      => $this->make_hook('phpinfo', AUTH_MDP, 'admin'),
-             'get_rights'                   => $this->make_hook('get_rights', AUTH_MDP, 'admin'),
-             'admin'                        => $this->make_hook('default', AUTH_MDP, 'admin'),
-             'admin/ax-xorg'                => $this->make_hook('ax_xorg', AUTH_MDP, 'admin'),
-             'admin/dead-but-active'        => $this->make_hook('dead_but_active', AUTH_MDP, 'admin'),
-             'admin/deaths'                 => $this->make_hook('deaths', AUTH_MDP, 'admin'),
-             'admin/downtime'               => $this->make_hook('downtime', AUTH_MDP, 'admin'),
-             'admin/homonyms'               => $this->make_hook('homonyms', AUTH_MDP, 'admin'),
-             'admin/logger'                 => $this->make_hook('logger', AUTH_MDP, 'admin'),
-             'admin/logger/actions'         => $this->make_hook('logger_actions', AUTH_MDP, 'admin'),
-             'admin/postfix/blacklist'      => $this->make_hook('postfix_blacklist', AUTH_MDP, 'admin'),
-             'admin/postfix/delayed'        => $this->make_hook('postfix_delayed', AUTH_MDP, 'admin'),
+             'phpinfo'                      => $this->make_hook('phpinfo',                AUTH_MDP, 'admin'),
++            'get_rights'                   => $this->make_hook('get_rights',             AUTH_MDP, 'admin'),
+             'admin'                        => $this->make_hook('default',                AUTH_MDP, 'admin'),
+             'admin/ax-xorg'                => $this->make_hook('ax_xorg',                AUTH_MDP, 'admin'),
+             'admin/dead-but-active'        => $this->make_hook('dead_but_active',        AUTH_MDP, 'admin'),
+             'admin/deaths'                 => $this->make_hook('deaths',                 AUTH_MDP, 'admin'),
+             'admin/downtime'               => $this->make_hook('downtime',               AUTH_MDP, 'admin'),
+             'admin/homonyms'               => $this->make_hook('homonyms',               AUTH_MDP, 'admin'),
+             'admin/logger'                 => $this->make_hook('logger',                 AUTH_MDP, 'admin'),
+             'admin/logger/actions'         => $this->make_hook('logger_actions',         AUTH_MDP, 'admin'),
+             'admin/postfix/blacklist'      => $this->make_hook('postfix_blacklist',      AUTH_MDP, 'admin'),
+             'admin/postfix/delayed'        => $this->make_hook('postfix_delayed',        AUTH_MDP, 'admin'),
              'admin/postfix/regexp_bounces' => $this->make_hook('postfix_regexpsbounces', AUTH_MDP, 'admin'),
-             'admin/postfix/whitelist'      => $this->make_hook('postfix_whitelist', AUTH_MDP, 'admin'),
-             'admin/mx/broken'              => $this->make_hook('mx_broken', AUTH_MDP, 'admin'),
-             'admin/skins'                  => $this->make_hook('skins', AUTH_MDP, 'admin'),
-             'admin/synchro_ax'             => $this->make_hook('synchro_ax', AUTH_MDP, 'admin'),
-             'admin/user'                   => $this->make_hook('user', AUTH_MDP, 'admin'),
-             'admin/promo'                  => $this->make_hook('promo', AUTH_MDP, 'admin'),
-             'admin/validate'               => $this->make_hook('validate', AUTH_MDP, 'admin'),
-             'admin/validate/answers'       => $this->make_hook('validate_answers', AUTH_MDP, 'admin'),
-             'admin/wiki'                   => $this->make_hook('wiki', AUTH_MDP, 'admin'),
-             'admin/ipwatch'                => $this->make_hook('ipwatch', AUTH_MDP, 'admin'),
-             'admin/icons'                  => $this->make_hook('icons', AUTH_MDP, 'admin'),
-             'admin/accounts'               => $this->make_hook('accounts', AUTH_MDP, 'admin'),
-             'admin/account/types'          => $this->make_hook('account_types', AUTH_MDP, 'admin'),
-             'admin/jobs'                   => $this->make_hook('jobs', AUTH_MDP, 'admin'),
+             'admin/postfix/whitelist'      => $this->make_hook('postfix_whitelist',      AUTH_MDP, 'admin'),
+             'admin/mx/broken'              => $this->make_hook('mx_broken',              AUTH_MDP, 'admin'),
+             'admin/skins'                  => $this->make_hook('skins',                  AUTH_MDP, 'admin'),
+             'admin/synchro_ax'             => $this->make_hook('synchro_ax',             AUTH_MDP, 'admin'),
+             'admin/user'                   => $this->make_hook('user',                   AUTH_MDP, 'admin'),
+             'admin/promo'                  => $this->make_hook('promo',                  AUTH_MDP, 'admin'),
+             'admin/validate'               => $this->make_hook('validate',               AUTH_MDP, 'admin'),
+             'admin/validate/answers'       => $this->make_hook('validate_answers',       AUTH_MDP, 'admin'),
+             'admin/wiki'                   => $this->make_hook('wiki',                   AUTH_MDP, 'admin'),
+             'admin/ipwatch'                => $this->make_hook('ipwatch',                AUTH_MDP, 'admin'),
+             'admin/icons'                  => $this->make_hook('icons',                  AUTH_MDP, 'admin'),
+             'admin/accounts'               => $this->make_hook('accounts',               AUTH_MDP, 'admin'),
++            'admin/account/types'          => $this->make_hook('account_types',          AUTH_MDP, 'admin'),
+             'admin/jobs'                   => $this->make_hook('jobs',                   AUTH_MDP, 'admin'),
          );
      }
  
@@@ -131,9 -146,9 +128,9 @@@ class AuthModule extends PLModul
          }
          $gpex_challenge = $_GET["challenge"];
  
-         // mise à jour de l'heure et de la machine de dernier login sauf quand on est en suid
+         // Update the last login information (unless the user is in SUID).
          $uid = S::i('uid');
 -        if (!isset($_SESSION['suid'])) {
 +        if (!S::suid()) {
              global $platal;
              S::logger($uid)->log('connexion_auth_ext', $platal->path);
          }
@@@ -74,11 -66,9 +74,11 @@@ function gpex_make($chlg, $privkey, $da
                  $perms = $res->fetchOneCell();
              } else {
                  // if no group asked, return main rights
-                 $perms = S::has_perms() ? 'admin' : 'membre';
+                 $perms = S::admin() ? 'admin' : 'membre';
              }
              $params .= gpex_prepare_param($val, $perms, $tohash, $charset);
 +        } else {
 +            $params .= gpex_prepare_param($val, '', $tohash, $charset);
          }
      }
      $tohash .= "1";
@@@ -329,12 -343,39 +335,12 @@@ class AXLetterModule extends PLModul
                  }
              }
          }
 -        $email = $line[$field];
 -        if (strpos($email, '@') === false) {
 -            $user  = $email;
 -            $domain = $globals->mail->domain2;
 -        } else {
 -            list($user, $domain) = explode('@', $email);
 -        }
 -        if ($domain != $globals->mail->domain && $domain != $globals->mail->domain2
 -                && $domain != $globals->mail->alias_dom && $domain != $globals->mail->alias_dom2) {
 -            $res = XDB::query("SELECT uid FROM emails WHERE email = {?}", $email);
 -            if ($res->numRows() == 1) {
 -                return $res->fetchOneCell();
 -            }
 -            return '0';
 -        }
 -        list($user) = explode('+', $user);
 -        list($user) = explode('_', $user);
 -        if ($domain == $globals->mail->alias_dom || $domain == $globals->mail->alias_dom2) {
 -            $res = XDB::query("SELECT a.id
 -                                 FROM virtual          AS v
 -                           INNER JOIN virtual_redirect AS r USING(vid)
 -                           INNER JOIN aliases          AS a ON (a.type = 'a_vie'
 -                                                            AND r.redirect = CONCAT(a.alias, '@{$globals->mail->domain2}'))
 -                                WHERE v.alias = CONCAT({?}, '@{$globals->mail->alias_dom}')", $user);
 -            $id = $res->fetchOneCell();
 -            return $id ? $id : '0';
 -        }
 -        $res = XDB::query("SELECT id FROM aliases WHERE alias = {?}", $user);
 -        $id = $res->fetchOneCell();
 -        return $id ? $id : '0';
 +        $uf = new UserFilter(new UFC_Email($line[$field]));
 +        $id = $uf->getUIDs();
 +        return count($id) == 1 ? $id[0] : 0;
      }
  
-     function createHash($line, $partial_result, $key)
+     function createHash($line, $key, $relation)
      {
          $hash = implode(time(), $line) . rand();
          $hash = md5($hash);
Simple merge
Simple merge
Simple merge
@@@ -106,36 -106,26 +106,27 @@@ class EventsModule extends PLModul
          $page->addJsLink('ajax.js');
          $page->assign('tips', $this->get_tips());
  
-         // Profile update (appears when profile is > 400d old), and birthday
-         // oneboxes.
+         // Adds a reminder onebox to the page.
          $user = S::user();
 -        $res = XDB::query(
 -            'SELECT  MONTH(naissance) = MONTH(NOW())
 -                     AND DAYOFMONTH(naissance) = DAYOFMONTH(NOW()) AS is_birthday
 -               FROM  auth_user_md5
 -              WHERE  user_id = {?}',
 -            $user->id());
 -        $page->assign('birthday', $res->fetchOneCell());
+         require_once 'reminder.inc.php';
+         if (($reminder = Reminder::GetCandidateReminder($user))) {
+             $reminder->Prepare($page);
+         }
+         // Wishes "Happy birthday" when required
-             if (strtotime($profile->last_change) < time() - (400 * 86400)) {
-                 $page->assign('fiche_incitation', $profile->last_change);
-             }
 +        $profile = $user->profile();
 +        if (!is_null($profile)) {
 +            if ($profile->next_birthday == date('Y-m-d')) {
 +                $birthyear = (int)date('Y', strtotime($profile->birthdate));
 +                $curyear   = (int)date('Y');
 +                $page->assign('birthday', $curyear - $birthyear);
 +            }
 +        }
  
-         // No-photo onebox.
-         $res = XDB::query("SELECT  COUNT(*)
-                              FROM  photo
-                             WHERE  uid = {?}",
-                           S::user()->id());
-         $page->assign('photo_incitation', $res->fetchOneCell() == 0);
-         // Geo-location onebox.
-         require_once "geocoding.inc.php";
-         $page->assign('geoloc_incitation', Geocoder::countNonGeocoded(S::user()->id()));
          // Direct link to the RSS feed, when available.
 -        if (S::rssActivated()) {
 +        if (S::hasAuthToken()) {
              $page->setRssLink('Polytechnique.org :: News',
 -                              '/rss/'.S::v('hruid') .'/'.S::v('core_rss_hash').'/rss.xml');
 +                              '/rss/'.S::v('hruid') .'/'.S::v('token').'/rss.xml');
          }
  
          // Hide the read event, and reload the page to get to the next event.
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -213,15 -217,18 +213,16 @@@ class PaymentModule extends PLModul
          }
  
          /* on fait l'insertion en base de donnees */
 -        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle,comment)
 -                           VALUES  ({?},{?},{?},{?},{?},{?},{?})",
 -                     $champ901, $uid, $ref, $champ200, $montant, $champ905,Env::v('comment'));
 +        XDB::execute("INSERT INTO  paiement.transactions (id, uid, ref, fullref, montant, cle, comment)
 +                           VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
 +                     $champ901, $user->id(), $ref, $champ200, $montant, $champ905, Env::v('comment'));
  
          /* on genere le mail de confirmation */
-         $conf_text = str_replace(array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>'),
-                                  array($user->firstName(), $user->lastName(), $user->promo(), $montant,
-                                        $user->isFemale() ? 'Chère' : 'Cher',
-                                        $user->isFemale() ? 'Chère' : 'Cher'), $conf_text);
 -        $conf_text = str_replace("<prenom>",$prenom,$conf_text);
 -        $conf_text = str_replace("<nom>",$nom,$conf_text);
 -        $conf_text = str_replace("<promo>",$promo,$conf_text);
 -        $conf_text = str_replace("<montant>",$montant,$conf_text);
 -        $conf_text = str_replace("<comment>", Env::v('comment'), $conf_text);
 -        $conf_text = str_replace("<salutation>",$femme ? "Chère" : "Cher",$conf_text);
 -        $conf_text = str_replace("<cher>",$femme ? "Chère" : "Cher",$conf_text);
++        $conf_text = str_replace(
++            array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>', 'comment>'),
++            array($user->firstName(), $user->lastName(), $user->promo(), $montant,
++                  $user->isFemale() ? 'Chère' : 'Cher', $user->isFemale() ? 'Chère' : 'Cher',
++                  Env::v('comment')), $conf_text);
  
          global $globals;
          $mymail = new PlMailer();
Simple merge
@@@ -333,13 -339,18 +332,13 @@@ class ProfileModule extends PLModul
          if (!$user) {
              return PL_NOT_FOUND;
          }
 -
 -        $res = XDB::query("SELECT  matricule_ax
 -                             FROM  auth_user_md5
 -                            WHERE  user_id = {?}", $user->id());
 -        $mat = $res->fetchOneCell();
 -        if (!intval($mat)) {
 -            $page->kill("Le matricule AX de {$user->login()} est inconnu");
 +        if (!$user->ax_id) {
 +            $page->kill("Le matricule AX de {$user->hrid()} est inconnu");
          }
 -        http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id=$mat");
 +        http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id=" . $user->ax_id);
      }
  
-     function handler_p_edit(&$page, $user = null, $opened_tab = null, $mode = null)
 -    function handler_p_edit(&$page, $opened_tab = null, $mode = null, $success = null)
++    function handler_p_edit(&$page, $user = null, $opened_tab = null, $mode = null, $success = null)
      {
          global $globals;
  
Simple merge
@@@ -81,16 -81,16 +82,18 @@@ class ProfileSearchNames implements Pro
              while ($sn_type = $sn_types->next()) {
                  if ($sn_type['id'] == $sn['typeid']) {
                      $value[] = $sn;
 -                    $sn = $sn_all->next();
 +                    if ($sn) {
 +                        $sn = $sn_all->next();
 +                    }
                  } else {
-                     $value[] = array('typeid'    => $sn_type['id'],
-                                      'type'      => $sn_type['type'],
-                                      'type_name' => $sn_type['name'],
-                                      'pub'       => 1,
+                     $value[] = array('name'             => '',
+                                      'particle'         => '',
+                                      'typeid'           => $sn_type['id'],
+                                      'type'             => $sn_type['type'],
+                                      'type_name'        => $sn_type['name'],
                                       'has_particle'     => $sn_type['has_particle'],
-                                      'always_displayed' => 1);
+                                      'always_displayed' => 1,
+                                      'pub'              => 1);
                  }
              }
              if ($sn) {
@@@ -387,20 -397,19 +389,20 @@@ class ProfileGeneral extends ProfilePag
      {
          // Checkout all data...
          $res = XDB::query("SELECT  p.promo, e.entry_year AS entry_year, e.grad_year AS grad_year,
 -                                   u.nationalite, u.nationalite2, u.nationalite3, u.naissance,
 +                                   pr.nationality1, pr.nationality2, pr.nationality3, pr.birthdate,
                                     t.display_tel as mobile, t.pub as mobile_pub,
                                     d.email_directory as email_directory,
-                                    pr.freetext, pr.freetext_pub as freetext_pub
 -                                   q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub,
 -                                   u.matricule_ax, p.yourself
 -                             FROM  auth_user_md5         AS u
 -                       INNER JOIN  auth_user_quick       AS q ON (u.user_id = q.user_id)
 -                       INNER JOIN  profile_display       AS p ON (p.pid = u.user_id)
 -                       INNER JOIN  profile_education     AS e ON (e.uid = u.user_id AND FIND_IN_SET('primary', e.flags))
 -                        LEFT JOIN  profile_phones        AS t ON (u.user_id = t.uid AND link_type = 'user')
 -                        LEFT JOIN  profile_directory     AS d ON (d.uid = u.user_id)
 -                            WHERE  u.user_id = {?}", S::v('uid', -1));
++                                   pr.freetext, pr.freetext_pub, pr.ax_id AS matricule_ax, p.yourself
 +                             FROM  profiles              AS pr
 +                       INNER JOIN  profile_display       AS p ON (p.pid = pr.pid)
 +                       INNER JOIN  profile_education     AS e ON (e.uid = pr.pid AND FIND_IN_SET('primary', e.flags))
 +                        LEFT JOIN  profile_phones        AS t ON (t.uid = pr.pid AND link_type = 'user')
 +                        LEFT JOIN  profile_directory     AS d ON (d.uid = pr.pid)
 +                            WHERE  pr.pid = {?}", $this->pid());
          $this->values = $res->fetchOneAssoc();
 +        if ($this->owner) {
 +            $this->values['yourself'] = $this->owner->displayName();
 +        }
  
          // Retreive photo informations
          $res = XDB::query("SELECT  pub
  
      protected function _saveData()
      {
 -        if ($this->changed['nationalite'] || $this->changed['nationalite2'] || $this->changed['nationalite3']
 -            || $this->changed['naissance']) {
 -            if ($this->values['nationalite3'] == "") {
 -                $this->values['nationalite3'] = NULL;
 +        if ($this->changed['nationality1'] || $this->changed['nationality2'] || $this->changed['nationality3']
 +            || $this->changed['birthdate'] || $this->changed['freetext'] || $this->changed['freetext_pub']) {
 +            if ($this->values['nationality3'] == "") {
 +                $this->values['nationality3'] = NULL;
              }
 -            if ($this->values['nationalite2'] == "") {
 -                $this->values['nationalite2'] = $this->values['nationalite3'];
 -                $this->values['nationalite3'] = NULL;
 +            if ($this->values['nationality2'] == "") {
 +                $this->values['nationality2'] = $this->values['nationality3'];
 +                $this->values['nationality3'] = NULL;
              }
 -            if ($this->values['nationalite'] == "") {
 -                $this->values['nationalite']  = $this->values['nationalite2'];
 -                $this->values['nationalite2'] = $this->values['nationalite3'];
 -                $this->values['nationalite3'] = NULL;
 +            if ($this->values['nationality1'] == "") {
 +                $this->values['nationality1']  = $this->values['nationality2'];
 +                $this->values['nationality2'] = $this->values['nationality3'];
 +                $this->values['nationality3'] = NULL;
              }
  
 -            XDB::execute("UPDATE  auth_user_md5
 -                             SET  nationalite = {?}, nationalite2 = {?}, nationalite3 = {?}, naissance={?}
 -                           WHERE  user_id = {?}",
 -                         $this->values['nationalite'], $this->values['nationalite2'], $this->values['nationalite3'],
 -                         preg_replace('@(\d{2})/(\d{2})/(\d{4})@', '\3-\2-\1', $this->values['naissance']),
 -                         S::v('uid'));
 -        }
 -        if ($this->changed['freetext'] || $this->changed['freetext_pub']) {
 -            XDB::execute("UPDATE  auth_user_quick
 -                             SET  profile_freetext={?}, profile_freetext_pub={?}
 -                           WHERE  user_id = {?}",
 -                         $this->values['freetext'], $this->values['freetext_pub'], S::v('uid'));
 +            XDB::execute("UPDATE  profiles
 +                             SET  nationality1 = {?}, nationality2 = {?}, nationality3 = {?}, birthdate = {?},
 +                                  freetext = {?}, freetext_pub = {?}
-                            WHERE  user_id = {?}",
++                           WHERE  pid = {?}",
 +                          $this->values['nationality1'], $this->values['nationality2'], $this->values['nationality3'],
 +                          preg_replace('@(\d{2})/(\d{2})/(\d{4})@', '\3-\2-\1', $this->values['birthdate']),
-                           $this->values['freetext'], $this->values['freetext_pub'],
-                           $this->pid());
++                          $this->values['freetext'], $this->values['freetext_pub'], $this->pid());
          }
          if ($this->changed['email_directory']) {
              $new_email = ($this->values['email_directory'] == "new@example.org") ?
@@@ -227,99 -303,150 +303,150 @@@ class ProfileJobs extends ProfilePag
                            LEFT JOIN  profile_addresses             AS ah ON (ah.jobid = j.jobid AND ah.type = 'hq')
                                WHERE  j.uid = {?}
                             ORDER BY  j.id",
 -                            S::i('uid'));
 +                            $this->pid());
          $this->values['jobs'] = array();
-         while (list($id, $jobid, $name, $sector, $subSector, $subSubSector,
-                     $subSubSectorName, $description, $w_email, $w_emailPub, $w_url, $pub,
-                     $hq_acronym, $hq_url, $hq_email,
-                     $w_accuracy, $w_text, $w_postalText, $w_postalCode, $w_localityId,
-                     $w_subAdministrativeAreaId, $w_administrativeAreaId, $w_countryId,
-                     $w_latitude, $w_longitude, $w_pub, $w_updateTime,
-                     $w_north, $w_south, $w_east, $w_west,
-                     $hq_accuracy, $hq_text, $hq_postalText, $hq_postalCode, $hq_localityId,
-                     $hq_subAdministrativeAreaId, $hq_administrativeAreaId, $hq_countryId,
-                     $hq_latitude, $hq_longitude, $hq_pub, $hq_updateTime,
-                     $hq_north, $hq_south, $hq_east, $hq_west,
-                    ) = $res->next()) {
-             $this->values['jobs'][] = array('id'               => $id,
-                                             'jobid'            => $jobid,
-                                             'name'             => $name,
-                                             'sector'           => $sector,
-                                             'subSector'        => $subSector,
-                                             'subSubSector'     => $subSubSector,
-                                             'subSubSectorName' => $subSubSectorName,
-                                             'description'      => $description,
-                                             'pub'              => $pub,
-                                             'w_email'          => $w_email,
-                                             'w_email_pub'      => $w_email_pub,
-                                             'w_url'            => $w_url,
-                                             'hq_acronym'       => $hq_acronym,
-                                             'hq_url'           => $hq_url,
-                                             'hq_email'         => $hq_email,
-                                             'w_address'        => array('accuracy'                => $w_accuracy,
-                                                                         'text'                    => $w_text,
-                                                                         'postalText'              => $w_postalText,
-                                                                         'postalCode'              => $w_postalCode,
-                                                                         'localityId'              => $w_localityId,
-                                                                         'subAdministrativeAreaId' => $w_subAdministrativeAreaId,
-                                                                         'administrativeAreaId'    => $w_administrativeAreaId,
-                                                                         'countryId'               => $w_countryId,
-                                                                         'latitude'                => $w_latitude,
-                                                                         'longitude'               => $w_longitude,
-                                                                         'pub'                     => $w_pub,
-                                                                         'updateTime'              => $w_update,
-                                                                         'north'                   => $w_north,
-                                                                         'south'                   => $w_south,
-                                                                         'east'                    => $w_east,
-                                                                         'west'                    => $w_west,
-                                                                        ),
-                                             'hq_address'       => array('accuracy'                => $hq_accuracy,
-                                                                         'text'                    => $hq_text,
-                                                                         'postalText'              => $hq_postalText,
-                                                                         'postalCode'              => $hq_postalCode,
-                                                                         'localityId'              => $hq_localityId,
-                                                                         'subAdministrativeAreaId' => $hq_subAdministrativeAreaId,
-                                                                         'administrativeAreaId'    => $hq_administrativeAreaId,
-                                                                         'countryId'               => $hq_countryId,
-                                                                         'latitude'                => $hq_latitude,
-                                                                         'longitude'               => $hq_longitude,
-                                                                         'pub'                     => $hq_pub,
-                                                                         'updateTime'              => $hq_update,
-                                                                         'north'                   => $hq_north,
-                                                                         'south'                   => $hq_south,
-                                                                         'east'                    => $hq_east,
-                                                                         'west'                    => $hq_west,
-                                                                        ),
-                                            );
-         }
  
-         $res = XDB::iterator("SELECT  link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment
-                                 FROM  profile_phones
-                                WHERE  uid = {?} AND link_type = 'pro'
-                             ORDER BY  link_id",
-                              $this->pid());
-         $i = 0;
-         $jobNb = count($this->values['jobs']);
-         while ($phone = $res->next()) {
-             $jobid = $phone['jobid'];
-             while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) {
-                 $i++;
+         if ($res->numRows() > 0) {
+             while (list($id, $jobid, $name, $sector, $subSector, $subSubSector,
+                         $subSubSectorName, $description, $w_email, $w_emailPub, $w_url, $pub,
+                         $hq_acronym, $hq_url, $hq_email,
+                         $w_accuracy, $w_text, $w_postalText, $w_postalCode, $w_localityId,
+                         $w_subAdministrativeAreaId, $w_administrativeAreaId, $w_countryId,
+                         $w_latitude, $w_longitude, $w_pub, $w_updateTime,
+                         $w_north, $w_south, $w_east, $w_west,
+                         $hq_accuracy, $hq_text, $hq_postalText, $hq_postalCode, $hq_localityId,
+                         $hq_subAdministrativeAreaId, $hq_administrativeAreaId, $hq_countryId,
+                         $hq_latitude, $hq_longitude, $hq_pub, $hq_updateTime,
+                         $hq_north, $hq_south, $hq_east, $hq_west,
+                        ) = $res->next()) {
+                 $this->values['jobs'][] = array(
+                     'id'               => $id,
+                     'jobid'            => $jobid,
+                     'name'             => $name,
+                     'sector'           => $sector,
+                     'subSector'        => $subSector,
+                     'subSubSector'     => $subSubSector,
+                     'subSubSectorName' => $subSubSectorName,
+                     'description'      => $description,
+                     'pub'              => $pub,
+                     'w_email'          => $w_email,
+                     'w_email_pub'      => $w_emailPub,
+                     'w_url'            => $w_url,
+                     'hq_acronym'       => $hq_acronym,
+                     'hq_url'           => $hq_url,
+                     'hq_email'         => $hq_email,
+                     'w_address'        => array(
+                         'accuracy'                => $w_accuracy,
+                         'text'                    => $w_text,
+                         'postalText'              => $w_postalText,
+                         'postalCode'              => $w_postalCode,
+                         'localityId'              => $w_localityId,
+                         'subAdministrativeAreaId' => $w_subAdministrativeAreaId,
+                         'administrativeAreaId'    => $w_administrativeAreaId,
+                         'countryId'               => $w_countryId,
+                         'latitude'                => $w_latitude,
+                         'longitude'               => $w_longitude,
+                         'pub'                     => $w_pub,
+                         'updateTime'              => $w_updateTime,
+                         'north'                   => $w_north,
+                         'south'                   => $w_south,
+                         'east'                    => $w_east,
+                         'west'                    => $w_west,
+                     ),
+                     'hq_address'       => array(
+                         'accuracy'                => $hq_accuracy,
+                         'text'                    => $hq_text,
+                         'postalText'              => $hq_postalText,
+                         'postalCode'              => $hq_postalCode,
+                         'localityId'              => $hq_localityId,
+                         'subAdministrativeAreaId' => $hq_subAdministrativeAreaId,
+                         'administrativeAreaId'    => $hq_administrativeAreaId,
+                         'countryId'               => $hq_countryId,
+                         'latitude'                => $hq_latitude,
+                         'longitude'               => $hq_longitude,
+                         'pub'                     => $hq_pub,
+                         'updateTime'              => $hq_updateTime,
+                         'north'                   => $hq_north,
+                         'south'                   => $hq_south,
+                         'east'                    => $hq_east,
+                         'west'                    => $hq_west,
+                     ),
+                 );
+             }
+             $res = XDB::iterator("SELECT  link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment
+                                     FROM  profile_phones
+                                    WHERE  uid = {?} AND link_type = 'pro'
+                                 ORDER BY  link_id",
+                                  S::i('uid'));
+             $i = 0;
+             $jobNb = count($this->values['jobs']);
+             while ($phone = $res->next()) {
+                 $jobid = $phone['jobid'];
+                 while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) {
+                     $i++;
+                 }
+                 if ($i >= $jobNb) {
+                     break;
+                 }
+                 $job =& $this->values['jobs'][$i];
+                 if (!isset($job['w_phone'])) {
+                     $job['w_phone'] = array();
+                 }
+                 if ($job['id'] == $jobid) {
+                     $job['w_phone'][] = $phone;
+                 }
              }
-             if ($i >= $jobNb) {
-                 break;
+             foreach ($this->values['jobs'] as $id => &$job) {
+                 if (!isset($job['w_phone'])) {
+                     $job['w_phone'] = array(
+                         0 => array(
+                             'type'    => 'fixed',
+                             'tel'     => '',
+                             'pub'     => 'private',
+                             'comment' => '',
+                         )
+                     );
+                 }
              }
-             $job =& $this->values['jobs'][$i];
-             if (!isset($job['w_phone'])) {
-                 $job['w_phone'] = array();
+  
+             $job['w_email_new'] = '';
+             if (!isset($job['hq_phone'])) {
+                 $job['hq_phone'] = '';
              }
-             if ($job['id'] == $jobid) {
-                 $job['w_phone'][] = $phone;
+             if (!isset($job['hq_fax'])) {
+                 $job['hq_fax'] = '';
              }
-         }
-         foreach ($this->values['jobs'] as $id => &$job) {
-             if (!isset($job['w_phone'])) {
-                 $job['w_phone'] = array();
+             if (!isset($job['w_email_pub'])) {
+                 $job['w_email_pub'] = 'private';
              }
+             if (!$job['hq_address']['text']) {
+                 $job['hq_address'] = array(
+                     'text'                    => '',
+                     'accuracy'                => '',
+                     'postalText'              => '',
+                     'postalCode'              => '',
+                     'administrativeAreaId'    => '',
+                     'subAdministrativeAreaId' => '',
+                     'localityId'              => '',
+                     'countryId'               => '',
+                     'latitude'                => '',
+                     'longitude'               => '',
+                     'north'                   => '',
+                     'south'                   => '',
+                     'east'                    => '',
+                     'west'                    => '',
+                     'cedex'                   => '',
+                     'updateTime'              => '',
+                     'changed'                 => '0',
+                     'removed'                 => '0',
+                 );
+             }
+             $job['w_address']['cedex'] = '';
+             $job['w_address']['changed'] = '0';
+             $job['w_address']['removed'] = '0';
+         } else {
+             $this->values['jobs'][] = $this->settings['jobs']->emptyJob();
          }
      }
  
Simple merge
@@@ -320,15 -342,18 +342,18 @@@ class RegisterModule extends PLModul
          register_watch_op($uid, WATCH_INSCR);
          inscription_notifs_base($uid);
  
-         // Default registration on forums
-         $p_for = 'xorg.promo.x' . $promo;
-         $cible = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $p_for);
-         foreach ($cible as $val) {
-             XDB::execute('INSERT INTO  forum_subs (fid,uid)
+         // Forcibly register the new user on default forums.
+         $promo_forum = 'xorg.promo.x' . $promo;
+         $registered_forums = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $promo_forum);
+         foreach ($registered_forums as $forum) {
+             XDB::execute("INSERT INTO  forums.abos (fid,uid)
                                 SELECT  fid, {?}
-                                  FROM  forum
-                                 WHERE  name = {?}', $uid, $val);
-             if (XDB::affectedRows() == 0 && $val == $p_for) {
 -                                 FROM   forums.list
++                                 FROM  forums.list
+                                 WHERE  nom = {?}",
+                                 $uid, $val);
+             // Notify the newsgroup admin of the promotion forum needs be created.
+             if (XDB::affectedRows() == 0 && $forum == $promo_forum) {
                  $res = XDB::query("SELECT  SUM(perms IN ('admin','user') AND deces = 0), COUNT(*)
                                       FROM  auth_user_md5
                                      WHERE  promo = {?}", $promo);
@@@ -225,13 -229,13 +229,12 @@@ function finish_ins($sub_state
  {
      global $globals;
      extract($sub_state);
 -    require_once('secure_hash.inc.php');
  
-     $pass     = rand_pass();
-     $pass_encrypted = sha1($pass);
-     $hash     = rand_url_id(12);
-     XDB::execute('UPDATE auth_user_md5 SET last_known_email={?} WHERE matricule = {?}', $email, $mat);
+     $hash = rand_url_id(12);
+     XDB::execute(
+             "UPDATE  auth_user_md5
+                 SET  last_known_email = {?}
+               WHERE  matricule = {?}", $email, $mat);
      XDB::execute(
              "REPLACE INTO  register_pending (uid, forlife, bestalias, mailorg2, password, email, date, relance, naissance, hash)
                     VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?})",
Simple merge
Simple merge
@@@ -188,9 -238,9 +181,9 @@@ class XnetGrpModule extends PLModul
              } else {
                  $site = "";
              }
 -            if (S::admin()) {
 +            if (S::has_perms()) {
-                 if (strstr(Post::v('mail_domain'), '.') === false) {
-                     $page->trigError("le domaine doit être un FQDN (aucune modif effectuée) !!!");
+                 if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) {
 -                    $page->trigError("le domaine doit être un FQDN (aucune modif effectuée) !!!");
++                    $page->trigError("Le domaine doit être un FQDN (aucune modification effectuée) !!!");
                      return;
                  }
                  XDB::execute(
Simple merge
  
  
  <form action="admin/deaths" method="post">
-   <table class="tinybicol">
+   <table class="bicol">
      <tr>
        <td>
 -        <input type="submit" value="GO" style="visibility: hidden" />
 -        <input type="submit" value="&lt;&lt;" name="sub10" />
 -      </td>
 -      <td><input type="submit" value="&lt;"  name="sub01" /></td>
 -      <td>
          Promotion&nbsp;:
 -        <input type="text" name="promo" value="{$promo}" size="4" maxlength="4" />
 +        <input type="text" name="promo" value="{$promo}" size="5" maxlength="5" />
          <input type="submit" value="GO" />
        </td>
 -      <td><input type="submit" value="&gt;"  name="add01" /></td>
 -      <td>
 -        <input type="submit" value="&gt;&gt;" name="add10" />
 -        <input type="submit" value="GO" style="visibility: hidden" />
 -      </td>
      </tr>
    </table>
  </form>
Simple merge
Simple merge
@@@ -47,9 -47,9 +47,9 @@@ correspondant si tu veux que nous puiss
      <a href="emails/broken/warn/{$email}?token={xsrf_token}">clique sur ce lien</a>.
    </p>
  {elseif $x}
- <h2>Patte Cassée</h2>
+ <h2>Patte cassée</h2>
    <p>
 -    Désolé, mais ton correspondant, {$x.prenom} {$x.nom} (X{$x.promo}),
 +    Désolé, mais ton correspondant, {$x.user->fullName()},
      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,
Simple merge
    {/if}
  
    <div class="long">
 -  {if $c.wasinscrit || !$c.dcd}
 -    {if $c.web || $c.mobile || $c.countrytxt || $c.city || $c.region || $c.entreprise || $c.freetext || (!$c.dcd && !$c.actif )}
 +  {if !$dead}
 +    {assign var=address value=$profile->getMainAddress()}
 +    {assign var=web     value=$profile->getWebSite()}
 +    {assign var=job     value=$profile->getMailJob()}
 +    {if $web || $profile->mobile || $address.country || $job || (!$dead && !$registered)}
      <table cellspacing="0" cellpadding="0">
 -      {if $c.web}
 +      {if $web}
        <tr>
          <td class="lt">Page web&nbsp;:</td>
 -        <td class="rt"><a href="{$c.web}">{$c.web}</a></td>
 +        <td class="rt"><a href="{$web}">{$web}</a></td>
        </tr>
        {/if}
-       {if $address.country}
 -      {if ($c.countrytxt || $c.city) && !$c.dcd}
++      {if $address.country && !$c.dcd}
        <tr>
          <td class="lt">Géographie&nbsp;:</td>
 -        <td class="rt">{$c.city}{if $c.city && $c.countrytxt}, {/if}{$c.countrytxt}</td>
 +        <td class="rt">{if $address.locality}{$address.locality}, {/if}{$address.country}</td>
        </tr>
        {/if}
 -      {if $c.mobile && !$c.dcd}
 +      {if $profile->mobile && !$dead}
        <tr>
          <td class="lt">Mobile&nbsp;:</td>
 -        <td class="rt">{$c.mobile}</td>
 +        <td class="rt">{$profile->mobile}</td>
        </tr>
        {/if}
 -      {if $c.entreprise}
 +      {if $job}
        <tr>
          <td class="lt">Profession&nbsp;:</td>
          <td class="rt">
Simple merge
Simple merge
@@@ -41,8 -42,9 +42,9 @@@ Le groupe {$asso->nom} compte {$nb_tot
      </a>
    </li>
    {/if}
+   {/if}
    <li>
 -    <a href="{$platal->ns}annuaire/csv/{$asso.diminutif}.csv">
 +    <a href="{$platal->ns}annuaire/csv/{$asso->diminutif}.csv">
        {icon name=page_excel title="Fichier Excel"} 
        Obtenir au format Excel
      </a>
  
      <tr>
        <td class="titre center" colspan="2">
-         <label><input type="checkbox" value="1" name="ax" {if $asso->ax}checked="checked"{/if} />
-         groupe agréé par l'AX</label>
-       </td>
-     </tr>
-     <tr>
-       <td class="titre center" colspan="2">
          Diffusion de la liste des membres&nbsp;:
          <select name="pub">
 -          <option value="public" {if $asso.pub eq 'public'}selected="selected"{/if}>Publique</option>
 -          <option value="membre" {if $asso.pub eq 'membre'}selected="selected"{/if}>Aux membres du groupe</option>
 -          <option value="private" {if $asso.pub eq 'private'}selected="selected"{/if}>Aux animateurs du groupe</option>
 +          <option value="public" {if $asso->pub eq 'public'}selected="selected"{/if}>Publique</option>
 +          <option value="membre" {if $asso->pub eq 'membre'}selected="selected"{/if}>Aux membres du groupe</option>
 +          <option value="private" {if $asso->pub eq 'private'}selected="selected"{/if}>Aux animateurs du groupe</option>
          </select>
        </td>
      </tr>
Simple merge