Merge branch 'xorg/maint' into xorg/master
authorStéphane Jacob <sj@m4x.org>
Tue, 20 Sep 2011 18:45:31 +0000 (20:45 +0200)
committerStéphane Jacob <sj@m4x.org>
Tue, 20 Sep 2011 18:45:31 +0000 (20:45 +0200)
57 files changed:
ChangeLog
bin/cron/cron_xnet_accounts.php
classes/profile.php
classes/xnetsession.php
classes/xorgsession.php
core
include/profilefields.inc.php
include/validations/paiements.inc.php
modules/admin.php
modules/auth.php
modules/axletter.php
modules/email.php
modules/epletter.php
modules/events.php
modules/forums.php
modules/fusionax.php
modules/googleapps.php
modules/lists.php
modules/marketing.php
modules/newsletter.php
modules/openid.php
modules/payment.php
modules/payment/money.inc.php
modules/payment/money/bplccyberplus.inc.php
modules/payment/money/paypal.inc.php
modules/platal.php
modules/profile.php
modules/profile/mentor.inc.php
modules/profile/page.inc.php
modules/profile/skills.inc.php [deleted file]
modules/register.php
modules/survey.php
modules/urlshortener.php
modules/xnet.php
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php
modules/xnetgrp.php
modules/xnetlists.php
modules/xnetnl.php
plugins/function.profile.php
templates/carnet/notif.mail.tpl
templates/include/form.valid.edit-paiements.tpl
templates/include/form.valid.paiements.tpl
templates/payment/payment.tpl [moved from templates/payment/index.tpl with 81% similarity]
templates/profile/fiche_referent.tpl
templates/profile/mentor.tpl
templates/profile/skill.tpl [deleted file]
templates/skin/common.footer.tpl
templates/skin/common.menu.tpl
templates/xnet/account.mail.tpl
templates/xnetevents/admin.tpl
templates/xnetevents/edit.tpl
templates/xnetgrp/asso.tpl
templates/xnetgrp/edit.tpl
templates/xnetgrp/membres-edit.tpl
upgrade/1.1.4/01_payments.sql [new file with mode: 0644]
upgrade/1.1.4/README [new file with mode: 0644]

index 79f63da..cc46cb5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,26 @@
 ================================================================================
+VERSION 1.1.4                                                         XX XX XXXX
+
+Bug/Wish:
+
+    * Carnet:
+        - #1528: Do not display birthday of deceased users in emails       -FUL
+
+    * Core:
+        - #1523: Rename AUTH_MDP to AUTH_PASSWD                            -JAC
+
+    * Payments:
+        - #1512: Allows payments for unlogged users                        -JAC
+        - #1537: Replaces payments page on main site by a donation page    -JAC
+
+    * Profile:
+        - #1535: Moves and displays skills with mentoring informations     -JAC
+
+    * XnetGrp:
+        - #1525: Fixes broken page on erroneous group page edition         -JAC
+        - #1530: Enables reminder for xnet accounts                        -JAC
+
+================================================================================
 VERSION 1.1.3                                                         10 09 2011
 
 New:
@@ -1781,6 +1803,7 @@ ACRONYMS:
     * CAT: Florian El Ahdab     (LeChat)    <florian.el-ahdab@m4x.org>
     * FAL: Raphaël Marichez     (Falco)     <raphael.marichez@m4x.org>
     * FRU: Florent Bruneau      (Fruneau)   <florent.bruneau@m4x.org>
+    * FUL: Thomas Minvielle     (Fulanor)   <thomas.minvielle@m4x.org>
     * GUI: Guillaume Bandet     (GUI)       <guillaume.bandet@m4x.org>
     * JAC: Stéphane Jacob       (jacou)     <stephane.jacob@m4x.org>
     * JM : Jean-Marc Bécu                   <jean-marc.becu@m4x.org>
index de935e0..6194f68 100755 (executable)
@@ -40,6 +40,7 @@ foreach ($users as $user) {
     $mailer->assign('email', $user['email']);
     $mailer->assign('group', $user['group_name']);
     $mailer->assign('sender_name', $user['sender_name']);
+    $mailer->assign('again', false);
     $mailer->send();
 
     XDB::execute('UPDATE  accounts
index 6574d0a..953d1d9 100644 (file)
@@ -111,10 +111,12 @@ class Profile implements PlExportable
     const FETCH_MENTOR_TERMS   = 0x000400;
     const FETCH_DELTATEN       = 0x000800;
     const FETCH_PARTNER        = 0x001000;
+    const FETCH_SKILL          = 0x002000;
+    const FETCH_LANGUAGE       = 0x004000;
 
     const FETCH_MINIFICHES   = 0x00012D; // FETCH_ADDRESSES | FETCH_EDU | FETCH_JOBS | FETCH_NETWORKING | FETCH_PHONES
 
-    const FETCH_ALL          = 0x001FFF; // OR of FETCH_*
+    const FETCH_ALL          = 0x007FFF; // OR of FETCH_*
 
     static public $descriptions = array(
         'search_names'    => 'Noms',
@@ -676,7 +678,10 @@ class Profile implements PlExportable
     public function getEducations($flags, $limit = null)
     {
         if ($this->educations == null && !$this->fetched(self::FETCH_EDU)) {
-            $this->setEducations($this->getProfileField(self::FETCH_EDU));
+            $educations = $this->getProfileField(self::FETCH_EDU);
+            if ($educations) {
+                $this->setEducations($educations);
+            }
         }
 
         if ($this->educations == null) {
@@ -701,7 +706,10 @@ class Profile implements PlExportable
     public function getCorps()
     {
         if ($this->corps == null && !$this->fetched(self::FETCH_CORPS)) {
-            $this->setCorps($this->getProfileField(self::FETCH_CORPS));
+            $corps = $this->getProfileField(self::FETCH_CORPS);
+            if ($corps) {
+                $this->setCorps($corps);
+            }
         }
         return $this->corps;
     }
@@ -796,7 +804,10 @@ class Profile implements PlExportable
     public function getMentoringCountries()
     {
         if ($this->mentor_countries == null && !$this->fetched(self::FETCH_MENTOR_COUNTRY)) {
-            $this->setMentoringCountries($this->getProfileField(self::FETCH_MENTOR_COUNTRY));
+            $countries = $this->getProfileField(self::FETCH_MENTOR_COUNTRY);
+            if ($countries) {
+                $this->setMentoringCountries($countries);
+            }
         }
 
         if ($this->mentor_countries == null) {
@@ -823,7 +834,10 @@ class Profile implements PlExportable
     public function getMentoringTerms()
     {
         if ($this->mentor_terms == null && !$this->fetched(self::FETCH_MENTOR_TERMS)) {
-            $this->setMentoringTerms($this->getProfileField(self::FETCH_MENTOR_TERMS));
+            $terms = $this->getProfileField(self::FETCH_MENTOR_TERMS);
+            if ($terms) {
+                $this->setMentoringTerms($terms);
+            }
         }
 
         if ($this->mentor_terms == null) {
@@ -833,6 +847,50 @@ class Profile implements PlExportable
         }
     }
 
+    /* Skills */
+    private $skills = null;
+    public function setSkills(ProfileSkills $skills)
+    {
+        $this->skills = $skills;
+    }
+    public function getSkills()
+    {
+        if ($this->skills == null && !$this->fetched(self::FETCH_SKILL)) {
+            $skills = $this->getProfileField(self::FETCH_SKILL);
+            if ($skills) {
+                $this->setSkills($skills);
+            }
+        }
+
+        if ($this->skills == null) {
+            return array();
+        } else {
+            return $this->skills->skills;
+        }
+    }
+
+    /* Languades */
+    private $languages = null;
+    public function setLanguages(ProfileLanguages $languages)
+    {
+        $this->languages = $languages;
+    }
+    public function getLanguages()
+    {
+        if ($this->languages == null && !$this->fetched(self::FETCH_LANGUAGE)) {
+            $languages = $this->getProfileField(self::FETCH_LANGUAGE);
+            if ($languages) {
+                $this->setLanguages($languages);
+            }
+        }
+
+        if ($this->languages == null) {
+            return array();
+        } else {
+            return $this->languages->languages;
+        }
+    }
+
     /** DeltaTen
      */
 
@@ -907,7 +965,10 @@ class Profile implements PlExportable
     public function getMedals()
     {
         if ($this->medals == null && !$this->fetched(self::FETCH_MEDALS)) {
-            $this->setMedals($this->getProfileField(self::FETCH_MEDALS));
+            $medals = $this->getProfileField(self::FETCH_MEDALS);
+            if ($medals) {
+                $this->setMedals($medals);
+            }
         }
         if ($this->medals == null) {
             return array();
@@ -926,7 +987,10 @@ class Profile implements PlExportable
     public function getPartnerSettings($partner_id)
     {
         if ($this->partners_settings === null && !$this->fetched(self::FETCH_PARTNER)) {
-            $this->setPartnersSettings($this->getProfileField(self::FETCH_PARTNER));
+            $settings = $this->getProfileField(self::FETCH_PARTNER);
+            if ($settings) {
+                $this->setPartnersSettings($settings);
+            }
         }
         if ($this->partners_settings === null) {
             return PartnerSettings::getEmpty($partner_id);
index b6fe1f7..b7a8c1f 100644 (file)
@@ -29,7 +29,7 @@ class XnetSession extends XorgSession
     public function startAvailableAuth()
     {
         if (!S::logged() && Get::has('auth')) {
-            if (!$this->start(AUTH_MDP)) {
+            if (!$this->start(AUTH_PASSWD)) {
                 return false;
             }
         }
@@ -88,7 +88,7 @@ class XnetSession extends XorgSession
             return null;
         }
         Get::kill('auth');
-        S::set('auth', AUTH_MDP);
+        S::set('auth', AUTH_PASSWD);
         return User::getSilentWithValues(null, array('uid' => Get::i('uid')));
     }
 
@@ -100,7 +100,7 @@ class XnetSession extends XorgSession
         }
 
         if ($level == AUTH_SUID) {
-            S::set('auth', AUTH_MDP);
+            S::set('auth', AUTH_PASSWD);
         }
 
         S::set('uid', $user->uid);
index 84128af..d0efe9d 100644 (file)
@@ -138,8 +138,6 @@ class XorgSession extends PlSession
 
         $user = User::getSilent($login);
 
-        $success = $this->checkPassword($login, $user, Post::v('response'));
-
         if (!is_null($user) && S::suid()) {
             $success = (S::suid('uid') == $user->id());
         } else {
@@ -147,7 +145,7 @@ class XorgSession extends PlSession
         }
 
         if ($success) {
-            S::set('auth', AUTH_MDP);
+            S::set('auth', AUTH_PASSWD);
             S::kill('challenge');
             S::logger($user->id())->log('auth_ok');
         }
@@ -163,7 +161,7 @@ class XorgSession extends PlSession
             return true;
         }
         if ($level == AUTH_SUID) {
-            S::set('auth', AUTH_MDP);
+            S::set('auth', AUTH_PASSWD);
         }
 
         // Loads uid and hruid into the session for developement conveniance.
@@ -303,7 +301,7 @@ class XorgSession extends PlSession
 
     public function sureLevel()
     {
-        return AUTH_MDP;
+        return AUTH_PASSWD;
     }
 
 
diff --git a/core b/core
index a552b53..999c36c 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit a552b53ac5b4e512720d77b457bfda823ed3e10b
+Subproject commit 999c36caa0af1a215504c8043f906d6ee8f3c448
index c1dd074..96502f8 100644 (file)
@@ -36,6 +36,8 @@ abstract class ProfileField
         Profile::FETCH_MENTOR_COUNTRY => 'ProfileMentoringCountries',
         Profile::FETCH_JOB_TERMS      => 'ProfileJobTerms',
         Profile::FETCH_MENTOR_TERMS   => 'ProfileMentoringTerms',
+        Profile::FETCH_SKILL          => 'ProfileSkills',
+        Profile::FETCH_LANGUAGE       => 'ProfileLanguages',
         Profile::FETCH_PARTNER        => 'ProfilePartnerSharing',
     );
 
@@ -722,6 +724,66 @@ class ProfileMentoringTerms extends ProfileJobTerms
     }
 }
 // }}}
+// {{{ class ProfileSkills                                   [ Field ]
+class ProfileSkills extends ProfileField
+{
+    public $skills = array();
+
+    public function __construct(PlInnerSubIterator $it)
+    {
+        $this->pid = $it->value();
+        while ($skill = $it->next()) {
+            $this->skills[$skill['cid']] = $skill;
+        }
+    }
+
+    public static function fetchData(array $pids, Visibility $visibility)
+    {
+        $data = XDB::iterator('SELECT  ps.cid, pse.text_fr, ps.level, ps.pid
+                                 FROM  profile_skills          AS ps
+                           INNER JOIN  profile_skill_enum      AS pse ON (pse.id = ps.cid)
+                                WHERE  ps.pid IN {?}
+                             ORDER BY  ' . XDB::formatCustomOrder('ps.pid', $pids),
+                              $pids);
+        return PlIteratorUtils::subIterator($data, PlIteratorUtils::arrayValueCallback('pid'));
+    }
+}
+// }}}
+// {{{ class ProfileLanguages                                [ Field ]
+class ProfileLanguages extends ProfileField
+{
+    public $languages = array();
+
+    public function __construct(PlInnerSubIterator $it)
+    {
+        static $levels = array(
+            1 => 'connaissance basique',
+            2 => 'maîtrise des bases',
+            3 => 'maîtrise limitée',
+            4 => 'maîtrise générale',
+            5 => 'bonne maîtrise',
+            6 => 'maîtrise complète'
+        );
+
+        $this->pid = $it->value();
+        while ($language = $it->next()) {
+            $this->languages[$language['lid']] = $language;
+            $this->languages[$language['lid']]['level'] = $levels[$language['level']];
+        }
+    }
+
+    public static function fetchData(array $pids, Visibility $visibility)
+    {
+        $data = XDB::iterator('SELECT  ps.lid, pse.language, ps.level, ps.pid
+                                 FROM  profile_langskills     AS ps
+                           INNER JOIN  profile_langskill_enum AS pse ON (pse.iso_639_2b = ps.lid)
+                                WHERE  ps.pid IN {?}
+                             ORDER BY  ' . XDB::formatCustomOrder('ps.pid', $pids),
+                              $pids);
+        return PlIteratorUtils::subIterator($data, PlIteratorUtils::arrayValueCallback('pid'));
+    }
+}
+// }}}
 // {{{ class ProfilePartnerSharing                    [ Field ]
 class ProfilePartnerSharing extends ProfileField
 {
index 2509806..0214520 100644 (file)
@@ -37,7 +37,7 @@ class PayReq extends Validate
     public $asso;
     public $evt;
     public $evt_intitule;
-    public $donation;
+    public $public;
 
     public $rules = "Vérifier que les balises &lt;salutation&gt;, &lt;prenom&gt;, &lt;nom&gt;,  &lt;montant&gt; et &lt;comment&gt; n'ont pas été modifiées.
 Vérifier que le demandeur n'a pas laissé les crochets [].
@@ -47,7 +47,7 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
 
     public function __construct(User $_user, $_intitule, $_site, $_montant, $_msg,
                                 $_montantmin=0, $_montantmax=999, $_asso_id = 0,
-                                $_evt = 0, $_donation = false, $_stamp=0)
+                                $_evt = 0, $_public = false, $_stamp = 0)
     {
         parent::__construct($_user, false, 'paiements', $_stamp);
 
@@ -56,10 +56,10 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
         $this->msg_reponse  = $_msg;
         $this->asso_id      = (string)$_asso_id;
         $this->evt          = (string)$_evt;
-        $this->donation     = $_donation;
         $this->montant      = $_montant;
         $this->montant_min  = $_montantmin;
         $this->montant_max  = $_montantmax;
+        $this->public       = $_public;
 
         if ($_asso_id) {
             $res = XDB::query("SELECT nom FROM groups WHERE id = {?}", $_asso_id);
@@ -89,7 +89,7 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
     public function accept()
     {
         // no text [AI JMIAJM IJA MIJ]
-        if (preg_match('/\[[-\'"A-Z ]+\]/', $this->msg_reponse)) {
+        if (preg_match('/\[[-\'"a-zA-Z ]+\]/', replace_accent($this->msg_reponse))) {
             $this->trigError("La demande de paiement n'est pas valide. Merci de compléter le texte avant de la soumettre");
             return false;
         }
@@ -139,6 +139,7 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
         $this->montant_min = Env::i('pay_montant_min');
         $this->montant_max = Env::i('pay_montant_max');
         $this->msg_reponse = Env::v('pay_msg_reponse');
+        $this->public      = (Env::v('pay_public') == 'yes');
         return true;
     }
 
@@ -169,11 +170,11 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
     {
         $res = XDB::query("SELECT MAX(id) FROM payments");
         $id = $res->fetchOneCell()+1;
-        $flags = ($this->donation ? 'donation' : '');
-        $ret = XDB::execute('INSERT INTO  payments (id, text, url, flags, amount_def, amount_min, amount_max, mail, confirmation, asso_id)
+        $ret = XDB::execute('INSERT INTO  payments (id, text, url, amount_def, amount_min, amount_max, mail, confirmation, asso_id, flags)
                                   VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
-                            $id, $this->titre, $this->site, $flags, $this->montant, $this->montant_min,
-                            $this->montant_max, $this->user->bestEmail(), $this->msg_reponse, $this->asso_id);
+                            $id, $this->titre, $this->site, $this->montant, $this->montant_min,
+                            $this->montant_max, $this->user->bestEmail(), $this->msg_reponse, $this->asso_id,
+                            ($this->public ? 'public' : ''));
         if ($this->asso_id && $this->evt) {
             XDB::execute("UPDATE  group_events
                              SET  paiement_id = {?}
index ad07d0e..c6a9852 100644 (file)
@@ -24,38 +24,38 @@ class AdminModule extends PLModule
     function handlers()
     {
         return array(
-            'phpinfo'                      => $this->make_hook('phpinfo',                AUTH_MDP,    'admin'),
+            'phpinfo'                      => $this->make_hook('phpinfo',                AUTH_PASSWD, 'admin'),
             'get_rights'                   => $this->make_hook('get_rights',             AUTH_COOKIE, 'admin'),
             'set_skin'                     => $this->make_hook('set_skin',               AUTH_COOKIE, 'admin'),
-            'admin'                        => $this->make_hook('default',                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/user'                   => $this->make_hook('user',                   AUTH_MDP,    'admin'),
-            'admin/add_accounts'           => $this->make_hook('add_accounts',           AUTH_MDP,    'admin'),
-            'admin/validate'               => $this->make_hook('validate',               AUTH_MDP,    'admin,edit_directory'),
-            '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/geocoding'              => $this->make_hook('geocoding',              AUTH_MDP,    'admin'),
-            'admin/accounts'               => $this->make_hook('accounts',               AUTH_MDP,    'admin'),
-            'admin/account/watch'          => $this->make_hook('account_watch',          AUTH_MDP,    'admin'),
-            'admin/account/types'          => $this->make_hook('account_types',          AUTH_MDP,    'admin'),
-            'admin/xnet_without_group'     => $this->make_hook('xnet_without_group',     AUTH_MDP,    'admin'),
-            'admin/jobs'                   => $this->make_hook('jobs',                   AUTH_MDP,    'admin,edit_directory'),
-            'admin/profile'                => $this->make_hook('profile',                AUTH_MDP,    'admin,edit_directory'),
-            'admin/phd'                    => $this->make_hook('phd',                    AUTH_MDP,    'admin'),
-            'admin/add_secondary_edu'      => $this->make_hook('add_secondary_edu',      AUTH_MDP,    'admin')
+            'admin'                        => $this->make_hook('default',                AUTH_PASSWD, 'admin'),
+            'admin/dead-but-active'        => $this->make_hook('dead_but_active',        AUTH_PASSWD, 'admin'),
+            'admin/deaths'                 => $this->make_hook('deaths',                 AUTH_PASSWD, 'admin'),
+            'admin/downtime'               => $this->make_hook('downtime',               AUTH_PASSWD, 'admin'),
+            'admin/homonyms'               => $this->make_hook('homonyms',               AUTH_PASSWD, 'admin'),
+            'admin/logger'                 => $this->make_hook('logger',                 AUTH_PASSWD, 'admin'),
+            'admin/logger/actions'         => $this->make_hook('logger_actions',         AUTH_PASSWD, 'admin'),
+            'admin/postfix/blacklist'      => $this->make_hook('postfix_blacklist',      AUTH_PASSWD, 'admin'),
+            'admin/postfix/delayed'        => $this->make_hook('postfix_delayed',        AUTH_PASSWD, 'admin'),
+            'admin/postfix/regexp_bounces' => $this->make_hook('postfix_regexpsbounces', AUTH_PASSWD, 'admin'),
+            'admin/postfix/whitelist'      => $this->make_hook('postfix_whitelist',      AUTH_PASSWD, 'admin'),
+            'admin/mx/broken'              => $this->make_hook('mx_broken',              AUTH_PASSWD, 'admin'),
+            'admin/skins'                  => $this->make_hook('skins',                  AUTH_PASSWD, 'admin'),
+            'admin/user'                   => $this->make_hook('user',                   AUTH_PASSWD, 'admin'),
+            'admin/add_accounts'           => $this->make_hook('add_accounts',           AUTH_PASSWD, 'admin'),
+            'admin/validate'               => $this->make_hook('validate',               AUTH_PASSWD, 'admin,edit_directory'),
+            'admin/validate/answers'       => $this->make_hook('validate_answers',       AUTH_PASSWD, 'admin'),
+            'admin/wiki'                   => $this->make_hook('wiki',                   AUTH_PASSWD, 'admin'),
+            'admin/ipwatch'                => $this->make_hook('ipwatch',                AUTH_PASSWD, 'admin'),
+            'admin/icons'                  => $this->make_hook('icons',                  AUTH_PASSWD, 'admin'),
+            'admin/geocoding'              => $this->make_hook('geocoding',              AUTH_PASSWD, 'admin'),
+            'admin/accounts'               => $this->make_hook('accounts',               AUTH_PASSWD, 'admin'),
+            'admin/account/watch'          => $this->make_hook('account_watch',          AUTH_PASSWD, 'admin'),
+            'admin/account/types'          => $this->make_hook('account_types',          AUTH_PASSWD, 'admin'),
+            'admin/xnet_without_group'     => $this->make_hook('xnet_without_group',     AUTH_PASSWD, 'admin'),
+            'admin/jobs'                   => $this->make_hook('jobs',                   AUTH_PASSWD, 'admin,edit_directory'),
+            'admin/profile'                => $this->make_hook('profile',                AUTH_PASSWD, 'admin,edit_directory'),
+            'admin/phd'                    => $this->make_hook('phd',                    AUTH_PASSWD, 'admin'),
+            'admin/add_secondary_edu'      => $this->make_hook('add_secondary_edu',      AUTH_PASSWD, 'admin')
         );
     }
 
index a86313e..688c5c5 100644 (file)
@@ -32,7 +32,7 @@ class AuthModule extends PLModule
             'auth-redirect.php'             => $this->make_hook('redirect',           AUTH_COOKIE, 'user'),
             'auth-groupex.php'              => $this->make_hook('groupex_old',        AUTH_COOKIE, ''),
             'auth-groupex'                  => $this->make_hook('groupex',            AUTH_PUBLIC, ''),
-            'admin/auth-groupes-x'          => $this->make_hook('admin_authgroupesx', AUTH_MDP,    'admin'),
+            'admin/auth-groupes-x'          => $this->make_hook('admin_authgroupesx', AUTH_PASSWD, 'admin'),
         );
     }
 
index d6a63be..4ebf134 100644 (file)
@@ -30,12 +30,12 @@ class AXLetterModule extends NewsletterModule
             'ax/out'               => $this->make_hook('out',             AUTH_PUBLIC),
             'ax/show'              => $this->make_hook('nl_show',         AUTH_COOKIE, 'user'),
             'ax/search'            => $this->make_hook('nl_search',       AUTH_COOKIE, 'user'),
-            'ax/admin'             => $this->make_hook('admin_nl',        AUTH_MDP,    'user'),
-            'ax/admin/edit'        => $this->make_hook('admin_nl_edit',   AUTH_MDP,    'user'),
-            'ax/admin/edit/valid'  => $this->make_hook('admin_nl_valid',  AUTH_MDP,    'user'),
-            'ax/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_MDP,    'user'),
-            'ax/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_MDP,    'user'),
-            'ax/admin/categories'  => $this->make_hook('admin_nl_cat',    AUTH_MDP,    'user'),
+            'ax/admin'             => $this->make_hook('admin_nl',        AUTH_PASSWD, 'user'),
+            'ax/admin/edit'        => $this->make_hook('admin_nl_edit',   AUTH_PASSWD, 'user'),
+            'ax/admin/edit/valid'  => $this->make_hook('admin_nl_valid',  AUTH_PASSWD, 'user'),
+            'ax/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_PASSWD, 'user'),
+            'ax/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_PASSWD, 'user'),
+            'ax/admin/categories'  => $this->make_hook('admin_nl_cat',    AUTH_PASSWD, 'user'),
         );
     }
 
index e5049c5..457157f 100644 (file)
@@ -25,11 +25,11 @@ class EmailModule extends PLModule
     {
         return array(
             'emails'                  => $this->make_hook('emails',      AUTH_COOKIE, 'mail'),
-            'emails/alias'            => $this->make_hook('alias',       AUTH_MDP,    'mail'),
-            'emails/antispam'         => $this->make_hook('antispam',    AUTH_MDP,    'mail'),
+            'emails/alias'            => $this->make_hook('alias',       AUTH_PASSWD, 'mail'),
+            'emails/antispam'         => $this->make_hook('antispam',    AUTH_PASSWD, 'mail'),
             'emails/broken'           => $this->make_hook('broken',      AUTH_COOKIE, 'user'),
-            'emails/redirect'         => $this->make_hook('redirect',    AUTH_MDP,    'mail'),
-            'emails/send'             => $this->make_hook('send',        AUTH_MDP,    'mail'),
+            'emails/redirect'         => $this->make_hook('redirect',    AUTH_PASSWD, 'mail'),
+            'emails/send'             => $this->make_hook('send',        AUTH_PASSWD, 'mail'),
             'emails/antispam/submit'  => $this->make_hook('submit',      AUTH_COOKIE, 'user'),
             'emails/test'             => $this->make_hook('test',        AUTH_COOKIE, 'mail', NO_AUTH),
 
@@ -38,10 +38,10 @@ class EmailModule extends PLModule
 
             'emails/imap/in'          => $this->make_hook('imap_in',     AUTH_PUBLIC),
 
-            'admin/emails/duplicated' => $this->make_hook('duplicated',  AUTH_MDP,    'admin'),
-            'admin/emails/watch'      => $this->make_hook('duplicated',  AUTH_MDP,    'admin'),
-            'admin/emails/lost'       => $this->make_hook('lost',        AUTH_MDP,    'admin'),
-            'admin/emails/broken'     => $this->make_hook('broken_addr', AUTH_MDP,    'admin'),
+            'admin/emails/duplicated' => $this->make_hook('duplicated',  AUTH_PASSWD, 'admin'),
+            'admin/emails/watch'      => $this->make_hook('duplicated',  AUTH_PASSWD, 'admin'),
+            'admin/emails/lost'       => $this->make_hook('lost',        AUTH_PASSWD, 'admin'),
+            'admin/emails/broken'     => $this->make_hook('broken_addr', AUTH_PASSWD, 'admin'),
         );
     }
 
index b914893..f3667d3 100644 (file)
@@ -30,12 +30,12 @@ class EPLetterModule extends NewsletterModule
             'epletter/out'               => $this->make_hook('out',             AUTH_PUBLIC),
             'epletter/show'              => $this->make_hook('nl_show',         AUTH_COOKIE, 'user'),
             'epletter/search'            => $this->make_hook('nl_search',       AUTH_COOKIE, 'user'),
-            'epletter/admin'             => $this->make_hook('admin_nl',        AUTH_MDP,    'user'),
-            'epletter/admin/edit'        => $this->make_hook('admin_nl_edit',   AUTH_MDP,    'user'),
-            'epletter/admin/edit/valid'  => $this->make_hook('admin_nl_valid',  AUTH_MDP,    'user'),
-            'epletter/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_MDP,    'user'),
-            'epletter/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_MDP,    'user'),
-            'epletter/admin/categories'  => $this->make_hook('admin_nl_cat',    AUTH_MDP,    'user'),
+            'epletter/admin'             => $this->make_hook('admin_nl',        AUTH_PASSWD, 'user'),
+            'epletter/admin/edit'        => $this->make_hook('admin_nl_edit',   AUTH_PASSWD, 'user'),
+            'epletter/admin/edit/valid'  => $this->make_hook('admin_nl_valid',  AUTH_PASSWD, 'user'),
+            'epletter/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_PASSWD, 'user'),
+            'epletter/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_PASSWD, 'user'),
+            'epletter/admin/categories'  => $this->make_hook('admin_nl_cat',    AUTH_PASSWD, 'user'),
         );
     }
 
index b1f6482..7395568 100644 (file)
@@ -27,12 +27,12 @@ class EventsModule extends PLModule
             'events'         => $this->make_hook('ev',           AUTH_COOKIE, 'user'),
             'events/preview' => $this->make_hook('preview',      AUTH_PUBLIC, 'user', NO_AUTH),
             'events/photo'   => $this->make_hook('photo',        AUTH_PUBLIC),
-            'events/submit'  => $this->make_hook('ev_submit',    AUTH_MDP,    'user'),
-            'admin/events'   => $this->make_hook('admin_events', AUTH_MDP,    'admin'),
+            'events/submit'  => $this->make_hook('ev_submit',    AUTH_PASSWD, 'user'),
+            'admin/events'   => $this->make_hook('admin_events', AUTH_PASSWD, 'admin'),
             'rss'            => $this->make_token_hook('rss',    AUTH_COOKIE, 'user'),
 
             'ajax/tips'      => $this->make_hook('tips',         AUTH_COOKIE, 'user', NO_AUTH),
-            'admin/tips'     => $this->make_hook('admin_tips',   AUTH_MDP,    'admin'),
+            'admin/tips'     => $this->make_hook('admin_tips',   AUTH_PASSWD, 'admin'),
         );
     }
 
index 28ea1c8..22604b1 100644 (file)
@@ -26,7 +26,7 @@ class ForumsModule extends PLModule
         return array(
             'banana'       => $this->make_hook('banana',      AUTH_COOKIE, 'forums'),
             'banana/rss'   => $this->make_hook('rss',         AUTH_PUBLIC, 'forums', NO_HTTPS),
-            'admin/forums' => $this->make_hook('forums_bans', AUTH_MDP,    'admin'),
+            'admin/forums' => $this->make_hook('forums_bans', AUTH_PASSWD, 'admin'),
         );
     }
 
index 65a692b..b30fcb4 100644 (file)
@@ -35,22 +35,22 @@ class FusionAxModule extends PLModule
     {
         if (Platal::globals()->merge->state == 'pending') {
             return array(
-                'fusionax'                  => $this->make_hook('index',    AUTH_MDP, 'admin'),
-                'fusionax/import'           => $this->make_hook('import',   AUTH_MDP, 'admin'),
-                'fusionax/view'             => $this->make_hook('view',     AUTH_MDP, 'admin'),
-                'fusionax/ids'              => $this->make_hook('ids',      AUTH_MDP, 'admin'),
-                'fusionax/deceased'         => $this->make_hook('deceased', AUTH_MDP, 'admin'),
-                'fusionax/promo'            => $this->make_hook('promo',    AUTH_MDP, 'admin'),
-                'fusionax/names'            => $this->make_hook('names',    AUTH_MDP, 'admin'),
-                'fusionax/edu'              => $this->make_hook('edu',      AUTH_MDP, 'admin'),
-                'fusionax/corps'            => $this->make_hook('corps',    AUTH_MDP, 'admin')
+                'fusionax'                  => $this->make_hook('index',    AUTH_PASSWD, 'admin'),
+                'fusionax/import'           => $this->make_hook('import',   AUTH_PASSWD, 'admin'),
+                'fusionax/view'             => $this->make_hook('view',     AUTH_PASSWD, 'admin'),
+                'fusionax/ids'              => $this->make_hook('ids',      AUTH_PASSWD, 'admin'),
+                'fusionax/deceased'         => $this->make_hook('deceased', AUTH_PASSWD, 'admin'),
+                'fusionax/promo'            => $this->make_hook('promo',    AUTH_PASSWD, 'admin'),
+                'fusionax/names'            => $this->make_hook('names',    AUTH_PASSWD, 'admin'),
+                'fusionax/edu'              => $this->make_hook('edu',      AUTH_PASSWD, 'admin'),
+                'fusionax/corps'            => $this->make_hook('corps',    AUTH_PASSWD, 'admin')
             );
         } elseif (Platal::globals()->merge->state == 'done') {
             return array(
-                'fusionax'                  => $this->make_hook('index',            AUTH_MDP, 'admin,edit_directory'),
-                'fusionax/issues'           => $this->make_hook('issues',           AUTH_MDP, 'admin,edit_directory'),
-                'fusionax/issues/deathdate' => $this->make_hook('issues_deathdate', AUTH_MDP, 'admin,edit_directory'),
-                'fusionax/issues/promo'     => $this->make_hook('issues_promo',     AUTH_MDP, 'admin,edit_directory'),
+                'fusionax'                  => $this->make_hook('index',            AUTH_PASSWD, 'admin,edit_directory'),
+                'fusionax/issues'           => $this->make_hook('issues',           AUTH_PASSWD, 'admin,edit_directory'),
+                'fusionax/issues/deathdate' => $this->make_hook('issues_deathdate', AUTH_PASSWD, 'admin,edit_directory'),
+                'fusionax/issues/promo'     => $this->make_hook('issues_promo',     AUTH_PASSWD, 'admin,edit_directory'),
             );
         }
     }
index b4900b9..bad3836 100644 (file)
@@ -29,10 +29,10 @@ class GoogleAppsModule extends PLModule
         }
 
         return array(
-            'googleapps'            => $this->make_hook('index',      AUTH_MDP, 'gapps'),
-            'admin/googleapps'      => $this->make_hook('admin',      AUTH_MDP, 'admin'),
-            'admin/googleapps/job'  => $this->make_hook('admin_job',  AUTH_MDP, 'admin'),
-            'admin/googleapps/user' => $this->make_hook('admin_user', AUTH_MDP, 'admin'),
+            'googleapps'            => $this->make_hook('index',      AUTH_PASSWD, 'gapps'),
+            'admin/googleapps'      => $this->make_hook('admin',      AUTH_PASSWD, 'admin'),
+            'admin/googleapps/job'  => $this->make_hook('admin_job',  AUTH_PASSWD, 'admin'),
+            'admin/googleapps/user' => $this->make_hook('admin_user', AUTH_PASSWD, 'admin'),
         );
     }
 
index 688b0b0..f73598f 100644 (file)
@@ -26,9 +26,9 @@ class ListsModule extends PLModule
     function handlers()
     {
         return array(
-            'lists'              => $this->make_hook('lists',     AUTH_MDP,    'user'),
-            'lists/ajax'         => $this->make_hook('ajax',      AUTH_MDP,    'user', NO_AUTH),
-            'lists/create'       => $this->make_hook('create',    AUTH_MDP,    'lists'),
+            'lists'              => $this->make_hook('lists',     AUTH_PASSWD, 'user'),
+            'lists/ajax'         => $this->make_hook('ajax',      AUTH_PASSWD, 'user', NO_AUTH),
+            'lists/create'       => $this->make_hook('create',    AUTH_PASSWD, 'lists'),
 
             'lists/members'      => $this->make_hook('members',   AUTH_COOKIE, 'user'),
             'lists/csv'          => $this->make_hook('csv',       AUTH_COOKIE, 'user'),
@@ -36,15 +36,15 @@ class ListsModule extends PLModule
             'lists/archives'     => $this->make_hook('archives',  AUTH_COOKIE, 'user'),
             'lists/archives/rss' => $this->make_hook('rss',       AUTH_PUBLIC, 'user', NO_HTTPS),
 
-            'lists/moderate'     => $this->make_hook('moderate',  AUTH_MDP,    'user'),
-            'lists/admin'        => $this->make_hook('admin',     AUTH_MDP,    'user'),
-            'lists/options'      => $this->make_hook('options',   AUTH_MDP,    'user'),
-            'lists/delete'       => $this->make_hook('delete',    AUTH_MDP,    'user'),
+            'lists/moderate'     => $this->make_hook('moderate',  AUTH_PASSWD, 'user'),
+            'lists/admin'        => $this->make_hook('admin',     AUTH_PASSWD, 'user'),
+            'lists/options'      => $this->make_hook('options',   AUTH_PASSWD, 'user'),
+            'lists/delete'       => $this->make_hook('delete',    AUTH_PASSWD, 'user'),
 
-            'lists/soptions'     => $this->make_hook('soptions',  AUTH_MDP,    'user'),
-            'lists/check'        => $this->make_hook('check',     AUTH_MDP,    'user'),
-            'admin/lists'        => $this->make_hook('admin_all', AUTH_MDP,    'admin'),
-            'admin/aliases'      => $this->make_hook('aaliases',  AUTH_MDP,    'admin')
+            'lists/soptions'     => $this->make_hook('soptions',  AUTH_PASSWD, 'user'),
+            'lists/check'        => $this->make_hook('check',     AUTH_PASSWD, 'user'),
+            'admin/lists'        => $this->make_hook('admin_all', AUTH_PASSWD, 'admin'),
+            'admin/aliases'      => $this->make_hook('aaliases',  AUTH_PASSWD, 'admin')
         );
     }
 
index 5086e96..d1d8372 100644 (file)
@@ -24,13 +24,13 @@ class MarketingModule extends PLModule
     function handlers()
     {
         return array(
-            'marketing'            => $this->make_hook('marketing',  AUTH_MDP,    'admin'),
-            'marketing/promo'      => $this->make_hook('promo',      AUTH_MDP,    'admin'),
-            'marketing/relance'    => $this->make_hook('relance',    AUTH_MDP,    'admin'),
-            'marketing/this_week'  => $this->make_hook('week',       AUTH_MDP,    'admin'),
-            'marketing/volontaire' => $this->make_hook('volontaire', AUTH_MDP,    'admin'),
+            'marketing'            => $this->make_hook('marketing',  AUTH_PASSWD, 'admin'),
+            'marketing/promo'      => $this->make_hook('promo',      AUTH_PASSWD, 'admin'),
+            'marketing/relance'    => $this->make_hook('relance',    AUTH_PASSWD, 'admin'),
+            'marketing/this_week'  => $this->make_hook('week',       AUTH_PASSWD, 'admin'),
+            'marketing/volontaire' => $this->make_hook('volontaire', AUTH_PASSWD, 'admin'),
 
-            'marketing/private'    => $this->make_hook('private',    AUTH_MDP,    'admin'),
+            'marketing/private'    => $this->make_hook('private',    AUTH_PASSWD, 'admin'),
             'marketing/public'     => $this->make_hook('public',     AUTH_COOKIE, 'user'),
             'marketing/broken'     => $this->make_hook('broken',     AUTH_COOKIE, 'user'),
         );
index 6603bc8..7ea958e 100644 (file)
@@ -27,16 +27,16 @@ class NewsletterModule extends PLModule
             'nl'                           => $this->make_hook('nl',              AUTH_COOKIE, 'user'),
             'nl/show'                      => $this->make_hook('nl_show',         AUTH_COOKIE, 'user'),
             'nl/search'                    => $this->make_hook('nl_search',       AUTH_COOKIE, 'user'),
-            'nl/submit'                    => $this->make_hook('nl_submit',       AUTH_MDP,    'user'),
-            'nl/remaining'                 => $this->make_hook('nl_remaining',    AUTH_MDP,    'user'),
-            'admin/nls'                    => $this->make_hook('admin_nl_groups', AUTH_MDP,    'admin'),
-            'admin/newsletter'             => $this->make_hook('admin_nl',        AUTH_MDP,    'admin'),
-            'admin/newsletter/categories'  => $this->make_hook('admin_nl_cat',    AUTH_MDP,    'admin'),
-            'admin/newsletter/edit'        => $this->make_hook('admin_nl_edit',   AUTH_MDP,    'admin'),
-            'admin/newsletter/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_MDP,    'admin'),
+            'nl/submit'                    => $this->make_hook('nl_submit',       AUTH_PASSWD, 'user'),
+            'nl/remaining'                 => $this->make_hook('nl_remaining',    AUTH_PASSWD, 'user'),
+            'admin/nls'                    => $this->make_hook('admin_nl_groups', AUTH_PASSWD, 'admin'),
+            'admin/newsletter'             => $this->make_hook('admin_nl',        AUTH_PASSWD, 'admin'),
+            'admin/newsletter/categories'  => $this->make_hook('admin_nl_cat',    AUTH_PASSWD, 'admin'),
+            'admin/newsletter/edit'        => $this->make_hook('admin_nl_edit',   AUTH_PASSWD, 'admin'),
+            'admin/newsletter/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_PASSWD, 'admin'),
             // Automatic mailing is disabled for X.org NL
-//            'admin/newsletter/edit/cancel' => $this->make_hook('cancel', AUTH_MDP, 'admin'),
-//            'admin/newsletter/edit/valid'  => $this->make_hook('valid',  AUTH_MDP, 'admin'),
+//            'admin/newsletter/edit/cancel' => $this->make_hook('cancel', AUTH_PASSWD, 'admin'),
+//            'admin/newsletter/edit/valid'  => $this->make_hook('valid',  AUTH_PASSWD, 'admin'),
         );
     }
 
index fa4c1d5..826c78c 100644 (file)
@@ -64,9 +64,9 @@ class OpenidModule extends PLModule
             'openid'               => $this->make_hook('openid',        AUTH_PUBLIC),
             'openid/melix'         => $this->make_hook('melix',         AUTH_PUBLIC),
             'openid/xrds'          => $this->make_hook('xrds',          AUTH_PUBLIC),
-            'openid/trust'         => $this->make_hook('trust',         AUTH_MDP, 'user'),
-            'openid/trusted'       => $this->make_hook('trusted',       AUTH_MDP, 'user'),
-            'admin/openid/trusted' => $this->make_hook('admin_trusted', AUTH_MDP, 'admin'),
+            'openid/trust'         => $this->make_hook('trust',         AUTH_PASSWD, 'user'),
+            'openid/trusted'       => $this->make_hook('trusted',       AUTH_PASSWD, 'user'),
+            'admin/openid/trusted' => $this->make_hook('admin_trusted', AUTH_PASSWD, 'admin'),
         );
     }
 
index ef0ed1a..66c56b2 100644 (file)
@@ -105,104 +105,116 @@ class PaymentModule extends PLModule
     function handlers()
     {
         return array(
-            'payment'                      => $this->make_hook('payment',          AUTH_MDP,    'payment'),
+            'payment'                      => $this->make_hook('payment',          AUTH_PUBLIC, 'user'),
             'payment/cyber2_return'        => $this->make_hook('cyber2_return',    AUTH_PUBLIC, 'user', NO_HTTPS),
             'payment/paypal_return'        => $this->make_hook('paypal_return',    AUTH_PUBLIC, 'user', NO_HTTPS),
-            '%grp/paiement'                => $this->make_hook('xnet_payment',     AUTH_MDP,    'user'),
-            '%grp/payment'                 => $this->make_hook('xnet_payment',     AUTH_MDP,    'user'),
-            '%grp/payment/csv'             => $this->make_hook('payment_csv',      AUTH_MDP,    'groupadmin'),
+            '%grp/paiement'                => $this->make_hook('xnet_payment',     AUTH_PUBLIC, 'user'),
+            '%grp/payment'                 => $this->make_hook('xnet_payment',     AUTH_PUBLIC, 'user'),
+            '%grp/payment/csv'             => $this->make_hook('payment_csv',      AUTH_PASSWD, 'groupadmin'),
             '%grp/payment/cyber2_return'   => $this->make_hook('cyber2_return',    AUTH_PUBLIC, 'user', NO_HTTPS),
             '%grp/payment/paypal_return'   => $this->make_hook('paypal_return',    AUTH_PUBLIC, 'user', NO_HTTPS),
-            'admin/payments'               => $this->make_hook('admin',            AUTH_MDP,    'admin'),
-            'admin/payments/methods'       => $this->make_hook('adm_methods',      AUTH_MDP,    'admin'),
-            'admin/payments/transactions'  => $this->make_hook('adm_transactions', AUTH_MDP,    'admin'),
-            'admin/reconcile'              => $this->make_hook('adm_reconcile',    AUTH_MDP,    'admin'),
-            'admin/reconcile/importlogs'   => $this->make_hook('adm_importlogs',   AUTH_MDP,    'admin'),
-            'admin/reconcile/transfers'    => $this->make_hook('adm_transfers',    AUTH_MDP,    'admin'),
-            'admin/reconcile/bankaccounts' => $this->make_hook('adm_bankaccounts', AUTH_MDP,    'admin'),
+            'admin/payments'               => $this->make_hook('admin',            AUTH_PASSWD, 'admin'),
+            'admin/payments/methods'       => $this->make_hook('adm_methods',      AUTH_PASSWD, 'admin'),
+            'admin/payments/transactions'  => $this->make_hook('adm_transactions', AUTH_PASSWD, 'admin'),
+            'admin/reconcile'              => $this->make_hook('adm_reconcile',    AUTH_PASSWD, 'admin'),
+            'admin/reconcile/importlogs'   => $this->make_hook('adm_importlogs',   AUTH_PASSWD, 'admin'),
+            'admin/reconcile/transfers'    => $this->make_hook('adm_transfers',    AUTH_PASSWD, 'admin'),
+            'admin/reconcile/bankaccounts' => $this->make_hook('adm_bankaccounts', AUTH_PASSWD, 'admin'),
         );
     }
 
     function handler_payment($page, $ref = -1)
     {
-        global $globals;
-
+        $page->changeTpl('payment/payment.tpl');
+        $page->setTitle('Télépaiement');
         $this->load('money.inc.php');
 
-        if (!empty($GLOBALS['IS_XNET_SITE'])) {
-            if (!$globals->asso('id')) {
-                return PL_NOT_FOUND;
-            }
-            $res = XDB::query('SELECT  asso_id
-                                 FROM  payments
-                                WHERE  asso_id = {?} AND id = {?}',
-                              $globals->asso('id'), $ref);
-            if (!$res->numRows()) {
-                return PL_FORBIDDEN;
-            }
-        }
-        $page->changeTpl('payment/index.tpl');
-        $page->setTitle('Télépaiements');
-
-        // initialisation
-        $op   = Env::v('op', 'select');
         $meth = new PayMethod(Env::i('methode', -1));
         $pay  = new Payment($ref);
 
-        if($pay->flags->hasflag('old')){
-            $page->trigError("La transaction selectionnée est périmée.");
-            $pay = new Payment();
+        if (!$pay->flags->hasflag('public') && (!S::user() || !S::logged())) {
+            $page->kill("Vous n'avez pas les permissions nécessaires pour accéder à cette page.");
+        } else {
+            $page->assign('public', true);
         }
-        $val = Env::v('montant') != 0 ? Env::v('montant') : $pay->amount_def;
 
-        if (($e = $pay->check($val)) !== true) {
-            $page->trigError($e);
+        if ($pay->flags->hasflag('old')) {
+            $page->kill('La transaction selectionnée est périmée.');
         }
 
-        if ($op == 'submit') {
-            $pay->init($val, $meth);
-            $pay->prepareform($pay);
-        } else {
+        $val = (Post::v('amount') != 0) ? Post::v('amount') : $pay->amount_def;
+
+        if (($error = $pay->check($val)) !== true) {
+            $page->trigError($error);
+        }
+
+        if (Post::has('op') && Post::v('op', 'select') == 'submit') {
+            if (S::logged()) {
+                $user = S::user();
+            } else {
+                $user = User::getSilent(Post::t('login'));
+            }
+
+            if (is_null($user)) {
+                $page->trigError("L'identifiant est erroné.");
+                $page->assign('login_error', true);
+                $page->assign('login', Post::t('login'));
+            } else {
+                $pay->init($val, $meth);
+                $pay->prepareform($user);
+                $page->assign('full_name', $user->fullName(true));
+                $page->assign('sex', $user->isFemale());
+            }
+        } elseif (S::logged()) {
             $res = XDB::iterator('SELECT  ts_confirmed, amount
                                     FROM  payment_transactions
                                    WHERE  uid = {?} AND ref = {?}
                                 ORDER BY  ts_confirmed DESC',
-                                 S::v('uid', -1), $ref);
+                                 S::v('uid', -1), $pay->id);
 
             if ($res->total()) {
                 $page->assign('transactions', $res);
             }
 
-            if ($pay->flags->hasflag('donation')) {
-                $donations = XDB::fetchAllAssoc('SELECT  IF(p.display,
-                                                            IF(ap.pid IS NOT NULL, CONCAT(a.full_name, \' (\', pd.promo, \')\'), a.full_name),
-                                                            \'XXXX\') AS name, p.amount
-                                                   FROM  payment_transactions AS p
-                                             INNER JOIN  accounts             AS a  ON (a.uid = p.uid)
-                                              LEFT JOIN  account_profiles     AS ap ON (a.uid = ap.uid AND FIND_IN_SET(\'owner\', ap.perms))
-                                              LEFT JOIN  profile_display      AS pd ON (ap.pid = pd.pid)
-                                                  WHERE  p.ref = {?}
-                                               ORDER BY  LENGTH(p.amount) DESC, p.amount DESC, name',
-                                                $ref);
-                $sum = 0;
-                foreach ($donations as $d) {
-                    $sum += $d['amount'];
-                }
-
+            // Only if $id = -1, meaning only for donation the site's association
+            if ($ref == -1) {
+                $biggest_donations = XDB::fetchAllAssoc('SELECT  IF(p.display,
+                                                                    IF(ap.pid IS NOT NULL, CONCAT(a.full_name, \' (\', pd.promo, \')\'), a.full_name),
+                                                                    \'XXXX\') AS name, p.amount, p.ts_confirmed
+                                                           FROM  payment_transactions AS p
+                                                     INNER JOIN  accounts             AS a  ON (a.uid = p.uid)
+                                                      LEFT JOIN  account_profiles     AS ap ON (a.uid = ap.uid AND FIND_IN_SET(\'owner\', ap.perms))
+                                                      LEFT JOIN  profile_display      AS pd ON (ap.pid = pd.pid)
+                                                          WHERE  p.ref = {?}
+                                                       ORDER BY  LENGTH(p.amount) DESC, p.amount DESC, name
+                                                          LIMIT  10',
+                                                        $pay->id);
+
+                $donations = XDB::fetchAllAssoc('(SELECT  SUM(amount) AS amount, YEAR(ts_confirmed) AS year, MONTH(ts_confirmed) AS month, ts_confirmed
+                                                    FROM  payment_transactions
+                                                   WHERE  ref = {?} AND YEAR(ts_confirmed) = YEAR(CURDATE())
+                                                GROUP BY  month)
+                                                 UNION
+                                                 (SELECT  SUM(amount) AS amount, YEAR(ts_confirmed) AS year, 0 AS month, ts_confirmed
+                                                    FROM  payment_transactions
+                                                   WHERE  ref = {?} AND YEAR(ts_confirmed) < YEAR(CURDATE())
+                                                GROUP BY  year)
+                                                ORDER BY  year DESC, month DESC',
+                                                $pay->id, $pay->id);
+
+                $page->assign('biggest_donations', $biggest_donations);
                 $page->assign('donations', $donations);
-                $page->assign('sum', strtr($sum, '.', ','));
+                $page->assign('donation', true);
             }
         }
 
-        $val = floor($val*100)/100;
-        $page->assign('montant', $val);
+        $val = floor($val * 100) / 100;
+        $page->assign('amount', $val);
         $page->assign('comment', Env::v('comment'));
 
         $page->assign('meth', $meth);
         $page->assign('pay', $pay);
         $page->assign('evtlink', $pay->event());
-        $page->assign('sex', S::user()->isFemale());
-        $page->assign('donation', $pay->flags->hasflag('donation'));
     }
 
     function handler_cyber2_return($page, $uid = null)
@@ -404,7 +416,7 @@ class PaymentModule extends PLModule
         global $globals;
 
         $perms = S::v('perms');
-        if (!$perms->hasFlag('groupmember')) {
+        if (!(S::identified() && $perms->hasFlag('groupmember'))) {
             if (is_null($pid)) {
                 return PL_FORBIDDEN;
             }
@@ -413,7 +425,12 @@ class PaymentModule extends PLModule
                            INNER JOIN  group_event_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
                                 WHERE  e.paiement_id = {?} AND e.asso_id = {?}",
                               S::i('uid'), $pid, $globals->asso('id'));
-            if ($res->numRows() == 0) {
+            $public = XDB::query("SELECT  1
+                                    FROM  payments     AS p
+                              INNER JOIN  group_events AS g ON (g.paiement_id = p.id)
+                                   WHERE  g.asso_id = {?} AND p.id = {?} AND FIND_IN_SET('public', p.flags)",
+                                 $globals->asso('id'), $pid);
+            if ($res->numRows() == 0 && $public->numRows() == 0) {
                 return PL_FORBIDDEN;
             }
         }
@@ -925,7 +942,7 @@ class PaymentLogsImporter extends CSVImporter {
             // convert date
             $a['date'] = preg_replace('/([0-9]{2})\/([0-9]{2})\/([0-9]{4}).*/', '\3-\2-\1', $a['date']);
             $a['date'] = preg_replace('/T.*/','', $a['date']);
-            
+
             // convert money
             $a['amount'] = str_replace(',', '.', $a['amount']);
             $a['commission'] = str_replace(',', '.', $a['commission']);
index 83b21db..ecd49f5 100644 (file)
 
 class Payment
 {
-    // {{{ properties
-
-    var $id;
-    var $text;
-    var $url;
-    var $flags;
-    var $mail;
-    var $amount_min;
-    var $amount_max;
-    var $amount_def;
-    var $asso_id;
-
-    var $api = null;
-
-    // }}}
-    // {{{ constructor
-
-    function Payment($ref=-1)
+    public $id;
+    public $text;
+    public $url;
+    public $flags;
+    public $mvarail;
+    public $amount_min;
+    public $amount_max;
+    public $amount_def;
+    public $asso_id;
+
+    public $api = null;
+
+    function Payment($ref = -1)
     {
         global $globals;
-        $r   = $ref==-1 ? $globals->money->mpay_def_id : $ref;
-        $res = XDB::query("SELECT  id, text, url, flags, mail, amount_min, amount_max, amount_def, asso_id
-                             FROM  payments WHERE id={?}", $r);
+
+        $r   = ($ref == -1) ? $globals->money->mpay_def_id : $ref;
+        $res = XDB::query('SELECT  id, text, url, flags, mail, amount_min, amount_max, amount_def, asso_id
+                             FROM  payments
+                            WHERE  id = {?}', $r);
         list($this->id, $this->text, $this->url, $flags, $this->mail,
              $this->amount_min, $this->amount_max, $this->amount_def, $this->asso_id) = $res->fetchOneRow();
 
         $this->amount_min = (float)$this->amount_min;
         $this->amount_max = (float)$this->amount_max;
-        $this->flags       = new PlFlagSet($flags);
+        $this->flags      = new PlFlagSet($flags);
     }
 
-    // }}}
-    // {{{ function check()
-
     function check($value)
     {
         $v = (float)strtr($value, ',', '.');
@@ -67,21 +61,15 @@ class Payment
         }
     }
 
-    // }}}
-    // {{{ function init()
-
     function init($val, $meth)
     {
-        require_once dirname(__FILE__).'/money/'.$meth->inc;
+        require_once dirname(__FILE__) . '/money/' . $meth->inc;
         $this->api = new $api($val);
     }
 
-    // }}}
-    // {{{ function prepareform()
-
-    function prepareform()
+    function prepareform(User $user)
     {
-        return $this->api->prepareform($this);
+        return $this->api->prepareform($this, $user);
     }
 
     function event()
@@ -98,34 +86,25 @@ class Payment
         }
         return null;
     }
-    // }}}
 }
 
-// {{{ class PayMethod
-
 class PayMethod
 {
-    // {{{ properties
-
-    var $id;
-    var $text;
-    var $inc;
-
-    // }}}
-    // {{{ constructor
+    public $id;
+    public $text;
+    public $inc;
 
-    function PayMethod($id=-1)
+    function PayMethod($id = -1)
     {
         global $globals;
-        $i   = $id==-1 ? $globals->money->mpay_def_meth : $id;
-        $res = XDB::query("SELECT id,text,include FROM payment_methods WHERE id={?}", $i);
+
+        $i   = ($id == -1) ? $globals->money->mpay_def_meth : $id;
+        $res = XDB::query('SELECT  id, text, include
+                             FROM  payment_methods
+                            WHERE  id = {?}', $i);
         list($this->id, $this->text, $this->inc) = $res->fetchOneRow();
     }
-
-    // }}}
 }
 
-// }}}
-
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index f0b40e4..e82fb8f 100644 (file)
@@ -60,7 +60,7 @@ class BPLCCyberPlus
         return trim(preg_replace('/\s\s+/', ' ', preg_replace('/[^a-zA-Z0-9]/', ' ', $string)));
     }
 
-    function prepareform($pay)
+    function prepareform($pay, $user)
     {
         global $globals, $platal;
         $log = S::v('log');
@@ -79,9 +79,9 @@ class BPLCCyberPlus
             'vads_return_mode' => 'NONE',
             'vads_url_return' => $pay->url ? $pay->url : $globals->baseurl . '/' . $platal->ns);
         $this->infos['client'] = Array(
-            'vads_cust_email' => S::user()->bestEmail(),
+            'vads_cust_email' => $user->bestEmail(),
             'vads_cust_id' => S::v('uid'),
-            'vads_cust_name' => substr(self::replaceNonAlpha(replace_accent(S::user()->shortName())), 0, 127));
+            'vads_cust_name' => substr(self::replaceNonAlpha(replace_accent($user->shortName())), 0, 127));
         $this->infos['commande'] = Array(
             'vads_amount' => $this->val,
             'vads_currency' => '978', # Euro
index 521733a..aba2f9a 100644 (file)
@@ -33,7 +33,7 @@ class PayPal
         $this->val_number = $val;
     }
 
-    function prepareform($pay)
+    function prepareform($pay, $user)
     {
         // Documentation:
         // https://www.paypal.com/developer
@@ -43,7 +43,6 @@ class PayPal
         global $globals, $platal;
 
         $this->urlform = 'https://' . $globals->money->paypal_site . '/cgi-bin/webscr';
-        $user = S::user();
 
         $roboturl = str_replace("https://","http://",$globals->baseurl)
                   . '/' . $platal->ns . "payment/paypal_return/" . S::v('uid')
index c9fd3d9..1dee07e 100644 (file)
@@ -38,26 +38,26 @@ class PlatalModule extends PLModule
     function handlers()
     {
         return array(
-            'index'             => $this->make_hook('index',     AUTH_PUBLIC),
-            'cacert.pem'        => $this->make_hook('cacert',    AUTH_PUBLIC),
-            'changelog'         => $this->make_hook('changelog', AUTH_PUBLIC),
+            'index'             => $this->make_hook('index',        AUTH_PUBLIC),
+            'cacert.pem'        => $this->make_hook('cacert',       AUTH_PUBLIC),
+            'changelog'         => $this->make_hook('changelog',    AUTH_PUBLIC),
 
             // Preferences thingies
-            'prefs'             => $this->make_hook('prefs',     AUTH_COOKIE, 'user,groups'),
-            'prefs/rss'         => $this->make_hook('prefs_rss', AUTH_COOKIE, 'user'),
-            'prefs/webredirect' => $this->make_hook('webredir',  AUTH_MDP,    'mail'),
-            'prefs/skin'        => $this->make_hook('skin',      AUTH_COOKIE, 'user'),
+            'prefs'             => $this->make_hook('prefs',        AUTH_COOKIE, 'user,groups'),
+            'prefs/rss'         => $this->make_hook('prefs_rss',    AUTH_COOKIE, 'user'),
+            'prefs/webredirect' => $this->make_hook('webredir',     AUTH_PASSWD, 'mail'),
+            'prefs/skin'        => $this->make_hook('skin',         AUTH_COOKIE, 'user'),
 
             // password related thingies
-            'password'          => $this->make_hook('password',  AUTH_MDP,    'user,groups'),
-            'tmpPWD'            => $this->make_hook('tmpPWD',    AUTH_PUBLIC),
-            'password/smtp'     => $this->make_hook('smtppass',  AUTH_MDP,    'mail'),
-            'recovery'          => $this->make_hook('recovery',  AUTH_PUBLIC),
+            'password'          => $this->make_hook('password',     AUTH_PASSWD, 'user,groups'),
+            'password/smtp'     => $this->make_hook('smtppass',     AUTH_PASSWD, 'mail'),
+            'tmpPWD'            => $this->make_hook('tmpPWD',       AUTH_PUBLIC),
+            'recovery'          => $this->make_hook('recovery',     AUTH_PUBLIC),
             'recovery/ext'      => $this->make_hook('recovery_ext', AUTH_PUBLIC),
             'register/ext'      => $this->make_hook('register_ext', AUTH_PUBLIC),
-            'exit'              => $this->make_hook('exit',      AUTH_PUBLIC),
-            'review'            => $this->make_hook('review',    AUTH_PUBLIC),
-            'deconnexion.php'   => $this->make_hook('exit',      AUTH_PUBLIC),
+            'exit'              => $this->make_hook('exit',         AUTH_PUBLIC),
+            'review'            => $this->make_hook('review',       AUTH_PUBLIC),
+            'deconnexion.php'   => $this->make_hook('exit',         AUTH_PUBLIC),
         );
     }
 
@@ -375,7 +375,7 @@ Adresse de secours : ' . $to));
                      $user->id(), $hash);
 
         $mymail = new PlMailer('platal/password_recovery_xnet.mail.tpl');
-        $mymail->addTo($user);
+        $mymail->setTo($user);
         $mymail->assign('hash', $hash);
         $mymail->assign('email', Post::t('login'));
         $mymail->send();
@@ -389,23 +389,18 @@ Adresse de secours : ' . $to));
         XDB::execute('DELETE FROM  account_lost_passwords
                             WHERE  DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created');
 
-        $res = XDB::query('SELECT  uid
-                             FROM  account_lost_passwords WHERE certificat={?}', $certif);
-        $ligne = $res->fetchOneAssoc();
-        if (!$ligne) {
-            $page->changeTpl('platal/index.tpl');
-            $page->kill("Cette adresse n'existe pas ou n'existe plus sur le serveur.");
-        }
-
-        $uid = $ligne["uid"];
         if (Post::has('pwhash') && Post::t('pwhash')) {
+            $uid = XDB::fetchOneCell('SELECT  uid
+                                        FROM  accounts
+                                       WHERE  hruid = {?}',
+                                     Post::t('username'));
             $password = Post::t('pwhash');
             XDB::query('UPDATE  accounts
-                           SET  password={?}
+                           SET  password = {?}
                          WHERE  uid = {?} AND state = \'active\'',
                        $password, $uid);
             XDB::query('DELETE FROM  account_lost_passwords
-                              WHERE  certificat={?}', $certif);
+                              WHERE  certificat = {?}', $certif);
 
             // If GoogleApps is enabled, and the user did choose to use synchronized passwords,
             // updates the Google Apps password as well.
@@ -421,14 +416,23 @@ Adresse de secours : ' . $to));
 
             // Try to start a session (so the user don't have to log in); we will use
             // the password available in Post:: to authenticate the user.
-            Platal::session()->start(AUTH_MDP);
+            Platal::session()->start(AUTH_PASSWD);
 
             $page->changeTpl('platal/tmpPWD.success.tpl');
         } else {
+            $res = XDB::query('SELECT  uid
+                                 FROM  account_lost_passwords
+                                WHERE  certificat = {?}', $certif);
+            $ligne = $res->fetchOneAssoc();
+            if (!$ligne) {
+                $page->changeTpl('platal/index.tpl');
+                $page->kill("Cette adresse n'existe pas ou n'existe plus sur le serveur.");
+            }
+
             $hruid = XDB::fetchOneCell('SELECT  hruid
                                           FROM  accounts
                                          WHERE  uid = {?}',
-                                       $uid);
+                                       $ligne['uid']);
             $page->changeTpl('platal/password.tpl');
             $page->assign('hruid', $hruid);
             $page->assign('do_auth', 1);
index c780786..5988743 100644 (file)
@@ -25,15 +25,15 @@ class ProfileModule extends PLModule
     {
         return array(
             'photo'                      => $this->make_hook('photo',                      AUTH_PUBLIC),
-            'photo/change'               => $this->make_hook('photo_change',               AUTH_MDP,    'user'),
+            'photo/change'               => $this->make_hook('photo_change',               AUTH_PASSWD, 'user'),
 
             'fiche.php'                  => $this->make_hook('fiche',                      AUTH_PUBLIC),
             'profile'                    => $this->make_hook('profile',                    AUTH_PUBLIC),
             'profile/private'            => $this->make_hook('profile',                    AUTH_COOKIE, 'user'),
             'profile/ax'                 => $this->make_hook('ax',                         AUTH_COOKIE, 'admin,edit_directory'),
-            'profile/edit'               => $this->make_hook('p_edit',                     AUTH_MDP,    'user'),
+            'profile/edit'               => $this->make_hook('p_edit',                     AUTH_PASSWD, 'user'),
             'profile/ajax/address'       => $this->make_hook('ajax_address',               AUTH_COOKIE, 'user', NO_AUTH),
-            'profile/ajax/address/del'   => $this->make_hook('ajax_address_del',           AUTH_MDP,    'user'),
+            'profile/ajax/address/del'   => $this->make_hook('ajax_address_del',           AUTH_PASSWD, 'user'),
             'profile/ajax/tel'           => $this->make_hook('ajax_tel',                   AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/edu'           => $this->make_hook('ajax_edu',                   AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/medal'         => $this->make_hook('ajax_medal',                 AUTH_COOKIE, 'user', NO_AUTH),
@@ -57,17 +57,17 @@ class ProfileModule extends PLModule
             'groupes-x/logo'             => $this->make_hook('xnetlogo',                   AUTH_PUBLIC),
 
             'vcard'                      => $this->make_hook('vcard',                      AUTH_COOKIE, 'user', NO_HTTPS),
-            'admin/binets'               => $this->make_hook('admin_binets',               AUTH_MDP,    'admin'),
-            'admin/medals'               => $this->make_hook('admin_medals',               AUTH_MDP,    'admin'),
-            'admin/education'            => $this->make_hook('admin_education',            AUTH_MDP,    'admin'),
-            'admin/education_field'      => $this->make_hook('admin_education_field',      AUTH_MDP,    'admin'),
-            'admin/education_degree'     => $this->make_hook('admin_education_degree',     AUTH_MDP,    'admin'),
-            'admin/education_degree_set' => $this->make_hook('admin_education_degree_set', AUTH_MDP,    'admin'),
-            'admin/sections'             => $this->make_hook('admin_sections',             AUTH_MDP,    'admin'),
-            'admin/networking'           => $this->make_hook('admin_networking',           AUTH_MDP,    'admin'),
-            'admin/trombino'             => $this->make_hook('admin_trombino',             AUTH_MDP,    'admin'),
-            'admin/corps_enum'           => $this->make_hook('admin_corps_enum',           AUTH_MDP,    'admin'),
-            'admin/corps_rank'           => $this->make_hook('admin_corps_rank',           AUTH_MDP,    'admin'),
+            'admin/binets'               => $this->make_hook('admin_binets',               AUTH_PASSWD, 'admin'),
+            'admin/medals'               => $this->make_hook('admin_medals',               AUTH_PASSWD, 'admin'),
+            'admin/education'            => $this->make_hook('admin_education',            AUTH_PASSWD, 'admin'),
+            'admin/education_field'      => $this->make_hook('admin_education_field',      AUTH_PASSWD, 'admin'),
+            'admin/education_degree'     => $this->make_hook('admin_education_degree',     AUTH_PASSWD, 'admin'),
+            'admin/education_degree_set' => $this->make_hook('admin_education_degree_set', AUTH_PASSWD, 'admin'),
+            'admin/sections'             => $this->make_hook('admin_sections',             AUTH_PASSWD, 'admin'),
+            'admin/networking'           => $this->make_hook('admin_networking',           AUTH_PASSWD, 'admin'),
+            'admin/trombino'             => $this->make_hook('admin_trombino',             AUTH_PASSWD, 'admin'),
+            'admin/corps_enum'           => $this->make_hook('admin_corps_enum',           AUTH_PASSWD, 'admin'),
+            'admin/corps_rank'           => $this->make_hook('admin_corps_rank',           AUTH_PASSWD, 'admin'),
         );
     }
 
@@ -301,7 +301,7 @@ class ProfileModule extends PLModule
     {
         global $globals;
 
-        if (in_array($hrpid, array('general', 'adresses', 'emploi', 'poly', 'deco', 'skill', 'mentor', 'deltaten'))) {
+        if (in_array($hrpid, array('general', 'adresses', 'emploi', 'poly', 'deco', 'mentor', 'deltaten'))) {
             $aux = $opened_tab;
             $opened_tab = $hrpid;
             $hrpid = $aux;
@@ -333,7 +333,6 @@ class ProfileModule extends PLModule
         }
         $wiz->addPage('ProfilePageDecos', 'Décorations - Medailles', 'deco');
         if (S::user()->checkPerms(User::PERM_DIRECTORY_PRIVATE)) {
-            $wiz->addPage('ProfilePageSkills', 'Compétences diverses', 'skill');
             $wiz->addPage('ProfilePageMentor', 'Mentoring', 'mentor');
         }
         if (S::user()->checkPerms(User::PERM_DIRECTORY_PRIVATE) && $profile->isDeltatenEnabled(Profile::DELTATEN_OLD)) {
index 7a14e2d..279a105 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+class ProfileSettingSkill implements ProfileSetting
+{
+    private $table;
+    private $id;
+    private $skill_field;
+    private $text_field;
+
+    public function __construct($table, $id, $skill, $text)
+    {
+        $this->table = $table;
+        $this->id = $id;
+        $this->skill_field = $skill;
+        $this->text_field = $text;
+    }
+
+    public function value(ProfilePage $page, $field, $value, &$success)
+    {
+        if (is_null($value)) {
+            $value = array();
+            $res = XDB::iterRow("SELECT  s.{$this->id}, s.{$this->text_field}, i.level
+                                   FROM  profile_{$this->table}_enum AS s
+                             INNER JOIN  profile_{$this->table}s     AS i ON (s.{$this->id} = i.{$this->skill_field})
+                                  WHERE  i.pid = {?}",
+                                $page->pid());
+            while (list($sid, $text, $level) = $res->next()) {
+                $value[$sid] = array('text' => $text, 'level' => $level);
+            }
+        }
+        if (!is_array($value)) {
+            $value = array();
+        } else {
+            foreach ($value as $id=>&$skill) {
+                if (!isset($skill['text']) || empty($skill['text'])) {
+                    $res = XDB::query("SELECT  {$this->text_field}
+                                         FROM  profile_{$this->table}_enum
+                                        WHERE  {$this->id} = {?}", $id);
+                    $skill['text'] = $res->fetchOneCell();
+                }
+            }
+        }
+        ksort($value);
+        $success = true;
+        return $value;
+    }
+
+    public function save(ProfilePage $page, $field, $value)
+    {
+        XDB::execute("DELETE FROM  profile_{$this->table}s
+                            WHERE  pid = {?}",
+                     $page->pid());
+        if (!count($value)) {
+            return;
+        }
+        foreach ($value as $id=>&$skill) {
+            XDB::execute("INSERT INTO  profile_{$this->table}s (pid, {$this->skill_field}, level)
+                               VALUES  ({?}, {?}, {?})",
+                         $page->pid(), $id, $skill['level']);
+        }
+    }
+
+    public function getText($value) {
+        $skills = array();
+
+        if ($this->table == 'langskill') {
+            static $levels = array(
+                1 => 'connaissance basique',
+                2 => 'maîtrise des bases',
+                3 => 'maîtrise limitée',
+                4 => 'maîtrise générale',
+                5 => 'bonne maîtrise',
+                6 => 'maîtrise complète'
+            );
+            foreach ($value as $skill) {
+                $skills[] = $skill['text'] . ' (' . $levels[$skill['level']] . ')';
+            }
+        } else {
+            foreach ($value as $skill) {
+                $skills[] = $skill['text'] . ' (' . $skill['level'] . ')';
+            }
+        }
+
+        return implode(', ' , $skills);
+    }
+}
+
 /** Terms associated to profile mentoring */
 class ProfileSettingTerms implements ProfileSetting
 {
@@ -143,6 +228,8 @@ class ProfilePageMentor extends ProfilePage
         $this->settings['expertise'] = null;
         $this->settings['terms'] = new ProfileSettingTerms();
         $this->settings['countries'] = new ProfileSettingCountry();
+        $this->settings['competences'] = new ProfileSettingSkill('skill', 'id', 'cid', 'text_fr');
+        $this->settings['langues'] = new ProfileSettingSkill('langskill', 'iso_639_2b', 'lid', 'language');
     }
 
     protected function _fetchData()
@@ -179,6 +266,20 @@ class ProfilePageMentor extends ProfilePage
                                                       FROM  geoloc_countries
                                                   ORDER BY  country"));
         $page->assign('hrpid', $this->profile->hrpid);
+        $page->assign('comp_list', XDB::iterator("SELECT  id, text_fr, FIND_IN_SET('titre',flags) AS title
+                                                    FROM  profile_skill_enum"));
+        $page->assign('comp_level', array('initié' => 'initié',
+                                          'bonne connaissance' => 'bonne connaissance',
+                                          'expert' => 'expert'));
+        $page->assign('lang_list', XDB::iterator('SELECT  iso_639_2b, language
+                                                    FROM  profile_langskill_enum
+                                                ORDER BY  language'));
+        $page->assign('lang_level', array(1 => 'connaissance basique',
+                                          2 => 'maîtrise des bases',
+                                          3 => 'maîtrise limitée',
+                                          4 => 'maîtrise générale',
+                                          5 => 'bonne maîtrise',
+                                          6 => 'maîtrise complète'));
     }
 }
 
index c6eae36..02f3316 100644 (file)
@@ -435,7 +435,6 @@ require_once dirname(__FILE__) . '/addresses.inc.php';
 require_once dirname(__FILE__) . '/groups.inc.php';
 require_once dirname(__FILE__) . '/decos.inc.php';
 require_once dirname(__FILE__) . '/jobs.inc.php';
-require_once dirname(__FILE__) . '/skills.inc.php';
 require_once dirname(__FILE__) . '/mentor.inc.php';
 require_once dirname(__FILE__) . '/deltaten.inc.php';
 
diff --git a/modules/profile/skills.inc.php b/modules/profile/skills.inc.php
deleted file mode 100644 (file)
index 3145811..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2011 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                *
- ***************************************************************************/
-
-class ProfileSettingSkill implements ProfileSetting
-{
-    private $table;
-    private $id;
-    private $skill_field;
-    private $text_field;
-
-    public function __construct($table, $id, $skill, $text)
-    {
-        $this->table = $table;
-        $this->id = $id;
-        $this->skill_field = $skill;
-        $this->text_field = $text;
-    }
-
-    public function value(ProfilePage $page, $field, $value, &$success)
-    {
-        if (is_null($value)) {
-            $value = array();
-            $res = XDB::iterRow("SELECT  s.{$this->id}, s.{$this->text_field}, i.level
-                                   FROM  profile_{$this->table}_enum AS s
-                             INNER JOIN  profile_{$this->table}s     AS i ON (s.{$this->id} = i.{$this->skill_field})
-                                  WHERE  i.pid = {?}",
-                                $page->pid());
-            while (list($sid, $text, $level) = $res->next()) {
-                $value[$sid] = array('text' => $text, 'level' => $level);
-            }
-        }
-        if (!is_array($value)) {
-            $value = array();
-        } else {
-            foreach ($value as $id=>&$skill) {
-                if (!isset($skill['text']) || empty($skill['text'])) {
-                    $res = XDB::query("SELECT  {$this->text_field}
-                                         FROM  profile_{$this->table}_enum
-                                        WHERE  {$this->id} = {?}", $id);
-                    $skill['text'] = $res->fetchOneCell();
-                }
-            }
-        }
-        ksort($value);
-        $success = true;
-        return $value;
-    }
-
-    public function save(ProfilePage $page, $field, $value)
-    {
-        XDB::execute("DELETE FROM  profile_{$this->table}s
-                            WHERE  pid = {?}",
-                     $page->pid());
-        if (!count($value)) {
-            return;
-        }
-        foreach ($value as $id=>&$skill) {
-            XDB::execute("INSERT INTO  profile_{$this->table}s (pid, {$this->skill_field}, level)
-                               VALUES  ({?}, {?}, {?})",
-                         $page->pid(), $id, $skill['level']);
-        }
-    }
-
-    public function getText($value) {
-        $skills = array();
-
-        if ($this->table == 'langskill') {
-            static $levels = array(
-                1 => 'connaissance basique',
-                2 => 'maîtrise des bases',
-                3 => 'maîtrise limitée',
-                4 => 'maîtrise générale',
-                5 => 'bonne maîtrise',
-                6 => 'maîtrise complète'
-            );
-            foreach ($value as $skill) {
-                $skills[] = $skill['text'] . ' (' . $levels[$skill['level']] . ')';
-            }
-        } else {
-            foreach ($value as $skill) {
-                $skills[] = $skill['text'] . ' (' . $skill['level'] . ')';
-            }
-        }
-
-        return implode(', ' , $skills);
-    }
-}
-
-class ProfilePageSkills extends ProfilePage
-{
-    protected $pg_template = 'profile/skill.tpl';
-
-    public function __construct(PlWizard $wiz)
-    {
-        parent::__construct($wiz);
-        $this->settings['competences'] = new ProfileSettingSkill('skill', 'id', 'cid', 'text_fr');
-        $this->settings['langues'] = new ProfileSettingSkill('langskill', 'iso_639_2b', 'lid', 'language');
-    }
-
-    public function _prepare(PlPage $page, $id)
-    {
-        $page->assign('comp_list', XDB::iterator("SELECT  id, text_fr, FIND_IN_SET('titre',flags) AS title
-                                                    FROM  profile_skill_enum"));
-        $page->assign('comp_level', array('initié' => 'initié',
-                                          'bonne connaissance' => 'bonne connaissance',
-                                          'expert' => 'expert'));
-        $page->assign('lang_list', XDB::iterator('SELECT  iso_639_2b, language
-                                                    FROM  profile_langskill_enum
-                                                ORDER BY  language'));
-        $page->assign('lang_level', array(1 => 'connaissance basique',
-                                          2 => 'maîtrise des bases',
-                                          3 => 'maîtrise limitée',
-                                          4 => 'maîtrise générale',
-                                          5 => 'bonne maîtrise',
-                                          6 => 'maîtrise complète'));
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
index 83169e8..d2825dd 100644 (file)
@@ -381,7 +381,7 @@ class RegisterModule extends PLModule
 
         // Try to start a session (so the user don't have to log in); we will use
         // the password available in Post:: to authenticate the user.
-        Platal::session()->start(AUTH_MDP);
+        Platal::session()->start(AUTH_PASSWD);
 
         // Subscribe the user to the services she did request at registration time.
         require_once 'newsletter.inc.php';
index eaef664..26af2d4 100644 (file)
@@ -30,10 +30,10 @@ class SurveyModule extends PLModule
             'survey/result'      => $this->make_hook('result',        AUTH_PUBLIC),
             'survey/edit'        => $this->make_hook('edit',          AUTH_COOKIE, 'user'),
             'survey/ajax'        => $this->make_hook('ajax',          AUTH_COOKIE, 'user'),
-            'survey/admin'       => $this->make_hook('admin',         AUTH_MDP,    'admin'),
-            'survey/admin/edit'  => $this->make_hook('adminEdit',     AUTH_MDP,    'admin'),
-            'survey/admin/valid' => $this->make_hook('adminValidate', AUTH_MDP,    'admin'),
-            'survey/admin/del'   => $this->make_hook('adminDelete',   AUTH_MDP,    'admin'),
+            'survey/admin'       => $this->make_hook('admin',         AUTH_PASSWD, 'admin'),
+            'survey/admin/edit'  => $this->make_hook('adminEdit',     AUTH_PASSWD, 'admin'),
+            'survey/admin/valid' => $this->make_hook('adminValidate', AUTH_PASSWD, 'admin'),
+            'survey/admin/del'   => $this->make_hook('adminDelete',   AUTH_PASSWD, 'admin'),
         );
     }
     // }}}
index 33b5153..b9da82e 100644 (file)
@@ -25,7 +25,7 @@ class UrlShortenerModule extends PLModule
     {
         return array(
             'url'       => $this->make_hook('url',       AUTH_PUBLIC),
-            'admin/url' => $this->make_hook('admin_url', AUTH_MDP, 'admin')
+            'admin/url' => $this->make_hook('admin_url', AUTH_PASSWD, 'admin')
         );
     }
 
index 44094d8..ae6edc4 100644 (file)
@@ -27,15 +27,15 @@ class XnetModule extends PLModule
             'index'        => $this->make_hook('index',        AUTH_PUBLIC),
             'exit'         => $this->make_hook('exit',         AUTH_PUBLIC),
 
-            'admin'        => $this->make_hook('admin',        AUTH_MDP, 'admin'),
+            'admin'        => $this->make_hook('admin',        AUTH_PASSWD, 'admin'),
             'groups'       => $this->make_hook('groups',       AUTH_PUBLIC),
             'groupes.php'  => $this->make_hook('groups2',      AUTH_PUBLIC),
             'plan'         => $this->make_hook('plan',         AUTH_PUBLIC),
             // Should be removed in a future release as links will have expired anyway.
             'register/ext' => $this->make_hook('register_ext', AUTH_PUBLIC),
-            'photo'        => $this->make_hook('photo',        AUTH_MDP, 'groups'),
-            'autologin'    => $this->make_hook('autologin',    AUTH_MDP, 'groups'),
-            'edit'         => $this->make_hook('edit',         AUTH_MDP, 'groups'),
+            'photo'        => $this->make_hook('photo',        AUTH_PASSWD, 'groups'),
+            'autologin'    => $this->make_hook('autologin',    AUTH_PASSWD, 'groups'),
+            'edit'         => $this->make_hook('edit',         AUTH_PASSWD, 'groups'),
             'Xnet'         => $this->make_wiki_hook(),
         );
     }
index f345f13..60a8460 100644 (file)
@@ -26,12 +26,12 @@ class XnetEventsModule extends PLModule
     function handlers()
     {
         return array(
-            '%grp/events'       => $this->make_hook('events', AUTH_MDP, 'groups'),
-            '%grp/events/sub'   => $this->make_hook('sub',    AUTH_MDP, 'groups'),
-            '%grp/events/csv'   => $this->make_hook('csv',    AUTH_MDP, 'groups', NO_HTTPS),
-            '%grp/events/ical'  => $this->make_hook('ical',   AUTH_MDP, 'groups', NO_HTTPS),
-            '%grp/events/edit'  => $this->make_hook('edit',   AUTH_MDP, 'groupadmin'),
-            '%grp/events/admin' => $this->make_hook('admin',  AUTH_MDP, 'groupmember'),
+            '%grp/events'       => $this->make_hook('events', AUTH_PASSWD, 'groups'),
+            '%grp/events/sub'   => $this->make_hook('sub',    AUTH_PASSWD, 'groups'),
+            '%grp/events/csv'   => $this->make_hook('csv',    AUTH_PASSWD, 'groups', NO_HTTPS),
+            '%grp/events/ical'  => $this->make_hook('ical',   AUTH_PASSWD, 'groups', NO_HTTPS),
+            '%grp/events/edit'  => $this->make_hook('edit',   AUTH_PASSWD, 'groupadmin'),
+            '%grp/events/admin' => $this->make_hook('admin',  AUTH_PASSWD, 'groupmember'),
         );
     }
 
@@ -463,7 +463,7 @@ class XnetEventsModule extends PLModule
                                 Post::v('intitule')." - ".$globals->asso('nom'),
                                 Post::v('site'), $money_defaut,
                                 Post::v('confirmation'), 0, 999,
-                                $globals->asso('id'), $eid, Post::b('donation'));
+                                $globals->asso('id'), $eid, Post::v('payment_public') == 'yes');
                 if ($p->accept()) {
                     $p->submit();
                 } else {
@@ -485,9 +485,10 @@ class XnetEventsModule extends PLModule
         }
 
         // get a list of all the payment for this asso
-        $res = XDB::iterator("SELECT id, text
-                                FROM payments
-                               WHERE asso_id = {?}", $globals->asso('id'));
+        $res = XDB::iterator("SELECT  id, text
+                                FROM  payments
+                               WHERE  asso_id = {?} AND NOT FIND_IN_SET('old', flags)",
+                             $globals->asso('id'));
         $paiements = array();
         while ($a = $res->next()) $paiements[$a['id']] = $a['text']; {
             $page->assign('paiements', $paiements);
index 71ac30c..acdfa56 100644 (file)
@@ -272,20 +272,23 @@ function event_change_shortname($page, $eid, $old, $new)
         // if we have a first new short_name create the lists
         $lastid = array();
         $where = array(
-            $globals->xnet->participant_list => 'nb > 0',
-            $globals->xnet->payed_list       => 'paid > 0',
-            $globals->xnet->unpayed_list     => 'nb > 0 AND paid = 0'
+            $globals->xnet->participant_list => 'g.nb > 0',
+            $globals->xnet->payed_list       => '(g.paid > 0 OR p.amount > 0)',
+            $globals->xnet->unpayed_list     => 'g.nb > 0 AND g.paid = 0 AND p.amount IS NULL'
         );
 
         foreach (array($globals->xnet->participant_list, $globals->xnet->payed_list, $globals->xnet->unpayed_list) as $suffix) {
-            $uids = XDB::fetchColumn('SELECT  uid
-                                        FROM  group_event_participants
-                                       WHERE  eid = {?} AND ' . $where[$suffix],
+            $uids = XDB::fetchColumn('SELECT  g.uid
+                                        FROM  group_event_participants AS g
+                                  INNER JOIN  group_events             AS e ON (g.eid = e.eid)
+                                   LEFT JOIN  payment_transactions     AS p ON (e.paiement_id = p.ref AND g.uid = p.uid)
+                                       WHERE  g.eid = {?} AND ' . $where[$suffix],
                                      $eid);
             foreach ($uids as $uid) {
                 add_to_list_alias($uid, $new . $suffix, $globals->xnet->evts_domain, 'event');
             }
         }
+
         $uids = XDB::fetchColumn('SELECT  m.uid
                                     FROM  group_members            AS m
                                LEFT JOIN  group_event_participants AS e ON (e.uid = m.uid AND e.eid = {?})
index 864cb0a..6ee283c 100644 (file)
@@ -29,34 +29,34 @@ class XnetGrpModule extends PLModule
             '%grp/asso.php'        => $this->make_hook('index',                 AUTH_PUBLIC),
             '%grp/logo'            => $this->make_hook('logo',                  AUTH_PUBLIC),
             '%grp/site'            => $this->make_hook('site',                  AUTH_PUBLIC),
-            '%grp/edit'            => $this->make_hook('edit',                  AUTH_MDP, 'groupadmin'),
-            '%grp/mail'            => $this->make_hook('mail',                  AUTH_MDP, 'groupadmin'),
-            '%grp/forum'           => $this->make_hook('forum',                 AUTH_MDP, 'groupmember'),
-            '%grp/former_users'    => $this->make_hook('former_users',          AUTH_MDP, 'admin'),
-            '%grp/annuaire'        => $this->make_hook('annuaire',              AUTH_MDP, 'groupannu'),
-            '%grp/annuaire/vcard'  => $this->make_hook('vcard',                 AUTH_MDP, 'groupmember:groupannu'),
-            '%grp/annuaire/csv'    => $this->make_hook('csv',                   AUTH_MDP, 'groupmember:groupannu'),
-            '%grp/directory/sync'  => $this->make_hook('directory_sync',        AUTH_MDP, 'groupadmin'),
-            '%grp/directory/unact' => $this->make_hook('non_active',            AUTH_MDP, 'groupadmin'),
-            '%grp/trombi'          => $this->make_hook('trombi',                AUTH_MDP, 'groupannu'),
-            '%grp/geoloc'          => $this->make_hook('geoloc',                AUTH_MDP, 'groupannu'),
-            '%grp/subscribe'       => $this->make_hook('subscribe',             AUTH_MDP, 'groups'),
-            '%grp/subscribe/valid' => $this->make_hook('subscribe_valid',       AUTH_MDP, 'groupadmin'),
-            '%grp/unsubscribe'     => $this->make_hook('unsubscribe',           AUTH_MDP, 'groupmember'),
-
-            '%grp/change_rights'   => $this->make_hook('change_rights',         AUTH_MDP, 'groups'),
-            '%grp/admin/annuaire'  => $this->make_hook('admin_annuaire',        AUTH_MDP, 'groupadmin'),
-            '%grp/member'          => $this->make_hook('admin_member',          AUTH_MDP, 'groupadmin'),
-            '%grp/member/new'      => $this->make_hook('admin_member_new',      AUTH_MDP, 'groupadmin'),
-            '%grp/member/new/ajax' => $this->make_hook('admin_member_new_ajax', AUTH_MDP, 'groups', NO_AUTH),
-            '%grp/member/del'      => $this->make_hook('admin_member_del',      AUTH_MDP, 'groupadmin'),
-            '%grp/member/suggest'  => $this->make_hook('admin_member_suggest',  AUTH_MDP, 'groupadmin'),
+            '%grp/edit'            => $this->make_hook('edit',                  AUTH_PASSWD, 'groupadmin'),
+            '%grp/mail'            => $this->make_hook('mail',                  AUTH_PASSWD, 'groupadmin'),
+            '%grp/forum'           => $this->make_hook('forum',                 AUTH_PASSWD, 'groupmember'),
+            '%grp/former_users'    => $this->make_hook('former_users',          AUTH_PASSWD, 'admin'),
+            '%grp/annuaire'        => $this->make_hook('annuaire',              AUTH_PASSWD, 'groupannu'),
+            '%grp/annuaire/vcard'  => $this->make_hook('vcard',                 AUTH_PASSWD, 'groupmember:groupannu'),
+            '%grp/annuaire/csv'    => $this->make_hook('csv',                   AUTH_PASSWD, 'groupmember:groupannu'),
+            '%grp/directory/sync'  => $this->make_hook('directory_sync',        AUTH_PASSWD, 'groupadmin'),
+            '%grp/directory/unact' => $this->make_hook('non_active',            AUTH_PASSWD, 'groupadmin'),
+            '%grp/trombi'          => $this->make_hook('trombi',                AUTH_PASSWD, 'groupannu'),
+            '%grp/geoloc'          => $this->make_hook('geoloc',                AUTH_PASSWD, 'groupannu'),
+            '%grp/subscribe'       => $this->make_hook('subscribe',             AUTH_PASSWD, 'groups'),
+            '%grp/subscribe/valid' => $this->make_hook('subscribe_valid',       AUTH_PASSWD, 'groupadmin'),
+            '%grp/unsubscribe'     => $this->make_hook('unsubscribe',           AUTH_PASSWD, 'groupmember'),
+
+            '%grp/change_rights'   => $this->make_hook('change_rights',         AUTH_PASSWD, 'groups'),
+            '%grp/admin/annuaire'  => $this->make_hook('admin_annuaire',        AUTH_PASSWD, 'groupadmin'),
+            '%grp/member'          => $this->make_hook('admin_member',          AUTH_PASSWD, 'groupadmin'),
+            '%grp/member/new'      => $this->make_hook('admin_member_new',      AUTH_PASSWD, 'groupadmin'),
+            '%grp/member/new/ajax' => $this->make_hook('admin_member_new_ajax', AUTH_PASSWD, 'groups', NO_AUTH),
+            '%grp/member/del'      => $this->make_hook('admin_member_del',      AUTH_PASSWD, 'groupadmin'),
+            '%grp/member/suggest'  => $this->make_hook('admin_member_suggest',  AUTH_PASSWD, 'groupadmin'),
 
             '%grp/rss'             => $this->make_token_hook('rss',             AUTH_PUBLIC),
-            '%grp/announce/new'    => $this->make_hook('edit_announce',         AUTH_MDP, 'groupadmin'),
-            '%grp/announce/edit'   => $this->make_hook('edit_announce',         AUTH_MDP, 'groupadmin'),
+            '%grp/announce/new'    => $this->make_hook('edit_announce',         AUTH_PASSWD, 'groupadmin'),
+            '%grp/announce/edit'   => $this->make_hook('edit_announce',         AUTH_PASSWD, 'groupadmin'),
             '%grp/announce/photo'  => $this->make_hook('photo_announce',        AUTH_PUBLIC),
-            '%grp/admin/announces' => $this->make_hook('admin_announce',        AUTH_MDP, 'groupadmin'),
+            '%grp/admin/announces' => $this->make_hook('admin_announce',        AUTH_PASSWD, 'groupadmin'),
         );
     }
 
@@ -120,6 +120,12 @@ class XnetGrpModule extends PLModule
                                     WHERE  asso_id = {?} AND expiration >= CURRENT_DATE()
                                            AND FIND_IN_SET('public', flags)",
                                   $globals->asso('id'));
+            $payments = XDB::fetchAllAssoc("SELECT  id, text
+                                              FROM  payments
+                                             WHERE  asso_id = {?} AND NOT FIND_IN_SET('old', flags) AND FIND_IN_SET('public', flags)
+                                          ORDER BY  id DESC",
+                                           $globals->asso('id'));
+            $page->assign('payments', $payments);
         }
         if (may_update()) {
             $subs_valid = XDB::query("SELECT  uid
@@ -162,6 +168,15 @@ class XnetGrpModule extends PLModule
     {
         global $globals;
         $page->changeTpl('xnetgrp/edit.tpl');
+        $error = false;
+
+        if (S::admin()) {
+            $domains = XDB::iterator('SELECT  *
+                                        FROM  group_dom
+                                    ORDER BY  nom');
+            $page->assign('domains', $domains);
+            $page->assign('super', true);
+        }
 
         if (Post::has('submit')) {
             S::assert_xsrf_token();
@@ -182,12 +197,38 @@ class XnetGrpModule extends PLModule
 
                 if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) {
                     $page->trigError('Le domaine doit être un FQDN (aucune modification effectuée)&nbsp;!!!');
-                    return;
+                    $error = true;
                 }
                 if (Post::t('nom') == '' || Post::t('diminutif') == '') {
                     $page->trigError('Ni le nom ni le diminutif du groupe ne peuvent être vide.');
+                    $error = true;
+                }
+                if ($error) {
+                    $page->assign('nom', Post::t('nom'));
+                    $page->assign('diminutif', Post::t('diminutif'));
+                    $page->assign('mail_domain', Post::t('mail_domain'));
+                    $page->assign('cat', Post::v('cat'));
+                    $page->assign('dom', Post::v('dom'));
+                    $page->assign('ax', Post::v('ax'));
+                    $page->assign('axDate', Post::t('axDate'));
+                    $page->assign('site', $site);
+                    $page->assign('resp', Post::t('resp'));
+                    $page->assign('mail', Post::t('mail'));
+                    $page->assign('phone', Post::t('phone'));
+                    $page->assign('fax', Post::t('fax'));
+                    $page->assign('address', Post::t('address'));
+                    $page->assign('forum', Post::t('forum'));
+                    $page->assign('inscriptible', Post::v('inscriptible'));
+                    $page->assign('sub_url', Post::t('sub_url'));
+                    $page->assign('unsub_url', Post::t('unsub_url'));
+                    $page->assign('welcome_msg', Post::t('welcome_msg'));
+                    $page->assign('pub', Post::v('pub'));
+                    $page->assign('notif_unsub', Post::i('notif_unsub'));
+                    $page->assign('descr', Post::t('descr'));
+                    $page->assign('error', $error);
                     return;
                 }
+
                 $axDate = make_datetime(Post::v('axDate'));
                 if (Post::t('axDate') != '') {
                     $axDate = make_datetime(Post::v('axDate'))->format('Y-m-d');
@@ -261,14 +302,13 @@ class XnetGrpModule extends PLModule
 
             pl_redirect('../' . Post::v('diminutif', $globals->asso('diminutif')) . '/edit');
         }
-
-        if (S::admin()) {
-            $dom = XDB::iterator('SELECT  *
-                                    FROM  group_dom
-                                ORDER BY  nom');
-            $page->assign('dom', $dom);
-            $page->assign('super', true);
-        }
+        $page->assign('error', $error);
+        $page->assign('cat', $globals->asso('cat'));
+        $page->assign('dom', $globals->asso('dom'));
+        $page->assign('ax', $globals->asso('ax'));
+        $page->assign('inscriptible', $globals->asso('inscriptible'));
+        $page->assign('pub', $globals->asso('pub'));
+        $page->assign('notif_unsub', $globals->asso('notif_unsub'));
     }
 
     function handler_mail($page)
@@ -848,40 +888,45 @@ class XnetGrpModule extends PLModule
                 }
             }
         } else {
-            // User is of type xnet. There are 3 possible cases:
-            //  * the email is not known yet: we create a new account and
-            //      propose to send an email to the user so he can activate
-            //      his account,
-            //  * the email is known but the user was not contacted in order to
-            //      activate yet: we propose to send an email to the user so he
-            //      can activate his account,
-            //  * the email is known and the user was already contacted or has
-            //      an active account: nothing to be done.
-            list($mbox, $domain) = explode('@', strtolower($email));
-            $hruid = User::makeHrid($mbox, $domain, 'ext');
-            // User might already have an account (in another group for example).
-            $user = User::getSilent($hruid);
-
-            // If the user has no account yet, creates new account: build names from email address.
-            if (empty($user)) {
-                $parts = explode('.', $mbox);
-                if (count($parts) == 1) {
-                    $lastname = $display_name = $full_name = $directory_name = ucfirst($mbox);
-                    $firstname = '';
-                } else {
-                    $firstname = ucfirst($parts[0]);
-                    $lastname = ucwords(implode(' ', array_slice($parts, 1)));
-                    $display_name = $firstname;
-                    $full_name = "$firstname $lastname";
-                    $directory_name = strtoupper($lastname) . " " . $firstname;
-                }
-                XDB::execute('INSERT INTO  accounts (hruid, display_name, full_name, directory_name, firstname, lastname, email, type, state)
-                                   VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, \'xnet\', \'disabled\')',
-                             $hruid, $display_name, $full_name, $directory_name, $firstname, $lastname, $email);
+            // Check if the email is a redirection.
+            $user = User::getSilent($email);
+
+            if (is_null($user) || $user->type == 'xnet') {
+                // User is of type xnet. There are 3 possible cases:
+                //  * the email is not known yet: we create a new account and
+                //      propose to send an email to the user so he can activate
+                //      his account,
+                //  * the email is known but the user was not contacted in order to
+                //      activate yet: we propose to send an email to the user so he
+                //      can activate his account,
+                //  * the email is known and the user was already contacted or has
+                //      an active account: nothing to be done.
+                list($mbox, $domain) = explode('@', strtolower($email));
+                $hruid = User::makeHrid($mbox, $domain, 'ext');
+                // User might already have an account (in another group for example).
                 $user = User::getSilent($hruid);
-            }
 
-            $suggest_account_activation = $this->suggest($user);
+                // If the user has no account yet, creates new account: build names from email address.
+                if (empty($user)) {
+                    $parts = explode('.', $mbox);
+                    if (count($parts) == 1) {
+                        $lastname = $display_name = $full_name = $directory_name = ucfirst($mbox);
+                        $firstname = '';
+                    } else {
+                        $firstname = ucfirst($parts[0]);
+                        $lastname = ucwords(implode(' ', array_slice($parts, 1)));
+                        $display_name = $firstname;
+                        $full_name = "$firstname $lastname";
+                        $directory_name = strtoupper($lastname) . " " . $firstname;
+                    }
+                    XDB::execute('INSERT INTO  accounts (hruid, display_name, full_name, directory_name, firstname, lastname, email, type, state)
+                                       VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, \'xnet\', \'disabled\')',
+                                 $hruid, $display_name, $full_name, $directory_name, $firstname, $lastname, $email);
+                    $user = User::getSilent($hruid);
+                }
+
+                $suggest_account_activation = $this->suggest($user);
+            }
         }
 
         if ($user) {
@@ -1197,10 +1242,29 @@ class XnetGrpModule extends PLModule
                 $page->trigSuccess('Données de l\'utilisateur mises à jour.');
             }
 
-            if (($user->type == 'xnet' && !$user->perms) && Post::b('suggest')) {
-                $request = new AccountReq(S::user(), $user->hruid, Post::t('email'), $globals->asso('nom'));
-                $request->submit();
-                $page->trigSuccess('Le compte va bientôt être activé.');
+            if (($user->type == 'xnet' && !$user->perms)) {
+                if (Post::b('suggest')) {
+                    $request = new AccountReq(S::user(), $user->hruid, Post::t('email'), $globals->asso('nom'));
+                    $request->submit();
+                    $page->trigSuccess('Le compte va bientôt être activé.');
+                }
+                if (Post::b('again')) {
+                    $data = XDB::fetchOneAssoc('SELECT  hash, group_name, sender_name, email
+                                                  FROM  register_pending_xnet
+                                                 WHERE  uid = {?}',
+                                               $user->id());
+
+                    $mailer = new PlMailer('xnet/account.mail.tpl');
+                    $mailer->addCc('validation+xnet_account@polytechnique.org');
+                    $mailer->setTo($data['email']);
+                    $mailer->assign('hash', $data['hash']);
+                    $mailer->assign('email', $data['email']);
+                    $mailer->assign('group', $data['group_name']);
+                    $mailer->assign('sender_name', $data['sender_name']);
+                    $mailer->assign('again', true);
+                    $mailer->send();
+                    $page->trigSuccess('Relance effectuée avec succès.');
+                }
             }
 
             // Update group params for user
@@ -1271,7 +1335,7 @@ class XnetGrpModule extends PLModule
                 if (Post::i('newsletter') == 1) {
                     $nl->subscribe($user);
                 } else {
-                    $nl->unsubscribe(null, $user->id);
+                    $nl->unsubscribe(null, $user->id());
                 }
             }
         }
@@ -1291,6 +1355,10 @@ class XnetGrpModule extends PLModule
         $page->assign('alias', $user->emailGroupAliases($globals->asso('mail_domain')));
         $page->assign('positions', explode(',', $positions));
         $page->assign('nl_registered', $nl_registered);
+        $page->assign('pending_xnet_account', XDB::fetchOneCell('SELECT  1
+                                                                   FROM  register_pending_xnet
+                                                                  WHERE  uid = {?}',
+                                                                $user->id()));
     }
 
     function handler_rss(PlPage $page, PlUser $user)
index c0eaa38..6a06b26 100644 (file)
@@ -28,8 +28,8 @@ class XnetListsModule extends ListsModule
     function handlers()
     {
         return array(
-            '%grp/lists'              => $this->make_hook('lists',    AUTH_MDP,    'groupmember'),
-            '%grp/lists/create'       => $this->make_hook('create',   AUTH_MDP,    'groupmember'),
+            '%grp/lists'              => $this->make_hook('lists',    AUTH_PASSWD, 'groupmember'),
+            '%grp/lists/create'       => $this->make_hook('create',   AUTH_PASSWD, 'groupmember'),
 
             '%grp/lists/members'      => $this->make_hook('members',  AUTH_COOKIE, 'groups'),
             '%grp/lists/csv'          => $this->make_hook('csv',      AUTH_COOKIE, 'groups'),
@@ -37,17 +37,17 @@ class XnetListsModule extends ListsModule
             '%grp/lists/archives'     => $this->make_hook('archives', AUTH_COOKIE, 'groups'),
             '%grp/lists/archives/rss' => $this->make_hook('rss',      AUTH_PUBLIC),
 
-            '%grp/lists/moderate'     => $this->make_hook('moderate', AUTH_MDP,    'groups'),
-            '%grp/lists/admin'        => $this->make_hook('admin',    AUTH_MDP,    'groups'),
-            '%grp/lists/options'      => $this->make_hook('options',  AUTH_MDP,    'groups'),
-            '%grp/lists/delete'       => $this->make_hook('delete',   AUTH_MDP,    'groups'),
+            '%grp/lists/moderate'     => $this->make_hook('moderate', AUTH_PASSWD, 'groups'),
+            '%grp/lists/admin'        => $this->make_hook('admin',    AUTH_PASSWD, 'groups'),
+            '%grp/lists/options'      => $this->make_hook('options',  AUTH_PASSWD, 'groups'),
+            '%grp/lists/delete'       => $this->make_hook('delete',   AUTH_PASSWD, 'groups'),
 
-            '%grp/lists/soptions'     => $this->make_hook('soptions', AUTH_MDP,    'groups'),
-            '%grp/lists/check'        => $this->make_hook('check',    AUTH_MDP,    'groups'),
-            '%grp/lists/sync'         => $this->make_hook('sync',     AUTH_MDP,    'groups'),
+            '%grp/lists/soptions'     => $this->make_hook('soptions', AUTH_PASSWD, 'groups'),
+            '%grp/lists/check'        => $this->make_hook('check',    AUTH_PASSWD, 'groups'),
+            '%grp/lists/sync'         => $this->make_hook('sync',     AUTH_PASSWD, 'groups'),
 
-            '%grp/alias/admin'        => $this->make_hook('aadmin',   AUTH_MDP,    'groupadmin'),
-            '%grp/alias/create'       => $this->make_hook('acreate',  AUTH_MDP,    'groupadmin'),
+            '%grp/alias/admin'        => $this->make_hook('aadmin',   AUTH_PASSWD, 'groupadmin'),
+            '%grp/alias/create'       => $this->make_hook('acreate',  AUTH_PASSWD, 'groupadmin'),
 
             /* hack: lists uses that */
             'profile'                 => $this->make_hook('profile',  AUTH_PUBLIC),
index 7451a07..f8e9150 100644 (file)
@@ -26,16 +26,16 @@ class XnetNlModule extends NewsletterModule
     function handlers()
     {
         return array(
-            '%grp/nl'                   => $this->make_hook('nl',              AUTH_MDP, 'groups'),
-            '%grp/nl/show'              => $this->make_hook('nl_show',         AUTH_MDP, 'groups'),
-            '%grp/nl/search'            => $this->make_hook('nl_search',       AUTH_MDP, 'groups'),
-            '%grp/admin/nl'             => $this->make_hook('admin_nl',        AUTH_MDP, 'groupadmin'),
-            '%grp/admin/nl/sync'        => $this->make_hook('admin_nl_sync',   AUTH_MDP, 'groupadmin'),
-            '%grp/admin/nl/enable'      => $this->make_hook('admin_nl_enable', AUTH_MDP, 'groupadmin'),
-            '%grp/admin/nl/edit'        => $this->make_hook('admin_nl_edit',   AUTH_MDP, 'groupadmin'),
-            '%grp/admin/nl/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_MDP, 'groupadmin'),
-            '%grp/admin/nl/edit/valid'  => $this->make_hook('admin_nl_valid',  AUTH_MDP, 'groupadmin'),
-            '%grp/admin/nl/categories'  => $this->make_hook('admin_nl_cat',    AUTH_MDP, 'groupadmin'),
+            '%grp/nl'                   => $this->make_hook('nl',              AUTH_PASSWD, 'groups'),
+            '%grp/nl/show'              => $this->make_hook('nl_show',         AUTH_PASSWD, 'groups'),
+            '%grp/nl/search'            => $this->make_hook('nl_search',       AUTH_PASSWD, 'groups'),
+            '%grp/admin/nl'             => $this->make_hook('admin_nl',        AUTH_PASSWD, 'groupadmin'),
+            '%grp/admin/nl/sync'        => $this->make_hook('admin_nl_sync',   AUTH_PASSWD, 'groupadmin'),
+            '%grp/admin/nl/enable'      => $this->make_hook('admin_nl_enable', AUTH_PASSWD, 'groupadmin'),
+            '%grp/admin/nl/edit'        => $this->make_hook('admin_nl_edit',   AUTH_PASSWD, 'groupadmin'),
+            '%grp/admin/nl/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_PASSWD, 'groupadmin'),
+            '%grp/admin/nl/edit/valid'  => $this->make_hook('admin_nl_valid',  AUTH_PASSWD, 'groupadmin'),
+            '%grp/admin/nl/categories'  => $this->make_hook('admin_nl_cat',    AUTH_PASSWD, 'groupadmin'),
         );
     }
 
index fe40261..abfb165 100644 (file)
@@ -27,7 +27,7 @@ function smarty_function_profile($params, $smarty)
     $with_link  = $params->b('link', true);
     $with_dir   = $params->b('directory', true);
     $with_groupperms = $params->b('groupperms', true);
-    $raw = $params->b('raw', true);
+    $raw = $params->b('raw', false);
     $user = $params->v('user');
     if (is_int($user) || ctype_digit($user)) {
         $user = User::getWithUID($user);
index df21a2d..22f0675 100644 (file)
@@ -38,7 +38,9 @@ Tu trouveras les mêmes informations sur [[https://www.polytechnique.org/carnet/
 
 {foreach from=$cat.users item=user}
 {assign var=profile value=$user->profile()}
+{if !$profile->isDead()}
 * Le {$cat.operation->getDate($user)|date_format:"%d %B %Y"}, [[https://www.polytechnique.org/profile/private/{$profile->hrid()}|{$profile->fullname(true)}]]
+{/if}
 {/foreach}
 
 {/foreach}
index 4d91d37..bd9da07 100644 (file)
 <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}" />)
+<br />
+<strong>Public&nbsp;:</strong>
+<label><input type="radio" name="pay_public" value="no" {if !t($valid->public)}checked="checked"{/if} />Non</label>
+&nbsp;-&nbsp;
+<label>Oui<input type="radio" name="pay_public" value="yes" {if t($valid->public)}checked="checked"{/if} /></label><br />
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 58f5663..50080d3 100644 (file)
@@ -59,4 +59,9 @@
 </tr>
 {/if}
 {/if}
+<tr class="pair">
+  <td class="titre">Public&nbsp;:</td>
+  <td>{if $valid->public}Oui{else}Non{/if}</td>
+</tr>
+
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
similarity index 81%
rename from templates/payment/index.tpl
rename to templates/payment/payment.tpl
index 69b0bc7..d926a91 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
+{if $smarty.request.op eq "submit" and !$pl_errors}
 
 <h1>Télépaiements</h1>
 
-{if $smarty.request.op eq "submit" and !$pl_errors}
-
 <table class="bicol">
   <tr>
     <th colspan="2">Paiement via {$meth->text}</th>
   </tr>
+{if t($public)}
+  <tr>
+    <td><b>Nom</b></td>
+    <td>{$full_name}</td>
+  </tr>
+{/if}
   <tr>
     <td><b>Transaction</b></td>
     <td>{$pay->text}</td>
   </tr>
   <tr>
     <td><b>Montant</b></td>
-    <td>{$montant} &euro;</td>
+    <td>{$amount} &euro;</td>
   </tr>
 {if $comment}
   <tr>
@@ -73,7 +78,7 @@
 </table>
 <p>
 En cliquant sur "Valider", tu seras redirigé{if $sex}e{/if} vers le site de {$pay->api->nomsite}, où il te
-sera demandé de saisir ton numéro de carte bancaire.  Lorsque le paiement aura été effectué, tu
+sera demandé de saisir ton numéro de carte bancaire. Lorsque le paiement aura été effectué, tu
 recevras une confirmation par email.
 </p>
 {if $pay->api->text}
@@ -89,17 +94,9 @@ Si tu n'es pas encore inscrit à cet événement, n'oublie pas d'aller t'<a href
 
 {else}
 
-<script type='text/javascript'>
-{literal}
-function payment_submit(form)
-{
-    form.op.value = 'select';
-    form.montant.value = 0;
-    form.action = 'payment/' + form.ref.value;
-    form.submit();
-}
-{/literal}
-</script>
+{if t($donation)}
+{include wiki=Docs.Dons}
+{/if}
 
 <form method="post" action="{$platal->pl_self()}">
   <table class="bicol">
@@ -109,15 +106,7 @@ function payment_submit(form)
     <tr>
       <td>Transaction</td>
       <td>
-        {if t($asso)}
         <strong>{$pay->text}</strong><input type="hidden" name="ref" value="{$pay->id}" />
-        {else}
-        <select name="ref" onchange="payment_submit(this.form)">
-          {select_db_table table="payments" valeur=$pay->id
-                           where="WHERE FIND_IN_SET('old', t.flags) = 0"
-                           join="LEFT JOIN groups AS g ON (t.asso_id = g.id)" group="g.nom"}
-        </select>
-        {/if}
         {if $pay->url}
         <br />
         <a href="{$pay->url}">plus d'informations</a>
@@ -134,15 +123,21 @@ function payment_submit(form)
     </tr>
     <tr>
       <td>Montant</td>
-      <td><input type="text" name="montant" size="13" class='right' value="{$montant}" /> &euro;</td>
+      <td><input type="text" name="amount" size="13" class="right" value="{$pay->amount_def}" /> &euro;</td>
     </tr>
+    {if t($public)}
+    <tr>
+      <td>Identifiant <small>(prenom.nom.promo)</small></td>
+      <td><input type="text" name="login" size="30" /></td>
+    </tr>
+    {/if}
     <tr>
       <td>Commentaire</td>
       <td><textarea name="comment" rows="5" cols="30"></textarea></td>
     </tr>
     {if t($donation)}
     <tr>
-      <td>Afficher ton nom dans la liste des donateurs sur {#globals.core.sitename#}</td>
+      <td>Afficher ton nom dans la liste des donateurs</td>
       <td>
         <label>Oui<input type="radio" name="display" value="1" checked="checked" /></label>
         &nbsp;-&nbsp;
@@ -153,7 +148,6 @@ function payment_submit(form)
     <tr>
       <td>&nbsp;</td>
       <td>
-        {if !t($donation)}<input type="hidden" name="display" value="0" />{/if}
         <input type="hidden" name="op" value="submit" />
         <input type="submit" value="Continuer" />
       </td>
@@ -175,26 +169,37 @@ function payment_submit(form)
 {/if}
 
 {if t($donation)}
-{if !t($donations)}
-<p class="descr">Aucun don n'a encore été recueilli.</p>
-{else}
-<p class="descr">Les dons suivants ont déjà été recueillis (pour un total de {$sum} &euro;)&nbsp;:</p>
+<p class="descr">Les 10 plus gros dons sont les suivants&nbsp;:</p>
 <table class="bicol">
   <tr>
     <th>Nom</th>
     <th>Montant</th>
+    <th>Date</th>
   </tr>
-  {foreach from=$donations item=d}
+  {foreach from=$biggest_donations item=d}
   <tr class="{cycle values="pair,impair"}">
     <td>{$d.name}</td>
     <td class="center">{$d.amount|replace:'.':','} &euro;</td>
+    <td>{$d.ts_confirmed|date_format}</td>
   </tr>
   {/foreach}
 </table>
-{/if}
-{/if}
 
+<p class="descr">Les dons par période&nbsp;:</p>
+<table class="tinybicol">
+  <tr>
+    <th>Période</th>
+    <th>Montant</th>
+  </tr>
+  {foreach from=$donations item=d}
+  <tr class="{cycle values="pair,impair"}">
+    <td>{if $d.month neq 0}{$d.ts_confirmed|date_format:"%B %Y"}{else}{$d.ts_confirmed|date_format:"%Y"}{/if}</td>
+    <td style="text-align: right">{$d.amount|replace:'.':','} &euro;</td>
+  </tr>
+  {/foreach}
+</table>
 {/if}
 
+{/if}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 0fe683d..fa72041 100644 (file)
@@ -26,6 +26,8 @@
 
 {assign var=terms value=$profile->getMentoringTerms()}
 {assign var=countries value=$profile->getMentoringCountries()}
+{assign var=skills value=$profile->getSkills()}
+{assign var=languages value=$profile->getLanguages()}
 <div id="fiche">
 <div id="fiche_referent">
   <div id="fiche_identite">
   </div>
   <div class="spacer"></div>
 
+  {if $skills|count || $languages|count}
+  <div class="part">
+    <h2>Compétences&nbsp;:</h2>
+    {if $skills|count}
+    <div style="float: left">
+      <em>Professionnelles&nbsp;:</em><br />
+      <ul>
+        {foreach from=$skills item="skill"}
+        <li>{$skill.text_fr} ({$skill.level})</li>
+        {/foreach}
+      </ul>
+    </div>
+    {/if}
+    {if $languages|count}
+    <div {if $skills|count}style="float: right"{/if}>
+      <em>Linguistiques&nbsp;:</em><br />
+      <ul>
+        {foreach from=$languages item="language"}
+        <li>{$language.language} ({$language.level})</li>
+        {/foreach}
+      </ul>
+    </div>
+    {/if}
+    <div class="spacer">&nbsp;</div>
+  </div>
+  {/if}
+
   {if $profile->mentor_expertise != '' || $terms|count || $countries|count }
-  <div id="part">
+  <div class="part">
     <h2>Informations de référent&nbsp;:</h2>
     {if $profile->mentor_expertise}
     <div class="rubrique_referent">
index 02ffefd..83c1585 100644 (file)
   <li>ou bien, plus âgés, qui souhaitent réorienter leur carrière.</li>
 </ul>
 
+<table class="bicol" id="competences_table" style="margin-bottom: 1em">
+  <tr>
+    <th>
+      <div class="flags" style="float: left">
+        <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
+        {icon name="flag_red" title="privé"}
+      </div>
+      Compétences professionnelles
+    </th>
+  </tr>
+  <tr>
+    <td>
+      <span class="titre">Domaine&nbsp;:</span>
+      <select name="competences_sel" onchange="updateElement('competences')">
+        <option value="">&nbsp;</option>
+        {assign var=ingroup value=false}
+        {iterate from=$comp_list item=comp}
+        {if $comp.title}
+        {if $ingroup}</optgroup>{/if}
+        <optgroup label="{$comp.text_fr}">
+        {assign var=ingroup value=true}
+        {/if}
+        <option value="{$comp.id}">{$comp.text_fr}</option>
+        {/iterate}
+        {if $ingroup}</optgroup>{/if}
+      </select>
+      <span id="competences_add" style="display: none">
+        <a href="javascript:addSkill('competences')">{icon name=add title="Ajouter cette compétence"}</a>
+      </span>
+    </td>
+  </tr>
+  <tr class="pair">
+    <td id="competences">
+      {foreach from=$competences item=competence key=id}
+      {include file="profile/skill.skill.tpl" cat='competences' skill=$competence id=$id levels=$comp_level}
+      {/foreach}
+    </td>
+  </tr>
+</table>
+
+<table class="bicol" id="langues_table" style="margin-bottom: 1em">
+  <tr>
+    <th>
+      <div class="flags" style="float: left">
+        <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
+        {icon name="flag_red" title="privé"}
+      </div>
+      Compétences linguistiques
+    </th>
+  </tr>
+  <tr>
+    <td>
+      <span class="titre">Domaine&nbsp;:</span>
+      <select name="langues_sel" onchange="updateElement('langues')">
+        <option value="">&nbsp;</option>
+        {iterate from=$lang_list item=lang}
+        <option value="{$lang.iso_639_2b}">{$lang.language}</option>
+        {/iterate}
+      </select>
+      <span id="langues_add" style="display: none">
+        <a href="javascript:addSkill('langues')">{icon name=add title="Ajouter cette langue"}</a>
+      </span>
+    </td>
+  </tr>
+  <tr class="pair">
+    <td id="langues">
+      {foreach from=$langues item=langue key=id}
+      {include file="profile/skill.skill.tpl" cat='langues' skill=$langue id=$id levels=$lang_level}
+      {/foreach}
+    </td>
+  </tr>
+ </table>
+
 <table class="bicol" id="countries_table" style="margin-bottom: 1em" summary="Profil&nbsp;: Mentoring">
   <tr>
     <th>
diff --git a/templates/profile/skill.tpl b/templates/profile/skill.tpl
deleted file mode 100644 (file)
index 7b423a8..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2011 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               *}
-{*                                                                        *}
-{**************************************************************************}
-
-<table class="bicol" id="competences_table" style="margin-bottom: 1em">
-  <tr>
-    <th>
-      <div class="flags" style="float: left">
-        <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
-        {icon name="flag_red" title="privé"}
-      </div>
-      Compétences professionnelles
-    </th>
-  </tr>
-  <tr>
-    <td>
-      <span class="titre">Domaine&nbsp;:</span>
-      <select name="competences_sel" onchange="updateElement('competences')">
-        <option value="">&nbsp;</option>
-        {assign var=ingroup value=false}
-        {iterate from=$comp_list item=comp}
-        {if $comp.title}
-        {if $ingroup}</optgroup>{/if}
-        <optgroup label="{$comp.text_fr}">
-        {assign var=ingroup value=true}
-        {/if}
-        <option value="{$comp.id}">{$comp.text_fr}</option>
-        {/iterate}
-        {if $ingroup}</optgroup>{/if}
-      </select>
-      <span id="competences_add" style="display: none">
-        <a href="javascript:addSkill('competences')">{icon name=add title="Ajouter cette compétence"}</a>
-      </span>
-    </td>
-  </tr>
-  <tr class="pair">
-    <td id="competences">
-      {foreach from=$competences item=competence key=id}
-      {include file="profile/skill.skill.tpl" cat='competences' skill=$competence id=$id levels=$comp_level}
-      {/foreach}
-    </td>
-  </tr>
-</table>
-
-<table class="bicol" id="langues_table">
-  <tr>
-    <th>
-      <div class="flags" style="float: left">
-        <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
-        {icon name="flag_red" title="privé"}
-      </div>
-      Compétences linguistiques
-    </th>
-  </tr>
-  <tr>
-    <td>
-      <span class="titre">Domaine&nbsp;:</span>
-      <select name="langues_sel" onchange="updateElement('langues')">
-        <option value="">&nbsp;</option>
-        {iterate from=$lang_list item=lang}
-        <option value="{$lang.iso_639_2b}">{$lang.language}</option>
-        {/iterate}
-      </select>
-      <span id="langues_add" style="display: none">
-        <a href="javascript:addSkill('langues')">{icon name=add title="Ajouter cette langue"}</a>
-      </span>
-    </td>
-  </tr>
-  <tr class="pair">
-    <td id="langues">
-      {foreach from=$langues item=langue key=id}
-      {include file="profile/skill.skill.tpl" cat='langues' skill=$langue id=$id levels=$lang_level}
-      {/foreach}
-    </td>
-  </tr>
- </table>
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 8b7eeba..88d920b 100644 (file)
   <a href="Reference/Convention-AX">Lien avec l'AX</a>
   &nbsp;-&nbsp;
   <a href="Equipe/APropos">À propos de ce site et ses équipes</a>
+  {if hasPerm('payment')}
+  &nbsp;-&nbsp;
+  <a href="payment">Faire un don</a>
+  {/if}
 <br />
   <a href="Docs/Ethique">Services et éthique</a>
   | <a href="Reference/Charte">Charte</a>
index a07bb56..a50c9f4 100644 (file)
@@ -38,7 +38,7 @@
 
 {else}
 
-{if $smarty.session.auth == AUTH_MDP}
+{if $smarty.session.auth == AUTH_PASSWD}
 <div class="menu_item"><a href="exit">Déconnexion</a></div>
 {elseif $smarty.cookies.ORGaccess}
 <div class="menu_item"><a href="exit/forget">Déconnexion totale</a></div>
@@ -71,9 +71,6 @@
 {if hasPerm('user')}
 <div class="menu_item"><a href="lists">Listes de diffusion</a></div>
 {/if}
-{if hasPerm('payment')}
-<div class="menu_item"><a href="payment">Télépaiements</a></div>
-{/if}
 {if hasPerm('mail')}
 <div class="menu_item"><a href="emails/antispam/submit">Soumettre un spam</a></div>
 {/if}
index 6c57b33..d219f32 100644 (file)
@@ -28,7 +28,7 @@
 {elseif $mail_part eq 'text'}
 Bonjour,
 
-{$sender_name} nous a demandé de vous créer un compte pour que vous puissiez disposer pleinement de toutes les fonctionnalités liées au groupe {$group}.
+{$sender_name} nous a demandé de vous {if $again}relancer{else}créer un compte{/if} pour que vous puissiez disposer pleinement de toutes les fonctionnalités liées au groupe {$group}.
 
 Après activation, vos paramètres de connexion seront :
 
index c27462d..551fa14 100644 (file)
@@ -32,7 +32,7 @@
   qui aura lieu {$evt.date}.
 </p>
 
-{if $participants|@count && $is_admin}
+{if $evt.short_name && $participants|@count && $is_admin}
 <p class="center">
   [<a href="mailto:?bcc={$evt.short_name}-participants@{#globals.xnet.evts_domain#}">envoyer un email à ceux qui viennent</a>]
   <br />
index 09053af..654aef5 100644 (file)
@@ -201,7 +201,11 @@ Ton inscription à [METS LE NOM DE L'ÉVÉNEMENT ICI] a bien été enregistrée
 {$profile->fullName("promo")}{/if}</textarea><br />
         {assign var='asso_url' value=$globals->baseurl|cat:'/'|cat:$platal->ns}
         Page internet de l'événement&nbsp;: <input size="40" name="site" value="{$paiement_site|default:$asso->site|default:$asso_url}" /><br />
-        <label><input type="checkbox" name="donation" {if t($donation)}check="checked"{/if} />Afficher la liste des payeurs ne s'y opposant pas sur {#globals.core.sitename#}</label><br />
+        Rendre public le télépaiement&nbsp;:
+        <label><input type="radio" name="payment_public" value="no" {if !t($payment_public)}checked="checked"{/if} />Non</label>
+        &nbsp;-&nbsp;
+        <label>Oui<input type="radio" name="payment_public" value="yes" {if t($payment_public)}checked="checked"{/if} /></label><br />
+        Attention&nbsp;: cela aura pour effet de rendre accessible ce télépaiement à tout le monde, même aux personnes non connectées.<br />
         Le nouveau paiement sera activé automatiquement après validation par le trésorier de Polytechnique.org,
         ce qui sera fait sous peu.
         <script type="text/javascript">//<![CDATA[
index 5043faf..d6aea31 100644 (file)
@@ -203,4 +203,13 @@ interprétée comme polémique par un lecteur.
 </div>
 {/if}
 
+{if t($payments)}
+<p>Télépaiements publics pour le groupe {$asso->nom}&nbsp;:</p>
+<ul>
+{foreach from=$payments item=payment}
+<li><a href="{$platal->ns}payment/{$payment.id}">{icon name=money title="Télépaiement"}{$payment.text}</a></li>
+{/foreach}
+</ul>
+{/if}
+
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 5af8cda..b63c1bd 100644 (file)
@@ -31,7 +31,7 @@
         Nom&nbsp;:
       </td>
       <td>
-        <input type="text" size="40" value="{$asso->nom}" name="nom" />
+        <input type="text" size="40" value="{if $error}{$nom}{else}{$asso->nom}{/if}" name="nom" />
       </td>
     </tr>
     <tr>
@@ -39,7 +39,7 @@
         Diminutif&nbsp;:
       </td>
       <td>
-        <input type="text" size="40" value="{$asso->diminutif}" name="diminutif" />
+        <input type="text" size="40" value="{if $error}{$diminutif}{else}{$asso->diminutif}{/if}" name="diminutif" />
       </td>
     </tr>
     <tr>
@@ -47,7 +47,7 @@
         Domaine DNS&nbsp;:
       </td>
       <td>
-        <input type="text" size="40" value="{$asso->mail_domain}" name="mail_domain" />
+        <input type="text" size="40" value="{if $error}{$mail_domain}{else}{$asso->mail_domain}{/if}" name="mail_domain" />
       </td>
     </tr>
     <tr>
       </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 $cat eq 'GroupesX'}selected="selected"{/if}>Groupes X</option>
+          <option value="binets" {if $cat eq 'Binets'}selected="selected"{/if}>Binets</option>
+          <option value="promotions" {if $cat eq 'Promotions'}selected="selected"{/if}>Promotions</option>
+          <option value="institutions" {if $cat eq 'Institutions'}selected="selected"{/if}>Institutions</option>
         </select>
       </td>
     </tr>
       <td>
         <select name="dom">
           <option value="">&nbsp;</option>
-          {iterate from=$dom item=d}
-          <option value="{$d.id}" {if $d.id eq $asso->dom}selected="selected"{/if}>{$d.nom} [{$d.cat}]</option>
+          {iterate from=$domains item=d}
+          <option value="{$d.id}" {if $d.id eq $dom}selected="selected"{/if}>{$d.nom} [{$d.cat}]</option>
           {/iterate}
         </select>
       </td>
     </tr>
     <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> le <input type="text" size="10" maxlength="10" value="{$asso->axDate}" name="axDate" />
+        <label><input type="checkbox" value="1" name="ax" {if $ax}checked="checked"{/if} />
+        groupe agréé par l'AX</label> le <input type="text" size="10" maxlength="10" value="{if $error}{$axDate}{$asso->axDate}{/if}" name="axDate" />
         <small>(ex: 01/01/1970)</small>
       </td>
     </tr>
         Site web&nbsp;:
       </td>
       <td>
-        <input type="text" size="40" value="{$asso->site|default:"http://"}" name="site" />
+        <input type="text" size="40" value="{if $error}{$site}{else}{$asso->site|default:"http://"}{/if}" name="site" />
       </td>
     </tr>
 
         Contact&nbsp;:
       </td>
       <td>
-        <input type="text" size="40" name="resp" value="{$asso->resp}" />
+        <input type="text" size="40" name="resp" value="{if $error}{$resp}{else}{$asso->resp}{/if}" />
       </td>
     </tr>
 
         Adresse email&nbsp;:
       </td>
       <td>
-        <input type="text" size="40" name="mail" value="{$asso->mail}" />
+        <input type="text" size="40" name="mail" value="{if $error}{$mail}{else}{$asso->mail}{/if}" />
       </td>
     </tr>
 
     <tr>
       <td class="titre">Téléphone</td>
       <td>
-        <input type="text" maxlength="28" name="phone" value="{$asso->phone}" />
+        <input type="text" maxlength="28" name="phone" value="{if $error}{$phone}{else}{$asso->phone}{/if}" />
       </td>
     </tr>
     <tr>
       <td class="titre">Fax</td>
       <td>
-        <input type="text" maxlength="28" name="fax" value="{$asso->fax}" />
+        <input type="text" maxlength="28" name="fax" value="{if $error}{$fax}{else}{$asso->fax}{/if}" />
       </td>
     </tr>
     <tr>
       <td class="titre">Adresse</td>
       <td>
-        <textarea name="address" cols="30" rows="4">{$asso->address}</textarea>
+        <textarea name="address" cols="30" rows="4">{if $error}{$address}{else}{$asso->address}{/if}</textarea>
       </td>
     </tr>
 
         Forum&nbsp;:
       </td>
       <td>
-        <input type="text" size="40" name="forum" value="{$asso->forum}" />
+        <input type="text" size="40" name="forum" value="{if $error}{$forum}{else}{$asso->forum}{/if}" />
       </td>
     </tr>
 
         Inscription possible&nbsp;:
       </td>
       <td>
-        <input type="radio" value="1" id="inscr_yes"
-          {if $asso->inscriptible eq 1}checked="checked"{/if}
-          name="inscriptible" />
-        <label for="inscr_yes">oui</label>
-        <input type="radio" value="0" id="inscr_no"
-          {if $asso->inscriptible neq 1}checked="checked"{/if}
-          name="inscriptible" />
-        <label for="inscr_no">non</label>
+        <label><input type="radio" value="1" {if $inscriptible eq 1}checked="checked"{/if} name="inscriptible" />oui</label>
+        <label><input type="radio" value="0" {if $inscriptible neq 1}checked="checked"{/if} name="inscriptible" />non</label>
       </td>
     </tr>
 
         <em>laisser vide par défaut</em>
       </td>
       <td>
-        <input type="text" size="40" name="sub_url" value="{$asso->sub_url}" />
+        <input type="text" size="40" name="sub_url" value="{if $error}{$sub_url}{else}{$asso->sub_url}{/if}" />
       </td>
     </tr>
 
         <em>laisser vide par défaut</em>
       </td>
       <td>
-        <input type="text" size="40" name="unsub_url" value="{$asso->unsub_url}" />
+        <input type="text" size="40" name="unsub_url" value="{if $error}{$unsub_url}{else}{$asso->unsub_url}{/if}" />
       </td>
     </tr>
 
         <em>envoyé à l'inscription</em>
       </td>
       <td>
-        <textarea cols='40' rows='8' name='welcome_msg'>{$asso->welcome_msg}</textarea>
+        <textarea cols='40' rows='8' name='welcome_msg'>{if $error}{$welcome_msg}{else}{$asso->welcome_msg}{/if}</textarea>
       </td>
     </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 $pub eq 'public'}selected="selected"{/if}>Publique</option>
+          <option value="membre" {if $pub eq 'membre'}selected="selected"{/if}>Aux membres du groupe</option>
+          <option value="private" {if $pub eq 'private'}selected="selected"{/if}>Aux animateurs du groupe</option>
         </select>
       </td>
     </tr>
     <tr>
       <td class="titre center" colspan="2">
-        <label><input type="checkbox" value="1" name="notif_unsub" {if $asso->notif_unsub}checked="checked"{/if} />
+        <label><input type="checkbox" value="1" name="notif_unsub" {if $notif_unsub}checked="checked"{/if} />
         prévenir les animateurs lors de la désinscription d'un membre</label>
       </td>
     </tr>
     <a href="wiki_help" class="popup3">
       {icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki autorisée pour la description.
     </a>
-    <textarea name="descr" cols="70" rows="15" id="descr">{$asso->descr}</textarea>
+    <textarea name="descr" cols="70" rows="15" id="descr">{if $error}{$descr}{else}{$asso->descr}{/if}</textarea>
     <input type="submit" name="preview" value="Aperçu de la description"
            onclick="previewWiki('descr', 'preview_descr', true, 'preview_descr'); return false;" /><br />
     <input type="submit" name="submit" value="Enregistrer" />
index 24edb37..acad698 100644 (file)
       <td colspan="2">
         <label>
           <input type="checkbox" name="suggest" />
-          coche cette case si tu souhaites qu'un compte « Extérieur » soit créé
+          coche cette case si tu souhaites qu'un compte «&nbsp;Extérieur&nbsp;» soit créé
           pour cette personne et que nous lui envoyions un email afin qu'il ait
           accès aux nombreuses fonctionnalités de Polytechnique.net (inscription
           aux évènements, télépaiement, modération des listes de diffusion&hellip;)
       </td>
     </tr>
     {/if}
+    {if $user->type eq 'xnet' && $pending_xnet_account}
+    <tr>
+      <td colspan="2">
+        <label>
+          <input type="checkbox" name="again" />
+          Cette personne a un compte «&nbsp;Extérieur&nbsp;» en attente d'activation de sa part. Pour la relancer, il suffit
+          de cocher la case ci-contre.
+        </label>
+      </td>
+    </tr>
+    {/if}
   </table>
 
   <h2>Abonnement aux listes</h2>
diff --git a/upgrade/1.1.4/01_payments.sql b/upgrade/1.1.4/01_payments.sql
new file mode 100644 (file)
index 0000000..49e0c91
--- /dev/null
@@ -0,0 +1,4 @@
+ALTER TABLE payments MODIFY COLUMN flags SET('unique', 'old') NOT NULL DEFAULT '';
+ALTER TABLE payments MODIFY COLUMN flags SET('unique', 'old', 'public') NOT NULL DEFAULT '';
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.1.4/README b/upgrade/1.1.4/README
new file mode 100644 (file)
index 0000000..ecbf37f
--- /dev/null
@@ -0,0 +1,5 @@
+platal.conf:
+[Money]
+mpay_def_id = 386 # donation id
+
+https://www.polytechnique.org/Docs/Dons must be adapted after the release (cf https://dev.m4x.org/~x2004jacob/Docs/Dons).