From cab0809050d58f8484608e91f7555ebd69dcb451 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Mon, 17 Jul 2006 10:29:39 +0000 Subject: [PATCH] pending commit, finished during MQ/S download ... 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 --- classes/Platal.php | 3 +- classes/Session.php | 74 +++++++++++++++++++++++++++++ hooks/tmp.inc.php | 10 ++-- hooks/webredirect.inc.php | 6 +-- htdocs.net/groupe/getCityInfos.php | 2 +- htdocs.net/groupe/getData.php | 2 +- htdocs/admin/lists.php | 2 +- htdocs/admin/synchro_ax.php | 4 +- htdocs/admin/utilisateurs.php | 8 ++-- include/banana.inc.php | 18 +++---- include/emails.inc.php | 10 ++-- include/money/cyberpaiement.inc.php | 8 ++-- include/money/paypal.inc.php | 10 ++-- include/newsletter.inc.php | 6 +-- include/notifs.inc.php | 6 +-- include/platal/env.inc.php | 64 ------------------------- include/platal/session.inc.php | 45 ++---------------- include/profil/assign_poly.inc.php | 2 +- include/profil/get_adresses.inc.php | 10 ++-- include/profil/get_deco.inc.php | 10 ++-- include/profil/get_emploi.inc.php | 4 +- include/profil/get_general.inc.php | 6 +-- include/profil/get_mentor.inc.php | 14 +++--- include/profil/get_poly.inc.php | 10 ++-- include/profil/get_skill.inc.php | 12 ++--- include/profil/update_adresses.inc.php | 10 ++-- include/profil/update_deco.inc.php | 2 +- include/profil/update_emploi.inc.php | 4 +- include/profil/update_general.inc.php | 16 +++---- include/profil/update_mentor.inc.php | 2 +- include/profil/update_poly.inc.php | 2 +- include/search.inc.php | 6 +-- include/search/classes.inc.php | 2 +- include/user.func.inc.php | 4 +- include/validations.inc.php | 4 +- include/validations/listes.inc.php | 2 +- include/wiki.inc.php | 8 ++-- include/xnet.inc.php | 4 +- include/xnet/page.inc.php | 16 +++---- include/xnet/session.inc.php | 71 ++++++++++----------------- include/xnet/smarty.plugins.inc.php | 4 +- include/xorg/menu.inc.php | 6 +-- include/xorg/page.inc.php | 18 +++---- include/xorg/session.inc.php | 87 ++++++++++++++-------------------- modules/auth.php | 2 +- modules/auth/auth.inc.php | 16 +++---- modules/banana.php | 10 ++-- modules/carnet.php | 18 +++---- modules/email.php | 32 ++++++------- modules/events.php | 32 ++++++------- modules/lists.php | 8 ++-- modules/marketing.php | 8 ++-- modules/payment.php | 2 +- modules/platal.php | 43 ++++++++--------- modules/profile.php | 60 +++++++++++------------ modules/register.php | 6 +-- modules/search.php | 12 ++--- modules/xnet.php | 2 +- modules/xnetevents.php | 14 +++--- modules/xnetevents/xnetevents.inc.php | 8 ++-- modules/xnetgrp.php | 34 +++++++------ modules/xnetlists.php | 5 +- plugins/block.min_auth.php | 4 +- plugins/block.only_public.php | 2 +- plugins/block.perms.php | 2 +- plugins/insert.getNbNotifs.php | 2 +- plugins/insert.getUserName.php | 2 +- plugins/pmwiki.platalAuth.php | 16 +++---- templates/password_prompt.tpl | 2 +- templates/password_prompt_logged.tpl | 2 +- templates/xnet/skin.tpl | 2 +- 71 files changed, 444 insertions(+), 516 deletions(-) create mode 100644 classes/Session.php diff --git a/classes/Platal.php b/classes/Platal.php index a2048d3..88c6fd1 100644 --- a/classes/Platal.php +++ b/classes/Platal.php @@ -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 index 0000000..0a641a6 --- /dev/null +++ b/classes/Session.php @@ -0,0 +1,74 @@ += AUTH_COOKIE; + } + + function identified() + { + return Session::v('auth', AUTH_PUBLIC) >= AUTH_MDP; + } +} + +class S extends Session { } + +?> diff --git a/hooks/tmp.inc.php b/hooks/tmp.inc.php index a965508..491e97b 100644 --- a/hooks/tmp.inc.php +++ b/hooks/tmp.inc.php @@ -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 sous forme de ' - .Session::get('mail_fmt', 'html').'', + .S::v('mail_fmt', 'html').'', '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 ) diff --git a/hooks/webredirect.inc.php b/hooks/webredirect.inc.php index 47c46b6..3b574b8 100644 --- a/hooks/webredirect.inc.php +++ b/hooks/webredirect.inc.php @@ -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( diff --git a/htdocs.net/groupe/getCityInfos.php b/htdocs.net/groupe/getCityInfos.php index abfb114..eda7d7d 100644 --- a/htdocs.net/groupe/getCityInfos.php +++ b/htdocs.net/groupe/getCityInfos.php @@ -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(); diff --git a/htdocs.net/groupe/getData.php b/htdocs.net/groupe/getData.php index 28701ab..b8f3d82 100644 --- a/htdocs.net/groupe/getData.php +++ b/htdocs.net/groupe/getData.php @@ -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"); diff --git a/htdocs/admin/lists.php b/htdocs/admin/lists.php index 281d879..1674404 100644 --- a/htdocs/admin/lists.php +++ b/htdocs/admin/lists.php @@ -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(); diff --git a/htdocs/admin/synchro_ax.php b/htdocs/admin/synchro_ax.php index 574e844..b881f73 100644 --- a/htdocs/admin/synchro_ax.php +++ b/htdocs/admin/synchro_ax.php @@ -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'); diff --git a/htdocs/admin/utilisateurs.php b/htdocs/admin/utilisateurs.php index 0d47a54..3f17653 100644 --- a/htdocs/admin/utilisateurs.php +++ b/htdocs/admin/utilisateurs.php @@ -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; diff --git a/include/banana.inc.php b/include/banana.inc.php index c395e8a..0529996 100644 --- a/include/banana.inc.php +++ b/include/banana.inc.php @@ -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); diff --git a/include/emails.inc.php b/include/emails.inc.php index 3979152..0a7cf14 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -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) { diff --git a/include/money/cyberpaiement.inc.php b/include/money/cyberpaiement.inc.php index 2acb3ea..0030fc5 100644 --- a/include/money/cyberpaiement.inc.php +++ b/include/money/cyberpaiement.inc.php @@ -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' => '.', diff --git a/include/money/paypal.inc.php b/include/money/paypal.inc.php index b4cdc95..910c016 100644 --- a/include/money/paypal.inc.php +++ b/include/money/paypal.inc.php @@ -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 diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 3fa2a2c..06d3e54 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -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); } diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 4240139..71ef1e9 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -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 diff --git a/include/platal/env.inc.php b/include/platal/env.inc.php index be87caa..4c35b98 100644 --- a/include/platal/env.inc.php +++ b/include/platal/env.inc.php @@ -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 diff --git a/include/platal/session.inc.php b/include/platal/session.inc.php index 73de7fe..6cd8dbf 100644 --- a/include/platal/session.inc.php +++ b/include/platal/session.inc.php @@ -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: ?> diff --git a/include/profil/assign_poly.inc.php b/include/profil/assign_poly.inc.php index ec98308..9dcdbef 100644 --- a/include/profil/assign_poly.inc.php +++ b/include/profil/assign_poly.inc.php @@ -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 diff --git a/include/profil/get_adresses.inc.php b/include/profil/get_adresses.inc.php index 42b4e58..71293a7 100644 --- a/include/profil/get_adresses.inc.php +++ b/include/profil/get_adresses.inc.php @@ -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']; diff --git a/include/profil/get_deco.inc.php b/include/profil/get_deco.inc.php index d4542e9..59c4e19 100644 --- a/include/profil/get_deco.inc.php +++ b/include/profil/get_deco.inc.php @@ -21,16 +21,16 @@ 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')) { diff --git a/include/profil/get_emploi.inc.php b/include/profil/get_emploi.inc.php index 00aa739..30693b2 100644 --- a/include/profil/get_emploi.inc.php +++ b/include/profil/get_emploi.inc.php @@ -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(); ?> diff --git a/include/profil/get_general.inc.php b/include/profil/get_general.inc.php index 528a05d..12e293f 100644 --- a/include/profil/get_general.inc.php +++ b/include/profil/get_general.inc.php @@ -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: diff --git a/include/profil/get_mentor.inc.php b/include/profil/get_mentor.inc.php index 08333e3..0034c12 100644 --- a/include/profil/get_mentor.inc.php +++ b/include/profil/get_mentor.inc.php @@ -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', ''); diff --git a/include/profil/get_poly.inc.php b/include/profil/get_poly.inc.php index d658eaa..e72c3b0 100644 --- a/include/profil/get_poly.inc.php +++ b/include/profil/get_poly.inc.php @@ -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)); } } diff --git a/include/profil/get_skill.inc.php b/include/profil/get_skill.inc.php index a5381b7..c28577a 100644 --- a/include/profil/get_skill.inc.php +++ b/include/profil/get_skill.inc.php @@ -22,19 +22,19 @@ 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(); diff --git a/include/profil/update_adresses.inc.php b/include/profil/update_adresses.inc.php index f834cbb..49c09ba 100644 --- a/include/profil/update_adresses.inc.php +++ b/include/profil/update_adresses.inc.php @@ -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']); } diff --git a/include/profil/update_deco.inc.php b/include/profil/update_deco.inc.php index 8208d5f..24eef73 100644 --- a/include/profil/update_deco.inc.php +++ b/include/profil/update_deco.inc.php @@ -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: ?> diff --git a/include/profil/update_emploi.inc.php b/include/profil/update_emploi.inc.php index 3b5120d..806f384 100644 --- a/include/profil/update_emploi.inc.php +++ b/include/profil/update_emploi.inc.php @@ -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)); ?> diff --git a/include/profil/update_general.inc.php b/include/profil/update_general.inc.php index 535b9c6..374fc01 100644 --- a/include/profil/update_general.inc.php +++ b/include/profil/update_general.inc.php @@ -20,21 +20,21 @@ ***************************************************************************/ 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: ?> diff --git a/include/profil/update_mentor.inc.php b/include/profil/update_mentor.inc.php index 4abf46f..75dc036 100644 --- a/include/profil/update_mentor.inc.php +++ b/include/profil/update_mentor.inc.php @@ -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); } diff --git a/include/profil/update_poly.inc.php b/include/profil/update_poly.inc.php index 5add42e..1f36023 100644 --- a/include/profil/update_poly.inc.php +++ b/include/profil/update_poly.inc.php @@ -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)); ?> diff --git a/include/search.inc.php b/include/search.inc.php index 32ccecc..296eaa1 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -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(); diff --git a/include/search/classes.inc.php b/include/search/classes.inc.php index c164852..5359e59 100644 --- a/include/search/classes.inc.php +++ b/include/search/classes.inc.php @@ -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, diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 11691be..9870f46 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -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 { diff --git a/include/validations.inc.php b/include/validations.inc.php index fdd0fae..1edb05c 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -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"; diff --git a/include/validations/listes.inc.php b/include/validations/listes.inc.php index bf9c493..fe06410 100644 --- a/include/validations/listes.inc.php +++ b/include/validations/listes.inc.php @@ -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); diff --git a/include/wiki.inc.php b/include/wiki.inc.php index 1b3f974..ae4c888 100644 --- a/include/wiki.inc.php +++ b/include/wiki.inc.php @@ -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 diff --git a/include/xnet.inc.php b/include/xnet.inc.php index 836efe4..aea2c12 100644 --- a/include/xnet.inc.php +++ b/include/xnet.inc.php @@ -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"); } diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index b150c37..a1af5e5 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -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); } } diff --git a/include/xnet/session.inc.php b/include/xnet/session.inc.php index 6a40919..83e3a72 100644 --- a/include/xnet/session.inc.php +++ b/include/xnet/session.inc.php @@ -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]; diff --git a/include/xnet/smarty.plugins.inc.php b/include/xnet/smarty.plugins.inc.php index fb18971..4bc287b 100644 --- a/include/xnet/smarty.plugins.inc.php +++ b/include/xnet/smarty.plugins.inc.php @@ -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 = '
Mes groupes :
'; while (list($nom, $mini) = $res->next()) { $html .= "• $nom"; diff --git a/include/xorg/menu.inc.php b/include/xorg/menu.inc.php index 0198d6f..41c9e45 100644 --- a/include/xorg/menu.inc.php +++ b/include/xorg/menu.inc.php @@ -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) { diff --git a/include/xorg/page.inc.php b/include/xorg/page.inc.php index e00fb63..5bc9e56 100644 --- a/include/xorg/page.inc.php +++ b/include/xorg/page.inc.php @@ -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(); } - + // }}} } diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index 9c3d81d..9d783e2 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -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 diff --git a/modules/auth.php b/modules/auth.php index cda2bdc..8f2f9b3 100644 --- a/modules/auth.php +++ b/modules/auth.php @@ -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(); diff --git a/modules/auth/auth.inc.php b/modules/auth/auth.inc.php index 7b6d0e8..dbc50f7 100644 --- a/modules/auth/auth.inc.php +++ b/modules/auth/auth.inc.php @@ -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; } diff --git a/modules/banana.php b/modules/banana.php index aa5ccca..3dab3d1 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -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' : '') diff --git a/modules/carnet.php b/modules/carnet.php index 62713fe..5241b1e 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -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()) { diff --git a/modules/email.php b/modules/email.php index ddecd56..5bd2046 100644 --- a/modules/email.php +++ b/modules/email.php @@ -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 ! diff --git a/modules/events.php b/modules/events.php index d5b9521..87b9e17 100644 --- a/modules/events.php +++ b/modules/events.php @@ -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 '\\0', $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); diff --git a/modules/lists.php b/modules/lists.php index c686573..95c2ec8 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -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 **/ diff --git a/modules/marketing.php b/modules/marketing.php index 1046574..ae2ad4a 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -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(); } diff --git a/modules/payment.php b/modules/payment.php index 2cd1c2d..07199aa 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -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); } diff --git a/modules/platal.php b/modules/platal.php index 5ebb7be..646656f 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -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 $url"); } 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"); diff --git a/modules/profile.php b/modules/profile.php index 92a01d6..fc92dba 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -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); diff --git a/modules/register.php b/modules/register.php index 2ea8483..52f7892 100644 --- a/modules/register.php +++ b/modules/register.php @@ -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')) { diff --git a/modules/search.php b/modules/search.php index 4f7be95..6024d6f 100644 --- a/modules/search.php +++ b/modules/search.php @@ -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'); diff --git a/modules/xnet.php b/modules/xnet.php index 1b368eb..22cdf7f 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -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); diff --git a/modules/xnetevents.php b/modules/xnetevents.php index 40fa385..d290d5e 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -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, diff --git a/modules/xnetevents/xnetevents.inc.php b/modules/xnetevents/xnetevents.inc.php index cc19ed7..e9cddbd 100644 --- a/modules/xnetevents/xnetevents.inc.php +++ b/modules/xnetevents/xnetevents.inc.php @@ -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(); } diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index beeb0b0..95e65c0 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -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')) { diff --git a/modules/xnetlists.php b/modules/xnetlists.php index 4241e5a..6f25969 100644 --- a/modules/xnetlists.php +++ b/modules/xnetlists.php @@ -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; diff --git a/plugins/block.min_auth.php b/plugins/block.min_auth.php index 5f4324a..5caa432 100644 --- a/plugins/block.min_auth.php +++ b/plugins/block.min_auth.php @@ -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; } ?> diff --git a/plugins/block.only_public.php b/plugins/block.only_public.php index 31a9ac1..24430a2 100644 --- a/plugins/block.only_public.php +++ b/plugins/block.only_public.php @@ -30,7 +30,7 @@ */ function smarty_block_only_public($params, $content, &$smarty) { - if( empty($content) || logged() ) + if( empty($content) || S::logged() ) return; return $content; } diff --git a/plugins/block.perms.php b/plugins/block.perms.php index 56299f2..51ff85d 100644 --- a/plugins/block.perms.php +++ b/plugins/block.perms.php @@ -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; } ?> diff --git a/plugins/insert.getNbNotifs.php b/plugins/insert.getNbNotifs.php index 5c4cc53..1b680e5 100644 --- a/plugins/insert.getNbNotifs.php +++ b/plugins/insert.getNbNotifs.php @@ -22,7 +22,7 @@ function smarty_insert_getNbNotifs($params, &$smarty) { - if(logged()) { + if(S::logged()) { require_once('notifs.inc.php'); return getNbNotifs(); } diff --git a/plugins/insert.getUserName.php b/plugins/insert.getUserName.php index 3b7a55a..56e02b3 100644 --- a/plugins/insert.getUserName.php +++ b/plugins/insert.getUserName.php @@ -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 ""; diff --git a/plugins/pmwiki.platalAuth.php b/plugins/pmwiki.platalAuth.php index d674b36..e6974e7 100644 --- a/plugins/pmwiki.platalAuth.php +++ b/plugins/pmwiki.platalAuth.php @@ -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"); diff --git a/templates/password_prompt.tpl b/templates/password_prompt.tpl index 5ba099f..abc19e9 100644 --- a/templates/password_prompt.tpl +++ b/templates/password_prompt.tpl @@ -127,7 +127,7 @@ Probl
- + diff --git a/templates/password_prompt_logged.tpl b/templates/password_prompt_logged.tpl index 4c7e821..32a06a7 100644 --- a/templates/password_prompt_logged.tpl +++ b/templates/password_prompt_logged.tpl @@ -77,7 +77,7 @@
- + diff --git a/templates/xnet/skin.tpl b/templates/xnet/skin.tpl index 14d3cde..74bfbcb 100644 --- a/templates/xnet/skin.tpl +++ b/templates/xnet/skin.tpl @@ -143,7 +143,7 @@ {list_all_my_groups} {only_public}
Me connecter :
- polytechnicien + polytechnicien {/only_public} manuel -- 2.1.4