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";
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()) {
global $page;
function applis_options($current=0) {
- global $globals;
$html = '<option value="-1"></option>';
$res = XDB::iterator("select * from applis_def order by text");
while ($arr_appli = $res->next()) {
/** 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()) {
/** 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"]));
function run($params = null)
{
- global $banana, $globals;
+ global $banana;
if (Get::get('banana') == 'updateall'
|| (!is_null($params) && isset($params['banana']) && $params['banana'] == 'updateall')) {
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,
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;
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;
}
// }}}
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();
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);
}
// }}}
function activate($uid)
{
- global $globals;
if (!$this->active) {
XDB::execute("UPDATE emails SET flags = 'active'
WHERE uid={?} AND email={?}", $uid, $this->email);
function deactivate($uid)
{
- global $globals;
if ($this->active) {
XDB::execute("UPDATE emails SET flags =''
WHERE uid={?} AND email={?}", $uid, $this->email);
function rewrite($rew, $uid)
{
- global $globals;
if ($this->rewrite == $rew) {
return;
}
function Redirect($_uid)
{
- global $globals;
$this->uid=$_uid;
$res = XDB::iterRow("
SELECT email, flags='active', rewrite, panne
function delete_email($email)
{
- global $globals;
if (!$this->other_active($email)) {
return ERROR_INACTIVE_REDIRECTION;
}
function add_email($email)
{
- global $globals;
$email_stripped = strtolower(trim($email));
if (!isvalid_email($email_stripped)) {
return ERROR_INVALID_EMAIL;
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);
***************************************************************************/
function select_fonction($fonction){
- global $globals;
$html = "<option value='' ". (($fonction == '0')?"selected='selected'":"") ."> </option>\n";
$res = XDB::iterRow("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) from fonctions_def ORDER BY id");
* @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()) {
* @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 = "<option value=\"\"></option>";
while (list($regid, $regname) = $res->next()) {
/** 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)
}
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();
}
* @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();
// {{{ 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)
}
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
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);
}
function geoloc_getData_subcountries($mapid, $SFields, $minentities) {
- global $globals;
$countries = array();
$cities = array();
***************************************************************************/
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')
}
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();
// {{{ 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
$uid, $email);
$sender = $res->fetchOneAssoc();
return "\"".$sender['prenom']." ".$sender['nom']."\" <".$sender['alias']."@polytechnique.org>";
-
}
// }}}
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);
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();
}
function solde_until($date='')
{
- global $globals;
$sql = "SELECT SUM(credit)-SUM(debit) FROM money_trezo";
if (empty($date)) {
$res = XDB::query($sql);
function NewsLetter($id=null)
{
- global $globals;
-
if (isset($id)) {
if ($id == 'last') {
$res = XDB::query("SELECT MAX(id) FROM newsletter WHERE bits!='new'");
function setSent()
{
- global $globals;
XDB::execute("UPDATE newsletter SET bits='sent' WHERE id={?}", $this->_id);
}
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);
}
// }}}
function saveArticle(&$a)
{
- global $globals;
if ($a->_aid>=0) {
XDB::execute('REPLACE INTO newsletter_art (id,aid,cid,pos,title,body,append)
VALUES ({?},{?},{?},{?},{?},{?},{?})',
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"]);
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)
***************************************************************************/
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) {
function inscription_notifs_base($uid)
{
- global $globals;
XDB::execute('REPLACE INTO watch_sub (uid,cid) SELECT {?},id FROM watch_cat', $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);
}
}
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 .= "
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 ";
$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();
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;
+ }
}
}
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);
+ }
}
}
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;
}
}
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;
}
- }
+ }
}
}
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;
}
}
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();
}
}
-
+
// }}}
?>
class PlatalPage extends Smarty
{
// {{{ properties
-
+
var $_page_type;
var $_tpl;
var $_errors;
// }}}
// {{{ function fakeDiogenes()
-
+
function fakeDiogenes()
{
require_once 'diogenes/diogenes.core.page.inc.php';
$this->register_function("tag","diogenes_func_tag");
$this->register_function("toolbar","diogenes_func_toolbar");
}
-
+
// }}}
// {{{ function changeTpl()
$this->assign("xorg_errors", $this->_errors);
$this->assign("xorg_failure", $this->_failure);
-
+
if ($this->_page_type == NO_SKIN) {
$this->display($this->_tpl);
exit;
$this->display($skin);
exit;
}
-
+
if ($globals->debug & 1) {
$this->assign('db_trace', $globals->db->trace_format($this, 'database-debug.tpl'));
}
$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)) {
// {{{ function doAuth()
function doAuth() { }
-
+
// }}}
// {{{ function loadModule()
-
+
function loadModule($modname)
{
require_once("$modname.inc.php");
// }}}
// {{{ function gassign
-
+
function gassign($varname)
{
global $$varname;
}
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)";
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
?>
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.";
}
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
function check_new_user(&$sub)
{
- global $globals;
extract($sub);
$prenom = preg_replace("/[ \t]+/", ' ', trim($prenom));
function create_aliases (&$sub)
{
- global $globals;
extract ($sub);
$mailorg = make_username($prenom, $nom);
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');
function select_secteur($secteur){
- global $globals;
if ($secteur == '') {
$secteur = -1;
}
}
function select_ss_secteur($secteur,$ss_secteur){
- global $globals;
if ($secteur) {
$html = "<option value=\"\"> </option>\n";
$res = XDB::iterRow("SELECT id, label FROM emploi_ss_secteur WHERE secteur = {?}", $secteur);
{
require_once('webservices/ax/client.inc');
- global $globals;
-
$ancien = recupere_infos_ancien($matricule_ax);
$userax = Array();
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,
// }}}
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,
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,
// }}}
// {{{ 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(), {?}
// }}}
// {{{ 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 = {?})
// }}}
// {{{ 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']);
// }}}
// {{{ 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 = {?}",
// }}}
// {{{ 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`)
// }}}
// {{{ function update_user_pro()
function update_user_pro($uid, $entrid, $pro) {
- global $globals;
$join = "";
$set = "";
$args_join = array();
$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) {
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) {
// }}}
// {{{ 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);
}
// {{{ function _user_reindex
function _user_reindex($uid, $keys, $muls) {
- global $globals;
foreach ($keys as $i => $key) {
if ($key == '') {
continue;
// {{{ 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));
*/
function Validate($_uid, $_unique, $_type)
{
- global $globals;
$this->uid = $_uid;
$this->stamp = date('YmdHis');
$this->unique = $_unique;
*/
function submit ()
{
- global $globals;
if ($this->unique) {
XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?}', $this->uid, $this->type);
}
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);
*/
function clean ()
{
- global $globals;
if ($this->unique) {
return XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?}',
$this->uid, $this->type);
*/
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 {
// {{{ constructor
function EvtReq($_titre, $_texte, $_pmin, $_pmax, $_peremption, $_comment, $_uid) {
- global $globals;
$this->Validate($_uid, false, 'evts');
$this->titre = $_titre;
$this->texte = $_texte;
function commit()
{
- global $globals;
return XDB::execute(
"INSERT INTO evenements
SET user_id = {?}, creation_date=NOW(), titre={?}, texte={?},
function commit()
{
- global $globals;
require_once('homonymes.inc.php');
switch_bestalias($this->uid, $this->loginbis);
// }}}
// {{{ 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;
function commit()
{
- global $globals;
require_once('platal/xmlrpc-client.inc.php');
require_once('lists.inc.php');
// {{{ 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;
function commit()
{
- global $globals;
require_once('marketing.inc.php');
mark_send_mail($this->m_id, $this->m_email,(!$this->perso)?"staff":"user");
return true;
function UsageReq($_uid, $_usage, $_reason)
{
- global $globals;
$this->Validate($_uid, true, 'usage');
$this->nom_usage = $_usage;
$this->reason = $_reason;
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);
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;
function commit()
{
- global $globals;
-
XDB::execute("UPDATE auth_user_md5 set promo_sortie={?} WHERE user_id={?}",$this->promo_sortie ,$this->uid);
return true;
}
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;
// 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));
function PhotoReq($_uid, $_data, $_stamp=0)
{
- global $globals, $page;
+ global $page;
$this->Validate($_uid, true, 'photo', $_stamp);
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);
*/
function doAuth(&$page)
{
- global $globals;
if (identified()) { // ok, c'est bon, on n'a rien à faire
return true;
}
if (!logged()) {
return;
}
- global $globals;
$res = XDB::iterRow(
"SELECT a.nom, a.diminutif
FROM groupex.asso AS a
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;
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();
}
// }}}
*/
function try_cookie()
{
- global $globals;
if (Cookie::get('ORGaccess') == '' or !Cookie::has('ORGuid')) {
return -1;
}
*/
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,
function handler_groupex(&$page)
{
- global $globals;
-
require_once dirname(__FILE__).'/auth/auth.inc.php';
$gpex_pass = $_GET["pass"];
/* cree le champs "auth" renvoye au Groupe X */
function gpex_make_auth($chlg, $privkey, $datafields) {
- global $globals;
$fieldarr = explode(",",$datafields);
$tohash = "1$chlg$privkey";
/* 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,
function handler_notifs(&$page, $action = null, $arg = null)
{
- global $globals;
-
$page->changeTpl('carnet/notifs.tpl');
require_once 'notifs.inc.php';
}
function _get_list($offset, $limit) {
- global $globals;
$uid = Session::getInt('uid');
$res = XDB::query("SELECT COUNT(*) FROM contacts WHERE uid = {?}", $uid);
$total = $res->fetchOneCell();
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');
function handler_pdf(&$page, $arg0 = null, $arg1 = null)
{
- global $globals;
-
require_once 'contacts.pdf.inc.php';
require_once 'user.func.inc.php';
function handler_ical(&$page, $user = null, $hash = null, $all = null)
{
- global $globals;
-
new_nonhtml_page('carnet/calendar.tpl', AUTH_PUBLIC);
if ($alias && $hash) {
function handler_ev(&$page)
{
- global $globals;
-
$page->changeTpl('login.tpl');
$res = XDB::query('SELECT date, naissance FROM auth_user_md5
function handler_ev_submit(&$page)
{
- global $globals;
$page->changeTpl('evenements.tpl');
$titre = Post::get('titre');
function handler_lists(&$page)
{
- global $globals;
-
$this->prepare_client($page);
$page->changeTpl('listes/index.tpl');
function handler_create(&$page)
{
- global $globals;
$page->changeTpl('listes/create.tpl');
$owners = preg_split("/[\s]+/", Post::get('owners'), -1, PREG_SPLIT_NO_EMPTY);
function handler_members(&$page, $liste = null)
{
- global $globals;
-
if (is_null($liste)) {
return PL_NOT_FOUND;
}
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();
function handler_trombi(&$page, $liste = null)
{
- global $globals;
-
if (is_null($liste)) {
return PL_NOT_FOUND;
}
function handler_moderate(&$page, $liste = null)
{
- global $globals;
-
if (is_null($liste)) {
return PL_NOT_FOUND;
}
function handler_options(&$page, $liste = null)
{
- global $globals;
-
if (is_null($liste)) {
return PL_NOT_FOUND;
}
function handler_delete(&$page, $liste = null)
{
- global $globals;
-
if (is_null($liste)) {
return PL_NOT_FOUND;
}
function handler_soptions(&$page, $liste = null)
{
- global $globals;
-
if (is_null($liste)) {
return PL_NOT_FOUND;
}
function handler_check(&$page, $liste = null)
{
- global $globals;
-
if (is_null($liste)) {
return PL_NOT_FOUND;
}
function handler_marketing(&$page)
{
- global $globals;
-
$page->changeTpl('marketing/index.tpl');
$page->assign('xorg_title','Polytechnique.org - Marketing');
function handler_private(&$page, $uid = null,
$action = null, $value = null)
{
- global $globals;
-
$page->changeTpl('marketing/private.tpl');
if (is_null($uid)) {
function handler_promo(&$page, $promo = null)
{
- global $globals;
-
$page->changeTpl('marketing/promo.tpl');
if (is_null($promo)) {
function handler_public(&$page, $uid = null)
{
- global $globals;
-
$page->changeTpl('marketing/public.tpl');
if (is_null($uid)) {
function handler_week(&$page, $sorting = 'per_promo')
{
- global $globals;
-
$page->changeTpl('marketing/this_week.tpl');
$sort = $sorting == 'per_promo' ? 'promo' : 'date_ins';
function handler_volontaire(&$page, $promo = null)
{
- global $globals;
-
$page->changeTpl('marketing/volontaire.tpl');
$res = XDB::query(
function handler_relance(&$page)
{
- global $globals;
-
$page->changeTpl('marketing/relance.tpl');
if (Post::has('relancer')) {
$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)
function handler_paypal_return(&$page, $uid = null)
{
- global $globals;
-
$page->changeTpl('payment/retour_paypal.tpl');
require_once 'diogenes/diogenes.hermes.inc.php';
function __set_rss_state($state)
{
- global $globals;
-
if ($state) {
$_SESSION['core_rss_hash'] = rand_url_id(16);
XDB::execute('UPDATE auth_user_quick
function handler_webredir(&$page)
{
- global $globals;
-
$page->changeTpl('webredirect.tpl');
$page->assign('xorg_title','Polytechnique.org - Redirection de page WEB');
function handler_prefs_rss(&$page)
{
- global $globals;
-
$page->changeTpl('filrss.tpl');
$page->assign('goback', Env::get('referer', 'login'));
function handler_password(&$page)
{
- global $globals;
-
if (Post::has('response2')) {
require_once 'secure_hash.inc.php';
function handler_smtppass(&$page)
{
- global $globals;
-
$page->changeTpl('acces_smtp.tpl');
$page->assign('xorg_title','Polytechnique.org - Acces SMTP/NNTP');
function handler_tmpPWD(&$page, $certif = null)
{
- global $globals;
-
XDB::execute('DELETE FROM perte_pass
WHERE DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created');
function handler_rss(&$page, $user = null, $hash = null)
{
- global $globals;
-
require_once 'rss.inc.php';
$uid = init_rss('rss.tpl', $user, $hash);
function _trombi_getlist($offset, $limit)
{
- global $globals;
-
$where = ( $this->promo > 0 ? "WHERE promo='{$this->promo}'" : "" );
$res = XDB::query(
return PL_NOT_FOUND;
}
- global $globals;
-
$res = XDB::query("SELECT id, pub FROM aliases
LEFT JOIN photo ON(id = uid)
WHERE alias = {?}", $x);
function handler_photo_change(&$page)
{
- global $globals;
-
$page->changeTpl('trombino.tpl');
require_once('validations.inc.php');
function handler_p_orange(&$page)
{
- global $globals;
-
$page->changeTpl('orange.tpl');
require_once 'validations.inc.php';
function handler_referent(&$page, $x = null)
{
- global $globals;
-
require_once 'user.func.inc.php';
if (is_null($x)) {
function handler_ref_search(&$page)
{
- global $globals;
-
$page->changeTpl('referent.tpl');
$page->assign('xorg_title', 'Polytechnique.org - Conseil Pro');
function handler_p_usage(&$page)
{
- global $globals;
-
$page->changeTpl('nomusage.tpl');
require_once 'validations.inc.php';
function handler_register(&$page, $hash = null)
{
- global $globals;
-
$sub_state = Session::getMixed('sub_state', Array());
if (!isset($sub_state['step'])) {
$sub_state['step'] = 0;
function handler_success(&$page)
{
- global $globals;
-
$page->changeTpl('register/success.tpl');
if (Env::has('response2')) {
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
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
function handler_graph(&$page, $promo = null)
{
- global $globals;
-
if ($promo == 'all') {
// date de départ
$depart = 1920;
function handler_promos(&$page, $promo = null)
{
- global $globals;
-
$page->changeTpl('stats/nb_by_promo.tpl');
$res = XDB::iterRow(
function handler_coupures(&$page, $cp_id = null)
{
- global $globals;
-
$page->changeTpl('stats/coupure.tpl');
if (!is_null($cp_id)) {
function handler_default(&$page)
{
- global $globals;
-
$page->changeTpl('trezo/index.tpl');
require_once 'money/trezo.inc.php';
function handler_operation(&$page)
{
- global $globals;
-
$page->changeTpl('trezo/gere_operations.tpl');
require_once 'money/trezo.inc.php';
function handler_admin(&$page)
{
- global $globals;
-
new_admin_page('xnet/admin.tpl');
$page->useMenu();
function handler_plan(&$page)
{
- global $globals;
-
$page->changeTpl('xnet/plan.tpl');
$page->setType('plan');
function handler_groups(&$page, $cat = null, $dom = null)
{
- global $globals;
-
if (!$cat) {
$this->handler_index(&$page);
}
function handler_sub(&$page, $eid = null)
{
- global $globals;
-
require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
new_group_page('xnetevents/subscribe.tpl');
function handler_aadmin(&$page, $lfull = null)
{
- global $globals;
-
if (is_null($lfull)) {
return PL_NOT_FOUND;
}
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"';
$html.= '<option value="0"'.($valeur==0?$sel:"")."></option>\n";
}
while (list($my_id,$my_text) = $res->next()) {
- $html .= sprintf("<option value=\"%s\" %s>%s</option>\n",$my_id,($valeur==$my_id?$sel:""),$my_text);
+ $html .= sprintf("<option value=\"%s\" %s>%s</option>\n",
+ $my_id, ($valeur==$my_id?$sel:""), $my_text);
}
return $html;
}
$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']);
}
?>
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"';
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-function smarty_function_version()
-{
- global $globals;
- return $globals->version;
-}
-
-?>
function smarty_insert_getName()
{
- global $globals;
$uid = Cookie::get('ORGuid', -1);
if ($uid < 0) {
return "";
*/
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, ",", ".");
*/
function smarty_insert_mkStats($params, &$smarty)
{
- global $globals;
$res = XDB::query('select count(*) from requests');
$cnt = $res->fetchOneCell();
return ($cnt ? $cnt : '-');
<div>
- Plat/al <a href="{rel}/changelog">{version}</a> - Copyright © 1999-2006 <a href="http://x-org.polytechnique.org/">Polytechnique.org</a>
+ Plat/al <a href="{rel}/changelog">{#globals.version#}</a> - Copyright © 1999-2006 <a href="http://x-org.polytechnique.org/">Polytechnique.org</a>
-
<a href="{rel}/Docs/ConventionAX">Lien avec l'AX</a>
-