From a3a049fc80d3707bcc76903ab89f73974c470c0c Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sun, 16 Jul 2006 22:48:18 +0000 Subject: [PATCH] remove smarty {version} function, we have {#globals.version#} for it !!! remove useless global $globals; lines. git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@528 839d8a87-29fc-0310-9880-83ba4fa771e5 --- bin/cron/clean.php | 1 - hooks/banana.inc.php | 4 +- include/applis.func.inc.php | 3 - include/banana.inc.php | 2 +- include/contacts.pdf.inc.php | 1 - include/emails.inc.php | 37 ++--- include/fonction.emploi.inc.php | 1 - include/geoloc.inc.php | 35 ++--- include/homonymes.inc.php | 2 - include/marketing.inc.php | 3 - include/money.inc.php | 4 +- include/money/trezo.inc.php | 1 - include/newsletter.inc.php | 16 +- include/nomusage.inc.php | 2 - include/notifs.inc.php | 257 ++++++++++++++++----------------- include/platal/page.inc.php | 18 +-- include/profil/get_adresses.inc.php | 24 +-- include/profil/update_adresses.inc.php | 199 ++++++++++--------------- include/register.inc.php | 5 - include/rss.inc.php | 2 +- include/secteur.emploi.inc.php | 2 - include/synchro_ax.inc.php | 2 - include/user.func.inc.php | 22 +-- include/validations.inc.php | 5 - include/validations/evts.inc.php | 2 - include/validations/homonymes.inc.php | 1 - include/validations/listes.inc.php | 5 +- include/validations/marketing.inc.php | 2 - include/validations/nomusage.inc.php | 1 - include/validations/orange.inc.php | 4 - include/validations/paiements.inc.php | 10 +- include/validations/photos.inc.php | 4 +- include/xnet/session.inc.php | 1 - include/xnet/smarty.plugins.inc.php | 1 - include/xorg.inc.php | 2 +- include/xorg/menu.inc.php | 22 ++- include/xorg/session.inc.php | 2 - modules/auth.php | 2 - modules/auth/auth.inc.php | 2 - modules/carnet.php | 9 -- modules/events.php | 3 - modules/lists.php | 19 +-- modules/marketing.php | 14 -- modules/payment.php | 4 +- modules/platal.php | 14 -- modules/profile.php | 14 -- modules/register.php | 4 - modules/search.php | 2 - modules/stats.php | 8 - modules/trezo.php | 4 - modules/xnet.php | 6 - modules/xnetevents.php | 2 - modules/xnetlists.php | 2 - plugins/function.select_db_table.php | 7 +- plugins/function.select_nat.php | 1 - plugins/function.version.php | 28 ---- plugins/insert.getName.php | 1 - plugins/insert.getNbIns.php | 1 - plugins/insert.mkStats.php | 1 - templates/skin/common.footer.tpl | 2 +- 60 files changed, 286 insertions(+), 569 deletions(-) delete mode 100644 plugins/function.version.php diff --git a/bin/cron/clean.php b/bin/cron/clean.php index f1a5058..2e85b28 100755 --- a/bin/cron/clean.php +++ b/bin/cron/clean.php @@ -23,7 +23,6 @@ require('./connect.db.inc.php'); function query ($sql) { - global $globals; XDB::execute($sql); if (mysql_errno() != 0) { echo "error in \"$sql\" :\n", mysql_error(),"\n"; diff --git a/hooks/banana.inc.php b/hooks/banana.inc.php index d008532..15615c4 100644 --- a/hooks/banana.inc.php +++ b/hooks/banana.inc.php @@ -56,11 +56,9 @@ function banana_menu() function banana_subscribe($forlife, $uid, $promo, $password) { - global $globals; - $cible = array('xorg.general','xorg.pa.emploi','xorg.pa.divers','xorg.pa.logements'); $p_for = "xorg.promo.x$promo"; - + // récupération de l'id du forum promo $res = XDB::query("SELECT fid FROM forums.list WHERE nom={?}", $p_for); if ($res->numRows()) { diff --git a/include/applis.func.inc.php b/include/applis.func.inc.php index c3360ef..4d12501 100644 --- a/include/applis.func.inc.php +++ b/include/applis.func.inc.php @@ -22,7 +22,6 @@ global $page; function applis_options($current=0) { - global $globals; $html = ''; $res = XDB::iterator("select * from applis_def order by text"); while ($arr_appli = $res->next()) { @@ -45,7 +44,6 @@ $page->register_function('applis_options','_applis_options_smarty'); /** affiche un Array javascript contenant les types de chaque appli */ function applis_type(){ - global $globals; $html = ""; $res=XDB::iterRow("select type from applis_def order by text"); if (list($appli_type) = $res->next()) { @@ -61,7 +59,6 @@ $page->register_function('applis_type','applis_type'); /** affiche tous les types possibles d'applis */ function applis_type_all(){ - global $globals; $res = XDB::query("show columns from applis_def like 'type'"); $arr_appli = $res->fetchOneAssoc(); return str_replace(")","",str_replace("set(","",$arr_appli["Type"])); diff --git a/include/banana.inc.php b/include/banana.inc.php index 5b56c22..c395e8a 100644 --- a/include/banana.inc.php +++ b/include/banana.inc.php @@ -159,7 +159,7 @@ class PlatalBanana extends Banana function run($params = null) { - global $banana, $globals; + global $banana; if (Get::get('banana') == 'updateall' || (!is_null($params) && isset($params['banana']) && $params['banana'] == 'updateall')) { diff --git a/include/contacts.pdf.inc.php b/include/contacts.pdf.inc.php index 92a8f4a..e23bddd 100644 --- a/include/contacts.pdf.inc.php +++ b/include/contacts.pdf.inc.php @@ -248,7 +248,6 @@ class ContactsPDF extends FPDF function AddContact($x, $wp = true) { - global $globals; /* infamous hack : 1- we store the current state. 2- at the end, we find out if we triggered the page break, diff --git a/include/emails.inc.php b/include/emails.inc.php index b853b03..3979152 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -33,7 +33,6 @@ define("ERROR_LOOP_EMAIL", 4); function fix_bestalias($uid) { - global $globals; $res = XDB::query("SELECT COUNT(*) FROM aliases WHERE id={?} AND FIND_IN_SET('bestalias',flags) AND type!='homonyme'", $uid); if ($n = $res->fetchOneCell()) { return; @@ -50,15 +49,17 @@ function fix_bestalias($uid) function valide_email($str) { - $em = trim(rtrim($str)); - $em = str_replace('<', '', $em); - $em = str_replace('>', '', $em); - list($ident, $dom) = explode('@', $em); - if ($dom == $globals->mail->domain or $dom == $globals->mail->domain2) { - list($ident1) = explode('_', $ident); - list($ident) = explode('+', $ident1); - } - return $ident . '@' . $dom; + global $globals; + + $em = trim(rtrim($str)); + $em = str_replace('<', '', $em); + $em = str_replace('>', '', $em); + list($ident, $dom) = explode('@', $em); + if ($dom == $globals->mail->domain or $dom == $globals->mail->domain2) { + list($ident1) = explode('_', $ident); + list($ident) = explode('+', $ident1); + } + return $ident . '@' . $dom; } // }}} @@ -67,16 +68,15 @@ function valide_email($str) class Bogo { // {{{ properties - + var $state; var $_states = Array('let_spams', 'tag_spams', 'tag_and_drop_spams', 'drop_spams'); // }}} // {{{ constructor - + function Bogo($uid) { - global $globals; $res = XDB::query('SELECT email FROM emails WHERE uid={?} AND flags="filter"', $uid); if ($res->numRows()) { $this->state = $res->fetchOneCell(); @@ -92,9 +92,9 @@ class Bogo function change($uid, $state) { - global $globals; $this->state = is_int($state) ? $this->_states[$state] : $state; - XDB::execute('UPDATE emails SET email={?} WHERE uid={?} AND flags = "filter"', $this->state, $uid); + XDB::execute('UPDATE emails SET email={?} WHERE uid={?} AND flags = "filter"', + $this->state, $uid); } // }}} @@ -131,7 +131,6 @@ class Email function activate($uid) { - global $globals; if (!$this->active) { XDB::execute("UPDATE emails SET flags = 'active' WHERE uid={?} AND email={?}", $uid, $this->email); @@ -145,7 +144,6 @@ class Email function deactivate($uid) { - global $globals; if ($this->active) { XDB::execute("UPDATE emails SET flags ='' WHERE uid={?} AND email={?}", $uid, $this->email); @@ -159,7 +157,6 @@ class Email function rewrite($rew, $uid) { - global $globals; if ($this->rewrite == $rew) { return; } @@ -188,7 +185,6 @@ class Redirect function Redirect($_uid) { - global $globals; $this->uid=$_uid; $res = XDB::iterRow(" SELECT email, flags='active', rewrite, panne @@ -218,7 +214,6 @@ class Redirect function delete_email($email) { - global $globals; if (!$this->other_active($email)) { return ERROR_INACTIVE_REDIRECTION; } @@ -237,7 +232,6 @@ class Redirect function add_email($email) { - global $globals; $email_stripped = strtolower(trim($email)); if (!isvalid_email($email_stripped)) { return ERROR_INVALID_EMAIL; @@ -263,7 +257,6 @@ class Redirect function modify_email($emails_actifs,$emails_rewrite) { - global $globals; foreach ($this->emails as $i=>$mail) { if (in_array($mail->email,$emails_actifs)) { $this->emails[$i]->activate($this->uid); diff --git a/include/fonction.emploi.inc.php b/include/fonction.emploi.inc.php index c41c511..c0ac285 100644 --- a/include/fonction.emploi.inc.php +++ b/include/fonction.emploi.inc.php @@ -20,7 +20,6 @@ ***************************************************************************/ function select_fonction($fonction){ - global $globals; $html = "\n"; $res = XDB::iterRow("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) from fonctions_def ORDER BY id"); diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php index a371f5b..915ce5d 100644 --- a/include/geoloc.inc.php +++ b/include/geoloc.inc.php @@ -25,7 +25,6 @@ * @param $current pays actuellement selectionné */ function geoloc_country($current) { - global $globals; $res = XDB::iterRow('SELECT a2,pays FROM geoloc_pays ORDER BY pays'); $html = ""; while (list($my_id, $my_pays) = $res->next()) { @@ -47,7 +46,6 @@ $GLOBALS['page']->register_function('geoloc_country', '_geoloc_country_smarty'); * @param $current la region actuellement selectionnee */ function geoloc_region($country,$current) { - global $globals; $res = XDB::iterRow('SELECT region,name FROM geoloc_region where a2={?} ORDER BY name', $country); $html = ""; while (list($regid, $regname) = $res->next()) { @@ -113,17 +111,22 @@ function get_cities_maps($array) /** set new maps from url **/ function get_new_maps($url) { - if (!($f = @fopen($url, 'r'))) return false; - global $globals; - XDB::query('TRUNCATE TABLE geoloc_maps'); - $s = ''; - while (!feof($f)) { - $l = fgetcsv($f, 1024, ';', '"'); - foreach ($l as $i => $val) if ($val != 'NULL') $l[$i] = '\''.addslashes($val).'\''; - $s .= ',('.implode(',',$l).')'; - } - XDB::execute('INSERT INTO geoloc_maps VALUES '.substr($s, 1)); - return true; + if (!($f = @fopen($url, 'r'))) { + return false; + } + XDB::query('TRUNCATE TABLE geoloc_maps'); + $s = ''; + while (!feof($f)) { + $l = fgetcsv($f, 1024, ';', '"'); + foreach ($l as $i => $val) { + if ($val != 'NULL') { + $l[$i] = '\''.addslashes($val).'\''; + } + } + $s .= ',('.implode(',',$l).')'; + } + XDB::execute('INSERT INTO geoloc_maps VALUES '.substr($s, 1)); + return true; } // {{{ get_address_text($adr) @@ -159,7 +162,6 @@ function get_address_text($adr) { } if ($l) $t .= "\n".trim($l); if ($adr['country'] != '00' && (!$adr['countrytxt'] || $adr['countrytxt'] == strtoupper($adr['countrytxt']))) { - global $globals; $res = XDB::query("SELECT pays FROM geoloc_pays WHERE a2 = {?}", $adr['country']); $adr['countrytxt'] = $res->fetchOneCell(); } @@ -214,7 +216,6 @@ function cut_address($txt) { * @param $uid the id of the user */ function localize_addresses($uid) { - global $globals; $res = XDB::iterator("SELECT * FROM adresses WHERE uid = {?} and (cityid IS NULL OR cityid = 0)", $uid); $erreur = Array(); @@ -260,7 +261,6 @@ function localize_addresses($uid) { // {{{ function fix_cities_not_on_map($limit) function fix_cities_not_on_map($limit=false) { - global $globals; $missing = XDB::query("SELECT c.id FROM geoloc_city AS c LEFT JOIN geoloc_city_in_maps AS m ON(c.id = m.city_id) WHERE m.city_id IS NULL".($limit?" LIMIT $limit":"")); $maps = get_cities_maps($missing->fetchColumn()); if ($maps) @@ -277,7 +277,6 @@ function fix_cities_not_on_map($limit=false) } function set_smallest_levels() { - global $globals; $maxlengths = XDB::iterRow("SELECT MAX(LENGTH(gm.path)), gcim.city_id FROM geoloc_city_in_maps AS gcim INNER JOIN geoloc_maps AS gm @@ -307,7 +306,6 @@ function size_of_city($nb) { $s = round(log($nb + 1)*2,2); if ($s < 1) return 1; function size_of_territory($nb) { return size_of_city($nb); } function geoloc_getData_subcities($mapid, $SFields, &$cities, $direct=true) { - global $globals; for ($i_mapfield=0; $i_mapfield < count($SFields) ; $i_mapfield++) if ($SFields[$i_mapfield]->fieldFormName == 'mapid') break; $SFields[$i_mapfield] = new MapSField('mapid', array('gcim.map_id'), array('adresses','geoloc_city_in_maps'), array('am','gcim'), array(getadr_join('am'), 'am.cityid = gcim.city_id'), $mapid); @@ -340,7 +338,6 @@ function geoloc_getData_subcities($mapid, $SFields, &$cities, $direct=true) { } function geoloc_getData_subcountries($mapid, $SFields, $minentities) { - global $globals; $countries = array(); $cities = array(); diff --git a/include/homonymes.inc.php b/include/homonymes.inc.php index 2777b2a..5b37d7c 100644 --- a/include/homonymes.inc.php +++ b/include/homonymes.inc.php @@ -20,7 +20,6 @@ ***************************************************************************/ function select_if_homonyme($uid) { - global $globals; $res = XDB::query("SELECT prenom,nom,a.alias AS forlife,h.alias AS loginbis FROM auth_user_md5 AS u INNER JOIN aliases AS a ON (a.id=u.user_id AND a.type='a_vie') @@ -56,7 +55,6 @@ function send_robot_homonyme($prenom, $nom, $forlife, $loginbis) { } function switch_bestalias($uid, $loginbis) { - global $globals; // check if loginbis was the bestalias $res = XDB::query("SELECT alias FROM aliases WHERE id = {?} AND FIND_IN_SET('bestalias', flags)", $uid); $bestalias = $res->fetchOneCell(); diff --git a/include/marketing.inc.php b/include/marketing.inc.php index 920b432..db2c1bc 100644 --- a/include/marketing.inc.php +++ b/include/marketing.inc.php @@ -24,7 +24,6 @@ require_once("xorg.misc.inc.php"); // {{{ function mark_from_mail function mark_from_mail($uid, $email) { - global $globals; $res = XDB::query( "SELECT u.nom, u.prenom, a.alias FROM register_marketing AS r @@ -34,7 +33,6 @@ function mark_from_mail($uid, $email) { $uid, $email); $sender = $res->fetchOneAssoc(); return "\"".$sender['prenom']." ".$sender['nom']."\" <".$sender['alias']."@polytechnique.org>"; - } // }}} @@ -81,7 +79,6 @@ function mark_text_mail($uid, $email) function mark_send_mail($uid, $email, $perso, $to='', $title='', $text='') { require_once("diogenes/diogenes.hermes.inc.php"); - global $globals; $hash = rand_url_id(12); XDB::execute('UPDATE register_marketing SET nb=nb+1,hash={?},last=NOW() WHERE uid={?} AND email={?}', $hash, $uid, $email); diff --git a/include/money.inc.php b/include/money.inc.php index 400019c..550e1ff 100644 --- a/include/money.inc.php +++ b/include/money.inc.php @@ -90,9 +90,7 @@ class Payment function event() { - global $globals; - if ($this->asso_id) - { + if ($this->asso_id) { $res = XDB::query("SELECT eid, a.diminutif FROM groupex.evenements AS e, groupex.asso AS a WHERE e.asso_id = {?} AND a.id = {?}", $this->asso_id, $this->asso_id); return $res->fetchOneAssoc(); } diff --git a/include/money/trezo.inc.php b/include/money/trezo.inc.php index 9bede9c..624bd61 100644 --- a/include/money/trezo.inc.php +++ b/include/money/trezo.inc.php @@ -51,7 +51,6 @@ function isDate($date) function solde_until($date='') { - global $globals; $sql = "SELECT SUM(credit)-SUM(debit) FROM money_trezo"; if (empty($date)) { $res = XDB::query($sql); diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 56092a9..3fa2a2c 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -50,8 +50,6 @@ class NewsLetter function NewsLetter($id=null) { - global $globals; - if (isset($id)) { if ($id == 'last') { $res = XDB::query("SELECT MAX(id) FROM newsletter WHERE bits!='new'"); @@ -90,7 +88,6 @@ class NewsLetter function setSent() { - global $globals; XDB::execute("UPDATE newsletter SET bits='sent' WHERE id={?}", $this->_id); } @@ -99,9 +96,8 @@ class NewsLetter function save() { - global $globals; XDB::execute('UPDATE newsletter SET date={?},titre={?},head={?} WHERE id={?}', - $this->_date, $this->_title, $this->_head, $this->_id); + $this->_date, $this->_title, $this->_head, $this->_id); } // }}} @@ -134,7 +130,6 @@ class NewsLetter function saveArticle(&$a) { - global $globals; if ($a->_aid>=0) { XDB::execute('REPLACE INTO newsletter_art (id,aid,cid,pos,title,body,append) VALUES ({?},{?},{?},{?},{?},{?},{?})', @@ -157,7 +152,6 @@ class NewsLetter function delArticle($aid) { - global $globals; XDB::execute('DELETE FROM newsletter_art WHERE id={?} AND aid={?}', $this->_id, $aid); foreach ($this->_arts as $key=>$art) { unset($this->_arts[$key]["a$aid"]); @@ -440,43 +434,37 @@ class NLArticle function insert_new_nl() { - global $globals; XDB::execute("INSERT INTO newsletter SET bits='new',date=NOW(),titre='to be continued'"); } function get_nl_slist() { - global $globals; $res = XDB::query("SELECT id,date,titre FROM newsletter ORDER BY date DESC"); return $res->fetchAllAssoc(); } function get_nl_list() { - global $globals; $res = XDB::query("SELECT id,date,titre FROM newsletter WHERE bits!='new' ORDER BY date DESC"); return $res->fetchAllAssoc(); } function get_nl_state() { - global $globals; $res = XDB::query('SELECT 1 FROM newsletter_ins WHERE user_id={?}', Session::getInt('uid')); return $res->fetchOneCell(); } function unsubscribe_nl() { - global $globals; XDB::execute('DELETE FROM newsletter_ins WHERE user_id={?}', Session::getInt('uid')); } function subscribe_nl($uid=-1) { - global $globals; $user = ($uid == -1) ? Session::getInt('uid') : $uid; XDB::execute('REPLACE INTO newsletter_ins (user_id,last) - VALUES ({?}, 0)', $user); + VALUES ({?}, 0)', $user); } function justify($text,$n) diff --git a/include/nomusage.inc.php b/include/nomusage.inc.php index 3d81cf7..af1b30a 100644 --- a/include/nomusage.inc.php +++ b/include/nomusage.inc.php @@ -20,8 +20,6 @@ ***************************************************************************/ function set_new_usage($uid, $usage, $alias=false) { - global $globals; - XDB::execute("UPDATE auth_user_md5 set nom_usage={?} WHERE user_id={?}",$usage ,$uid); XDB::execute("DELETE FROM aliases WHERE FIND_IN_SET('usage',flags) AND id={?}", $uid); if ($alias && $usage) { diff --git a/include/notifs.inc.php b/include/notifs.inc.php index fcb8320..4240139 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -28,7 +28,6 @@ define('WATCH_BIRTH', 4); function inscription_notifs_base($uid) { - global $globals; XDB::execute('REPLACE INTO watch_sub (uid,cid) SELECT {?},id FROM watch_cat', $uid); } @@ -37,20 +36,19 @@ function inscription_notifs_base($uid) function register_watch_op($uid, $cid, $date='', $info='') { - global $globals; if (empty($date)) { $date = date('Y-m-d'); }; XDB::execute('REPLACE INTO watch_ops (uid,cid,known,date,info) VALUES({?},{?},NOW(),{?},{?})', $uid, $cid, $date, $info); if($cid == WATCH_FICHE) { - XDB::execute('UPDATE auth_user_md5 SET DATE=NOW() WHERE user_id={?}', $uid); + XDB::execute('UPDATE auth_user_md5 SET DATE=NOW() WHERE user_id={?}', $uid); } elseif($cid == WATCH_INSCR) { - XDB::execute('REPLACE INTO contacts (uid,contact) - SELECT uid,ni_id - FROM watch_nonins - WHERE ni_id={?}', $uid); - XDB::execute('DELETE FROM watch_nonins WHERE ni_id={?}', $uid); + XDB::execute('REPLACE INTO contacts (uid,contact) + SELECT uid,ni_id + FROM watch_nonins + WHERE ni_id={?}', $uid); + XDB::execute('DELETE FROM watch_nonins WHERE ni_id={?}', $uid); } } @@ -86,7 +84,7 @@ function _select_notifs_base($table, $mail, $where) if ($mail) { $sql.=", w.uid AS aid, v.prenom AS aprenom, IF(v.nom_usage='',v.nom,v.nom_usage) AS anom, - b.alias AS abestalias, (v.flags='femme') AS sexe, q.core_mail_fmt AS mail_fmt"; + b.alias AS abestalias, (v.flags='femme') AS sexe, q.core_mail_fmt AS mail_fmt"; } $sql .= " @@ -119,7 +117,6 @@ function _select_notifs_base($table, $mail, $where) function select_notifs($mail, $uid=null, $last=null, $iterator=true) { - global $globals; $where = $mail ? 'q.watch_flags=3' : 'w.uid = {?}'; $sql = _select_notifs_base('contacts', $mail, $where.($mail?'':' AND (q.watch_flags=1 OR q.watch_flags=3)')) . " UNION DISTINCT "; $sql .= _select_notifs_base('watch_promo', $mail, $where) . " UNION DISTINCT "; @@ -143,7 +140,8 @@ function getNbNotifs() { $uid = Session::getInt('uid', -1); $watchlast = Session::get('watch_last'); - // selectionne les notifs de uid, sans detail sur le watcher, depuis $watchlast, meme ceux sans surveillance, non ordonnés + // selectionne les notifs de uid, sans detail sur le watcher, depuis + // $watchlast, meme ceux sans surveillance, non ordonnés $res = select_notifs(false, $uid, $watchlast, false); $n = $res->numRows(); $res->free(); @@ -161,26 +159,25 @@ class AllNotifs { var $_data = Array(); function AllNotifs() { - global $globals; - - $res = XDB::iterator("SELECT * FROM watch_cat"); - while($tmp = $res->next()) { + $res = XDB::iterator("SELECT * FROM watch_cat"); + while($tmp = $res->next()) { $this->_cats[$tmp['id']] = $tmp; } - // recupère tous les watchers, avec détails des watchers, a partir du watch_last de chacun, seulement ceux qui sont surveillés, ordonnés - $res = select_notifs(true); + // recupère tous les watchers, avec détails des watchers, a partir du + // watch_last de chacun, seulement ceux qui sont surveillés, ordonnés + $res = select_notifs(true); - while($tmp = $res->next()) { - $aid = $tmp['aid']; + while($tmp = $res->next()) { + $aid = $tmp['aid']; if (empty($this->_data[$aid])) { $this->_data[$aid] = Array("prenom" => $tmp['aprenom'], 'nom' => $tmp['anom'], 'bestalias'=>$tmp['abestalias'], 'sexe' => $tmp['sexe'], 'mail_fmt' => $tmp['mail_fmt'], 'dcd'=>$tmp['dcd']); } - unset($tmp['aprenom'], $tmp['anom'], $tmp['abestalias'], $tmp['aid'], $tmp['sexe'], $tmp['mail_fmt'], $tmp['dcd']); - $this->_data[$aid]['data'][$tmp['cid']][] = $tmp; - } + unset($tmp['aprenom'], $tmp['anom'], $tmp['abestalias'], $tmp['aid'], $tmp['sexe'], $tmp['mail_fmt'], $tmp['dcd']); + $this->_data[$aid]['data'][$tmp['cid']][] = $tmp; + } } } @@ -191,27 +188,27 @@ class Notifs { var $_uid; var $_cats = Array(); var $_data = Array(); - + function Notifs($uid, $up=false) { - global $globals; - $this->_uid = $uid; - - $res = XDB::iterator("SELECT * FROM watch_cat"); - while($tmp = $res->next()) { + $this->_uid = $uid; + + $res = XDB::iterator("SELECT * FROM watch_cat"); + while($tmp = $res->next()) { $this->_cats[$tmp['id']] = $tmp; } - $lastweek = date('YmdHis',mktime() - 7*24*60*60); + $lastweek = date('YmdHis',mktime() - 7*24*60*60); - // recupere les notifs du watcher $uid, sans detail sur le watcher, depuis la semaine dernière, meme ceux sans surveillance, ordonnés + // recupere les notifs du watcher $uid, sans detail sur le watcher, + // depuis la semaine dernière, meme ceux sans surveillance, ordonnés $res = select_notifs(false, $uid, $lastweek); - while($tmp = $res->next()) { - $this->_data[$tmp['cid']][$tmp['promo']][] = $tmp; - } + while($tmp = $res->next()) { + $this->_data[$tmp['cid']][$tmp['promo']][] = $tmp; + } - if($up) { - XDB::execute('UPDATE auth_user_quick SET watch_last=NOW() WHERE user_id={?}', $uid); - } + if($up) { + XDB::execute('UPDATE auth_user_quick SET watch_last=NOW() WHERE user_id={?}', $uid); + } } } @@ -226,47 +223,47 @@ class Watch { var $_subs; var $watch_contacts; var $watch_mail; - + function Watch($uid) { - global $globals; - $this->_uid = $uid; - $this->_promos = new PromoNotifs($uid); - $this->_nonins = new NoninsNotifs($uid); - $this->_subs = new WatchSub($uid); - $res = XDB::query("SELECT FIND_IN_SET('contacts',watch_flags),FIND_IN_SET('mail',watch_flags) - FROM auth_user_quick - WHERE user_id={?}", $uid); - list($this->watch_contacts,$this->watch_mail) = $res->fetchOneRow(); - - $res = XDB::iterator("SELECT * FROM watch_cat"); - while($tmp = $res->next()) { + $this->_uid = $uid; + $this->_promos = new PromoNotifs($uid); + $this->_nonins = new NoninsNotifs($uid); + $this->_subs = new WatchSub($uid); + $res = XDB::query("SELECT FIND_IN_SET('contacts',watch_flags),FIND_IN_SET('mail',watch_flags) + FROM auth_user_quick + WHERE user_id={?}", $uid); + list($this->watch_contacts,$this->watch_mail) = $res->fetchOneRow(); + + $res = XDB::iterator("SELECT * FROM watch_cat"); + while($tmp = $res->next()) { $this->_cats[$tmp['id']] = $tmp; } } function saveFlags() { - global $globals; - $flags = ""; - if($this->watch_contacts) $flags = "contacts"; - if($this->watch_mail) $flags .= ($flags ? ',' : '')."mail"; - XDB::execute('UPDATE auth_user_quick SET watch_flags={?} WHERE user_id={?}', $flags, $this->_uid); - + $flags = ""; + if ($this->watch_contacts) + $flags = "contacts"; + if ($this->watch_mail) + $flags .= ($flags ? ',' : '')."mail"; + XDB::execute('UPDATE auth_user_quick SET watch_flags={?} WHERE user_id={?}', + $flags, $this->_uid); } function cats() { - return $this->_cats; + return $this->_cats; } function subs($i) { - return $this->_subs->_data[$i]; + return $this->_subs->_data[$i]; } - + function promos() { - return $this->_promos->toRanges(); + return $this->_promos->toRanges(); } - + function nonins() { - return $this->_nonins->_data; + return $this->_nonins->_data; } } @@ -278,24 +275,22 @@ class WatchSub { var $_data = Array(); function WatchSub($uid) { - $this->_uid = $uid; - global $globals; - $res = XDB::iterRow('SELECT cid FROM watch_sub WHERE uid={?}', $uid); - while(list($c) = $res->next()) { + $this->_uid = $uid; + $res = XDB::iterRow('SELECT cid FROM watch_sub WHERE uid={?}', $uid); + while(list($c) = $res->next()) { $this->_data[$c] = $c; } } function update($ind) { - global $globals; - $this->_data = Array(); - XDB::execute('DELETE FROM watch_sub WHERE uid={?}', $this->_uid); - foreach(Env::getMixed($ind) as $key=>$val) { - XDB::query('INSERT INTO watch_sub SELECT {?},id FROM watch_cat WHERE id={?}', $this->_uid, $key); - if(mysql_affected_rows()) { + $this->_data = Array(); + XDB::execute('DELETE FROM watch_sub WHERE uid={?}', $this->_uid); + foreach(Env::getMixed($ind) as $key=>$val) { + XDB::query('INSERT INTO watch_sub SELECT {?},id FROM watch_cat WHERE id={?}', $this->_uid, $key); + if(mysql_affected_rows()) { $this->_data[$key] = $key; } - } + } } } @@ -307,71 +302,66 @@ class PromoNotifs { var $_data = Array(); function PromoNotifs($uid) { - $this->_uid = $uid; - global $globals; - $res = XDB::iterRow('SELECT promo FROM watch_promo WHERE uid={?} ORDER BY promo', $uid); - while (list($p) = $res->next()) { + $this->_uid = $uid; + $res = XDB::iterRow('SELECT promo FROM watch_promo WHERE uid={?} ORDER BY promo', $uid); + while (list($p) = $res->next()) { $this->_data[intval($p)] = intval($p); } } function add($p) { - global $globals; - $promo = intval($p); - XDB::execute('REPLACE INTO watch_promo (uid,promo) VALUES({?},{?})', $this->_uid, $promo); - $this->_data[$promo] = $promo; - asort($this->_data); + $promo = intval($p); + XDB::execute('REPLACE INTO watch_promo (uid,promo) VALUES({?},{?})', $this->_uid, $promo); + $this->_data[$promo] = $promo; + asort($this->_data); } - + function del($p) { - global $globals; - $promo = intval($p); - XDB::execute('DELETE FROM watch_promo WHERE uid={?} AND promo={?}', $this->_uid, $promo); - unset($this->_data[$promo]); + $promo = intval($p); + XDB::execute('DELETE FROM watch_promo WHERE uid={?} AND promo={?}', $this->_uid, $promo); + unset($this->_data[$promo]); } - + function addRange($_p1,$_p2) { - global $globals; - $p1 = intval($_p1); - $p2 = intval($_p2); - $values = Array(); - for($i = min($p1,$p2); $i<=max($p1,$p2); $i++) { - $values[] = "('{$this->_uid}',$i)"; - $this->_data[$i] = $i; - } - XDB::execute('REPLACE INTO watch_promo (uid,promo) VALUES '.join(',',$values)); - asort($this->_data); + $p1 = intval($_p1); + $p2 = intval($_p2); + $values = Array(); + for($i = min($p1,$p2); $i<=max($p1,$p2); $i++) { + $values[] = "('{$this->_uid}',$i)"; + $this->_data[$i] = $i; + } + XDB::execute('REPLACE INTO watch_promo (uid,promo) VALUES '.join(',',$values)); + asort($this->_data); } function delRange($_p1,$_p2) { - global $globals; - $p1 = intval($_p1); - $p2 = intval($_p2); - $where = Array(); - for($i = min($p1,$p2); $i<=max($p1,$p2); $i++) { - $where[] = "promo=$i"; - unset($this->_data[$i]); - } - XDB::execute('DELETE FROM watch_promo WHERE uid={?} AND ('.join(' OR ',$where).')', $this->_uid); + $p1 = intval($_p1); + $p2 = intval($_p2); + $where = Array(); + for($i = min($p1,$p2); $i<=max($p1,$p2); $i++) { + $where[] = "promo=$i"; + unset($this->_data[$i]); + } + XDB::execute('DELETE FROM watch_promo WHERE uid={?} AND ('.join(' OR ',$where).')', $this->_uid); } function toRanges() { - $ranges = Array(); - $I = Array(); - foreach($this->_data as $promo) { - if(!isset($I[0])) { - $I = Array($promo,$promo); - } - elseif($I[1]+1 == $promo) { - $I[1] ++; - } - else { - $ranges[] = $I; - $I = Array($promo,$promo); - } - } - if(isset($I[0])) $ranges[] = $I; - return $ranges; + $ranges = Array(); + $I = Array(); + foreach($this->_data as $promo) { + if(!isset($I[0])) { + $I = Array($promo,$promo); + } + elseif($I[1]+1 == $promo) { + $I[1] ++; + } + else { + $ranges[] = $I; + $I = Array($promo,$promo); + } + } + if(isset($I[0])) $ranges[] = $I; + return $ranges; } } @@ -383,34 +373,31 @@ class NoninsNotifs { var $_data = Array(); function NoninsNotifs($uid) { - global $globals; - $this->_uid = $uid; - $res = XDB::iterator("SELECT u.prenom,IF(u.nom_usage='',u.nom,u.nom_usage) AS nom, u.promo, u.user_id + $this->_uid = $uid; + $res = XDB::iterator("SELECT u.prenom,IF(u.nom_usage='',u.nom,u.nom_usage) AS nom, u.promo, u.user_id FROM watch_nonins AS w INNER JOIN auth_user_md5 AS u ON (u.user_id = w.ni_id) WHERE w.uid = {?} - ORDER BY promo,nom", $uid); - while($tmp = $res->next()) { + ORDER BY promo,nom", $uid); + while($tmp = $res->next()) { $this->_data[$tmp['user_id']] = $tmp; } } function del($p) { - global $globals; - unset($this->_data["$p"]); - XDB::execute('DELETE FROM watch_nonins WHERE uid={?} AND ni_id={?}', $this->_uid, $p); + unset($this->_data["$p"]); + XDB::execute('DELETE FROM watch_nonins WHERE uid={?} AND ni_id={?}', $this->_uid, $p); } function add($p) { - global $globals; - XDB::execute('INSERT INTO watch_nonins (uid,ni_id) VALUES({?},{?})', $this->_uid, $p); - $res = XDB::query('SELECT prenom,IF(nom_usage="",nom,nom_usage) AS nom,promo,user_id + XDB::execute('INSERT INTO watch_nonins (uid,ni_id) VALUES({?},{?})', $this->_uid, $p); + $res = XDB::query('SELECT prenom,IF(nom_usage="",nom,nom_usage) AS nom,promo,user_id FROM auth_user_md5 WHERE user_id={?}', $p); - $this->_data["$p"] = $res->fetchOneAssoc(); + $this->_data["$p"] = $res->fetchOneAssoc(); } } - + // }}} ?> diff --git a/include/platal/page.inc.php b/include/platal/page.inc.php index e275732..b309c67 100644 --- a/include/platal/page.inc.php +++ b/include/platal/page.inc.php @@ -27,7 +27,7 @@ require_once 'platal/smarty.plugins.inc.php'; class PlatalPage extends Smarty { // {{{ properties - + var $_page_type; var $_tpl; var $_errors; @@ -73,7 +73,7 @@ class PlatalPage extends Smarty // }}} // {{{ function fakeDiogenes() - + function fakeDiogenes() { require_once 'diogenes/diogenes.core.page.inc.php'; @@ -86,7 +86,7 @@ class PlatalPage extends Smarty $this->register_function("tag","diogenes_func_tag"); $this->register_function("toolbar","diogenes_func_toolbar"); } - + // }}} // {{{ function changeTpl() @@ -114,7 +114,7 @@ class PlatalPage extends Smarty $this->assign("xorg_errors", $this->_errors); $this->assign("xorg_failure", $this->_failure); - + if ($this->_page_type == NO_SKIN) { $this->display($this->_tpl); exit; @@ -124,7 +124,7 @@ class PlatalPage extends Smarty $this->display($skin); exit; } - + if ($globals->debug & 1) { $this->assign('db_trace', $globals->db->trace_format($this, 'database-debug.tpl')); } @@ -139,7 +139,7 @@ class PlatalPage extends Smarty $fd = fopen($this->compile_dir."/valid.html","w"); fwrite($fd, $result); fclose($fd); - + exec($globals->spoolroot."/bin/devel/xhtml.validate.pl ".$this->compile_dir."/valid.html", $val); foreach ($val as $h) { if (preg_match("/^X-W3C-Validator-Errors: (\d+)$/", $h, $m)) { @@ -212,10 +212,10 @@ class PlatalPage extends Smarty // {{{ function doAuth() function doAuth() { } - + // }}} // {{{ function loadModule() - + function loadModule($modname) { require_once("$modname.inc.php"); @@ -239,7 +239,7 @@ class PlatalPage extends Smarty // }}} // {{{ function gassign - + function gassign($varname) { global $$varname; diff --git a/include/profil/get_adresses.inc.php b/include/profil/get_adresses.inc.php index 2593520..42b4e58 100644 --- a/include/profil/get_adresses.inc.php +++ b/include/profil/get_adresses.inc.php @@ -38,23 +38,23 @@ function is_adr_empty($adrid){ } function delete_address($adrid, $in_request_array = false){ - global $globals; - XDB::execute("DELETE FROM adresses WHERE uid = {?} AND adrid = {?}",Session::getInt('uid', -1), $adrid); - XDB::execute("DELETE FROM tels WHERE uid = {?} AND adrid = {?}",Session::getInt('uid', -1), $adrid); - if($in_request_array == true){ - unset($_REQUEST['adrid'][$adrid]); - } - else{ - unset($GLOBALS['adresses'][$adrid]); + XDB::execute("DELETE FROM adresses WHERE uid = {?} AND adrid = {?}", + Session::getInt('uid', -1), $adrid); + XDB::execute("DELETE FROM tels WHERE uid = {?} AND adrid = {?}", + Session::getInt('uid', -1), $adrid); + if ($in_request_array == true){ + unset($_REQUEST['adrid'][$adrid]); + } else{ + unset($GLOBALS['adresses'][$adrid]); } } //on verifie si on nous a demande une suppression $req_adrid_del = Env::getMixed('adrid_del', Array()); -for($i = 1; $i <= $nb_adr_max; $i++){ - if( isset( $req_adrid_del[$i] ) ) { - delete_address($i,true); - } +for ($i = 1; $i <= $nb_adr_max; $i++) { + if (isset($req_adrid_del[$i])) { + delete_address($i,true); + } } //$sql_order = "ORDER BY (NOT FIND_IN_SET('active', statut)), FIND_IN_SET('temporaire', statut)"; diff --git a/include/profil/update_adresses.inc.php b/include/profil/update_adresses.inc.php index ad1e9d8..f834cbb 100644 --- a/include/profil/update_adresses.inc.php +++ b/include/profil/update_adresses.inc.php @@ -22,131 +22,86 @@ reset($adresses); function insert_new_tel($adrid, $tel) { - global $globals; - if ($tel['tel'] == "") return; - 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']); + if ($tel['tel'] == "") + return; + 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']); } -foreach($adresses as $adrid => $adr){ +foreach ($adresses as $adrid => $adr) { - if($adr['nouvelle'] != 'new'){ // test si on vient de creer cette adresse dans verif_adresse.inc.php - - //construction des bits - $statut = ""; - if ($adr["secondaire"]) $statut .= 'res-secondaire,'; - if ($adr["courrier"]) $statut .= 'courrier,'; - if ($adr["active"]) $statut .= 'active,'; - if ($adr["temporaire"]) $statut .= 'temporaire,'; - if (! empty($statut)) $statut = substr($statut, 0, -1); + if ($adr['nouvelle'] != 'new') { + // test si on vient de creer cette adresse dans verif_adresse.inc.php - if ($adr["nouvelle"] == 'ajout') { - //nouvelle adresse - XDB::execute("INSERT INTO adresses SET - adr1 = {?}, - adr2 = {?}, - adr3 = {?}, - postcode = {?}, - city = {?}, - cityid = {?}, - country = {?}, - region = {?}, - regiontxt = {?}, - pub = {?}, - datemaj = NOW(), - statut = {?}, - uid = {?}, adrid = {?}", - $adr['adr1'], - $adr['adr2'], - $adr['adr3'], - $adr['postcode'], - $adr['city'], - $adr['cityid'], - $adr['country'], - $adr['region'], - $adr['regiontxt'], - $adr['pub'], - $statut, - Session::getInt('uid', -1), $adrid); - $telsvalues = ""; - foreach ($adr['tels'] as $tel) - insert_new_tel($adrid, $tel); - } - - else{ - //c'est une mise à jour - XDB::execute( - "UPDATE adresses SET - adr1 = {?}, - adr2 = {?}, - adr3 = {?}, - postcode = {?}, - city = {?}, - cityid = {?}, - country = {?}, - region = {?}, - regiontxt = {?}, - pub = {?}, - datemaj = NOW(), - statut = {?} - WHERE uid = {?} AND adrid = {?}", - $adr['adr1'], - $adr['adr2'], - $adr['adr3'], - $adr['postcode'], - $adr['city'], - $adr['cityid'], - $adr['country'], - $adr['region'], - $adr['regiontxt'], - $adr['pub'], - $statut, - Session::getInt('uid', -1), $adrid - ); - foreach ($adr['tels'] as $tel) { - if ($tel['new_tel']) - insert_new_tel($adrid, $tel); - else - if ($tel['tel'] != "") { - XDB::execute( - "UPDATE tels SET - tel_type = {?}, - tel_pub = {?}, - tel = {?} - WHERE - uid = {?} AND - adrid = {?} AND - telid = {?}", - $tel['tel_type'], - $tel['tel_pub'], - $tel['tel'], - Session::getInt('uid', -1), - $adrid, - $tel['telid']); - } else { - XDB::execute( - "DELETE FROM tels WHERE - uid = {?} AND - adrid = {?} AND - telid = {?}", - Session::getInt('uid', -1), - $adrid, - $tel['telid']); - } - } - }// fin nouvelle / ancienne adresse - }//fin if nouvellement crée + //construction des bits + $statut = ""; + if ($adr["secondaire"]) $statut .= 'res-secondaire,'; + if ($adr["courrier"]) $statut .= 'courrier,'; + if ($adr["active"]) $statut .= 'active,'; + if ($adr["temporaire"]) $statut .= 'temporaire,'; + if (! empty($statut)) $statut = substr($statut, 0, -1); + + if ($adr["nouvelle"] == 'ajout') { + //nouvelle adresse + XDB::execute("INSERT INTO adresses SET adr1 = {?}, adr2 = {?}, + adr3 = {?}, postcode = {?}, city = {?}, cityid = {?}, + country = {?}, region = {?}, regiontxt = {?}, + pub = {?}, datemaj = NOW(), statut = {?}, uid = {?}, + adrid = {?}", $adr['adr1'], $adr['adr2'], + $adr['adr3'], $adr['postcode'], $adr['city'], + $adr['cityid'], $adr['country'], $adr['region'], + $adr['regiontxt'], $adr['pub'], $statut, + Session::getInt('uid', -1), $adrid); + $telsvalues = ""; + foreach ($adr['tels'] as $tel) { + insert_new_tel($adrid, $tel); + } + } else { + //c'est une mise à jour + XDB::execute("UPDATE adresses SET adr1 = {?}, adr2 = {?}, + adr3 = {?}, postcode = {?}, city = {?}, cityid = {?}, + country = {?}, region = {?}, regiontxt = {?}, + pub = {?}, datemaj = NOW(), statut = {?} + WHERE uid = {?} AND adrid = {?}", $adr['adr1'], + $adr['adr2'], $adr['adr3'], $adr['postcode'], + $adr['city'], $adr['cityid'], $adr['country'], + $adr['region'], $adr['regiontxt'], $adr['pub'], + $statut, Session::getInt('uid', -1), $adrid); + foreach ($adr['tels'] as $tel) { + if ($tel['new_tel']) { + insert_new_tel($adrid, $tel); + } else { + if ($tel['tel'] != "") { + XDB::execute( + "UPDATE tels SET + tel_type = {?}, + tel_pub = {?}, + tel = {?} + WHERE + uid = {?} AND + adrid = {?} AND + telid = {?}", + $tel['tel_type'], + $tel['tel_pub'], + $tel['tel'], + Session::getInt('uid', -1), + $adrid, + $tel['telid']); + } else { + XDB::execute( + "DELETE FROM tels WHERE + uid = {?} AND + adrid = {?} AND + telid = {?}", + Session::getInt('uid', -1), + $adrid, + $tel['telid']); + } + } + } + }// fin nouvelle / ancienne adresse + }//fin if nouvellement crée }//fin foreach ?> diff --git a/include/register.inc.php b/include/register.inc.php index 69ccd76..e4e1c3b 100644 --- a/include/register.inc.php +++ b/include/register.inc.php @@ -70,7 +70,6 @@ function get_X_mat($ourmat) function check_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid) { - global $globals; if (!preg_match('/^[0-9][0-9][0-9][0-9][0-9][0-9]$/', $mat)) { return "Le matricule doit comporter 6 chiffres."; } @@ -105,8 +104,6 @@ function check_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid) function check_old_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid) { - global $globals; - $res = XDB::iterRow( 'SELECT user_id, nom, prenom, matricule FROM auth_user_md5 @@ -139,7 +136,6 @@ function check_old_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid) function check_new_user(&$sub) { - global $globals; extract($sub); $prenom = preg_replace("/[ \t]+/", ' ', trim($prenom)); @@ -172,7 +168,6 @@ function check_new_user(&$sub) function create_aliases (&$sub) { - global $globals; extract ($sub); $mailorg = make_username($prenom, $nom); diff --git a/include/rss.inc.php b/include/rss.inc.php index ba9ae91..afe4c86 100644 --- a/include/rss.inc.php +++ b/include/rss.inc.php @@ -39,7 +39,7 @@ function to_rss ($s) function init_rss($template, $alias, $hash) { - global $page, $globals; + global $page; new_nonhtml_page($template, AUTH_PUBLIC); $page->register_modifier('rss_date', '_rss_encode_date'); $page->default_modifiers = Array('@to_rss'); diff --git a/include/secteur.emploi.inc.php b/include/secteur.emploi.inc.php index 41d0f05..a7b840b 100644 --- a/include/secteur.emploi.inc.php +++ b/include/secteur.emploi.inc.php @@ -21,7 +21,6 @@ function select_secteur($secteur){ - global $globals; if ($secteur == '') { $secteur = -1; } @@ -34,7 +33,6 @@ function select_secteur($secteur){ } function select_ss_secteur($secteur,$ss_secteur){ - global $globals; if ($secteur) { $html = "\n"; $res = XDB::iterRow("SELECT id, label FROM emploi_ss_secteur WHERE secteur = {?}", $secteur); diff --git a/include/synchro_ax.inc.php b/include/synchro_ax.inc.php index ab0c8b6..0428dd8 100644 --- a/include/synchro_ax.inc.php +++ b/include/synchro_ax.inc.php @@ -33,8 +33,6 @@ function get_user_ax($matricule_ax, $raw=false) { require_once('webservices/ax/client.inc'); - global $globals; - $ancien = recupere_infos_ancien($matricule_ax); $userax = Array(); diff --git a/include/user.func.inc.php b/include/user.func.inc.php index d4edac7..11691be 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -165,7 +165,6 @@ function has_user_right($pub, $view = 'private') { function get_user_details_pro($uid, $view = 'private') { - global $globals; $sql = "SELECT e.entreprise, s.label as secteur , ss.label as sous_secteur , f.fonction_fr as fonction, e.poste, e.adr1, e.adr2, e.adr3, e.postcode, e.city, e.entrid, gp.pays AS countrytxt, gr.name AS region, e.tel, e.fax, e.mobile, e.entrid, @@ -245,7 +244,6 @@ function get_user_details_pro($uid, $view = 'private') // }}} function get_user_details_adr($uid, $view = 'private') { - global $globals; $sql = "SELECT a.adrid, a.adr1,a.adr2,a.adr3,a.postcode,a.city, gp.pays AS countrytxt,a.region, a.regiontxt, FIND_IN_SET('active', a.statut) AS active, a.adrid, @@ -289,7 +287,6 @@ function get_user_details_adr($uid, $view = 'private') { function &get_user_details($login, $from_uid = '', $view = 'private') { - global $globals; $reqsql = "SELECT u.user_id, u.promo, u.promo_sortie, u.prenom, u.nom, u.nom_usage, u.date, u.cv, u.perms IN ('admin','user') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces, q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_web AS web, q.profile_freetext AS freetext, @@ -399,7 +396,6 @@ function &get_user_details($login, $from_uid = '', $view = 'private') // }}} // {{{ function add_user_address() function add_user_address($uid, $adrid, $adr) { - global $globals; XDB::execute( "INSERT INTO adresses (`uid`, `adrid`, `adr1`, `adr2`, `adr3`, `postcode`, `city`, `country`, `datemaj`, `pub`) ( SELECT u.user_id, {?}, {?}, {?}, {?}, {?}, {?}, gp.a2, NOW(), {?} @@ -419,7 +415,6 @@ function add_user_address($uid, $adrid, $adr) { // }}} // {{{ function update_user_address() function update_user_address($uid, $adrid, $adr) { - global $globals; // update address XDB::execute( "UPDATE adresses AS a LEFT JOIN geoloc_pays AS gp ON (gp.pays = {?}) @@ -448,14 +443,12 @@ function update_user_address($uid, $adrid, $adr) { // }}} // {{{ function remove_user_address() function remove_user_address($uid, $adrid) { - global $globals; XDB::execute("DELETE FROM adresses WHERE adrid = {?} AND uid = {?}", $adrid, $uid); XDB::execute("DELETE FROM tels WHERE adrid = {?} AND uid = {?}", $adrid, $uid); } // }}} // {{{ function add_user_tel() function add_user_tel($uid, $adrid, $telid, $tel) { - global $globals; XDB::execute( "INSERT INTO tels SET uid = {?}, adrid = {?}, telid = {?}, tel = {?}, tel_type = {?}, tel_pub = {?}", $uid, $adrid, $telid, $tel['tel'], $tel['tel_type'], $tel['tel_pub']); @@ -463,7 +456,6 @@ function add_user_tel($uid, $adrid, $telid, $tel) { // }}} // {{{ function update_user_tel() function update_user_tel($uid, $adrid, $telid, $tel) { - global $globals; XDB::execute( "UPDATE tels SET tel = {?}, tel_type = {?}, tel_pub = {?} WHERE telid = {?} AND adrid = {?} AND uid = {?}", @@ -473,13 +465,12 @@ function update_user_tel($uid, $adrid, $telid, $tel) { // }}} // {{{ function remove_user_tel() function remove_user_tel($uid, $adrid, $telid) { - global $globals; - XDB::execute("DELETE FROM tels WHERE telid = {?} AND adrid = {?} AND uid = {?}", $telid, $adrid, $uid); + XDB::execute("DELETE FROM tels WHERE telid = {?} AND adrid = {?} AND uid = {?}", + $telid, $adrid, $uid); } // }}} // {{{ function add_user_pro() function add_user_pro($uid, $entrid, $pro) { - global $globals; XDB::execute( "INSERT INTO entreprises (`uid`, `entrid`, `entreprise`, `poste`, `secteur`, `ss_secteur`, `fonction`, `adr1`, `adr2`, `adr3`, `postcode`, `city`, `country`, `region`, `tel`, `fax`, `mobile`, `email`, `web`, `pub`, `adr_pub`, `tel_pub`, `email_pub`) @@ -502,7 +493,6 @@ function add_user_pro($uid, $entrid, $pro) { // }}} // {{{ function update_user_pro() function update_user_pro($uid, $entrid, $pro) { - global $globals; $join = ""; $set = ""; $args_join = array(); @@ -551,18 +541,16 @@ function update_user_pro($uid, $entrid, $pro) { $query = "UPDATE entreprises AS e ".$join." SET ".substr($set,1)." WHERE e.uid = {?} AND e.entrid = {?}"; $args_where = array($uid, $entrid); $args = array_merge(array($query), $args_join, $args_set, $args_where); - $globals->db->query(XDB::_prepare($args)); + call_user_func_array(array('XDB', 'execute'), $args); } // }}} // {{{ function remove_user_pro() function remove_user_pro($uid, $entrid) { - global $globals; XDB::execute("DELETE FROM entreprises WHERE entrid = {?} AND uid = {?}", $entrid, $uid); } // }}} // {{{ function set_user_details() function set_user_details_addresses($uid, $adrs) { - global $globals; $res = XDB::query("SELECT adrid FROM adresses WHERE uid = {?} AND adrid >= 1 ORDER BY adrid", $uid); $adrids = $res->fetchColumn(); foreach ($adrs as $adr) { @@ -585,7 +573,6 @@ function set_user_details_addresses($uid, $adrs) { function set_user_details_pro($uid, $pros) { - global $globals; $res = XDB::query("SELECT entrid FROM entreprises WHERE uid = {?} ORDER BY entrid", $uid); $entrids = $res->fetchColumn(); foreach ($pros as $pro) { @@ -604,7 +591,6 @@ function set_user_details_pro($uid, $pros) // }}} // {{{ function set_user_details() function set_user_details($uid, $details) { - global $globals; if (isset($details['nom_usage'])) { XDB::execute("UPDATE auth_user_md5 SET nom_usage = {?} WHERE user_id = {?}", strtoupper($details['nom_usage']), $uid); } @@ -648,7 +634,6 @@ function set_user_details($uid, $details) { // {{{ function _user_reindex function _user_reindex($uid, $keys, $muls) { - global $globals; foreach ($keys as $i => $key) { if ($key == '') { continue; @@ -669,7 +654,6 @@ function _user_reindex($uid, $keys, $muls) { // {{{ function user_reindex function user_reindex($uid) { - global $globals; XDB::execute("DELETE FROM search_name WHERE uid={?}", $uid); $res = XDB::query("SELECT prenom, nom, nom_usage, profile_nick FROM auth_user_md5 INNER JOIN auth_user_quick USING(user_id) WHERE auth_user_md5.user_id = {?}", $uid); _user_reindex($uid, $res->fetchOneRow(), array(1,1,1,0.2)); diff --git a/include/validations.inc.php b/include/validations.inc.php index 45229e7..fdd0fae 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -90,7 +90,6 @@ class Validate */ function Validate($_uid, $_unique, $_type) { - global $globals; $this->uid = $_uid; $this->stamp = date('YmdHis'); $this->unique = $_unique; @@ -112,7 +111,6 @@ class Validate */ function submit () { - global $globals; if ($this->unique) { XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?}', $this->uid, $this->type); } @@ -129,7 +127,6 @@ class Validate function update () { - global $globals; XDB::execute('UPDATE requests SET data={?}, stamp=stamp WHERE user_id={?} AND type={?} AND stamp={?}', $this, $this->uid, $this->type, $this->stamp); @@ -145,7 +142,6 @@ class Validate */ function clean () { - global $globals; if ($this->unique) { return XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?}', $this->uid, $this->type); @@ -262,7 +258,6 @@ class Validate */ function get_request($uid, $type, $stamp = -1) { - global $globals; if ($stamp == -1) { $res = XDB::query('SELECT data FROM requests WHERE user_id={?} and type={?}', $uid, $type); } else { diff --git a/include/validations/evts.inc.php b/include/validations/evts.inc.php index 9bcba19..3d7f5fc 100644 --- a/include/validations/evts.inc.php +++ b/include/validations/evts.inc.php @@ -37,7 +37,6 @@ class EvtReq extends Validate // {{{ constructor function EvtReq($_titre, $_texte, $_pmin, $_pmax, $_peremption, $_comment, $_uid) { - global $globals; $this->Validate($_uid, false, 'evts'); $this->titre = $_titre; $this->texte = $_texte; @@ -78,7 +77,6 @@ class EvtReq extends Validate function commit() { - global $globals; return XDB::execute( "INSERT INTO evenements SET user_id = {?}, creation_date=NOW(), titre={?}, texte={?}, diff --git a/include/validations/homonymes.inc.php b/include/validations/homonymes.inc.php index 66c7be4..0ff23b9 100644 --- a/include/validations/homonymes.inc.php +++ b/include/validations/homonymes.inc.php @@ -129,7 +129,6 @@ est ambigu pour des raisons d'homonymie et signalera ton email exact."; function commit() { - global $globals; require_once('homonymes.inc.php'); switch_bestalias($this->uid, $this->loginbis); diff --git a/include/validations/listes.inc.php b/include/validations/listes.inc.php index 6ffd215..bf9c493 100644 --- a/include/validations/listes.inc.php +++ b/include/validations/listes.inc.php @@ -40,9 +40,9 @@ class ListeReq extends Validate // }}} // {{{ constructor - function ListeReq($_uid, $_liste, $_desc, $_advertise, $_modlevel, $_inslevel, $_owners, $_members, $_stamp=0) + function ListeReq($_uid, $_liste, $_desc, $_advertise, $_modlevel, + $_inslevel, $_owners, $_members, $_stamp=0) { - global $globals; $this->Validate($_uid, true, 'liste', $_stamp); $this->liste = $_liste; @@ -85,7 +85,6 @@ class ListeReq extends Validate function commit() { - global $globals; require_once('platal/xmlrpc-client.inc.php'); require_once('lists.inc.php'); diff --git a/include/validations/marketing.inc.php b/include/validations/marketing.inc.php index 0e3faf9..401cbd5 100644 --- a/include/validations/marketing.inc.php +++ b/include/validations/marketing.inc.php @@ -41,7 +41,6 @@ class MarkReq extends Validate // {{{ constructor function MarkReq($sender, $mark_id, $email, $perso = false) { - global $globals; $this->Validate($sender, false, 'marketing'); $this->m_id = $mark_id; $this->m_email = $email; @@ -85,7 +84,6 @@ class MarkReq extends Validate function commit() { - global $globals; require_once('marketing.inc.php'); mark_send_mail($this->m_id, $this->m_email,(!$this->perso)?"staff":"user"); return true; diff --git a/include/validations/nomusage.inc.php b/include/validations/nomusage.inc.php index b53d868..e0ca232 100644 --- a/include/validations/nomusage.inc.php +++ b/include/validations/nomusage.inc.php @@ -46,7 +46,6 @@ class UsageReq extends Validate function UsageReq($_uid, $_usage, $_reason) { - global $globals; $this->Validate($_uid, true, 'usage'); $this->nom_usage = $_usage; $this->reason = $_reason; diff --git a/include/validations/orange.inc.php b/include/validations/orange.inc.php index 2754bb7..439961e 100644 --- a/include/validations/orange.inc.php +++ b/include/validations/orange.inc.php @@ -39,7 +39,6 @@ class OrangeReq extends Validate function OrangeReq($_uid, $_sortie) { - global $globals; $this->Validate($_uid, true, 'orange'); $this->promo_sortie = $_sortie; $res = XDB::query("SELECT promo FROM auth_user_md5 WHERE user_id = {?}", $_uid); @@ -73,7 +72,6 @@ class OrangeReq extends Validate function _mail_body($isok) { - global $globals; if ($isok) { $res = " La demande de changement de promo de sortie que tu as demandée vient d'être effectuée."; return $res; @@ -87,8 +85,6 @@ class OrangeReq extends Validate function commit() { - global $globals; - XDB::execute("UPDATE auth_user_md5 set promo_sortie={?} WHERE user_id={?}",$this->promo_sortie ,$this->uid); return true; } diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index 0a3a9e4..4bb591b 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -41,12 +41,13 @@ class PayReq extends Validate var $rules = "Laisser la validation à un trésorier"; // }}} // {{{ constructor - - function PayReq($_uid, $_intitule, $_site, $_montant, $_msg, $_montantmin=0, $_montantmax=999, $_asso_id = 0, $_evt = 0, $_stamp=0) + + function PayReq($_uid, $_intitule, $_site, $_montant, $_msg, + $_montantmin=0, $_montantmax=999, $_asso_id = 0, + $_evt = 0, $_stamp=0) { - global $globals; $this->Validate($_uid, false, 'paiements', $_stamp); - + $this->titre = $_intitule; $this->site = $_site; $this->msg_reponse = $_msg; @@ -80,7 +81,6 @@ class PayReq extends Validate // supprime les demandes de paiments pour le meme evenement function submit() { - global $globals; if ($this->evt) { XDB::execute('DELETE FROM requests WHERE type={?} AND data LIKE {?}', 'paiements', PayReq::same_event($this->evt, $this->asso_id)); diff --git a/include/validations/photos.inc.php b/include/validations/photos.inc.php index a1596cc..4becd18 100644 --- a/include/validations/photos.inc.php +++ b/include/validations/photos.inc.php @@ -44,7 +44,7 @@ class PhotoReq extends Validate function PhotoReq($_uid, $_data, $_stamp=0) { - global $globals, $page; + global $page; $this->Validate($_uid, true, 'photo', $_stamp); @@ -140,8 +140,6 @@ class PhotoReq extends Validate function commit() { - global $globals; - XDB::execute('REPLACE INTO photo (uid, attachmime, attach, x, y) VALUES ({?},{?},{?},{?},{?})', $this->uid, $this->mimetype, $this->data, $this->x, $this->y); diff --git a/include/xnet/session.inc.php b/include/xnet/session.inc.php index d26200f..6a40919 100644 --- a/include/xnet/session.inc.php +++ b/include/xnet/session.inc.php @@ -77,7 +77,6 @@ class XnetSession */ function doAuth(&$page) { - global $globals; if (identified()) { // ok, c'est bon, on n'a rien à faire return true; } diff --git a/include/xnet/smarty.plugins.inc.php b/include/xnet/smarty.plugins.inc.php index fd14806..fb18971 100644 --- a/include/xnet/smarty.plugins.inc.php +++ b/include/xnet/smarty.plugins.inc.php @@ -28,7 +28,6 @@ function list_all_my_groups($params) if (!logged()) { return; } - global $globals; $res = XDB::iterRow( "SELECT a.nom, a.diminutif FROM groupex.asso AS a diff --git a/include/xorg.inc.php b/include/xorg.inc.php index 6b211ed..cb86440 100644 --- a/include/xorg.inc.php +++ b/include/xorg.inc.php @@ -29,7 +29,7 @@ XorgSession::init(); function _new_page($type, $tpl_name, $min_auth, $admin=false) { - global $page,$globals; + global $page, $globals; require_once("xorg/page.inc.php"); if ($min_auth == AUTH_PUBLIC && Env::get('force_login') == '1') $min_auth = AUTH_COOKIE; diff --git a/include/xorg/menu.inc.php b/include/xorg/menu.inc.php index 94139c5..0198d6f 100644 --- a/include/xorg/menu.inc.php +++ b/include/xorg/menu.inc.php @@ -56,18 +56,16 @@ class XOrgMenu function XOrgMenu() { - global $globals; - - $this->_int[XOM_NO] = Array(); - $this->_int[XOM_CUSTOM] = Array(); - $this->_int[XOM_SERVICES] = Array(); - $this->_int[XOM_GROUPS] = Array(); - $this->_int[XOM_INFOS] = Array(); - $this->_int[XOM_ADMIN] = Array(); - - $this->_ext[XOM_US] = Array(); - $this->_ext[XOM_EXT] = Array(); - $this->_ext[XOM_INFOS] = Array(); + $this->_int[XOM_NO] = array(); + $this->_int[XOM_CUSTOM] = array(); + $this->_int[XOM_SERVICES] = array(); + $this->_int[XOM_GROUPS] = array(); + $this->_int[XOM_INFOS] = array(); + $this->_int[XOM_ADMIN] = array(); + + $this->_ext[XOM_US] = array(); + $this->_ext[XOM_EXT] = array(); + $this->_ext[XOM_INFOS] = array(); } // }}} diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index 54b6416..9c3d81d 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -221,7 +221,6 @@ class XorgSession */ function try_cookie() { - global $globals; if (Cookie::get('ORGaccess') == '' or !Cookie::has('ORGuid')) { return -1; } @@ -255,7 +254,6 @@ function try_cookie() */ function start_connexion ($uid, $identified) { - global $globals; $res = XDB::query(" SELECT u.user_id AS uid, prenom, nom, perms, promo, matricule, password, FIND_IN_SET('femme', u.flags) AS femme, UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, a.alias AS forlife, a2.alias AS bestalias, diff --git a/modules/auth.php b/modules/auth.php index da708a5..cda2bdc 100644 --- a/modules/auth.php +++ b/modules/auth.php @@ -125,8 +125,6 @@ class AuthModule extends PLModule function handler_groupex(&$page) { - global $globals; - require_once dirname(__FILE__).'/auth/auth.inc.php'; $gpex_pass = $_GET["pass"]; diff --git a/modules/auth/auth.inc.php b/modules/auth/auth.inc.php index 2d5aab4..7b6d0e8 100644 --- a/modules/auth/auth.inc.php +++ b/modules/auth/auth.inc.php @@ -21,7 +21,6 @@ /* cree le champs "auth" renvoye au Groupe X */ function gpex_make_auth($chlg, $privkey, $datafields) { - global $globals; $fieldarr = explode(",",$datafields); $tohash = "1$chlg$privkey"; @@ -53,7 +52,6 @@ function gpex_make_auth($chlg, $privkey, $datafields) { /* cree les parametres de l'URL de retour avec les champs demandes */ function gpex_make_params($chlg, $privkey, $datafields) { - global $globals; $params = "&auth=".gpex_make_auth($chlg, $privkey, $datafields); $res = XDB::query("SELECT matricule, matricule_ax, promo, diff --git a/modules/carnet.php b/modules/carnet.php index b4e5176..62713fe 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -110,8 +110,6 @@ class CarnetModule extends PLModule function handler_notifs(&$page, $action = null, $arg = null) { - global $globals; - $page->changeTpl('carnet/notifs.tpl'); require_once 'notifs.inc.php'; @@ -154,7 +152,6 @@ class CarnetModule extends PLModule } function _get_list($offset, $limit) { - global $globals; $uid = Session::getInt('uid'); $res = XDB::query("SELECT COUNT(*) FROM contacts WHERE uid = {?}", $uid); $total = $res->fetchOneCell(); @@ -185,8 +182,6 @@ class CarnetModule extends PLModule function handler_contacts(&$page, $action = null) { - global $globals; - $page->changeTpl('carnet/mescontacts.tpl'); require_once("applis.func.inc.php"); $page->assign('xorg_title','Polytechnique.org - Mes contacts'); @@ -295,8 +290,6 @@ class CarnetModule extends PLModule function handler_pdf(&$page, $arg0 = null, $arg1 = null) { - global $globals; - require_once 'contacts.pdf.inc.php'; require_once 'user.func.inc.php'; @@ -337,8 +330,6 @@ class CarnetModule extends PLModule function handler_ical(&$page, $user = null, $hash = null, $all = null) { - global $globals; - new_nonhtml_page('carnet/calendar.tpl', AUTH_PUBLIC); if ($alias && $hash) { diff --git a/modules/events.php b/modules/events.php index 98d2592..d5b9521 100644 --- a/modules/events.php +++ b/modules/events.php @@ -35,8 +35,6 @@ class EventsModule extends PLModule function handler_ev(&$page) { - global $globals; - $page->changeTpl('login.tpl'); $res = XDB::query('SELECT date, naissance FROM auth_user_md5 @@ -147,7 +145,6 @@ class EventsModule extends PLModule function handler_ev_submit(&$page) { - global $globals; $page->changeTpl('evenements.tpl'); $titre = Post::get('titre'); diff --git a/modules/lists.php b/modules/lists.php index e393a7f..c686573 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -52,8 +52,6 @@ class ListsModule extends PLModule function handler_lists(&$page) { - global $globals; - $this->prepare_client($page); $page->changeTpl('listes/index.tpl'); @@ -82,7 +80,6 @@ class ListsModule extends PLModule function handler_create(&$page) { - global $globals; $page->changeTpl('listes/create.tpl'); $owners = preg_split("/[\s]+/", Post::get('owners'), -1, PREG_SPLIT_NO_EMPTY); @@ -165,8 +162,6 @@ class ListsModule extends PLModule function handler_members(&$page, $liste = null) { - global $globals; - if (is_null($liste)) { return PL_NOT_FOUND; } @@ -204,7 +199,7 @@ class ListsModule extends PLModule function _get_list($offset, $limit) { - global $globals, $platal; + global $platal; list($total, $members) = $this->client->get_members_limit($platal->argv[1], $offset, $limit); $membres = Array(); @@ -226,8 +221,6 @@ class ListsModule extends PLModule function handler_trombi(&$page, $liste = null) { - global $globals; - if (is_null($liste)) { return PL_NOT_FOUND; } @@ -307,8 +300,6 @@ class ListsModule extends PLModule function handler_moderate(&$page, $liste = null) { - global $globals; - if (is_null($liste)) { return PL_NOT_FOUND; } @@ -488,8 +479,6 @@ class ListsModule extends PLModule function handler_options(&$page, $liste = null) { - global $globals; - if (is_null($liste)) { return PL_NOT_FOUND; } @@ -541,8 +530,6 @@ class ListsModule extends PLModule function handler_delete(&$page, $liste = null) { - global $globals; - if (is_null($liste)) { return PL_NOT_FOUND; } @@ -571,8 +558,6 @@ class ListsModule extends PLModule function handler_soptions(&$page, $liste = null) { - global $globals; - if (is_null($liste)) { return PL_NOT_FOUND; } @@ -599,8 +584,6 @@ class ListsModule extends PLModule function handler_check(&$page, $liste = null) { - global $globals; - if (is_null($liste)) { return PL_NOT_FOUND; } diff --git a/modules/marketing.php b/modules/marketing.php index d2ede2a..1046574 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -37,8 +37,6 @@ class MarketingModule extends PLModule function handler_marketing(&$page) { - global $globals; - $page->changeTpl('marketing/index.tpl'); $page->assign('xorg_title','Polytechnique.org - Marketing'); @@ -80,8 +78,6 @@ class MarketingModule extends PLModule function handler_private(&$page, $uid = null, $action = null, $value = null) { - global $globals; - $page->changeTpl('marketing/private.tpl'); if (is_null($uid)) { @@ -164,8 +160,6 @@ class MarketingModule extends PLModule function handler_promo(&$page, $promo = null) { - global $globals; - $page->changeTpl('marketing/promo.tpl'); if (is_null($promo)) { @@ -186,8 +180,6 @@ class MarketingModule extends PLModule function handler_public(&$page, $uid = null) { - global $globals; - $page->changeTpl('marketing/public.tpl'); if (is_null($uid)) { @@ -230,8 +222,6 @@ class MarketingModule extends PLModule function handler_week(&$page, $sorting = 'per_promo') { - global $globals; - $page->changeTpl('marketing/this_week.tpl'); $sort = $sorting == 'per_promo' ? 'promo' : 'date_ins'; @@ -246,8 +236,6 @@ class MarketingModule extends PLModule function handler_volontaire(&$page, $promo = null) { - global $globals; - $page->changeTpl('marketing/volontaire.tpl'); $res = XDB::query( @@ -272,8 +260,6 @@ class MarketingModule extends PLModule function handler_relance(&$page) { - global $globals; - $page->changeTpl('marketing/relance.tpl'); if (Post::has('relancer')) { diff --git a/modules/payment.php b/modules/payment.php index dc8791e..2cd1c2d 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -127,7 +127,7 @@ class PaymentModule extends PLModule $page->assign('pay', $pay); $page->assign('evtlink', $pay->event()); - $page->assign('prefix',$globals->money->mpay_tprefix); + $page->assign('prefix', $globals->money->mpay_tprefix); } function handler_cyber_return(&$page, $uid = null) @@ -226,8 +226,6 @@ class PaymentModule extends PLModule function handler_paypal_return(&$page, $uid = null) { - global $globals; - $page->changeTpl('payment/retour_paypal.tpl'); require_once 'diogenes/diogenes.hermes.inc.php'; diff --git a/modules/platal.php b/modules/platal.php index ce6e34f..5ebb7be 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -88,8 +88,6 @@ class PlatalModule extends PLModule function __set_rss_state($state) { - global $globals; - if ($state) { $_SESSION['core_rss_hash'] = rand_url_id(16); XDB::execute('UPDATE auth_user_quick @@ -131,8 +129,6 @@ class PlatalModule extends PLModule function handler_webredir(&$page) { - global $globals; - $page->changeTpl('webredirect.tpl'); $page->assign('xorg_title','Polytechnique.org - Redirection de page WEB'); @@ -165,8 +161,6 @@ class PlatalModule extends PLModule function handler_prefs_rss(&$page) { - global $globals; - $page->changeTpl('filrss.tpl'); $page->assign('goback', Env::get('referer', 'login')); @@ -179,8 +173,6 @@ class PlatalModule extends PLModule function handler_password(&$page) { - global $globals; - if (Post::has('response2')) { require_once 'secure_hash.inc.php'; @@ -209,8 +201,6 @@ class PlatalModule extends PLModule function handler_smtppass(&$page) { - global $globals; - $page->changeTpl('acces_smtp.tpl'); $page->assign('xorg_title','Polytechnique.org - Acces SMTP/NNTP'); @@ -303,8 +293,6 @@ Mail envoy function handler_tmpPWD(&$page, $certif = null) { - global $globals; - XDB::execute('DELETE FROM perte_pass WHERE DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created'); @@ -404,8 +392,6 @@ Mail envoy function handler_rss(&$page, $user = null, $hash = null) { - global $globals; - require_once 'rss.inc.php'; $uid = init_rss('rss.tpl', $user, $hash); diff --git a/modules/profile.php b/modules/profile.php index 7c1d733..92a01d6 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -51,8 +51,6 @@ class ProfileModule extends PLModule function _trombi_getlist($offset, $limit) { - global $globals; - $where = ( $this->promo > 0 ? "WHERE promo='{$this->promo}'" : "" ); $res = XDB::query( @@ -80,8 +78,6 @@ class ProfileModule extends PLModule return PL_NOT_FOUND; } - global $globals; - $res = XDB::query("SELECT id, pub FROM aliases LEFT JOIN photo ON(id = uid) WHERE alias = {?}", $x); @@ -112,8 +108,6 @@ class ProfileModule extends PLModule function handler_photo_change(&$page) { - global $globals; - $page->changeTpl('trombino.tpl'); require_once('validations.inc.php'); @@ -354,8 +348,6 @@ class ProfileModule extends PLModule function handler_p_orange(&$page) { - global $globals; - $page->changeTpl('orange.tpl'); require_once 'validations.inc.php'; @@ -406,8 +398,6 @@ class ProfileModule extends PLModule function handler_referent(&$page, $x = null) { - global $globals; - require_once 'user.func.inc.php'; if (is_null($x)) { @@ -473,8 +463,6 @@ class ProfileModule extends PLModule function handler_ref_search(&$page) { - global $globals; - $page->changeTpl('referent.tpl'); $page->assign('xorg_title', 'Polytechnique.org - Conseil Pro'); @@ -587,8 +575,6 @@ class ProfileModule extends PLModule function handler_p_usage(&$page) { - global $globals; - $page->changeTpl('nomusage.tpl'); require_once 'validations.inc.php'; diff --git a/modules/register.php b/modules/register.php index b14f2b4..2ea8483 100644 --- a/modules/register.php +++ b/modules/register.php @@ -33,8 +33,6 @@ class RegisterModule extends PLModule function handler_register(&$page, $hash = null) { - global $globals; - $sub_state = Session::getMixed('sub_state', Array()); if (!isset($sub_state['step'])) { $sub_state['step'] = 0; @@ -277,8 +275,6 @@ class RegisterModule extends PLModule function handler_success(&$page) { - global $globals; - $page->changeTpl('register/success.tpl'); if (Env::has('response2')) { diff --git a/modules/search.php b/modules/search.php index 1fcd390..4f7be95 100644 --- a/modules/search.php +++ b/modules/search.php @@ -71,8 +71,6 @@ class SearchModule extends PLModule function form_prepare() { - global $page,$globals; - $page->assign('formulaire',1); $page->assign('choix_nats', XDB::iterator('SELECT a2 AS id,IF(nat=\'\',pays,nat) AS text diff --git a/modules/stats.php b/modules/stats.php index c12eb97..bbd0fd8 100644 --- a/modules/stats.php +++ b/modules/stats.php @@ -60,8 +60,6 @@ class StatsModule extends PLModule function handler_graph_evo(&$page, $jours = 365) { - global $globals; - define('DUREEJOUR',24*3600); //recupere le nombre d'inscriptions par jour sur la plage concernée @@ -125,8 +123,6 @@ EOF2; function handler_graph(&$page, $promo = null) { - global $globals; - if ($promo == 'all') { // date de départ $depart = 1920; @@ -248,8 +244,6 @@ EOF2; function handler_promos(&$page, $promo = null) { - global $globals; - $page->changeTpl('stats/nb_by_promo.tpl'); $res = XDB::iterRow( @@ -276,8 +270,6 @@ EOF2; function handler_coupures(&$page, $cp_id = null) { - global $globals; - $page->changeTpl('stats/coupure.tpl'); if (!is_null($cp_id)) { diff --git a/modules/trezo.php b/modules/trezo.php index 615554d..ee966f5 100644 --- a/modules/trezo.php +++ b/modules/trezo.php @@ -31,8 +31,6 @@ class TrezoModule extends PLModule function handler_default(&$page) { - global $globals; - $page->changeTpl('trezo/index.tpl'); require_once 'money/trezo.inc.php'; @@ -71,8 +69,6 @@ class TrezoModule extends PLModule function handler_operation(&$page) { - global $globals; - $page->changeTpl('trezo/gere_operations.tpl'); require_once 'money/trezo.inc.php'; diff --git a/modules/xnet.php b/modules/xnet.php index 565c7f3..1b368eb 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -91,8 +91,6 @@ class XnetModule extends PLModule function handler_admin(&$page) { - global $globals; - new_admin_page('xnet/admin.tpl'); $page->useMenu(); @@ -144,8 +142,6 @@ class XnetModule extends PLModule function handler_plan(&$page) { - global $globals; - $page->changeTpl('xnet/plan.tpl'); $page->setType('plan'); @@ -192,8 +188,6 @@ class XnetModule extends PLModule function handler_groups(&$page, $cat = null, $dom = null) { - global $globals; - if (!$cat) { $this->handler_index(&$page); } diff --git a/modules/xnetevents.php b/modules/xnetevents.php index b555285..40fa385 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -138,8 +138,6 @@ class XnetEventsModule extends PLModule function handler_sub(&$page, $eid = null) { - global $globals; - require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php'; new_group_page('xnetevents/subscribe.tpl'); diff --git a/modules/xnetlists.php b/modules/xnetlists.php index 513c805..4241e5a 100644 --- a/modules/xnetlists.php +++ b/modules/xnetlists.php @@ -228,8 +228,6 @@ class XnetListsModule extends ListsModule function handler_aadmin(&$page, $lfull = null) { - global $globals; - if (is_null($lfull)) { return PL_NOT_FOUND; } diff --git a/plugins/function.select_db_table.php b/plugins/function.select_db_table.php index 4276fa8..1c7f072 100644 --- a/plugins/function.select_db_table.php +++ b/plugins/function.select_db_table.php @@ -21,7 +21,6 @@ function select_options($table,$valeur,$champ="text",$pad=false,$where="") { - global $globals; $sql = "SELECT id,$champ FROM $table $where ORDER BY $champ"; $res = XDB::iterRow($sql); $sel = ' selected="selected"'; @@ -32,7 +31,8 @@ function select_options($table,$valeur,$champ="text",$pad=false,$where="") { $html.= '\n"; } while (list($my_id,$my_text) = $res->next()) { - $html .= sprintf("\n",$my_id,($valeur==$my_id?$sel:""),$my_text); + $html .= sprintf("\n", + $my_id, ($valeur==$my_id?$sel:""), $my_text); } return $html; } @@ -48,7 +48,8 @@ function smarty_function_select_db_table($params, &$smarty) { $pad = true; if(empty($params['where'])) $params['where'] = ''; - return select_options($params['table'], $params['valeur'], $params['champ'], $pad, $params['where']); + return select_options($params['table'], $params['valeur'], + $params['champ'], $pad, $params['where']); } ?> diff --git a/plugins/function.select_nat.php b/plugins/function.select_nat.php index 6afeacb..813cb09 100644 --- a/plugins/function.select_nat.php +++ b/plugins/function.select_nat.php @@ -21,7 +21,6 @@ function select_nat($valeur,$pad=false) { - global $globals; $sql = "SELECT a2 AS id,IF(nat='',pays,nat) AS text FROM geoloc_pays ORDER BY text"; $res = XDB::iterRow($sql); $sel = ' selected="selected"'; diff --git a/plugins/function.version.php b/plugins/function.version.php deleted file mode 100644 index 15d4e6c..0000000 --- a/plugins/function.version.php +++ /dev/null @@ -1,28 +0,0 @@ -version; -} - -?> diff --git a/plugins/insert.getName.php b/plugins/insert.getName.php index 81058cc..78a1285 100644 --- a/plugins/insert.getName.php +++ b/plugins/insert.getName.php @@ -21,7 +21,6 @@ function smarty_insert_getName() { - global $globals; $uid = Cookie::get('ORGuid', -1); if ($uid < 0) { return ""; diff --git a/plugins/insert.getNbIns.php b/plugins/insert.getNbIns.php index 02eb725..cec99e2 100644 --- a/plugins/insert.getNbIns.php +++ b/plugins/insert.getNbIns.php @@ -30,7 +30,6 @@ */ function smarty_insert_getNbIns($params, &$smarty) { - global $globals; $res = XDB::query("SELECT COUNT(*) FROM auth_user_md5 WHERE perms IN ('admin','user') AND deces=0"); $cnt = $res->fetchOneCell(); return number_format($cnt, 0, ",", "."); diff --git a/plugins/insert.mkStats.php b/plugins/insert.mkStats.php index d83ec67..ba24d2e 100644 --- a/plugins/insert.mkStats.php +++ b/plugins/insert.mkStats.php @@ -31,7 +31,6 @@ */ function smarty_insert_mkStats($params, &$smarty) { - global $globals; $res = XDB::query('select count(*) from requests'); $cnt = $res->fetchOneCell(); return ($cnt ? $cnt : '-'); diff --git a/templates/skin/common.footer.tpl b/templates/skin/common.footer.tpl index b58942c..e62d4b9 100644 --- a/templates/skin/common.footer.tpl +++ b/templates/skin/common.footer.tpl @@ -22,7 +22,7 @@
- Plat/al {version} - Copyright © 1999-2006 Polytechnique.org + Plat/al {#globals.version#} - Copyright © 1999-2006 Polytechnique.org  -  Lien avec l'AX  -  -- 2.1.4