X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetgrp.php;h=afe992d6c1081c752b76821669725a548c61d140;hb=1707967ad953869e8f6f36ae995a7d16825486df;hp=232b2c625043b6d85412a9f6fdb98c5a3e9bbf1d;hpb=faefdbb72b58e3b1867fc7bbdfe8e872d7e8cbc0;p=platal.git diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 232b2c6..afe992d 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -122,7 +122,7 @@ class XnetGrpModule extends PLModule if (S::logged()) { if (Env::has('read')) { - XDB::query('DELETE r.* + XDB::query('DELETE groupex.r.* FROM groupex.announces_read AS r INNER JOIN groupex.announces AS a ON a.id = r.announce_id WHERE peremption < CURRENT_DATE()'); @@ -233,10 +233,19 @@ class XnetGrpModule extends PLModule if (Post::has('submit')) { S::assert_xsrf_token(); - $flags = new FlagSet('wiki_desc'); + $flags = new PlFlagSet('wiki_desc'); if (Post::has('notif_unsub') && Post::i('notif_unsub') == 1) { $flags->addFlag('notif_unsub'); } + $site = trim(Post::v('site')); + if ($site && ($site != "http://")) { + $scheme = parse_url($site, PHP_URL_SCHEME); + if (!$scheme) { + $site = "http://" . $site; + } + } else { + $site = ""; + } if (S::has_perms()) { if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) { $page->trigError("le domaine doit être un FQDN (aucune modif effectuée) !!!"); @@ -252,7 +261,7 @@ class XnetGrpModule extends PLModule WHERE id={?}", Post::v('nom'), Post::v('diminutif'), Post::v('cat'), Post::i('dom'), - Post::v('descr'), Post::v('site'), + Post::v('descr'), $site, Post::v('mail'), Post::v('resp'), Post::v('forum'), Post::v('mail_domain'), Post::has('ax'), Post::v('pub'), @@ -269,7 +278,7 @@ class XnetGrpModule extends PLModule forum={?}, ax={?}, pub= {?}, sub_url={?}, unsub_url={?},flags={?} WHERE id={?}", - Post::v('descr'), Post::v('site'), + Post::v('descr'), $site, Post::v('mail'), Post::v('resp'), Post::v('forum'), Post::has('ax'), Post::v('pub'), @@ -320,7 +329,7 @@ class XnetGrpModule extends PLModule $mls = array_keys(Env::v('ml', array())); $mbr = array_keys(Env::v('membres', array())); - require_once dirname(__FILE__) . '/xnetgrp/mail.inc.php'; + $this->load('mail.inc.php'); set_time_limit(120); $tos = get_all_redirects($mbr, $mls, $mmlist); $upload = PlUpload::get($_FILES['uploaded'], S::v('forlife'), 'xnet.emails', true); @@ -479,8 +488,9 @@ class XnetGrpModule extends PLModule $res = XDB::query('SELECT uid FROM groupex.membres WHERE asso_id = {?}', $globals->asso('id')); - $vcard = new VCard($res->fetchColumn(), $photos == 'photos', 'Membre du groupe ' . $globals->asso('nom')); - $vcard->do_page($page); + $vcard = new VCard($photos == 'photos', 'Membre du groupe ' . $globals->asso('nom')); + $vcard->addUsers($res->fetchColumn()); + $vcard->show(); } function handler_csv(&$page, $filename = null) @@ -708,25 +718,26 @@ class XnetGrpModule extends PLModule if (Env::has('right') && (may_update() || S::has('suid'))) { switch (Env::v('right')) { case 'admin': - XnetSession::killSuid(); + Platal::session()->stopSUID(); break; case 'anim': - XnetSession::doSelfSuid(); + Platal::session()->doSelfSuid(); may_update(true); is_member(true); break; case 'member': - XnetSession::doSelfSuid(); + Platal::session()->doSelfSuid(); may_update(false, true); is_member(true); break; case 'logged': - XnetSession::doSelfSuid(); + Platal::session()->doSelfSuid(); may_update(false, true); is_member(false, true); break; } } +// var_dump($_SESSION); http_redirect($_SERVER['HTTP_REFERER']); } @@ -734,7 +745,7 @@ class XnetGrpModule extends PLModule { global $globals; - require_once dirname(__FILE__) . '/xnetgrp/mail.inc.php'; + $this->load('mail.inc.php'); $page->changeTpl('xnetgrp/annuaire-admin.tpl'); $mmlist = new MMList(S::v('uid'), S::v('password'), $globals->asso('mail_domain')); @@ -811,7 +822,6 @@ class XnetGrpModule extends PLModule $page->trigError($email." n'est pas un alias polytechnique.org valide."); } } else { - require_once 'xorg.misc.inc.php'; if (isvalid_email($email)) { if (Env::v('x') && Env::has('userid') && Env::i('userid')) { $uid = Env::i('userid'); @@ -884,7 +894,7 @@ class XnetGrpModule extends PLModule function unsubscribe(&$user) { - global $globals, $page; + global $globals; XDB::execute( "DELETE FROM groupex.membres WHERE uid={?} AND asso_id={?}", $user['uid'], $globals->asso('id')); @@ -928,9 +938,9 @@ class XnetGrpModule extends PLModule $mmlist->unsubscribe($liste['list']); } } elseif ($liste['sub']) { - $page->trigWarning("{$user['prenom']} {$user['nom']} a une" - ." demande d'inscription en cours sur la" - ." liste {$liste['list']}@ !"); + Platal::page()->trigWarning("{$user['prenom']} {$user['nom']} a une" + ." demande d'inscription en cours sur la" + ." liste {$liste['list']}@ !"); $warning = true; } } @@ -989,7 +999,7 @@ class XnetGrpModule extends PLModule } } - private function changeLogin(PlatalPage &$page, array &$user, MMList &$mmlist, $login) + private function changeLogin(PlPage &$page, array &$user, MMList &$mmlist, $login) { require_once 'user.func.inc.php'; // Search the uid of the user... @@ -1183,32 +1193,14 @@ class XnetGrpModule extends PLModule function handler_rss(&$page, $user = null, $hash = null) { global $globals; - require_once('rss.inc.php'); - $uid = init_rss('xnetgrp/announce-rss.tpl', $user, $hash, false); - - if ($uid) { - $rss = XDB::iterator("SELECT a.id, a.titre, a.texte, a.contacts, a.create_date, - IF(u2.nom_usage != '', u2.nom_usage, u2.nom) AS nom, u2.prenom, u2.promo, - FIND_IN_SET('photo', a.flags) AS photo - FROM auth_user_md5 AS u - INNER JOIN groupex.announces AS a ON ( (a.promo_min = 0 OR a.promo_min <= u.promo) - AND (a.promo_max = 0 OR a.promo_max <= u.promo)) - INNER JOIN auth_user_md5 AS u2 ON (u2.user_id = a.user_id) - WHERE u.user_id = {?} AND peremption >= NOW() AND a.asso_id = {?}", - $uid, $globals->asso('id')); - } else { - $rss = XDB::iterator("SELECT a.id, a.titre, a.texte, a.create_date, - IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom, u.prenom, u.promo - FROM groupex.announces AS a - INNER JOIN auth_user_md5 AS u USING(user_id) - WHERE FIND_IN_SET('public', a.flags) AND peremption >= NOW() AND a.asso_id = {?}", - $globals->asso('id')); - } $page->assign('asso', $globals->asso()); - $page->assign('rss', $rss); + + $this->load('feed.inc.php'); + $feed = new XnetGrpEventFeed(); + return $feed->run($page, $user, $hash, false); } - private function upload_image(PlatalPage &$page, PlUpload &$upload) + private function upload_image(PlPage &$page, PlUpload &$upload) { if (@!$_FILES['image']['tmp_name'] && !Env::v('image_url')) { return true; @@ -1316,7 +1308,7 @@ class XnetGrpModule extends PLModule if (Post::v('valid') == 'Enregistrer') { $promo_min = ($art['public'] ? 0 : $art['promo_min']); $promo_max = ($art['public'] ? 0 : $art['promo_max']); - $flags = new FlagSet(); + $flags = new PlFlagSet(); if ($art['public']) { $flags->addFlag('public'); }