pending commit, finished during MQ/S download ...
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 17 Jul 2006 10:29:39 +0000 (10:29 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 17 Jul 2006 10:29:39 +0000 (10:29 +0000)
rework a lot the Session object, to share more code between platal and xnet

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@531 839d8a87-29fc-0310-9880-83ba4fa771e5

71 files changed:
classes/Platal.php
classes/Session.php [new file with mode: 0644]
hooks/tmp.inc.php
hooks/webredirect.inc.php
htdocs.net/groupe/getCityInfos.php
htdocs.net/groupe/getData.php
htdocs/admin/lists.php
htdocs/admin/synchro_ax.php
htdocs/admin/utilisateurs.php
include/banana.inc.php
include/emails.inc.php
include/money/cyberpaiement.inc.php
include/money/paypal.inc.php
include/newsletter.inc.php
include/notifs.inc.php
include/platal/env.inc.php
include/platal/session.inc.php
include/profil/assign_poly.inc.php
include/profil/get_adresses.inc.php
include/profil/get_deco.inc.php
include/profil/get_emploi.inc.php
include/profil/get_general.inc.php
include/profil/get_mentor.inc.php
include/profil/get_poly.inc.php
include/profil/get_skill.inc.php
include/profil/update_adresses.inc.php
include/profil/update_deco.inc.php
include/profil/update_emploi.inc.php
include/profil/update_general.inc.php
include/profil/update_mentor.inc.php
include/profil/update_poly.inc.php
include/search.inc.php
include/search/classes.inc.php
include/user.func.inc.php
include/validations.inc.php
include/validations/listes.inc.php
include/wiki.inc.php
include/xnet.inc.php
include/xnet/page.inc.php
include/xnet/session.inc.php
include/xnet/smarty.plugins.inc.php
include/xorg/menu.inc.php
include/xorg/page.inc.php
include/xorg/session.inc.php
modules/auth.php
modules/auth/auth.inc.php
modules/banana.php
modules/carnet.php
modules/email.php
modules/events.php
modules/lists.php
modules/marketing.php
modules/payment.php
modules/platal.php
modules/profile.php
modules/register.php
modules/search.php
modules/xnet.php
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php
modules/xnetgrp.php
modules/xnetlists.php
plugins/block.min_auth.php
plugins/block.only_public.php
plugins/block.perms.php
plugins/insert.getNbNotifs.php
plugins/insert.getUserName.php
plugins/pmwiki.platalAuth.php
templates/password_prompt.tpl
templates/password_prompt_logged.tpl
templates/xnet/skin.tpl

index a2048d3..88c6fd1 100644 (file)
@@ -84,7 +84,8 @@ class Platal
         $args    = $this->argv;
         $args[0] = &$page;
 
-        if ($hook['auth'] > Session::get('auth', AUTH_PUBLIC)) {
+        if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
+            // FIXME: don't use 'session' object anymore
             $_SESSION['session']->doAuth($page);
         }
 
diff --git a/classes/Session.php b/classes/Session.php
new file mode 100644 (file)
index 0000000..0a641a6
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2006 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 Session
+{
+    function init()
+    {
+        @session_start();
+        if (empty($_SESSION['challenge'])) {
+            $_SESSION['challenge'] = sha1(uniqid(rand(), true));
+        }
+    }
+
+    function destroy()
+    {
+        @session_destroy();
+        unset($_SESSION);
+    }
+
+
+
+    function has($key)
+    {
+        return isset($_SESSION[$key]);
+    }
+
+    function kill($key)
+    {
+        unset($_SESSION[$key]);
+    }
+
+    function v($key, $default = null)
+    {
+        return isset($_SESSION[$key]) ? $_SESSION[$key] : $default;
+    }
+
+
+    function has_perms()
+    {
+        return Session::logged() && Session::v('perms') == PERMS_ADMIN;
+    }
+
+    function logged()
+    {
+        return Session::v('auth', AUTH_PUBLIC) >= AUTH_COOKIE;
+    }
+
+    function identified()
+    {
+        return Session::v('auth', AUTH_PUBLIC) >= AUTH_MDP;
+    }
+}
+
+class S extends Session { }
+
+?>
index a965508..491e97b 100644 (file)
@@ -72,19 +72,19 @@ function tmp_subscribe($forlife, $uid, $promo, $password)
 
 function tmp_prefs()
 {
-    $fmt  = Session::get('mail_fmt', 'html') == 'html' ? 'texte' : 'html';
-    $fmt2 = Session::get('mail_fmt', 'html') == 'html' ? 'texte' : 'HTML';
+    $fmt  = S::v('mail_fmt', 'html') == 'html' ? 'texte' : 'html';
+    $fmt2 = S::v('mail_fmt', 'html') == 'html' ? 'texte' : 'HTML';
     return Array(
             Array(
                 'url'    => 'prefs?mail_fmt='.$fmt,
                 'title'  => 'Recevoir les mails en format '.$fmt2,
                 'text'   => 'Tu recois les mails envoyés par le site (lettre mensuelle, carnet, ...) de préférence <strong>sous forme de '
-                            .Session::get('mail_fmt', 'html').'</strong>',
+                            .S::v('mail_fmt', 'html').'</strong>',
                 'weight' => 80
             ),
             Array(
-                'url'    => 'prefs?rss='.(intval(Session::get('core_rss_hash')=='')),
-                'title'  => (Session::get('core_rss_hash') ? 'Désactiver' : 'Activer').' les fils rss',
+                'url'    => 'prefs?rss='.(intval(S::v('core_rss_hash')=='')),
+                'title'  => (S::v('core_rss_hash') ? 'Désactiver' : 'Activer').' les fils rss',
                 'text'   => 'Ceci te permet d\'utiliser les fils rss du site. Attention, désactiver puis réactiver les fils en change les URL !',
                 'weight' => 90
             )
index 47c46b6..3b574b8 100644 (file)
@@ -41,9 +41,9 @@ function webredirect_config()
 
 function webredirect_prefs()
 {
-    $text = "Tu peux configurer tes redirections WEB http://www.carva.org/" . Session::get('bestalias');
-    if (Session::get('forlife') != Session::get('bestalias')) {
-        $text .= ' et http://www.carva.org/'.Session::get('forlife');
+    $text = "Tu peux configurer tes redirections WEB http://www.carva.org/" . S::v('bestalias');
+    if (S::v('forlife') != S::v('bestalias')) {
+        $text .= ' et http://www.carva.org/'.S::v('forlife');
     }
 
     return Array(
index abfb114..eda7d7d 100644 (file)
@@ -48,7 +48,7 @@ INNER JOIN auth_user_quick AS q ON(q.user_id = a.uid)
      GROUP BY u.user_id LIMIT 11",
         $id);
 
-if ($globals->asso('pub') == 'public' || has_perms())
+if ($globals->asso('pub') == 'public' || S::has_perms())
     $page->assign('users', $users);
 
 $page->run();
index 28701ab..b8f3d82 100644 (file)
@@ -22,7 +22,7 @@
 require 'xnet.inc.php';
 
 new_nonhtml_page('geoloc/getData.tpl');
-$nodata = ($globals->asso('pub') != 'public') && !has_perms();
+$nodata = ($globals->asso('pub') != 'public') && !S::has_perms();
 
 header("Content-type: text/xml");
 
index 281d879..1674404 100644 (file)
@@ -25,7 +25,7 @@ $page->assign('xorg_title','Polytechnique.org - Administration - Mailing lists')
 require_once('platal/xmlrpc-client.inc.php');
 require_once('lists.inc.php');
 
-$client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
+$client =& lists_xmlrpc(S::v('uid'), S::v('password'));
 $listes = $client->get_all_lists();
 $page->assign_by_ref('listes',$listes);
 $page->run();
index 574e844..b881f73 100644 (file)
@@ -52,10 +52,10 @@ if (Env::has('mat')) {
 if ($login) {
     
     if (Env::has('importe')) {
-        ax_synchronize($login, Session::getInt('uid'));
+        ax_synchronize($login, S::v('uid'));
     }
     // get details from user, but looking only info that can be seen by ax
-    $user  = get_user_details($login, Session::getInt('uid'), 'ax');
+    $user  = get_user_details($login, S::v('uid'), 'ax');
     $userax= get_user_ax($user['matricule_ax']);
     require_once 'profil.func.inc.php';
     $diff = diff_user_details($userax, $user, 'ax');
index 0d47a54..3f17653 100644 (file)
@@ -25,7 +25,7 @@ $page->assign('xorg_title','Polytechnique.org - Administration - Edit/Su/Log');
 require_once("emails.inc.php");
 require_once("user.func.inc.php");
 
-if (Session::has('suid')) {
+if (S::has('suid')) {
     $page->kill("déjà en SUID !!!");
 }
 
@@ -46,7 +46,7 @@ if (Env::has('ax_button') && $login) {
 }
 
 if(Env::has('suid_button') && $login) {
-    $_SESSION['log']->log("suid_start", "login by ".Session::get('forlife'));
+    $_SESSION['log']->log("suid_start", "login by ".S::v('forlife'));
     $_SESSION['suid'] = $_SESSION;
     $r = XDB::query("SELECT id FROM aliases WHERE alias={?}", $login);
     if($uid = $r->fetchOneCell()) {
@@ -144,7 +144,7 @@ if ($login) {
                     $mailer = new HermesMailer();
                     $mailer->setFrom("webmaster@polytechnique.org");
                     $mailer->addTo("web@polytechnique.org");
-                    $mailer->setSubject("INTERVENTION de ".Session::get('forlife'));
+                    $mailer->setSubject("INTERVENTION de ".S::v('forlife'));
                     $mailer->setTxtBody(preg_replace("/[ \t]+/", ' ', $query));
                     $mailer->send();
 
@@ -169,7 +169,7 @@ if ($login) {
                $mailer = new HermesMailer();
                $mailer->setFrom("webmaster@polytechnique.org");
                $mailer->addTo("web@polytechnique.org");
-               $mailer->setSubject("INTERVENTION de ".Session::get('forlife'));
+               $mailer->setSubject("INTERVENTION de ".S::v('forlife'));
                $mailer->setTxtBody("\nUtilisateur $login effacé");
                $mailer->send();
                break;
index c395e8a..0529996 100644 (file)
@@ -34,7 +34,7 @@ function hook_formatDisplayHeader($_header, $_text) {
 }
 
 function hook_checkcancel($_headers) {
-    return ($_headers['x-org-id'] == Session::get('forlife') or has_perms());
+    return ($_headers['x-org-id'] == S::v('forlife') or S::has_perms());
 }
 
 function hook_shortcuts()
@@ -118,16 +118,16 @@ class PlatalBanana extends Banana
     {
         global $globals;
     
-        $uid = Session::getInt('uid');
+        $uid = S::v('uid');
         $req = XDB::query(
                 "SELECT  nom, mail, sig, FIND_IN_SET('threads',flags), FIND_IN_SET('automaj',flags)
                    FROM  {$globals->banana->table_prefix}profils
                   WHERE  uid={?}", $uid);
 
         if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) {
-            $nom  = Session::get('prenom')." ".Session::get('nom');
-            $mail = Session::get('forlife')."@polytechnique.org";
-            $sig  = $nom." (".Session::getInt('promo').")";
+            $nom  = S::v('prenom')." ".S::v('nom');
+            $mail = S::v('forlife')."@polytechnique.org";
+            $sig  = $nom." (".S::v('promo').")";
             $disp = 0;
             $maj  = 1;
         }
@@ -135,7 +135,7 @@ class PlatalBanana extends Banana
         $this->profile['sig']       = $sig;
         $this->profile['display']   = $disp;
         $this->profile['autoup']    = $maj;
-        $this->profile['lastnews']  = Session::get('banana_last');
+        $this->profile['lastnews']  = S::v('banana_last');
         
         if ($maj) {
             XDB::execute("UPDATE auth_user_quick SET banana_last={?} WHERE user_id={?}", gmdate("YmdHis"), $uid);
@@ -151,7 +151,7 @@ class PlatalBanana extends Banana
         array_splice($this->show_hdr,  count($this->show_hdr)  - 2, 0);
         array_splice($this->parse_hdr, count($this->parse_hdr) - 2, 0, 'x-org-id');
 
-        $this->host = 'news://web_'.Session::get('forlife')
+        $this->host = 'news://web_'.S::v('forlife')
             .":{$globals->banana->password}@{$globals->banana->server}:{$globals->banana->port}/";
 
         parent::Banana();
@@ -163,7 +163,7 @@ class PlatalBanana extends Banana
 
         if (Get::get('banana') == 'updateall'
                 || (!is_null($params) && isset($params['banana']) && $params['banana'] == 'updateall')) {
-            XDB::execute('UPDATE auth_user_quick SET banana_last={?} WHERE user_id={?}', gmdate('YmdHis'), Session::getInt('uid'));
+            XDB::execute('UPDATE auth_user_quick SET banana_last={?} WHERE user_id={?}', gmdate('YmdHis'), S::v('uid'));
             $_SESSION['banana_last'] = time();
         }
         return Banana::run('PlatalBanana', $params);
@@ -172,7 +172,7 @@ class PlatalBanana extends Banana
     function action_saveSubs()
     {
         global $globals;
-        $uid = Session::getInt('uid');
+        $uid = S::v('uid');
 
         $this->profile['subscribe'] = Array();
         XDB::execute("DELETE FROM {$globals->banana->table_prefix}abos WHERE uid={?}", $uid);
index 3979152..0a7cf14 100644 (file)
@@ -134,7 +134,7 @@ class Email
         if (!$this->active) {
             XDB::execute("UPDATE  emails SET flags = 'active'
                                      WHERE  uid={?} AND email={?}", $uid, $this->email);
-           $_SESSION['log']->log("email_on", $this->email.($uid!=Session::getInt('uid') ? "(admin on $uid)" : ""));
+           $_SESSION['log']->log("email_on", $this->email.($uid!=S::v('uid') ? "(admin on $uid)" : ""));
             $this->active = true;
         }
     }
@@ -147,7 +147,7 @@ class Email
         if ($this->active) {
             XDB::execute("UPDATE  emails SET flags =''
                                     WHERE  uid={?} AND email={?}", $uid, $this->email);
-           $_SESSION['log']->log("email_off",$this->email.($uid!=Session::getInt('uid') ? "(admin on $uid)" : "") );
+           $_SESSION['log']->log("email_off",$this->email.($uid!=S::v('uid') ? "(admin on $uid)" : "") );
             $this->active = false;
         }
     }
@@ -218,7 +218,7 @@ class Redirect
             return ERROR_INACTIVE_REDIRECTION;
         }
         XDB::execute('DELETE FROM emails WHERE uid={?} AND email={?}', $this->uid, $email);
-        $_SESSION['log']->log('email_del',$email.($this->uid!=Session::getInt('uid') ? " (admin on {$this->uid})" : ""));
+        $_SESSION['log']->log('email_del',$email.($this->uid!=S::v('uid') ? " (admin on {$this->uid})" : ""));
        foreach ($this->emails as $i=>$mail) {
            if ($email==$mail->email) {
                 unset($this->emails[$i]);
@@ -240,8 +240,8 @@ class Redirect
             return ERROR_LOOP_EMAIL;
         }
         XDB::execute('REPLACE INTO emails (uid,email,flags) VALUES({?},{?},"active")', $this->uid, $email);
-       if ($logger = Session::getMixed('log', null)) { // may be absent --> step4.php
-           $logger->log('email_add',$email.($this->uid!=Session::getInt('uid') ? " (admin on {$this->uid})" : ""));
+       if ($logger = S::v('log', null)) { // may be absent --> step4.php
+           $logger->log('email_add',$email.($this->uid!=S::v('uid') ? " (admin on {$this->uid})" : ""));
         }
        foreach ($this->emails as $mail) {
            if ($mail->email == $email_stripped) {
index 2acb3ea..0030fc5 100644 (file)
@@ -48,11 +48,11 @@ class CyberPayment
         global $globals;
 
         $roboturl = str_replace("https://","http://",$globals->baseurl)
-            ."/payment/cyber_return/".Session::getInt('uid')."?CHAMPBPX";
+            ."/payment/cyber_return/".S::v('uid')."?CHAMPBPX";
         if (Cookie::has(session_name())) {
             $returnurl .= "?".SID;
         }
-       $req = XDB::query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom FROM auth_user_md5 WHERE user_id = {?}",Session::get('uid'));
+       $req = XDB::query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom FROM auth_user_md5 WHERE user_id = {?}",S::v('uid'));
        $name = $req->fetchOneCell();
 
         // on constuit la reference de la transaction
@@ -72,10 +72,10 @@ class CyberPayment
                'CHAMP008' => $pay->mail);
        $this->infos['client'] = Array(
                'CHAMP100' => $name,
-               'CHAMP101' => Session::get('prenom'),
+               'CHAMP101' => S::v('prenom'),
                'CHAMP102' => '.',
                'CHAMP103' => '.',
-               'CHAMP104' => Session::get('bestalias').'@polytechnique.org',
+               'CHAMP104' => S::v('bestalias').'@polytechnique.org',
                'CHAMP106' => '.',
                'CHAMP107' => '.',
                'CHAMP108' => '.',
index b4cdc95..910c016 100644 (file)
@@ -52,11 +52,11 @@ class PayPal
         global $globals;
 
        $this->urlform = 'https://'.$globals->money->paypal_site.'/cgi-bin/webscr';
-       $req = XDB::query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom FROM auth_user_md5 WHERE user_id = {?}",Session::get('uid'));
+       $req = XDB::query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom FROM auth_user_md5 WHERE user_id = {?}",S::v('uid'));
        $name = $req->fetchOneCell();
 
         $roboturl = str_replace("https://","http://",$globals->baseurl)
-            ."/payment/paypal_return/".Session::getInt('uid');
+            ."/payment/paypal_return/".S::v('uid');
 
        $this->infos = Array();
        
@@ -69,9 +69,9 @@ class PayPal
                'cbt'         => 'Revenir sur polytechnique.org');
        
        $info_client = Array(
-               'first_name' => Session::get('prenom'),
+               'first_name' => S::v('prenom'),
                'last_name'  => $name,
-               'email'      => Session::get('bestalias').'@polytechnique.org');
+               'email'      => S::v('bestalias').'@polytechnique.org');
                
        $res = XDB::query(
                "SELECT a.adr1 AS address1, a.adr2 AS address2,
@@ -81,7 +81,7 @@ class PayPal
              LEFT JOIN adresses        AS a ON (q.user_id = a.uid)
              LEFT JOIN tels        AS t ON (t.uid = a.uid AND t.adrid = a.adrid)
                  WHERE q.user_id = {?} AND FIND_IN_SET('active', a.statut)
-                 LIMIT 1", Session::getInt('uid'));
+                 LIMIT 1", S::v('uid'));
        $this->infos['client']=array_merge($info_client, $res->fetchOneAssoc());
 
         // on constuit la reference de la transaction
index 3fa2a2c..06d3e54 100644 (file)
@@ -451,18 +451,18 @@ function get_nl_list()
 
 function get_nl_state()
 {
-    $res = XDB::query('SELECT 1 FROM newsletter_ins WHERE user_id={?}', Session::getInt('uid'));
+    $res = XDB::query('SELECT 1 FROM newsletter_ins WHERE user_id={?}', S::v('uid'));
     return $res->fetchOneCell();
 }
  
 function unsubscribe_nl()
 {
-    XDB::execute('DELETE FROM newsletter_ins WHERE user_id={?}', Session::getInt('uid'));
+    XDB::execute('DELETE FROM newsletter_ins WHERE user_id={?}', S::v('uid'));
 }
  
 function subscribe_nl($uid=-1)
 {
-    $user = ($uid == -1) ? Session::getInt('uid') : $uid;
+    $user = ($uid == -1) ? S::v('uid') : $uid;
     XDB::execute('REPLACE INTO  newsletter_ins (user_id,last)
                         VALUES  ({?}, 0)', $user);
 }
index 4240139..71ef1e9 100644 (file)
@@ -134,11 +134,11 @@ function select_notifs($mail, $uid=null, $last=null, $iterator=true)
 
 function getNbNotifs() {
     global $globals;
-    if (!Session::has('uid')) {
+    if (!S::has('uid')) {
         return 0;
     }
-    $uid       = Session::getInt('uid', -1);
-    $watchlast = Session::get('watch_last');
+    $uid       = S::v('uid', -1);
+    $watchlast = S::v('watch_last');
 
     // selectionne les notifs de uid, sans detail sur le watcher, depuis
     // $watchlast, meme ceux sans surveillance, non ordonnés
index be87caa..4c35b98 100644 (file)
@@ -211,70 +211,6 @@ class Get
 }
 
 // }}}
-// {{{ class Session
-
-class Session
-{
-    // {{{ function _get
-
-    function _get($key, $default)
-    {
-        return isset($_SESSION[$key]) ? $_SESSION[$key] : $default;
-    }
-    
-    // }}}
-    // {{{ function has
-
-    function has($key)
-    {
-        return isset($_SESSION[$key]);
-    }
-    
-    // }}}
-    // {{{ function kill
-    
-    function kill($key)
-    {
-        unset($_SESSION[$key]);
-    }
-
-    // }}}
-    // {{{ function get
-    
-    function get($key, $default='')
-    {
-        return (string)Session::_get($key, $default);
-    }
-
-    // }}}
-    // {{{ function &getMixed
-    
-    function &getMixed($key, $default=null)
-    {
-        return Session::_get($key, $default);
-    }
-
-    // }}}
-    // {{{ function getBool
-    
-    function getBool($key, $default=false)
-    {
-        return (bool)Session::_get($key, $default);
-    }
-
-    // }}}
-    // {{{ function getInt
-    
-    function getInt($key, $default=0)
-    {
-        $i = Session::_get($key, $default);
-        return preg_match(',^[0-9]+$,', $i) ? intval($i) : $default;
-    }
-
-    // }}}
-}
-
-// }}}
 // {{{ class Cookie
 
 class Cookie
index 73de7fe..6cd8dbf 100644 (file)
@@ -22,6 +22,8 @@
 require_once 'diogenes/diogenes.misc.inc.php';
 require_once 'diogenes/diogenes.core.logger.inc.php';
 
+require_once dirname(__FILE__).'/../../classes/Session.php';
+
 // {{{ function check_perms()
 
 /** verifie si un utilisateur a les droits pour voir une page
@@ -31,7 +33,7 @@ require_once 'diogenes/diogenes.core.logger.inc.php';
 function check_perms()
 {
     global $page;
-    if (!has_perms()) {
+    if (!S::has_perms()) {
         if ($_SESSION['log']) {
             $_SESSION['log']->log("noperms",$_SERVER['PHP_SELF']);
         }
@@ -40,47 +42,6 @@ function check_perms()
 }
 
 // }}}
-// {{{ function has_perms()
-
-/** verifie si un utilisateur a les droits pour voir une page
- ** soit parce qu'il est admin, soit il est dans une liste
- ** supplementaire de personnes utilisées
- * @return BOOL
- */
-    
-function has_perms()
-{
-    return logged() && Session::get('perms') == PERMS_ADMIN;
-}
-
-// }}}
-// {{{ function logged()
-
-/** renvoie true si la session existe et qu'on est loggué correctement
- * false sinon
- * @return bool vrai si loggué
- * @see header2.inc.php
- */
-function logged ()
-{
-    return Session::get('auth', AUTH_PUBLIC) >= AUTH_COOKIE;
-}
-
-// }}}
-// {{{ function identified()
-
-/** renvoie true si la session existe et qu'on est loggué correctement
- * et qu'on a été identifié par un mot de passe depuis le début de la session
- * false sinon
- * @return bool vrai si loggué
- * @see header2.inc.php
- */
-function identified ()
-{
-    return Session::get('auth', AUTH_PUBLIC) >= AUTH_MDP;
-}
-
-// }}}
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index ec98308..9dcdbef 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-$uid = Session::getInt('uid');
+$uid = S::v('uid');
  
 $res = XDB::query(
         "SELECT  text,id
index 42b4e58..71293a7 100644 (file)
@@ -39,9 +39,9 @@ function is_adr_empty($adrid){
 
 function delete_address($adrid, $in_request_array = false){
     XDB::execute("DELETE FROM adresses WHERE uid = {?} AND adrid = {?}",
-                 Session::getInt('uid', -1), $adrid);
+                 S::v('uid', -1), $adrid);
     XDB::execute("DELETE FROM tels WHERE uid = {?} AND adrid = {?}",
-                 Session::getInt('uid', -1), $adrid);
+                 S::v('uid', -1), $adrid);
     if ($in_request_array == true){
         unset($_REQUEST['adrid'][$adrid]);
     } else{
@@ -61,7 +61,7 @@ for ($i = 1; $i <= $nb_adr_max; $i++) {
 $sql_order = '';
 
 //recuperation des adrid
-$res = XDB::query("SELECT adrid FROM adresses WHERE uid = {?} AND NOT FIND_IN_SET('pro', statut) ".$sql_order, Session::getInt('uid', -1));
+$res = XDB::query("SELECT adrid FROM adresses WHERE uid = {?} AND NOT FIND_IN_SET('pro', statut) ".$sql_order, S::v('uid', -1));
 $adrids = $res->fetchColumn();
 
 //recuperation des donnees de la bd
@@ -74,7 +74,7 @@ $res = XDB::iterRow(
        gp.pays AS countrytxt, gp.display
        FROM adresses AS a INNER JOIN geoloc_pays AS gp ON(gp.a2 = a.country)
        WHERE uid = {?} AND NOT FIND_IN_SET('pro',statut) ".$sql_order
-, Session::getInt('uid', -1)
+, S::v('uid', -1)
 );
 
 $nb_adr = $res->total();
@@ -100,7 +100,7 @@ $restels = XDB::iterator(
     t.adrid, telid, tel_type, t.tel_pub, t.tel
     FROM tels AS t INNER JOIN adresses AS a ON(t.uid = a.uid AND t.adrid = a.adrid)
     WHERE t.uid = {?} AND NOT FIND_IN_SET('pro',statut) ORDER BY t.adrid, tel_type DESC, telid"
-, Session::getInt('uid', -1)   
+, S::v('uid', -1)   
 );
 while ($tel = $restels->next()) {
     $adrid = $tel['adrid'];
index d4542e9..59c4e19 100644 (file)
 
 if (Env::has('medal_op')) {
     if (Env::get('medal_op')=='retirer' && Env::getInt('medal_id')) {
-        XDB::execute("DELETE FROM profile_medals_sub WHERE uid = {?} AND mid = {?}", Session::getInt('uid', -1), Env::getInt('medal_id', -1));
+        XDB::execute("DELETE FROM profile_medals_sub WHERE uid = {?} AND mid = {?}", S::v('uid', -1), Env::getInt('medal_id', -1));
     }
 
     if (Env::get('medal_op')=='ajouter' && Env::getInt('medal_id')) {
-        XDB::execute("INSERT INTO profile_medals_sub (uid,mid) VALUES ({?}, {?})", Session::getInt('uid', -1), Env::getInt('medal_id'));
+        XDB::execute("INSERT INTO profile_medals_sub (uid,mid) VALUES ({?}, {?})", S::v('uid', -1), Env::getInt('medal_id'));
     }
 }
 if (Post::has('grade')) {
     foreach (Post::getMixed('grade') as $mid=>$gid) {
-        XDB::execute('UPDATE profile_medals_sub SET gid={?} WHERE uid={?} AND mid={?}', $gid, Session::getInt('uid'), $mid);
+        XDB::execute('UPDATE profile_medals_sub SET gid={?} WHERE uid={?} AND mid={?}', $gid, S::v('uid'), $mid);
     }
 } 
 
@@ -38,11 +38,11 @@ $res    = XDB::query(
        "SELECT  m.id, m.text AS medal, m.type, m.img, s.gid
            FROM  profile_medals_sub    AS s
      INNER JOIN  profile_medals        AS m ON ( s.mid = m.id )
-          WHERE  s.uid = {?}", Session::getInt('uid', -1));
+          WHERE  s.uid = {?}", S::v('uid', -1));
 
 $medals = $res->fetchAllAssoc();
 
-$res   = XDB::query("SELECT profile_medals_pub FROM auth_user_quick WHERE user_id = {?}", Session::getInt('uid', -1));
+$res   = XDB::query("SELECT profile_medals_pub FROM auth_user_quick WHERE user_id = {?}", S::v('uid', -1));
 $medals_pub = $res->fetchOneCell();
 
 if(Env::has('modifier') || Env::has('suivant')) {
index 00aa739..30693b2 100644 (file)
@@ -27,7 +27,7 @@ $res = XDB::iterRow("SELECT entrid, entreprise, secteur, ss_secteur, poste, fonc
        adr1, adr2, adr3, postcode, city, country, region, tel, fax, mobile,
        pub, adr_pub, tel_pub, email, email_pub, web
         FROM entreprises
-        WHERE uid = {?} ORDER BY entrid",Session::getInt('uid', -1));
+        WHERE uid = {?} ORDER BY entrid",S::v('uid', -1));
 
 $nb_res = $res->total();
 for($i = 0; $i < $nb_res ; $i++){
@@ -79,7 +79,7 @@ while(list($tmp_fonction_id, $tmp_fonction_label, $tmp_fonction_titre) = $res->n
 }
 
 //recuperation du CV
-$res = XDB::query("SELECT cv FROM auth_user_md5 WHERE user_id = {?}", Session::getInt('uid', -1));
+$res = XDB::query("SELECT cv FROM auth_user_md5 WHERE user_id = {?}", S::v('uid', -1));
 $cv = $res->fetchOneCell();
 
 ?>
index 528a05d..12e293f 100644 (file)
@@ -30,13 +30,13 @@ $sql = "SELECT  u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.promo_sorti
     LEFT  JOIN  applis_ins      AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
         WHERE  u.user_id = {?}";
 
-$result = XDB::query($sql, Session::getInt('uid', -1));
+$result = XDB::query($sql, S::v('uid', -1));
 list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $promo_sortie, $nom_usage, $nationalite,
        $mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname, 
         $synchro_ax, $matricule_ax,
         $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
 
-$result = XDB::query("SELECT pub FROM photo WHERE uid = {?}", Session::getInt('uid', -1));
+$result = XDB::query("SELECT pub FROM photo WHERE uid = {?}", S::v('uid', -1));
 $photo_pub = $result->fetchOneCell();
 
 $nom_anc = $nom;
@@ -74,7 +74,7 @@ require_once("xorg.misc.inc.php");
     $prenom_anc_comp = replace_accent($prenom_anc);
 
 // Y a-t-il une photo en attente de confirmation ?
-$sql = XDB::query("SELECT COUNT(*) FROM requests WHERE type='photo' AND user_id = {?}", Session::getInt('uid', -1));
+$sql = XDB::query("SELECT COUNT(*) FROM requests WHERE type='photo' AND user_id = {?}", S::v('uid', -1));
 $nouvellephoto=$sql->fetchOneCell();
 
 // vim:set et sws=4 sw=4 sts=4:
index 08333e3..0034c12 100644 (file)
@@ -26,7 +26,7 @@ $max_mentor_pays = 10;
 $max_mentor_secteurs = 10;
 
 //recuperation de l'expertise
-$res = XDB::query("SELECT expertise FROM mentor WHERE uid = {?}", Session::getInt('uid',-1));
+$res = XDB::query("SELECT expertise FROM mentor WHERE uid = {?}", S::v('uid',-1));
 
 $mentor_expertise = $res->fetchOneCell();
 $mentor_expertise_bd = $mentor_expertise;
@@ -35,14 +35,14 @@ $mentor_expertise_bd = $mentor_expertise;
 if(Post::get('mentor_pays_op', '') == 'retirer') {
     if(Post::has('mentor_pays_id')) {
         $id_supprimee = Post::get('mentor_pays_id', '00');
-        XDB::execute("DELETE FROM mentor_pays WHERE uid = {?} AND pid = {?} LIMIT 1", Session::getInt('uid', -1), $id_supprimee);
+        XDB::execute("DELETE FROM mentor_pays WHERE uid = {?} AND pid = {?} LIMIT 1", S::v('uid', -1), $id_supprimee);
     }
 }
 
 //recuperation des pays
 $res = XDB::iterRow("SELECT m.pid, p.pays 
                     FROM mentor_pays AS m
-                   LEFT JOIN geoloc_pays AS p ON(m.pid = p.a2) WHERE m.uid = {?} LIMIT {?}", Session::getInt('uid', -1), $max_mentor_pays);
+                   LEFT JOIN geoloc_pays AS p ON(m.pid = p.a2) WHERE m.uid = {?} LIMIT {?}", S::v('uid', -1), $max_mentor_pays);
 $nb_mentor_pays = $res->total();
 $mentor_pid = $mentor_pays = Array();
 for($i = 1; $i <= $nb_mentor_pays ; $i++) list($mentor_pid[$i], $mentor_pays[$i]) = $res->next();
@@ -51,7 +51,7 @@ for($i = 1; $i <= $nb_mentor_pays ; $i++) list($mentor_pid[$i], $mentor_pays[$i]
 if((Post::get('mentor_pays_op', '') == 'ajouter') && ($nb_mentor_pays < $max_mentor_pays)) {
     if(Post::get('mentor_pays_id', '00') != '00') {
        $id_ajoutee = Post::get('mentor_pays_id', '00');
-       XDB::execute("INSERT INTO mentor_pays(uid, pid) VALUES({?}, {?})", Session::getInt('uid', -1), $id_ajoutee);
+       XDB::execute("INSERT INTO mentor_pays(uid, pid) VALUES({?}, {?})", S::v('uid', -1), $id_ajoutee);
        $nb_mentor_pays++;
        $mentor_pid[$nb_mentor_pays] = $id_ajoutee;
        $mentor_pays[$nb_mentor_pays] = Post::get('mentor_pays_name', '');
@@ -64,7 +64,7 @@ if((Post::get('mentor_pays_op', '') == 'ajouter') && ($nb_mentor_pays < $max_men
 if(Post::get('mentor_secteur_op', '') == 'retirer') {
     if(Post::has('mentor_secteur_id')) {
         $id_supprimee = Post::get('mentor_secteur_id', '');
-        XDB::execute("DELETE FROM mentor_secteurs WHERE uid = {?} AND secteur = {?} LIMIT 1", Session::getInt('uid', -1), $id_supprimee);
+        XDB::execute("DELETE FROM mentor_secteurs WHERE uid = {?} AND secteur = {?} LIMIT 1", S::v('uid', -1), $id_supprimee);
     }
 }
 
@@ -74,7 +74,7 @@ $res = XDB::iterRow("SELECT m.secteur, s.label, m.ss_secteur, ss.label
                    LEFT JOIN emploi_secteur AS s ON(m.secteur = s.id)
                    LEFT JOIN emploi_ss_secteur AS ss ON(s.id = ss.secteur AND m.ss_secteur = ss.id)
                    WHERE m.uid = {?}
-                   LIMIT {?}", Session::getInt('uid', -1), $max_mentor_pays);
+                   LIMIT {?}", S::v('uid', -1), $max_mentor_pays);
 $nb_mentor_secteurs = $res->total();
 $mentor_sid = $mentor_secteur = $mentor_ssid = $mentor_ss_secteur = Array();
 for($i = 1; $i <= $nb_mentor_secteurs ; $i++)
@@ -89,7 +89,7 @@ if((Post::get('mentor_secteur_op', '')== 'ajouter') && ($nb_mentor_secteurs < $m
        if(Post::has('mentor_ss_secteur_id'))
            $ssid_ajoutee = Post::get('mentor_ss_secteur_id', '');
        XDB::execute("INSERT INTO mentor_secteurs (uid, secteur, ss_secteur)
-                                   VALUES({?}, {?}, {?})", Session::getInt('uid', -1), $sid_ajoutee, ($ssid_ajoutee == '')?null:$ssid_ajoutee);
+                                   VALUES({?}, {?}, {?})", S::v('uid', -1), $sid_ajoutee, ($ssid_ajoutee == '')?null:$ssid_ajoutee);
        $nb_mentor_secteurs++;
        $mentor_sid[$nb_mentor_secteurs] = $sid_ajoutee;
        $mentor_secteur[$nb_mentor_secteurs] = Post::get('mentor_secteur_name', '');
index d658eaa..e72c3b0 100644 (file)
@@ -26,7 +26,7 @@ $sql = "SELECT section".
     " FROM auth_user_md5 AS u".
     " WHERE user_id = {?}";
 
-$result = XDB::query($sql, Session::getInt('uid', -1));
+$result = XDB::query($sql, S::v('uid', -1));
 $section = $result->fetchOneCell();
 
 replace_ifset($section,'section');
@@ -35,22 +35,22 @@ replace_ifset($section,'section');
 if (Env::has('binet_op')) {
     // retrait binet
     if( (Env::get('binet_op', '')=='retirer')&&(Env::getInt('binet_id', 0) != 0)) {
-        XDB::execute("DELETE FROM binets_ins WHERE user_id = {?} AND binet_id = {?}", Session::getInt('uid', -1), Env::getInt('binet_id', -1));
+        XDB::execute("DELETE FROM binets_ins WHERE user_id = {?} AND binet_id = {?}", S::v('uid', -1), Env::getInt('binet_id', -1));
     }
     // ajout binet
     if (Env::get('binet_op')=="ajouter" && (Env::getInt('binet_id', 0) != 0)) {
-        XDB::execute("INSERT INTO binets_ins (user_id,binet_id) VALUES({?}, {?})", Session::getInt('uid', -1), Env::getInt('binet_id', -1));
+        XDB::execute("INSERT INTO binets_ins (user_id,binet_id) VALUES({?}, {?})", S::v('uid', -1), Env::getInt('binet_id', -1));
     }
 }
 /************* gestion des groupes X ************/
 if (Env::has('groupex_op')) {
     // retrait groupe X
     if (Env::get('groupex_op')=="retirer" && (Env::getInt('groupex_id', 0) != 0)) {
-        XDB::execute("DELETE FROM groupesx_ins WHERE guid = {?} AND gid = {?}", Session::getInt('uid', -1), Env::getInt('groupex_id', -1));
+        XDB::execute("DELETE FROM groupesx_ins WHERE guid = {?} AND gid = {?}", S::v('uid', -1), Env::getInt('groupex_id', -1));
     }
     // ajout groupe X
     if (Env::get('groupex_op')=="ajouter" && (Env::getInt('groupex_id', 0) != 0)) {
-        XDB::execute("INSERT INTO groupesx_ins (guid, gid) VALUES ({?}, {?})", Session::getInt('uid', -1), Env::getInt('groupex_id', -1));
+        XDB::execute("INSERT INTO groupesx_ins (guid, gid) VALUES ({?}, {?})", S::v('uid', -1), Env::getInt('groupex_id', -1));
     }
 }
 
index a5381b7..c28577a 100644 (file)
 
 if(Env::has('langue_op')){
     if(Env::get('langue_op', '')=='retirer'){
-        XDB::execute("DELETE FROM langues_ins WHERE uid = {?} AND lid = {?}", Session::getInt('uid', -1), Env::get('langue_id', ''));
+        XDB::execute("DELETE FROM langues_ins WHERE uid = {?} AND lid = {?}", S::v('uid', -1), Env::get('langue_id', ''));
     } elseif(Env::get('langue_op', '') == 'ajouter'){
         if(Env::get('langue_id', '') != '')
-            XDB::execute("INSERT INTO langues_ins (uid,lid,level) VALUES ({?}, {?}, {?})", Session::getInt('uid', -1), Env::get('langue_id', ''), Env::get('langue_level', ''));
+            XDB::execute("INSERT INTO langues_ins (uid,lid,level) VALUES ({?}, {?}, {?})", S::v('uid', -1), Env::get('langue_id', ''), Env::get('langue_level', ''));
     }
 }
 
 if(Env::has('comppros_op')){
     if(Env::get('comppros_op', '')=='retirer'){
-        XDB::execute("DELETE FROM competences_ins WHERE uid = {?} AND cid = {?}", Session::getInt('uid', -1), Env::get('comppros_id', ''));
+        XDB::execute("DELETE FROM competences_ins WHERE uid = {?} AND cid = {?}", S::v('uid', -1), Env::get('comppros_id', ''));
     } elseif(Env::get('comppros_op', '') == 'ajouter') {
         if(Env::get('comppros_id', '') != '')
-           XDB::execute("INSERT INTO competences_ins (uid,cid,level) VALUES({?}, {?}, {?})", Session::getInt('uid', -1), Env::get('comppros_id', ''), Env::get('comppros_level', ''));
+           XDB::execute("INSERT INTO competences_ins (uid,cid,level) VALUES({?}, {?}, {?})", S::v('uid', -1), Env::get('comppros_id', ''), Env::get('comppros_level', ''));
     }
 }
 
@@ -44,7 +44,7 @@ $nb_lg_max = 10;
 $nb_cpro_max = 20;
 
 $res = XDB::iterRow("SELECT ld.id, ld.langue_fr, li.level FROM langues_ins AS li, langues_def AS ld "
-               ."WHERE (li.lid=ld.id AND li.uid= {?}) LIMIT $nb_lg_max", Session::getInt('uid', -1));
+               ."WHERE (li.lid=ld.id AND li.uid= {?}) LIMIT $nb_lg_max", S::v('uid', -1));
 
 $nb_lg = $res->total();
 
@@ -53,7 +53,7 @@ for ($i = 1; $i <= $nb_lg; $i++) {
 }
 
 $res = XDB::iterRow("SELECT cd.id, cd.text_fr, ci.level FROM competences_ins AS ci, competences_def AS cd "
-               ."WHERE (ci.cid=cd.id AND ci.uid={?}) LIMIT $nb_cpro_max", Session::getInt('uid', -1));
+               ."WHERE (ci.cid=cd.id AND ci.uid={?}) LIMIT $nb_cpro_max", S::v('uid', -1));
 
 $nb_cpro = $res->total();
 
index f834cbb..49c09ba 100644 (file)
@@ -27,7 +27,7 @@ function insert_new_tel($adrid, $tel) {
     XDB::execute( "INSERT INTO tels SET tel_type = {?}, tel_pub = {?},
                   tel = {?}, uid = {?}, adrid = {?}, telid = {?}",
                   $tel['tel_type'], $tel['tel_pub'], $tel['tel'],
-                  Session::getInt('uid', -1), $adrid, $tel['telid']);
+                  S::v('uid', -1), $adrid, $tel['telid']);
 }
 
 foreach ($adresses as $adrid => $adr) {
@@ -53,7 +53,7 @@ foreach ($adresses as $adrid => $adr) {
                          $adr['adr3'], $adr['postcode'], $adr['city'],
                          $adr['cityid'], $adr['country'], $adr['region'],
                          $adr['regiontxt'], $adr['pub'], $statut,
-                         Session::getInt('uid', -1), $adrid);
+                         S::v('uid', -1), $adrid);
             $telsvalues = "";                   
             foreach ($adr['tels'] as $tel) {
                 insert_new_tel($adrid, $tel);
@@ -68,7 +68,7 @@ foreach ($adresses as $adrid => $adr) {
                          $adr['adr2'], $adr['adr3'], $adr['postcode'],
                          $adr['city'], $adr['cityid'], $adr['country'],
                          $adr['region'], $adr['regiontxt'], $adr['pub'],
-                         $statut, Session::getInt('uid', -1), $adrid);
+                         $statut, S::v('uid', -1), $adrid);
             foreach ($adr['tels'] as $tel) {
                 if ($tel['new_tel']) {
                     insert_new_tel($adrid, $tel);
@@ -86,7 +86,7 @@ foreach ($adresses as $adrid => $adr) {
                             $tel['tel_type'],
                             $tel['tel_pub'],
                             $tel['tel'],
-                            Session::getInt('uid', -1),
+                            S::v('uid', -1),
                             $adrid,
                             $tel['telid']);
                     } else {
@@ -95,7 +95,7 @@ foreach ($adresses as $adrid => $adr) {
                             uid = {?} AND
                             adrid = {?} AND
                             telid = {?}",
-                            Session::getInt('uid', -1),
+                            S::v('uid', -1),
                             $adrid,
                             $tel['telid']);
                     }
index 8208d5f..24eef73 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-XDB::execute("UPDATE auth_user_quick SET profile_medals_pub = {?} WHERE user_id = {?}", $medals_pub, Session::getInt('uid', -1));
+XDB::execute("UPDATE auth_user_quick SET profile_medals_pub = {?} WHERE user_id = {?}", $medals_pub, S::v('uid', -1));
 
 // vim:set et sws=4 sw=4 sts=4:
 ?>
index 3b5120d..806f384 100644 (file)
@@ -31,7 +31,7 @@ for($i = 0; $i < 2; $i++){
              "{?}, {?}, {?}, {?}, ".
              "{?}, {?}, {?}, ".
              "{?}, {?}, {?})",
-             Session::getInt('uid', -1) , $i , $entreprise[$i] ,
+             S::v('uid', -1) , $i , $entreprise[$i] ,
              ( ($secteur[$i] == "") ? null : $secteur[$i]), //sinon un faux 0 est rentre dans la base
              ( ($ss_secteur[$i] == "") ? null : $ss_secteur[$i]),
              $poste[$i], $fonction[$i],
@@ -41,5 +41,5 @@ for($i = 0; $i < 2; $i++){
              $pubpro[$i], $adr_pubpro[$i], $tel_pubpro[$i],
              $emailpro[$i], $email_pubpro[$i], $webpro[$i]);
 }
-XDB::execute("UPDATE auth_user_md5 set cv= {?} WHERE user_id = {?}", $cv, Session::getInt('uid', -1));
+XDB::execute("UPDATE auth_user_md5 set cv= {?} WHERE user_id = {?}", $cv, S::v('uid', -1));
 ?>
index 535b9c6..374fc01 100644 (file)
  ***************************************************************************/
 
 if ($appli_id1>0)
-     XDB::execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 0", Session::getInt('uid', -1), $appli_id1, $appli_type1);
+     XDB::execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 0", S::v('uid', -1), $appli_id1, $appli_type1);
 else
-     XDB::execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=0", Session::getInt('uid', -1));
+     XDB::execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=0", S::v('uid', -1));
 
 if ($appli_id2>0)
-     XDB::execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 1", Session::getInt('uid', -1), $appli_id2, $appli_type2);
+     XDB::execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 1", S::v('uid', -1), $appli_id2, $appli_type2);
 else
-     XDB::execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=1", Session::getInt('uid', -1));
+     XDB::execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=1", S::v('uid', -1));
 
 if ($nationalite != $nationalite_anc || $nom != $nom_anc || $prenom != $prenom_anc) {
     $sql = "UPDATE auth_user_md5
                SET nationalite= {?},
                    nom = {?},
                    prenom = {?} WHERE user_id= {?}";
-    XDB::execute($sql, $nationalite, $nom, $prenom, Session::getInt('uid', -1));
+    XDB::execute($sql, $nationalite, $nom, $prenom, S::v('uid', -1));
 }
 XDB::execute(
         "UPDATE auth_user_quick SET
@@ -49,12 +49,12 @@ XDB::execute(
             $web, $web_pub,
             $freetext, $freetext_pub,
             $synchro_ax,
-            Session::getInt('uid', -1));
+            S::v('uid', -1));
 
 if ($nickname != $nickname_anc) {
     require_once('user.func.inc.php');
-    user_reindex(Session::getInt('uid', -1));
+    user_reindex(S::v('uid', -1));
 }
-XDB::execute("UPDATE photo SET pub = {?} WHERE uid = {?}", $photo_pub, Session::getInt('uid', -1));
+XDB::execute("UPDATE photo SET pub = {?} WHERE uid = {?}", $photo_pub, S::v('uid', -1));
 // vim:set et sws=4 sts=4 sw=4:
 ?>
index 4abf46f..75dc036 100644 (file)
@@ -22,7 +22,7 @@
 //mise a jour d'expertise si nécessaire
 
 if($mentor_expertise != $mentor_expertise_bd) {
-    XDB::execute("REPLACE INTO mentor(uid, expertise) VALUES({?}, {?})", Session::getInt('uid', -1), $mentor_expertise);
+    XDB::execute("REPLACE INTO mentor(uid, expertise) VALUES({?}, {?})", S::v('uid', -1), $mentor_expertise);
 }
 
 
index 5add42e..1f36023 100644 (file)
@@ -21,6 +21,6 @@
 
 $sql = "UPDATE auth_user_md5 set section= {?} WHERE user_id= {?}";
 
-XDB::execute($sql, $section, Session::getInt('uid', -1));
+XDB::execute($sql, $section, S::v('uid', -1));
 
 ?>
index 32ccecc..296eaa1 100644 (file)
@@ -104,11 +104,11 @@ class XOrgSearch extends XOrgPlugin
     {
         foreach ($this->orders as $key=>$o) {
             if ($o[3] == AUTH_COOKIE) {
-                $this->orders[$key][3] = logged();
+                $this->orders[$key][3] = S::logged();
             } elseif ($o[3] == AUTH_PUBLIC) {
                 $this->orders[$key][3] = true;
             } else {
-                $this->orders[$key][3] = identified();
+                $this->orders[$key][3] = S::identified();
             }
         }
     }
@@ -151,7 +151,7 @@ class XOrgSearch extends XOrgPlugin
         list($list, $total) = call_user_func($this->_callback, $offset, $this->limit, $sql_order);
         
        $page_max = intval(($total-1)/$this->limit);
-        if(!logged() && $page_max > $globals->search->public_max)
+        if(!S::logged() && $page_max > $globals->search->public_max)
             $page_max = $globals->search->public_max;
 
        $links = Array();
index c164852..5359e59 100644 (file)
@@ -37,7 +37,7 @@ $globals->search->result_fields = '
                 es.label AS secteur, ef.fonction_fr AS fonction,
                 IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166,';
 // hide private information if not logged
-if (logged()) 
+if (S::logged()) 
        $globals->search->result_fields .='
                q.profile_web AS web,
                q.profile_mobile AS mobile,
index 11691be..9870f46 100644 (file)
@@ -60,7 +60,7 @@ function user_clear_all_subs($user_id, $really_del=true)
     
     include_once('lists.inc.php');
     if (function_exists(lists_xmlrpc)) {
-        $client =& lists_xmlrpc(Session::getInt('id'), Session::get('password'));
+        $client =& lists_xmlrpc(S::v('id'), S::v('password'));
         $client->kill($alias, $really_del);
     }
 }
@@ -130,7 +130,7 @@ function get_user_login($data, $get_forlife = false) {
                 return $res->fetchOneCell();
                 
             default:
-                if (has_perms()) {
+                if (S::has_perms()) {
                     $aliases = $res->fetchColumn();
                     $page->trig("Il y a $i utilisateurs avec cette adresse mail : ".join(', ', $aliases));
                 } else {
index fdd0fae..1edb05c 100644 (file)
@@ -166,7 +166,7 @@ class Validate
 
         // ajout d'un commentaire
         if (Env::has('hold') && Env::has('comm')) {
-            $this->comments[] = Array(Session::get('bestalias'), Env::get('comm'));
+            $this->comments[] = Array(S::v('bestalias'), Env::get('comm'));
 
             // envoi d'un mail à hotliners
             global $globals;
@@ -177,7 +177,7 @@ class Validate
             $mailer->addTo("hotliners@{$globals->mail->domain}");
 
             $body = "Validation {$this->type} pour {$this->prenom} {$this->nom}\n\n"
-              . Session::get('bestalias')." a ajouté le commentaire :\n\n" 
+              . S::v('bestalias')." a ajouté le commentaire :\n\n" 
               . Env::get('comm')."\n\n"
               . "cf la discussion sur : ".$globals->baseurl."/admin/valider.php";
 
index bf9c493..fe06410 100644 (file)
@@ -88,7 +88,7 @@ class ListeReq extends Validate
         require_once('platal/xmlrpc-client.inc.php');
         require_once('lists.inc.php');
 
-        $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
+        $client =& lists_xmlrpc(S::v('uid'), S::v('password'));
         $ret = $client->create_list($this->liste, $this->desc,
             $this->advertise, $this->modlevel, $this->inslevel,
             $this->owners, $this->members);
index 1b3f974..ae4c888 100644 (file)
@@ -95,11 +95,11 @@ function wiki_clean_tmp() {
 
 function wiki_assign_auth() {
     global $page, $wiki_auths;
-    $page->assign('logged', logged());
-    $page->assign('identified', identified());
-    $page->assign('has_perms', has_perms());
+    $page->assign('logged', S::logged());
+    $page->assign('identified', S::identified());
+    $page->assign('has_perms', S::has_perms());
     $page->assign('public', true);
-    $page->assign('wiki_admin', has_perms() && identified());
+    $page->assign('wiki_admin', S::has_perms() && S::identified());
 }
 
 // cannot be in a function because pmwiki use all vars as if it was globals
index 836efe4..aea2c12 100644 (file)
@@ -61,7 +61,7 @@ function new_group_page($tpl_name)
     new_page($tpl_name);
 
     $page->doAuth(true);
-    if (!is_member() && !has_perms()) {
+    if (!is_member() && !S::has_perms()) {
         $page->kill("You have not sufficient credentials");
     }
 
@@ -116,7 +116,7 @@ function new_nonhtml_page($tpl_name)
     new_page($tpl_name, NO_SKIN);
 
     $page->doAuth(true);
-    if (!is_member() && !has_perms()) {
+    if (!is_member() && !S::has_perms()) {
         $page->kill("You have not sufficient credentials");
     }
 
index b150c37..a1af5e5 100644 (file)
@@ -61,15 +61,15 @@ class XnetPage extends PlatalPage
         $sub = array();
         $sub['accueil']           = '';
         $sub['liste des groupes'] = 'plan';
-        if (logged()) {
-            if (has_perms()) {
+        if (S::logged()) {
+            if (S::has_perms()) {
                 $sub['admin X.net'] = 'admin';
             }
             $sub['déconnexion']   = 'exit';
         }
         $menu["Menu Principal"]   = $sub;
 
-        if (logged() && (is_member() || may_update())) {
+        if (S::logged() && (is_member() || may_update())) {
             $sub = array();
             $dim = $globals->asso('diminutif');
             $sub['présentation'] = "$dim/";
@@ -90,7 +90,7 @@ class XnetPage extends PlatalPage
             $menu[$globals->asso('nom')] = $sub;
         }
 
-        if (logged() && may_update()) {
+        if (S::logged() && may_update()) {
             $sub = array();
             $sub['modifier l\'accueil'] = "$dim/edit";
             if ($globals->asso('mail_domain')) {
@@ -112,11 +112,11 @@ class XnetPage extends PlatalPage
         $this->register_function('list_all_my_groups', 'list_all_my_groups');
         $this->register_modifier('cat_pp', 'cat_pp');
         $this->assign('it_is_xnet', true);
-        if (!logged() && $force) {
-            $_SESSION['session']->doLogin($this);
+        if (!S::logged() && $force) {
+            XnetSession::doLogin($this);
         }
-        if (!logged() && Get::has('auth')) {
-            $_SESSION['session']->doAuthX($this);
+        if (!S::logged() && Get::has('auth')) {
+            XnetSession::doAuthX($this);
         }
     }
 
index 6a40919..83e3a72 100644 (file)
@@ -25,26 +25,16 @@ require_once('platal/session.inc.php');
 
 class XnetSession
 {
-    var $challenge;
-
-    // {{{ function XnetSession()
-
-    function XnetSession()
-    {
-        $this->challenge = md5(uniqid(rand(), 1));
-    }
-
-    // }}}
     // {{{ function init
-    
+
     function init() {
         global $globals;
 
-        @session_start();
-        if (!Session::has('session')) {
-            $_SESSION['session'] = new XnetSession;
-        }
-        if (!logged()) {
+        S::init();
+
+        $_SESSION['session'] = new XnetSession;
+
+        if (!S::logged()) {
             // prevent connexion to be linked to deconnexion
             if (($i = strpos($_SERVER['REQUEST_URI'], 'exit')) !== false)
                 $returl = "http://{$_SERVER['SERVER_NAME']}".substr($_SERVER['REQUEST_URI'], 0, $i);
@@ -52,22 +42,21 @@ class XnetSession
                 $returl = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
             $url  = "https://www.polytechnique.org/auth-groupex.php";
             $url .= "?session=" . session_id();
-            $url .= "&challenge=" . $_SESSION['session']->challenge;
-            $url .= "&pass=" . md5($_SESSION['session']->challenge . $globals->xnet->secret);
+            $url .= "&challenge=" . S::v('challenge');
+            $url .= "&pass=" . md5(S::v('challenge') . $globals->xnet->secret);
             $url .= "&url=".urlencode($returl);
-            $_SESSION['session']->loginX = $url;
+            $_SESSION['loginX'] = $url;
         }
     }
-    
+
     // }}}
     // {{{ function destroy()
-    
+
     function destroy() {
-        @session_destroy();
-        unset($_SESSION);
+        S::destroy();
         XnetSession::init();
     }
-    
+
     // }}}
     // {{{ function doAuth()
 
@@ -77,16 +66,14 @@ class XnetSession
      */
     function doAuth(&$page)
     {
-       if (identified()) { // ok, c'est bon, on n'a rien à faire
+       if (S::identified()) { // ok, c'est bon, on n'a rien à faire
            return true;
        }
 
         if (Get::has('auth')) {
-            return $this->doAuthX($page);
-        } elseif (Post::has('challenge') && Post::has('username') && Post::has('response')) {
-            return $this->doAuthOther($page);
+            return XnetSession::doAuthX($page);
         } else {
-            $this->doLogin($page);
+            XnetSession::doLogin($page);
         }
     }
 
@@ -96,7 +83,7 @@ class XnetSession
     function doAuthX(&$page) {
         global $globals;
 
-        if (md5('1'.$this->challenge.$globals->xnet->secret.Get::getInt('uid').'1') != Get::get('auth')) {
+        if (md5('1'.S::v('challenge').$globals->xnet->secret.Get::getInt('uid').'1') != Get::get('auth')) {
             $page->kill("Erreur d'authentification avec polytechnique.org !");
         }
 
@@ -111,8 +98,8 @@ class XnetSession
              LIMIT  1", Get::getInt('uid'));
         $_SESSION = array_merge($_SESSION, $res->fetchOneAssoc());
         $_SESSION['auth'] = AUTH_MDP;
-        unset($this->challenge);
-        unset($this->loginX);
+        S::kill('challenge');
+        S::kill('loginX');
         Get::kill('auth');
         Get::kill('uid');
         $args = array();
@@ -123,20 +110,10 @@ class XnetSession
     }
 
     // }}}
-    // {{{ doAuthOther
-
-    function doAuthOther(&$page) {
-        if (Post::has('challenge') && Post::has('username') && Post::has('response')) {
-            $username = Post::get('username');
-        }
-        $this->doLogin($page);
-    }
-
-    // }}}
     // {{{ doLogin
 
     function doLogin(&$page) {
-        redirect($_SESSION['session']->loginX);
+        redirect(S::v('loginX'));
     }
 
     // }}}
@@ -148,11 +125,11 @@ class XnetSession
 function may_update() {
     global $globals;
     if (!$globals->asso('id')) { return false; }
-    if (has_perms()) { return true; }
+    if (S::has_perms()) { return true; }
     $res = XDB::query(
             "SELECT  perms
                FROM  groupex.membres
-              WHERE  uid={?} AND asso_id={?}", Session::getInt('uid'), $globals->asso('id'));
+              WHERE  uid={?} AND asso_id={?}", S::v('uid'), $globals->asso('id'));
     return $res->fetchOneCell() == 'admin';
 }
 
@@ -165,13 +142,13 @@ function is_member() {
     if (!$asso_id) { return false; }
     static $is_member;
     if (!$is_member) $is_member = array();
-    if (!isset($is_member[$asso_id])) 
+    if (!isset($is_member[$asso_id]))
     {
         $res = XDB::query(
             "SELECT  COUNT(*)
                FROM  groupex.membres
               WHERE  uid={?} AND asso_id={?}",
-                Session::getInt('uid'), $asso_id);
+                S::v('uid'), $asso_id);
         $is_member[$asso_id] = $res->fetchOneCell() == 1;
     }
     return $is_member[$asso_id];
index fb18971..4bc287b 100644 (file)
@@ -25,14 +25,14 @@ require_once $globals->spoolroot.'/plugins/function.rel.php';
 
 function list_all_my_groups($params)
 {
-    if (!logged()) {
+    if (!S::logged()) {
         return;
     }
     $res = XDB::iterRow(
             "SELECT  a.nom, a.diminutif
                FROM  groupex.asso    AS a
          INNER JOIN  groupex.membres AS m ON m.asso_id = a.id
-              WHERE  m.uid={?}", Session::getInt('uid'));
+              WHERE  m.uid={?}", S::v('uid'));
     $html = '<div>Mes groupes :</div>';
     while (list($nom, $mini) = $res->next()) {
         $html .= "<a class='gp' href='".smarty_function_rel()."/$mini/'>&bull; $nom</a>";
index 0198d6f..41c9e45 100644 (file)
@@ -89,13 +89,13 @@ class XOrgMenu
 
     function menu()
     {
-        $res = logged() ? $this->_int : $this->_ext;
-        if (identified()) {
+        $res = S::logged() ? $this->_int : $this->_ext;
+        if (S::identified()) {
             $res[XOM_NO][] = Array(0, 'text' => 'Déconnexion', 'url' => 'exit');
         } elseif (Cookie::has('ORGaccess')) {
             $res[XOM_NO][] = Array(0, 'text' => 'Déconnexion totale', 'url' => 'exit/forget');
         }
-        if (!has_perms()) {
+        if (!S::has_perms()) {
             unset($res[XOM_ADMIN]);
         }
         foreach (array_keys($res) as $key) {
index e00fb63..5bc9e56 100644 (file)
@@ -41,7 +41,7 @@ class XorgPage extends PlatalPage
         if ($this->_page_type != NO_SKIN) {
             $this->assign('menu', $globals->menu->menu());
         }
-        $this->_run('skin/'.Session::get('skin'));
+        $this->_run('skin/'.S::v('skin'));
     }
 
     // }}}
@@ -67,9 +67,9 @@ class XorgAuth extends XorgPage
 
     function doAuth()
     {
-        $_SESSION['session']->doAuth($this);
+        XorgSession::doAuth($this);
     }
-    
+
     // }}}
 }
 
@@ -82,20 +82,20 @@ class XorgAuth extends XorgPage
 class XorgCookie extends XorgPage
 {
     // {{{ function XorgCookie()
-    
+
     function XorgCookie($tpl, $type=SKINNED)
     {
         $this->XorgPage($tpl, $type);
     }
-    
+
     // }}}
     // {{{ function doAuth()
 
     function doAuth()
     {
-        $_SESSION['session']->doAuthCookie($this);
+        XorgSession::doAuthCookie($this);
     }
-    
+
     // }}}
 }
 
@@ -107,13 +107,13 @@ class XorgCookie extends XorgPage
 class XorgAdmin extends XorgAuth
 {
     // {{{ function XorgAdmin()
-    
+
     function XorgAdmin($tpl, $type=SKINNED)
     {
         $this->XorgAuth($tpl, $type);
         check_perms();
     }
-    
+
     // }}}
 }
 
index 9c3d81d..9d783e2 100644 (file)
@@ -25,39 +25,25 @@ require_once 'platal/session.inc.php';
 
 class XorgSession
 {
-    var $challenge;
-
-    // {{{ function XorgSession()
-
-    function XorgSession()
-    {
-        $this->challenge = md5(uniqid(rand(), 1));
+    // {{{ function init
 
-       if (!Session::has('uid')) {
+    function init() {
+        S::init();
+       if (!S::has('uid')) {
            try_cookie();
         }
        set_skin();
+        $_SESSION['session'] = new XorgSession;
     }
 
     // }}}
-    // {{{ function init
-    
-    function init() {
-        @session_start();
-        if (!Session::has('session')) {
-            $_SESSION['session'] = new XorgSession;
-        }
-    }
-    
-    // }}}
     // {{{ function destroy()
-    
+
     function destroy() {
-        @session_destroy();
-        unset($_SESSION);
+        S::destroy();
         XorgSession::init();
     }
-    
+
     // }}}
     // {{{ function doAuth()
 
@@ -68,21 +54,18 @@ class XorgSession
     function doAuth(&$page,$new_name=false)
     {
        global $globals;
-       if (identified()) { // ok, c'est bon, on n'a rien à faire
+       if (S::identified()) { // ok, c'est bon, on n'a rien à faire
            return true;
        }
 
-        if (Session::has('session')) {
-            $session =& Session::getMixed('session');
-        }
-        if (Env::has('username') && Env::has('response') && isset($session->challenge))
+        if (Env::has('username') && Env::has('response') && S::has('challenge'))
        {
            // si on vient de recevoir une identification par passwordpromptscreen.tpl
            // ou passwordpromptscreenlogged.tpl
             $uname = Env::get('username');
-            
+
             if (Env::get('domain') == "alias") {
-            
+
                 $res = XDB::query(
                     "SELECT redirect
                        FROM virtual
@@ -97,22 +80,22 @@ class XorgSession
             } else {
                 $login = $uname;
             }
-    
+
            $field = (!$redirect && preg_match('/^\d*$/', $uname)) ? 'id' : 'alias';
            $res   = XDB::query(
                         "SELECT  u.user_id, u.password
                            FROM  auth_user_md5 AS u
                      INNER JOIN  aliases       AS a ON ( a.id=u.user_id AND type!='homonyme' )
                           WHERE  a.$field = {?} AND u.perms IN('admin','user')", $login);
-    
-            $logger =& Session::getMixed('log');
+
+            $logger =& S::v('log');
            if (list($uid, $password) = $res->fetchOneRow()) {
                    require_once('secure_hash.inc.php');
-                       $expected_response=hash_encrypt("$uname:$password:{$session->challenge}");
+                       $expected_response=hash_encrypt("$uname:$password:".S::v('challenge'));
                        // le password de la base est peut-être encore encodé en md5
                        if (Env::get('response') != $expected_response) {
                          $new_password = hash_xor(Env::get('xorpass'), $password);
-                         $expected_response = hash_encrypt("$uname:$new_password:{$session->challenge}");
+                         $expected_response = hash_encrypt("$uname:$new_password:".S::v('challenge'));
                          if (Env::get('response') == $expected_response) {
                              XDB::execute("UPDATE auth_user_md5 SET password = {?} WHERE user_id = {?}", $new_password, $uid);
                          }
@@ -127,21 +110,21 @@ class XorgSession
                         // pour que la modification soit effective dans le reste de la page
                         $_COOKIE['ORGdomain'] = $domain;
                     }
-    
-                           unset($session->challenge);
-                           if ($logger) {
-                               $logger->log('auth_ok');
+
+                    S::kill('challenge');
+                    if ($logger) {
+                        $logger->log('auth_ok');
                     }
                            start_connexion($uid, true);
                     if (Env::get('remember', 'false') == 'true') {
-                        $cookie = hash_encrypt(Session::get('password'));
+                        $cookie = hash_encrypt(S::v('password'));
                         setcookie('ORGaccess',$cookie,(time()+25920000),'/','',0);
                         if ($logger) {
                             $logger->log("cookie_on");
                         }
                     } else {
                         setcookie('ORGaccess', '', time() - 3600, '/', '', 0);
-                        
+
                         if ($logger) {
                             $logger->log("cookie_off");
                         }
@@ -154,7 +137,7 @@ class XorgSession
                     $logger->log('auth_fail','bad login');
             }
        }
-        $this->doLogin($page,$new_name);
+        XorgSession::doLogin($page,$new_name);
     }
 
     // }}}
@@ -166,16 +149,16 @@ class XorgSession
      */
     function doAuthCookie(&$page)
     {
-       if (logged()) {
+       if (S::logged()) {
            return;
         }
 
        if (Env::has('username') and Env::has('response')) {
-           return $this->doAuth($page);
+           return XorgSession::doAuth($page);
         }
 
        if ($r = try_cookie()) {
-           return $this->doAuth($page,($r>0));
+           return XorgSession::doAuth($page,($r>0));
         }
     }
 
@@ -186,7 +169,7 @@ class XorgSession
      */
     function doLogin(&$page, $new_name=false)
     {
-        if (logged() and !$new_name) {
+        if (S::logged() and !$new_name) {
             $page->changeTpl('password_prompt_logged.tpl');
             $page->addJsLink('javascript/do_challenge_response_logged.js');
             $page->assign("xorg_tpl", "password_prompt_logged.tpl");
@@ -195,7 +178,7 @@ class XorgSession
             $page->changeTpl('password_prompt.tpl');
             $page->addJsLink('javascript/do_challenge_response.js');
             $page->assign("xorg_tpl", "password_prompt.tpl");
-            
+
             global $globals;
             if ($globals->mail->alias_dom) {
                 $page->assign("domains", Array(
@@ -267,14 +250,14 @@ function start_connexion ($uid, $identified)
       ORDER BY  s.start DESC
          LIMIT  1", $uid);
     $sess = $res->fetchOneAssoc();
-    $suid = Session::getMixed('suid');
-    
+    $suid = S::v('suid');
+
     if ($suid) {
        $logger = new DiogenesCoreLogger($uid, $suid);
-       $logger->log("suid_start", Session::get('forlife')." by {$suid['uid']}");
+       $logger->log("suid_start", S::v('forlife')." by {$suid['uid']}");
         $sess['suid'] = $suid;
     } else {
-        $logger = Session::getMixed('log', new DiogenesCoreLogger($uid));
+        $logger = S::v('log', new DiogenesCoreLogger($uid));
         $logger->log("connexion", $_SERVER['PHP_SELF']);
         setcookie('ORGuid', $uid, (time()+25920000), '/', '', 0);
     }
@@ -291,8 +274,8 @@ function start_connexion ($uid, $identified)
 function set_skin()
 {
     global $globals;
-    if (logged() && $globals->skin->enable) {
-        $uid = Session::getInt('uid');
+    if (S::logged() && $globals->skin->enable) {
+        $uid = S::v('uid');
        $res = XDB::query("SELECT  skin,skin_tpl
                                       FROM  auth_user_quick AS a
                                 INNER JOIN  skins           AS s ON a.skin=s.id
index cda2bdc..8f2f9b3 100644 (file)
@@ -53,7 +53,7 @@ class AuthModule extends PLModule
 
         $cle = $globals->core->econfiance;
 
-        if (Session::get('chall') && $_GET['PASS'] == md5(Session::get('chall').$cle)) {
+        if (S::v('chall') && $_GET['PASS'] == md5(S::v('chall').$cle)) {
 
             $res  = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id=10154");
             $pass = $res->fetchOneCell();
index 7b6d0e8..dbc50f7 100644 (file)
@@ -29,19 +29,19 @@ function gpex_make_auth($chlg, $privkey, $datafields) {
                                         prenom, nationalite, section,
                                         naissance
                                    FROM auth_user_md5 WHERE user_id = {?}",
-                                Session::getInt('uid'));
+                                S::v('uid'));
     $personnal_data = $res->fetchOneAssoc();
 
     foreach ($fieldarr as $val) {
         /* on verifie qu'on n'a pas demandé une variable inexistante ! */
-        if (Session::has($val)) {
-            $tohash .= Session::get($val);
+        if (S::has($val)) {
+            $tohash .= S::v($val);
         } else if (isset($personnal_data[$val])) {
             $tohash .= $personnal_data[$val];
         } else if ($val == 'username') {
             $res = XDB::query("SELECT alias FROM aliases
                                           WHERE id = {?} AND FIND_IN_SET('bestalias', flags)",
-                                        Session::getInt('uid'));
+                                        S::v('uid'));
             $min_username = $res->fetchOneCell();
             $tohash      .= $min_username;
         }
@@ -59,20 +59,20 @@ function gpex_make_params($chlg, $privkey, $datafields) {
                                         prenom, nationalite, section,
                                         naissance
                                    FROM auth_user_md5 WHERE user_id = {?}",
-                                Session::getInt('uid'));
+                                S::v('uid'));
     $personnal_data = $res->fetchOneAssoc();
 
     $fieldarr = explode(",",$datafields);
 
     foreach ($fieldarr as $val) {
-        if (Session::has($val)) {
-            $tohash .= Session::get($val);
+        if (S::has($val)) {
+            $tohash .= S::v($val);
         } else if (isset($personnal_data[$val])) {
             $params .= "&$val=".$personnal_data[$val];
         } else if ($val == 'username') {
             $res = XDB::query("SELECT alias FROM aliases 
                                           WHERE id = {?} AND FIND_IN_SET('bestalias', flags)",
-                                        Session::getInt('uid'));
+                                        S::v('uid'));
             $min_username = $res->fetchOneCell();
             $params      .= "&$val=".$min_username;
         }
index aa5ccca..3dab3d1 100644 (file)
@@ -72,11 +72,11 @@ class BananaModule extends PLModule
                 SELECT  nom,mail,sig,if(FIND_IN_SET('threads',flags),'1','0'),
                         IF(FIND_IN_SET('automaj',flags),'1','0') 
                   FROM  forums.profils
-                 WHERE  uid = {?}", Session::getInt('uid'));
+                 WHERE  uid = {?}", S::v('uid'));
             if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) {
-                $nom  = Session::get('prenom').' '.Session::get('nom');
-                $mail = Session::get('forlife').'@'.$globals->mail->domain;
-                $sig  = $nom.' ('.Session::getInt('promo').')';
+                $nom  = S::v('prenom').' '.S::v('nom');
+                $mail = S::v('forlife').'@'.$globals->mail->domain;
+                $sig  = $nom.' ('.S::v('promo').')';
                 $disp = 0;
                 $maj  = 0;
             }
@@ -89,7 +89,7 @@ class BananaModule extends PLModule
             XDB::execute(
                 'REPLACE INTO  forums.profils (uid,sig,mail,nom,flags)
                        VALUES  ({?},{?},{?},{?},{?})',
-                Session::getInt('uid'), Post::get('bananasig'),
+                S::v('uid'), Post::get('bananasig'),
                 Post::get('bananamail'), Post::get('banananame'),
                 (Post::getBool('bananadisplay') ? 'threads,' : '') .
                 (Post::getBool('bananaupdate') ? 'automaj' : '')
index 62713fe..5241b1e 100644 (file)
@@ -38,13 +38,13 @@ class CarnetModule extends PLModule
 
     function _add_rss_link(&$page)
     {
-        if (!Session::has('core_rss_hash')) {
+        if (!S::has('core_rss_hash')) {
             return;
         }
         $page->assign('xorg_rss',
                       array('title' => 'Polytechnique.org :: Carnet',
-                            'href'  => '/carnet/rss/'.Session::get('forlife')
-                                      .'/'.Session::get('core_rss_hash').'/rss.xml')
+                            'href'  => '/carnet/rss/'.S::v('forlife')
+                                      .'/'.S::v('core_rss_hash').'/rss.xml')
                       );
     }
 
@@ -69,7 +69,7 @@ class CarnetModule extends PLModule
         require_once 'notifs.inc.php';
 
         $page->assign('now',date('YmdHis'));
-        $notifs = new Notifs(Session::getInt('uid'), true);
+        $notifs = new Notifs(S::v('uid'), true);
 
         $page->assign('notifs', $notifs);
         $page->assign('today', date('Y-m-d'));
@@ -114,12 +114,12 @@ class CarnetModule extends PLModule
 
         require_once 'notifs.inc.php';
 
-        $watch = new Watch(Session::getInt('uid'));
+        $watch = new Watch(S::v('uid'));
 
         $res = XDB::query("SELECT promo_sortie
                                        FROM auth_user_md5
                                       WHERE user_id = {?}",
-                                    Session::getInt('uid', -1));
+                                    S::v('uid', -1));
         $promo_sortie = $res->fetchOneCell();
         $page->assign('promo_sortie', $promo_sortie);
 
@@ -152,7 +152,7 @@ class CarnetModule extends PLModule
     }
 
     function _get_list($offset, $limit) {
-        $uid   = Session::getInt('uid');
+        $uid   = S::v('uid');
         $res   = XDB::query("SELECT COUNT(*) FROM contacts WHERE uid = {?}", $uid);
         $total = $res->fetchOneCell();
 
@@ -186,7 +186,7 @@ class CarnetModule extends PLModule
         require_once("applis.func.inc.php");
         $page->assign('xorg_title','Polytechnique.org - Mes contacts');
 
-        $uid  = Session::getInt('uid');
+        $uid  = S::v('uid');
         $user = Env::get('user');
 
         switch (Env::get('action')) {
@@ -306,7 +306,7 @@ class CarnetModule extends PLModule
             $sql .= ' ORDER BY  u.nom, u.prenom, u.promo';
         }
 
-        $citer = XDB::iterRow($sql, Session::getInt('uid'));
+        $citer = XDB::iterRow($sql, S::v('uid'));
         $pdf   = new ContactsPDF();
 
         while (list($alias) = $citer->next()) {
index ddecd56..5bd2046 100644 (file)
@@ -40,7 +40,7 @@ class EmailModule extends PLModule
         $page->changeTpl('emails/index.tpl');
         $page->assign('xorg_title','Polytechnique.org - Mes emails');
 
-        $uid = Session::getInt('uid');
+        $uid = S::v('uid');
 
         if (Post::has('best')) {
             // bestalias is the first bit : 1
@@ -66,7 +66,7 @@ class EmailModule extends PLModule
 
 
         // on regarde si l'utilisateur a un alias et si oui on l'affiche !
-        $forlife = Session::get('forlife');
+        $forlife = S::v('forlife');
         $res = XDB::query(
                 "SELECT  alias
                    FROM  virtual          AS v
@@ -86,8 +86,8 @@ class EmailModule extends PLModule
         $page->changeTpl('emails/alias.tpl');
         $page->assign('xorg_title','Polytechnique.org - Alias melix.net');
 
-        $uid     = Session::getInt('uid');
-        $forlife = Session::get('forlife');
+        $uid     = S::v('uid');
+        $forlife = S::v('forlife');
 
         $page->assign('demande', AliasReq::get_request($uid));
 
@@ -109,7 +109,7 @@ class EmailModule extends PLModule
                    WHERE ( redirect={?} OR redirect= {?} )
                          AND alias LIKE '%@{$globals->mail->alias_dom}' AND user_id = {?}", 
                 $forlife.'@'.$globals->mail->domain,
-                $forlife.'@'.$globals->mail->domain2, Session::getInt('uid'));
+                $forlife.'@'.$globals->mail->domain2, S::v('uid'));
         list($alias, $visibility) = $res->fetchOneRow();
         $page->assign('actuel', $alias);
 
@@ -165,10 +165,10 @@ class EmailModule extends PLModule
         {
             if ($value == 'public') {
                 XDB::execute("UPDATE auth_user_quick SET emails_alias_pub = 'public'
-                                         WHERE user_id = {?}", Session::getInt('uid'));
+                                         WHERE user_id = {?}", S::v('uid'));
             } else {
                 XDB::execute("UPDATE auth_user_quick SET emails_alias_pub = 'private'
-                                         WHERE user_id = {?}", Session::getInt('uid'));
+                                         WHERE user_id = {?}", S::v('uid'));
             }
 
             $visibility = $value;
@@ -185,10 +185,10 @@ class EmailModule extends PLModule
 
         $page->changeTpl('emails/redirect.tpl');
 
-        $uid     = Session::getInt('uid');
-        $forlife = Session::get('forlife');
+        $uid     = S::v('uid');
+        $forlife = S::v('forlife');
 
-        $redirect = new Redirect(Session::getInt('uid'));
+        $redirect = new Redirect(S::v('uid'));
 
         if ($action == 'remove' && $email) {
             $page->assign('retour', $redirect->delete_email($email));
@@ -234,9 +234,9 @@ class EmailModule extends PLModule
 
         $page->changeTpl('emails/antispam.tpl');
 
-        $bogo = new Bogo(Session::getInt('uid'));
+        $bogo = new Bogo(S::v('uid'));
         if (Env::has('statut_filtre')) {
-            $bogo->change(Session::getInt('uid'), Env::getInt('statut_filtre'));
+            $bogo->change(S::v('uid'), Env::getInt('statut_filtre'));
         }
         $page->assign('filtre',$bogo->level());
     }
@@ -275,13 +275,13 @@ class EmailModule extends PLModule
                 $mymail->setTxtBody(wordwrap($txt,72,"\n"));
                 if ($mymail->send()) {
                     $page->trig("Ton mail a bien été envoyé.");
-                    $_REQUEST = array('bcc' => Session::get('bestalias').'@'.$globals->mail->domain);
+                    $_REQUEST = array('bcc' => S::v('bestalias').'@'.$globals->mail->domain);
                 } else {
                     $page->trig("Erreur lors de l'envoi du courriel, réessaye.");
                 }
             }
         } else {
-            $_REQUEST['bcc'] = Session::get('bestalias').'@'.$globals->mail->domain;
+            $_REQUEST['bcc'] = S::v('bestalias').'@'.$globals->mail->domain;
         }
 
         $res = XDB::query(
@@ -290,7 +290,7 @@ class EmailModule extends PLModule
              INNER JOIN  contacts      AS c ON (u.user_id = c.contact)
              INNER JOIN  aliases       AS a ON (u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags))
                   WHERE  c.uid = {?}
-                 ORDER BY u.nom, u.prenom", Session::getInt('uid'));
+                 ORDER BY u.nom, u.prenom", S::v('uid'));
         $page->assign('contacts', $res->fetchAllAssoc());
     }
 
@@ -318,7 +318,7 @@ class EmailModule extends PLModule
                 $message = "Bonjour !
 
 Ce mail a été généré automatiquement par le service de patte cassée de
-Polytechnique.org car un autre utilisateur, ".Session::get('prenom').' '.Session::get('nom').",
+Polytechnique.org car un autre utilisateur, ".S::v('prenom').' '.S::v('nom').",
 nous a signalé qu'en t'envoyant un mail, il avait reçu un message d'erreur
 indiquant que ton adresse de redirection $email
 ne fonctionnait plus !
index d5b9521..87b9e17 100644 (file)
@@ -38,7 +38,7 @@ class EventsModule extends PLModule
         $page->changeTpl('login.tpl');
 
         $res = XDB::query('SELECT date, naissance FROM auth_user_md5
-                                      WHERE user_id={?}', Session::getInt('uid'));
+                                      WHERE user_id={?}', S::v('uid'));
         list($date, $naissance) = $res->fetchOneRow();
 
         // incitation à mettre à jour la fiche
@@ -59,12 +59,12 @@ class EventsModule extends PLModule
         // incitation à mettre une photo
 
         $res = XDB::query('SELECT COUNT(*) FROM photo
-                                      WHERE uid={?}', Session::getInt('uid'));
+                                      WHERE uid={?}', S::v('uid'));
         $page->assign('photo_incitation', $res->fetchOneCell() == 0);
 
         // Incitation à se géolocaliser
         require_once 'geoloc.inc.php';
-        $res = localize_addresses(Session::getInt('uid', -1));
+        $res = localize_addresses(S::v('uid', -1));
         $page->assign('geoloc_incitation', count($res));
 
         // affichage de la boîte avec quelques liens
@@ -88,11 +88,11 @@ class EventsModule extends PLModule
 
         // ajout du lien RSS
 
-        if (Session::has('core_rss_hash')) {
+        if (S::has('core_rss_hash')) {
             $page->assign('xorg_rss',
                           array('title' => 'Polytechnique.org :: News',
-                                'href' => '/rss/'.Session::get('forlife')
-                                         .'/'.Session::get('core_rss_hash').'/rss.xml')
+                                'href' => '/rss/'.S::v('forlife')
+                                         .'/'.S::v('core_rss_hash').'/rss.xml')
             );
         }
 
@@ -102,19 +102,19 @@ class EventsModule extends PLModule
                                      INNER JOIN evenements AS e ON e.id = ev.evt_id
                                           WHERE peremption < NOW)');
             XDB::execute('REPLACE INTO evenements_vus VALUES({?},{?})',
-                                   Env::get('lu'), Session::getInt('uid'));
+                                   Env::get('lu'), S::v('uid'));
         }
 
         if (Env::has('nonlu')){
             XDB::execute('DELETE FROM evenements_vus
                                           WHERE evt_id = {?} AND user_id = {?}',
-                                   Env::get('nonlu'), Session::getInt('uid'));
+                                   Env::get('nonlu'), S::v('uid'));
         }
 
         // affichage des evenements
         // annonces promos triées par présence d'une limite sur les promos
         // puis par dates croissantes d'expiration
-        $promo = Session::getInt('promo');
+        $promo = S::v('promo');
         $sql = "SELECT  e.id,e.titre,e.texte,a.user_id,a.nom,a.prenom,a.promo,l.alias AS forlife
                   FROM  evenements     AS e
             INNER JOIN  auth_user_md5  AS a ON e.user_id=a.user_id
@@ -126,7 +126,7 @@ class EventsModule extends PLModule
                         AND ev.user_id IS NULL
               ORDER BY  (e.promo_min != 0 AND  e.promo_max != 0) DESC,  e.peremption";
         $page->assign('evenement',
-                      XDB::iterator($sql, Session::getInt('uid'),
+                      XDB::iterator($sql, S::v('uid'),
                                               $promo, $promo)
                       );
 
@@ -138,7 +138,7 @@ class EventsModule extends PLModule
                         AND (e.promo_max = 0 || e.promo_max >= {?})
               ORDER BY  (e.promo_min != 0 AND  e.promo_max != 0) DESC,  e.peremption";
         $page->assign('evenement_summary',
-                      XDB::iterator($sql, Session::getInt('uid'),
+                      XDB::iterator($sql, S::v('uid'),
                                               $promo, $promo)
                      );
     }
@@ -170,7 +170,7 @@ class EventsModule extends PLModule
                                   '<a href=\"mailto:\\0\">\\0</a>', $texte);
             require_once 'validations.inc.php';
             $evtreq = new EvtReq($titre, $texte, $promo_min, $promo_max,
-                                 $peremption, $valid_mesg, Session::getInt('uid'));
+                                 $peremption, $valid_mesg, S::v('uid'));
             $evtreq->submit();
             $page->assign('ok', true);
         }
@@ -219,9 +219,9 @@ class EventsModule extends PLModule
         $page->assign_by_ref('nl', $nl);
 
         if (Post::has('send')) {
-            $nl->sendTo(Session::get('prenom'), Session::get('nom'),
-                        Session::get('bestalias'), Session::get('femme'),
-                        Session::get('mail_fmt') != 'text');
+            $nl->sendTo(S::v('prenom'), S::v('nom'),
+                        S::v('bestalias'), S::v('femme'),
+                        S::v('mail_fmt') != 'text');
         }
     }
 
@@ -236,7 +236,7 @@ class EventsModule extends PLModule
             $page->assign('art', $art);
         } elseif (Post::has('valid')) {
             require_once('validations.inc.php');
-            $art = new NLReq(Session::getInt('uid'), Post::get('title'),
+            $art = new NLReq(S::v('uid'), Post::get('title'),
                              Post::get('body'), Post::get('append'));
             $art->submit();
             $page->assign('submited', true);
index c686573..95c2ec8 100644 (file)
@@ -47,7 +47,7 @@ class ListsModule extends PLModule
     {
         require_once 'lists.inc.php';
 
-        $this->client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
+        $this->client =& lists_xmlrpc(S::v('uid'), S::v('password'));
     }
 
     function handler_lists(&$page)
@@ -152,7 +152,7 @@ class ListsModule extends PLModule
         if (!$page->nb_errs()) {
             $page->assign('created', true);
             require_once 'validations.inc.php';
-            $req = new ListeReq(Session::getInt('uid'), $liste,
+            $req = new ListeReq(S::v('uid'), $liste,
                                 Post::get('desc'), Post::getInt('advertise'),
                                 Post::getInt('modlevel'), Post::getInt('inslevel'),
                                 $owners, $members);
@@ -324,8 +324,8 @@ class ListsModule extends PLModule
             $mail   = $this->client->get_pending_mail($liste, $mid);
             $reason = '';
 
-            $prenom = Session::get('prenom');
-            $nom    = Session::get('nom');
+            $prenom = S::v('prenom');
+            $nom    = S::v('nom');
 
             if (Env::has('mok')) {
                 $action  = 1; /** 2 = ACCEPT **/
index 1046574..ae2ad4a 100644 (file)
@@ -139,7 +139,7 @@ class MarketingModule extends PLModule
                 "INSERT INTO register_marketing
                          SET uid = {?}, sender = {?}, email = {?},
                              date = NOW(), type = {?}",
-                $uid, Session::get('uid'), Post::get('email'), Post::get('type')); 
+                $uid, S::v('uid'), Post::get('email'), Post::get('type')); 
         }
 
         $res = XDB::iterator(
@@ -163,7 +163,7 @@ class MarketingModule extends PLModule
         $page->changeTpl('marketing/promo.tpl');
 
         if (is_null($promo)) {
-            $promo = Session::getInt('promo');
+            $promo = S::v('promo');
         }
         $page->assign('promo', $promo);
 
@@ -210,9 +210,9 @@ class MarketingModule extends PLModule
                     XDB::execute(
                             "INSERT INTO  register_marketing (uid,sender,email,date,last,nb,type,hash)
                                   VALUES  ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')",
-                            $uid, Session::getInt('uid'), $email, Post::get('origine'));
+                            $uid, S::v('uid'), $email, Post::get('origine'));
                     require_once('validations.inc.php');
-                    $req = new MarkReq(Session::getInt('uid'), $uid, $email,
+                    $req = new MarkReq(S::v('uid'), $uid, $email,
                                        Post::get('origine')=='user');
                     $req->submit();
                 }
index 2cd1c2d..07199aa 100644 (file)
@@ -115,7 +115,7 @@ class PaymentModule extends PLModule
                                               FROM  paiement.transactions
                                              WHERE  uid = {?} AND ref = {?}
                                           ORDER BY  timestamp DESC",
-                                            Session::getInt('uid', -1), $ref);
+                                            S::v('uid', -1), $ref);
 
             if ($res->total()) $page->assign('transactions', $res);
         }
index 5ebb7be..646656f 100644 (file)
@@ -63,7 +63,7 @@ class PlatalModule extends PLModule
 
     function handler_index(&$page)
     {
-        if (logged()) {
+        if (S::logged()) {
             redirect("events");
         }
     }
@@ -92,13 +92,12 @@ class PlatalModule extends PLModule
             $_SESSION['core_rss_hash'] = rand_url_id(16);
             XDB::execute('UPDATE  auth_user_quick
                                    SET  core_rss_hash={?} WHERE user_id={?}',
-                                   Session::get('core_rss_hash'),
-                                   Session::getInt('uid'));
+                                   S::v('core_rss_hash'), S::v('uid'));
         } else {
             XDB::execute('UPDATE  auth_user_quick
                                    SET  core_rss_hash="" WHERE user_id={?}',
-                                   Session::getInt('uid'));
-            Session::kill('core_rss_hash');
+                                   S::v('uid'));
+            S::kill('core_rss_hash');
         }
     }
 
@@ -115,7 +114,7 @@ class PlatalModule extends PLModule
             XDB::execute("UPDATE auth_user_quick
                                        SET core_mail_fmt = '$fmt'
                                      WHERE user_id = {?}",
-                                     Session::getInt('uid'));
+                                     S::v('uid'));
             $_SESSION['mail_fmt'] = $fmt;
             redirect($globals->baseurl.'/preferences');
         }
@@ -133,20 +132,20 @@ class PlatalModule extends PLModule
 
         $page->assign('xorg_title','Polytechnique.org - Redirection de page WEB');
 
-        $log =& Session::getMixed('log');
+        $log =& S::v('log');
         $url = Env::get('url');
 
         if (Env::get('submit') == 'Valider' and Env::has('url')) {
             XDB::execute('UPDATE auth_user_quick
                                        SET redirecturl = {?} WHERE user_id = {?}',
-                                   $url, Session::getInt('uid'));
+                                   $url, S::v('uid'));
             $log->log('carva_add', 'http://'.Env::get('url'));
             $page->trig("Redirection activée vers <a href='http://$url'>$url</a>");
         } elseif (Env::get('submit') == "Supprimer") {
             XDB::execute("UPDATE auth_user_quick
                                        SET redirecturl = ''
                                      WHERE user_id = {?}",
-                                   Session::getInt('uid'));
+                                   S::v('uid'));
             $log->log("carva_del", $url);
             Post::kill('url');
             $page->trig('Redirection supprimée');
@@ -155,7 +154,7 @@ class PlatalModule extends PLModule
         $res = XDB::query('SELECT redirecturl
                                        FROM auth_user_quick
                                       WHERE user_id = {?}',
-                                    Session::getInt('uid'));
+                                    S::v('uid'));
         $page->assign('carva', $res->fetchOneCell());
     }
 
@@ -181,9 +180,9 @@ class PlatalModule extends PLModule
             XDB::execute('UPDATE  auth_user_md5 
                                        SET  password={?}
                                      WHERE  user_id={?}', $password,
-                                     Session::getInt('uid'));
+                                     S::v('uid'));
 
-            $log =& Session::getMixed('log');
+            $log =& S::v('log');
             $log->log('passwd', '');
 
             if (Cookie::get('ORGaccess')) {
@@ -204,9 +203,9 @@ class PlatalModule extends PLModule
         $page->changeTpl('acces_smtp.tpl');
         $page->assign('xorg_title','Polytechnique.org - Acces SMTP/NNTP');
 
-        $uid  = Session::getInt('uid');
+        $uid  = S::v('uid');
         $pass = Env::get('smtppass1');
-        $log  = Session::getMixed('log');
+        $log  = S::v('log');
 
         if (Env::get('op') == "Valider" && strlen($pass) >= 6 
         &&  Env::get('smtppass1') == Env::get('smtppass2')) 
@@ -334,7 +333,7 @@ Mail envoy
             XDB::execute('UPDATE auth_user_quick
                                        SET skin={?} WHERE user_id={?}',
                                     Env::getInt('newskin'),
-                                    Session::getInt('uid'));
+                                    S::v('uid'));
             set_skin();
         }
 
@@ -348,14 +347,14 @@ Mail envoy
 
     function handler_exit(&$page, $level = null)
     {
-        if (Session::has('suid')) {
-            if (Session::has('suid')) {
-                $a4l  = Session::get('forlife');
-                $suid = Session::getMixed('suid');
-                $log  = Session::getMixed('log');
-                $log->log("suid_stop", Session::get('forlife') . " by " . $suid['forlife']);
+        if (S::has('suid')) {
+            if (S::has('suid')) {
+                $a4l  = S::v('forlife');
+                $suid = S::v('suid');
+                $log  = S::v('log');
+                $log->log("suid_stop", S::v('forlife') . " by " . $suid['forlife']);
                 $_SESSION = $suid;
-                Session::kill('suid');
+                S::kill('suid');
                 redirect($globals->baseurl.'/admin/utilisateurs.php?login='.$a4l);
             } else {
                 redirect("events");
index 92a01d6..fc92dba 100644 (file)
@@ -83,7 +83,7 @@ class ProfileModule extends PLModule
                                       WHERE alias = {?}", $x);
         list($uid, $photo_pub) = $res->fetchOneRow();
 
-        if ($req && logged()) {
+        if ($req && S::logged()) {
             include 'validations.inc.php';
             $myphoto = PhotoReq::get_request($uid);
             Header('Content-type: image/'.$myphoto->mimetype);
@@ -95,7 +95,7 @@ class ProfileModule extends PLModule
                       WHERE  uid={?}", $uid);
 
             if ((list($type, $data) = $res->fetchOneRow())
-            &&  ($photo_pub == 'public' || logged())) {
+            &&  ($photo_pub == 'public' || S::logged())) {
                 Header("Content-type: image/$type");
                 echo $data;
             } else {
@@ -112,22 +112,22 @@ class ProfileModule extends PLModule
 
         require_once('validations.inc.php');
 
-        $trombi_x = '/home/web/trombino/photos'.Session::get('promo')
-                    .'/'.Session::get('forlife').'.jpg';
+        $trombi_x = '/home/web/trombino/photos'.S::v('promo')
+                    .'/'.S::v('forlife').'.jpg';
 
         if (Env::has('upload')) {
             $file = isset($_FILES['userfile']['tmp_name'])
                     ? $_FILES['userfile']['tmp_name']
                     : Env::get('photo');
             if ($data = file_get_contents($file)) {
-                if ($myphoto = new PhotoReq(Session::getInt('uid'), $data)) {
+                if ($myphoto = new PhotoReq(S::v('uid'), $data)) {
                     $myphoto->submit();
                 }
             } else {
                 $page->trig('Fichier inexistant ou vide');
             }
         } elseif (Env::has('trombi')) {
-            $myphoto = new PhotoReq(Session::getInt('uid'),
+            $myphoto = new PhotoReq(S::v('uid'),
                                     file_get_contents($trombi_x));
             if ($myphoto) {
                 $myphoto->commit();
@@ -135,19 +135,19 @@ class ProfileModule extends PLModule
             }
         } elseif (Env::get('suppr')) {
             XDB::execute('DELETE FROM photo WHERE uid = {?}',
-                                   Session::getInt('uid'));
+                                   S::v('uid'));
             XDB::execute('DELETE FROM requests
                                      WHERE user_id = {?} AND type="photo"',
-                                   Session::getInt('uid'));
+                                   S::v('uid'));
         } elseif (Env::get('cancel')) {
             $sql = XDB::query('DELETE FROM requests 
                                         WHERE user_id={?} AND type="photo"',
-                                        Session::getInt('uid'));
+                                        S::v('uid'));
         }
 
         $sql = XDB::query('SELECT COUNT(*) FROM requests
                                       WHERE user_id={?} AND type="photo"',
-                                    Session::getInt('uid'));
+                                    S::v('uid'));
         $page->assign('submited', $sql->fetchOneCell());
         $page->assign('has_trombi_x', file_exists($trombi_x));
     }
@@ -165,8 +165,8 @@ class ProfileModule extends PLModule
         $page->assign('simple', true);
 
         $view = 'private';
-        if (!logged() || Env::get('view') == 'public') $view = 'public';
-        if (logged() && Env::get('view') == 'ax')      $view = 'ax';
+        if (!S::logged() || Env::get('view') == 'public') $view = 'public';
+        if (S::logged() && Env::get('view') == 'ax')      $view = 'ax';
 
         if (is_numeric($x)) {
             $res = XDB::query(
@@ -184,7 +184,7 @@ class ProfileModule extends PLModule
         }
 
         $new   = Env::get('modif') == 'new';
-        $user  = get_user_details($login, Session::getInt('uid'), $view);
+        $user  = get_user_details($login, S::v('uid'), $view);
         $title = $user['prenom'] . ' ' . empty($user['nom_usage']) ? $user['nom'] : $user['nom_usage'];
         $page->assign('xorg_title', $title);
 
@@ -225,7 +225,7 @@ class ProfileModule extends PLModule
              INNER JOIN auth_user_quick  ON ( user_id = {?} AND emails_alias_pub = 'public' )
                   WHERE ( redirect={?} OR redirect={?} )
                         AND alias LIKE '%@{$globals->mail->alias_dom}'",
-                Session::getInt('uid'),
+                S::v('uid'),
                 $user['forlife'].'@'.$globals->mail->domain,
                 $user['forlife'].'@'.$globals->mail->domain2);
         $page->assign('virtualalias', $res->fetchOneCell());
@@ -250,7 +250,7 @@ class ProfileModule extends PLModule
             XDB::query('UPDATE auth_user_quick
                                      SET profile_from_ax = 1
                                    WHERE user_id = {?}',
-                                 Session::getInt('uid'));
+                                 S::v('uid'));
         }
 
         if (is_ax_key_missing()) {
@@ -258,7 +258,7 @@ class ProfileModule extends PLModule
         }
 
         if (Env::get('synchro_ax') == 'confirm' && !is_ax_key_missing()) {
-            ax_synchronize(Session::get('bestalias'), Session::getInt('uid'));
+            ax_synchronize(S::v('bestalias'), S::v('uid'));
             $page->trig('Ton profil a été synchronisé avec celui du site polytechniciens.com');
         }
 
@@ -267,7 +267,7 @@ class ProfileModule extends PLModule
         $res = XDB::query(
                 "SELECT  naissance, DATE_FORMAT(date, '%d.%m.%Y')
                    FROM  auth_user_md5
-                  WHERE  user_id={?}", Session::getInt('uid'));
+                  WHERE  user_id={?}", S::v('uid'));
         list($naissance, $date_modif_profil) = $res->fetchOneRow();
 
         // lorsqu'on n'a pas la date de naissance en base de données
@@ -288,7 +288,7 @@ class ProfileModule extends PLModule
                 XDB::execute("UPDATE auth_user_md5
                                            SET naissance={?}
                                          WHERE user_id={?}", $birth,
-                                       Session::getInt('uid'));
+                                       S::v('uid'));
                 $page->assign('etat_naissance', 'ok');
                 return;
             }
@@ -316,17 +316,17 @@ class ProfileModule extends PLModule
             * on a juste besoin d'insérer le user_id de la personne dans la table
             */
             XDB::execute('REPLACE INTO user_changes SET user_id={?}',
-                                   Session::getInt('uid'));
+                                   S::v('uid'));
 
-            if (!Session::has('suid')) {
+            if (!S::has('suid')) {
                 require_once 'notifs.inc.php';
-                register_watch_op(Session::getInt('uid'), WATCH_FICHE);
+                register_watch_op(S::v('uid'), WATCH_FICHE);
             }
 
             // mise a jour des champs relatifs au tab ouvert
             require_once "profil/update_{$opened_tab}.inc.php";
 
-            $log =& Session::getMixed('log');
+            $log =& S::v('log');
             $log->log('profil', $opened_tab);
             $page->assign('etat_update', 'ok');
         }
@@ -356,7 +356,7 @@ class ProfileModule extends PLModule
         $res = XDB::query(
                 "SELECT  u.promo, u.promo_sortie
                    FROM  auth_user_md5  AS u
-                  WHERE  user_id={?}", Session::getInt('uid'));
+                  WHERE  user_id={?}", S::v('uid'));
 
         list($promo, $promo_sortie_old) = $res->fetchOneRow();
         $page->assign('promo_sortie_old', $promo_sortie_old);
@@ -380,7 +380,7 @@ class ProfileModule extends PLModule
         elseif ($promo_sortie == $promo + 3) {
             XDB::execute(
                 "UPDATE  auth_user_md5 set promo_sortie={?} 
-                  WHERE  user_id={?}", $promo_sortie, Session::getInt('uid'));
+                  WHERE  user_id={?}", $promo_sortie, S::v('uid'));
                 $page->trig('Ton statut "orange" a été supprimé.');
                 $page->assign('promo_sortie_old', $promo_sortie);
         }
@@ -388,7 +388,7 @@ class ProfileModule extends PLModule
             $page->assign('promo_sortie', $promo_sortie);
 
             if (Env::has('submit')) {
-                $myorange = new OrangeReq(Session::getInt('uid'),
+                $myorange = new OrangeReq(S::v('uid'),
                                           $promo_sortie);
                 $myorange->submit();
                 $page->assign('myorange', $myorange);
@@ -544,7 +544,7 @@ class ProfileModule extends PLModule
                      WHERE  $where
                   GROUP BY  uid
                   ORDER BY  RAND({?})";
-            $res = XDB::iterator($sql, Session::getInt('uid'));
+            $res = XDB::iterator($sql, S::v('uid'));
 
             if ($res->total() == 0) {
                 $page->assign('recherche_trop_large', true);
@@ -585,7 +585,7 @@ class ProfileModule extends PLModule
                    FROM  auth_user_md5  AS u
               LEFT JOIN  aliases        AS e ON(u.user_id = e.id
                                                 AND FIND_IN_SET('usage', e.flags))
-                  WHERE  user_id={?}", Session::getInt('uid'));
+                  WHERE  user_id={?}", S::v('uid'));
 
         list($nom, $usage_old, $flags, $alias_old) = $res->fetchOneRow();
         $flags = new flagset($flags);
@@ -606,7 +606,7 @@ class ProfileModule extends PLModule
                 if ($reason == 'other') {
                     $reason = Env::get('other_reason');
                 }
-                $myusage = new UsageReq(Session::getInt('uid'), $nom_usage, $reason);
+                $myusage = new UsageReq(S::v('uid'), $nom_usage, $reason);
                 $myusage->submit();
                 $page->assign('myusage', $myusage);
             }
@@ -627,7 +627,7 @@ class ProfileModule extends PLModule
         $this->promo = $promo = intval($promo);
 
         if ($promo >= 1900 && $promo < intval(date('Y'))
-        || ($promo == -1 && has_perms()))
+        || ($promo == -1 && S::has_perms()))
         {
             $trombi = new Trombi(array($this, '_trombi_getlist'));
             $trombi->hidePromo();
@@ -678,7 +678,7 @@ class ProfileModule extends PLModule
              INNER JOIN auth_user_quick  ON ( user_id = {?} AND emails_alias_pub = 'public' )
                   WHERE ( redirect={?} OR redirect={?} )
                         AND alias LIKE '%@{$globals->mail->alias_dom}'",
-                Session::getInt('uid'),
+                S::v('uid'),
                 $user['forlife'].'@'.$globals->mail->domain,
                 $user['forlife'].'@'.$globals->mail->domain2);
 
index 2ea8483..52f7892 100644 (file)
@@ -33,7 +33,7 @@ class RegisterModule extends PLModule
 
     function handler_register(&$page, $hash = null)
     {
-        $sub_state = Session::getMixed('sub_state', Array());
+        $sub_state = S::v('sub_state', Array());
         if (!isset($sub_state['step'])) {
             $sub_state['step'] = 0;
         }
@@ -282,9 +282,9 @@ class RegisterModule extends PLModule
 
             XDB::execute('UPDATE auth_user_md5 SET password={?}
                                      WHERE user_id={?}', $password,
-                                   Session::getInt('uid'));
+                                   S::v('uid'));
 
-            $log =& Session::getMixed('log');
+            $log =& S::v('log');
             $log->log('passwd', '');
 
             if (Cookie::get('ORGaccess')) {
index 4f7be95..6024d6f 100644 (file)
@@ -49,13 +49,13 @@ class SearchModule extends PLModule
                 '.$fields->get_select_statement().'
                 LEFT JOIN  auth_user_quick AS q  ON (u.user_id = q.user_id)
                 LEFT JOIN  aliases         AS a  ON (u.user_id = a.id AND a.type="a_vie")
-                LEFT JOIN  contacts        AS c  ON (c.uid='.Session::getInt('uid').'
+                LEFT JOIN  contacts        AS c  ON (c.uid='.S::v('uid').'
                                                      AND c.contact=u.user_id)
                 LEFT JOIN  watch_nonins    AS w  ON (w.ni_id=u.user_id
-                                                     AND w.uid='.Session::getInt('uid').')
+                                                     AND w.uid='.S::v('uid').')
                 '.$globals->search->result_where_statement.'
                     WHERE  '.$fields->get_where_statement()
-                    .(logged() && Env::has('nonins') ? ' AND u.perms="pending" AND u.deces=0' : '')
+                    .(S::logged() && Env::has('nonins') ? ' AND u.perms="pending" AND u.deces=0' : '')
                 .'
                  GROUP BY  u.user_id
                  ORDER BY  '.($order?($order.', '):'')
@@ -131,10 +131,10 @@ class SearchModule extends PLModule
                 '.$fields->get_select_statement().'
                 '.(Env::has('only_referent') ? ' INNER JOIN mentor AS m ON (m.uid = u.user_id)' : '').'
                 LEFT JOIN  aliases        AS a ON (u.user_id = a.id AND a.type="a_vie")
-                LEFT JOIN  contacts       AS c ON (c.uid='.Session::getInt('uid').'
+                LEFT JOIN  contacts       AS c ON (c.uid='.S::v('uid').'
                                                    AND c.contact=u.user_id)
                 LEFT JOIN  watch_nonins   AS w ON (w.ni_id=u.user_id
-                                                   AND w.uid='.Session::getInt('uid').')
+                                                   AND w.uid='.S::v('uid').')
                 '.$globals->search->result_where_statement."
                     $where
                  ORDER BY  ".($order?($order.', '):'')
@@ -170,7 +170,7 @@ class SearchModule extends PLModule
 
             $nb_tot = $search->show();
 
-            if (!logged() && $nb_tot > $globals->search->public_max) {
+            if (!S::logged() && $nb_tot > $globals->search->public_max) {
                 new ThrowError('Votre recherche a généré trop de résultats pour un affichage public.');
             } elseif ($nb_tot > $globals->search->private_max) {
                 new ThrowError('Recherche trop générale');
index 1b368eb..22cdf7f 100644 (file)
@@ -112,7 +112,7 @@ class XnetModule extends PLModule
                     $page->trig('suppression des alias mails');
 
                     require_once('lists.inc.php');
-                    $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $domain);
+                    $client =& lists_xmlrpc(S::v('uid'), S::v('password'), $domain);
                     if ($listes = $client->get_lists()) {
                         foreach ($listes as $l) {
                             $client->delete_list($l['list'], true);
index 40fa385..d290d5e 100644 (file)
@@ -99,7 +99,7 @@ class XnetEventsModule extends PLModule
              LEFT JOIN  groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
                  WHERE  asso_id = {?}
               GROUP BY  e.eid
-              ORDER BY  debut", Session::get('uid'), $globals->asso('id'));
+              ORDER BY  debut", S::v('uid'), $globals->asso('id'));
 
         $evts = array();
 
@@ -110,7 +110,7 @@ class XnetEventsModule extends PLModule
               LEFT JOIN groupex.evenements_participants AS ep
                         ON (ep.eid = ei.eid AND ep.item_id = ei.item_id AND uid = {?})
                   WHERE ei.eid = {?}",
-                    Session::get('uid'), $e['eid']);
+                    S::v('uid'), $e['eid']);
             $e['moments'] = $res->fetchAllAssoc();
 
             $e['topay'] = 0;
@@ -121,7 +121,7 @@ class XnetEventsModule extends PLModule
             $query = XDB::query(
                 "SELECT montant
                    FROM {$globals->money->mpay_tprefix}transactions AS t
-                 WHERE ref = {?} AND uid = {?}", $e['paiement_id'], Session::get('uid'));
+                 WHERE ref = {?} AND uid = {?}", $e['paiement_id'], S::v('uid'));
             $montants = $query->fetchColumn();
 
             foreach ($montants as $m) {
@@ -192,13 +192,13 @@ class XnetEventsModule extends PLModule
                 XDB::execute(
                     "REPLACE INTO  groupex.evenements_participants
                            VALUES  ({?}, {?}, {?}, {?}, {?})",
-                    $eid, Session::getInt('uid'), $j, $nb, $evt['paid']);
+                    $eid, S::v('uid'), $j, $nb, $evt['paid']);
                 $page->assign('updated', true);
             } else {
                 XDB::execute(
                     "DELETE FROM  groupex.evenements_participants
                            WHERE  eid = {?} AND uid = {?} AND item_id = {?}",
-                    $eid, Session::getInt("uid"), $j);         
+                    $eid, S::v("uid"), $j);            
                 $page->assign('updated', true);
             }
         }
@@ -266,7 +266,7 @@ class XnetEventsModule extends PLModule
             $evt = array(
                 'eid'              => $eid,
                 'asso_id'          => $globals->asso('id'),
-                'organisateur_uid' => Session::get('uid'),
+                'organisateur_uid' => S::v('uid'),
                 'paiement_id'      => Post::get('paiement_id') > 0 ? Post::get('paiement_id') : null,
                 'debut'            => Post::get('deb_Year').'-'.Post::get('deb_Month')
                                       .'-'.Post::get('deb_Day').' '.Post::get('deb_Hour')
@@ -331,7 +331,7 @@ class XnetEventsModule extends PLModule
             // request for a new payment
             if (Post::get('paiement_id') == -1 && $money_defaut >= 0) {
                 require_once 'validations.inc.php';
-                $p = new PayReq(Session::get('uid'),
+                $p = new PayReq(S::v('uid'),
                                 Post::get('intitule')." - ".$globals->asso('nom'),
                                 Post::get('site'), $money_defaut,
                                 Post::get('confirmation'), 0, 999,
index cc19ed7..e9cddbd 100644 (file)
@@ -73,7 +73,7 @@ function get_event_detail($eid, $item_id = false)
       LEFT JOIN groupex.evenements_participants AS ep
                 ON (ep.eid = ei.eid AND ep.item_id = ei.item_id AND uid = {?})
           WHERE ei.eid = {?}",
-            Session::get('uid'), $evt['eid']);
+            S::v('uid'), $evt['eid']);
     $evt['moments'] = $res->fetchAllAssoc();
 
     $evt['topay'] = 0;
@@ -84,7 +84,7 @@ function get_event_detail($eid, $item_id = false)
     $req = XDB::query(
         "SELECT montant
            FROM {$globals->money->mpay_tprefix}transactions AS t
-         WHERE ref = {?} AND uid = {?}", $evt['paiement_id'], Session::get('uid'));
+         WHERE ref = {?} AND uid = {?}", $evt['paiement_id'], S::v('uid'));
     $montants = $req->fetchColumn();
 
     $evt['paid'] = 0;
@@ -180,12 +180,12 @@ function subscribe_lists_event($participate, $uid, $evt) {
     $participant_list = $evt['participant_list'];
     $absent_list      = $evt['absent_list'];
 
-    $email = Session::get('forlife');
+    $email = S::v('forlife');
 
     if ($email) {
         $email .= '@'.$globals->mail->domain;
     } else {
-        $res = XDB::query("SELECT email FROM groupex.membres WHERE uid = {?} AND asso_id = {?}", Session::get('uid'), $globals->asso('id'));
+        $res = XDB::query("SELECT email FROM groupex.membres WHERE uid = {?} AND asso_id = {?}", S::v('uid'), $globals->asso('id'));
         $email = $res->fetchOneCell();
     }
 
index beeb0b0..95e65c0 100644 (file)
@@ -98,7 +98,7 @@ class XnetGrpModule extends PLModule
         $page->useMenu();
         $page->setType($globals->asso('cat'));
         $page->assign('is_member', is_member());
-        $page->assign('logged', logged());
+        $page->assign('logged', S::logged());
 
         $page->assign('asso', $globals->asso());
     }
@@ -138,7 +138,7 @@ class XnetGrpModule extends PLModule
         new_groupadmin_page('xnet/groupe/edit.tpl');
 
         if (Post::has('submit')) {
-            if (has_perms()) {
+            if (S::has_perms()) {
                 if (Post::get('mail_domain') && (strstr(Post::get('mail_domain'), '.') === false)) {
                     $page->trig_run("le domaine doit être un FQDN (aucune modif effectuée) !!!");
                 }
@@ -186,7 +186,7 @@ class XnetGrpModule extends PLModule
             redirect('../'.Post::get('diminutif', $globals->asso('diminutif')).'/edit');
         }
 
-        if (has_perms()) {
+        if (S::has_perms()) {
             $dom = XDB::iterator('SELECT * FROM groupex.dom ORDER BY nom');
             $page->assign('dom', $dom);
             $page->assign('super', true);
@@ -200,8 +200,8 @@ class XnetGrpModule extends PLModule
         require_once 'lists.inc.php';
 
         new_groupadmin_page('xnet/groupe/mail.tpl');
-        $client =& lists_xmlrpc(Session::getInt('uid'),
-                                Session::get('password'),
+        $client =& lists_xmlrpc(S::v('uid'),
+                                S::v('password'),
                                 $globals->asso('mail_domain'));
         $page->assign('listes', $client->get_lists());
 
@@ -365,8 +365,8 @@ class XnetGrpModule extends PLModule
                     require_once 'diogenes/diogenes.hermes.inc.php';
                     $mailer = new HermesMailer();
                     $mailer->addTo("$u@polytechnique.org");
-                    $mailer->setFrom('"'.Session::get('prenom').' '.Session::get('nom')
-                                     .'" <'.Session::get('forlife').'@polytechnique.org>');
+                    $mailer->setFrom('"'.S::v('prenom').' '.S::v('nom')
+                                     .'" <'.S::v('forlife').'@polytechnique.org>');
                     $mailer->setSubject('['.$globals->asso('nom').'] Demande d\'inscription');
                     $message = "Cher Camarade,\n"
                              . "\n"
@@ -384,8 +384,8 @@ class XnetGrpModule extends PLModule
                     require_once 'diogenes/diogenes.hermes.inc.php';
                     $mailer = new HermesMailer();
                     $mailer->addTo("$u@polytechnique.org");
-                    $mailer->setFrom('"'.Session::get('prenom').' '.Session::get('nom')
-                                     .'" <'.Session::get('forlife').'@polytechnique.org>');
+                    $mailer->setFrom('"'.S::v('prenom').' '.S::v('nom')
+                                     .'" <'.S::v('forlife').'@polytechnique.org>');
                     $mailer->setSubject('['.$globals->asso('nom').'] Demande d\'inscription annulée');
                     $mailer->setTxtBody(Env::get('motif'));
                     $mailer->send();
@@ -422,12 +422,12 @@ class XnetGrpModule extends PLModule
             $append = "\n"
                     . "-- \n"
                     . "Ce message a été envoyé suite à la demande d'inscription de\n"
-                    . Session::get('prenom').' '.Session::get('nom').' (X'.Session::get('promo').")\n"
+                    . S::v('prenom').' '.S::v('nom').' (X'.S::v('promo').")\n"
                     . "Via le site www.polytechnique.net. Tu peux choisir de valider ou\n"
                     . "de refuser sa demande d'inscription depuis la page :\n"
                     .
                     "http://www.polytechnique.net/".$globals->asso("diminutif")."/subscribe/"
-                        .Session::get('forlife')."\n"
+                        .S::v('forlife')."\n"
                     . "\n"
                     . "En cas de problème, contacter l'équipe de Polytechnique.org\n"
                     . "à l'adresse : support@polytechnique.org\n";
@@ -443,8 +443,8 @@ class XnetGrpModule extends PLModule
             require_once 'diogenes/diogenes.hermes.inc.php';
             $mailer = new HermesMailer();
             $mailer->addTo($to);
-            $mailer->setFrom('"'.Session::get('prenom').' '.Session::get('nom')
-                             .'" <'.Session::get('forlife').'@polytechnique.org>');
+            $mailer->setFrom('"'.S::v('prenom').' '.S::v('nom')
+                             .'" <'.S::v('forlife').'@polytechnique.org>');
             $mailer->setSubject('['.$globals->asso('nom').'] Demande d\'inscription');
             $mailer->setTxtBody(Post::get('message').$append);
             $mailer->send();
@@ -527,8 +527,7 @@ class XnetGrpModule extends PLModule
         require_once 'xnet/mail.inc.php';
 
         new_groupadmin_page('xnet/groupe/annuaire-admin.tpl');
-        $client =& lists_xmlrpc(Session::getInt('uid'),
-                                Session::get('password'),
+        $client =& lists_xmlrpc(S::v('uid'), S::v('password'),
                                 $globals->asso('mail_domain'));
         $lists  = $client->get_lists();
         if (!$lists) $lists = array();
@@ -637,7 +636,7 @@ class XnetGrpModule extends PLModule
         if (($domain = $globals->asso('mail_domain')) && empty($user_same_email)) {
 
             require 'lists.inc.php';
-            $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $domain);
+            $client =& lists_xmlrpc(S::v('uid'), S::v('password'), $domain);
             $listes = $client->get_lists($user['email2']);
 
             foreach ($listes as $liste) {
@@ -677,8 +676,7 @@ class XnetGrpModule extends PLModule
         }
 
         require 'lists.inc.php';
-        $client =& lists_xmlrpc(Session::getInt('uid'),
-                                Session::get('password'),
+        $client =& lists_xmlrpc(S::v('uid'), S::v('password'),
                                 $globals->asso('mail_domain'));
 
         if (Post::has('change')) {
index 4241e5a..6f25969 100644 (file)
@@ -57,8 +57,7 @@ class XnetListsModule extends ListsModule
 
         require_once 'lists.inc.php';
 
-        $this->client =& lists_xmlrpc(Session::getInt('uid'),
-                                      Session::get('password'),
+        $this->client =& lists_xmlrpc(S::v('uid'), S::v('password'),
                                       $globals->asso('mail_domain'));
 
         $page->useMenu();
@@ -148,7 +147,7 @@ class XnetListsModule extends ListsModule
         $ret = $this->client->create_list(
                     $liste, Post::get('desc'), Post::get('advertise'),
                     Post::get('modlevel'), Post::get('inslevel'),
-                    array(Session::get('forlife')), array());
+                    array(S::v('forlife')), array());
 
         $dom = strtolower($globals->asso("mail_domain"));
         $red = $dom.'_'.$liste;
index 5f4324a..5caa432 100644 (file)
@@ -33,8 +33,8 @@ function smarty_block_min_auth($params, $content, &$smarty)
     if( empty($content) || empty($params['level'] ))
         return;
     if( ($params['level'] == 'public') ||
-        ($params['level'] == 'cookie' && logged()) ||
-        ($params['level'] == 'auth' && identified()) )
+        ($params['level'] == 'cookie' && S::logged()) ||
+        ($params['level'] == 'auth' && S::identified()) )
         return $content;
 }
 ?>
index 31a9ac1..24430a2 100644 (file)
@@ -30,7 +30,7 @@
  */
 function smarty_block_only_public($params, $content, &$smarty)
 {
-    if( empty($content) || logged() )
+    if( empty($content) || S::logged() )
         return;
     return $content;
 }
index 56299f2..51ff85d 100644 (file)
@@ -33,7 +33,7 @@ function smarty_block_perms($params, $content, &$smarty)
     if( empty($content) || empty($params['level'] ))
         return;
     if( ($params['level'] == 'public') ||
-        ($params['level'] == 'admin' && has_perms()) )
+        ($params['level'] == 'admin' && S::has_perms()) )
         return $content;
 }
 ?>
index 5c4cc53..1b680e5 100644 (file)
@@ -22,7 +22,7 @@
  
 function smarty_insert_getNbNotifs($params, &$smarty)
 {
-    if(logged()) {
+    if(S::logged()) {
        require_once('notifs.inc.php');
        return getNbNotifs();
     }
index 3b7a55a..56e02b3 100644 (file)
@@ -24,7 +24,7 @@ function smarty_insert_getUsername()
     global $globals;
 
     $id = Cookie::getInt('ORGuid', -1);
-    $id = Session::getInt($_SESSION['uid'], $id);
+    $id = S::v($_SESSION['uid'], $id);
     
     if ($id<0) {
         return "";
index d674b36..e6974e7 100644 (file)
@@ -2,11 +2,11 @@
 
 $AuthFunction = 'AuthPlatal';
 
-$Conditions['logged']      = logged();
-$Conditions['identified']  = identified();
-$Conditions['has_perms']   = has_perms();
+$Conditions['logged']      = S::logged();
+$Conditions['identified']  = S::identified();
+$Conditions['has_perms']   = S::has_perms();
 $Conditions['public']      = 'true';
-$Conditions['only_public'] = !identified();
+$Conditions['only_public'] = !S::identified();
 
 $HandleAuth['diff'] = 'edit';
 $HandleAuth['source'] = 'edit';
@@ -55,7 +55,7 @@ function authPerms($pagename, $key, $could=false, $smarty=false)
              $iauth = false;
              switch ($vars[1])
              {
-               case 'session':$iauth = Session::get($vars[2]) == $param; break;
+               case 'session':$iauth = S::v($vars[2]) == $param; break;
                case 'request':$iauth = Env::get($vars[2]) == $param; break;
              }
           }
@@ -141,7 +141,7 @@ function AuthPlatal($pagename, $level, $authprompt, $since)
     $panel .= ">><<\n";
     $panel .= "{/if}\n";
   
-    if ((identified() && has_perms()) || authPerms($pagename, $passwds[$level]))
+    if ((S::identified() && S::has_perms()) || authPerms($pagename, $passwds[$level]))
     {
         $page_read['=passwd'] = $passwds;
         $page_read['=pwsource'] = $pwsources;
@@ -158,14 +158,14 @@ function AuthPlatal($pagename, $level, $authprompt, $since)
     // if we arrive here, the user doesn't have enough permission to access page
 
     // maybe it is because he is not identified
-    if ($authprompt && !identified())
+    if ($authprompt && !S::identified())
     {
         new_identification_page(); 
     }
 
     global $page;
     new_identification_page();
-    if (has_perms()) {
+    if (S::has_perms()) {
         $page->trig('Erreur : page Wiki inutilisable sur plat/al');
     } else {
         $page->trig("Tu n'as pas le droit d'accéder à ce service");
index 5ba099f..abc19e9 100644 (file)
@@ -127,7 +127,7 @@ Probl
 <!-- Set up the form with the challenge value and an empty reply value //-->
 <form action="{$smarty.server.REQUEST_URI}" method="post" id="loginsub">
   <div>
-    <input type="hidden" name="challenge" value="{$smarty.session.session->challenge}" />
+    <input type="hidden" name="challenge" value="{$smarty.session.challenge}" />
     <input type="hidden" name="response"  value="" />
     <input type="hidden" name="xorpass"  value="" />
     <input type="hidden" name="username"  value="" />
index 4c7e821..32a06a7 100644 (file)
@@ -77,7 +77,7 @@
 <!-- Set up the form with the challenge value and an empty reply value -->
 <form action="{$smarty.server.REQUEST_URI}" method="post" id="loginsub">
   <div>
-    <input type="hidden" name="challenge" value="{$smarty.session.session->challenge}" />
+    <input type="hidden" name="challenge" value="{$smarty.session.challenge}" />
     <input type="hidden" name="username"  value="{$smarty.cookies.ORGuid}" />
     <input type="hidden" name="xorpass"  value="" />
     <input type="hidden" name="remember"  value="" />
index 14d3cde..74bfbcb 100644 (file)
           {list_all_my_groups}
           {only_public}
           <div>Me connecter :</div>
-          <a class='gp' href="{$smarty.session.session->loginX}">polytechnicien</a>
+          <a class='gp' href="{$smarty.session.loginX}">polytechnicien</a>
           {/only_public}
 
           <a href="{rel}/manuel" title="Manuel d'aide en ligne" style="float: right"><img src="{rel}/images/manuel.png" alt="manuel" /></a>