X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetgrp.php;h=215f45b5fc7517a23c69b481817ba9af3994dbaa;hb=7996ae8cd41fbb3ccd748eaed71a50f866269c6e;hp=4fc69a4d4b157ac80112d8ad0c3b2177dd2ef62a;hpb=0073747ac81cc9cff9e43847eb008f0e815255f0;p=platal.git diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 4fc69a4..215f45b 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -163,11 +163,17 @@ class XnetGrpModule extends PLModule } else { $site = ""; } - if (S::has_perms()) { + if (S::admin()) { + $page->assign('super', true); + if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) { $page->trigError('Le domaine doit être un FQDN (aucune modification effectuée) !!!'); return; } + if (Post::t('nom') == '' || Post::t('diminutif') == '') { + $page->trigError('Ni le nom ni le diminutif du groupe ne peuvent être vide.'); + return; + } XDB::execute( "UPDATE groups SET nom={?}, diminutif={?}, cat={?}, dom={?}, @@ -216,11 +222,13 @@ class XnetGrpModule extends PLModule } } - pl_redirect('../'.Post::v('diminutif', $globals->asso('diminutif')).'/edit'); + pl_redirect('../' . Post::v('diminutif', $globals->asso('diminutif')) . '/edit'); } if (S::admin()) { - $dom = XDB::iterator('SELECT * FROM group_dom ORDER BY nom'); + $dom = XDB::iterator('SELECT * + FROM group_dom + ORDER BY nom'); $page->assign('dom', $dom); $page->assign('super', true); } @@ -282,21 +290,20 @@ class XnetGrpModule extends PLModule { global $globals; - if ($action == 'search') { - http_redirect("https://www.polytechnique.org/search/adv?rechercher=Chercher&groupex={$globals->asso('id')}" - . "&cityid=" . Env::v('cityid') . "&mapid=" . Env::v('mapid')); - } else if ($action == 'geoloc' || $action == 'trombi') { - $view = new UserSet(); + if ($action == 'trombi') { + __autoload('userset'); + if ($action == 'trombi') { + $view = new ProfileSet(new UFC_Group($globals->asso('id'))); + } else { + $view = new UserSet(new UFC_Group($globals->asso('id'))); + } $view->addMod('trombi', 'Trombinoscope'); - // TODO: Reactivate when the new map is completed. - // $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'annuaire/search')); $view->apply('annuaire', $page, $action, $subaction); - if ($action == 'geoloc' && $subaction) { - return; - } + $page->changeTpl('xnetgrp/annuaire.tpl'); + return; } - $page->changeTpl('xnetgrp/annuaire.tpl'); + $page->changeTpl('xnetgrp/annuaire.tpl'); $sort = Env::s('order', 'directory_name'); $ofs = Env::i('offset'); if ($ofs < 0) { @@ -724,18 +731,20 @@ class XnetGrpModule extends PLModule $may_update = may_update(); $warning = false; - foreach ($listes as $liste) { - if ($liste['sub'] == 2) { - if ($may_update) { - $mmlist->mass_unsubscribe($liste['list'], Array($user->forlifeEmail())); - } else { - $mmlist->unsubscribe($liste['list']); + if (is_array($listes)) { + foreach ($listes as $liste) { + if ($liste['sub'] == 2) { + if ($may_update) { + $mmlist->mass_unsubscribe($liste['list'], Array($user->forlifeEmail())); + } else { + $mmlist->unsubscribe($liste['list']); + } + } elseif ($liste['sub']) { + Platal::page()->trigWarning($user->fullName() . " a une" + ." demande d'inscription en cours sur la" + ." liste {$liste['list']}@ !"); + $warning = true; } - } elseif ($liste['sub']) { - Platal::page()->trigWarning($user->fullName() . " a une" - ." demande d'inscription en cours sur la" - ." liste {$liste['list']}@ !"); - $warning = true; } } @@ -802,16 +811,15 @@ class XnetGrpModule extends PLModule WHERE a.alias = {?}", $login); if ($res->numRows() == 0) { - // TODO: replace this call to a removed function. - $x = get_not_registered_user($login); - if (!$x) { - $page->trigError("Le login $login ne correspond à aucun X."); + $accounts = User::getPendingAccounts($login); + if (!$accounts) { + $page->trigError("L'identifiant $login ne correspond à aucun X."); return false; - } else if (count($x) > 1) { - $page->trigError("Le login $login correspond a plusieurs camarades."); + } else if (count($accounts) > 1) { + $page->trigError("L'identifiant $login correspond à plusieurs camarades."); return false; } - $uid = $x[0]['uid']; + $uid = $accounts[0]['uid']; $sub = false; } else { list($uid, $login) = $res->fetchOneRow();