X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Flists.php;h=8b417e0cc96f89a097c536cfc5f8395ce8585b51;hb=14f4068d03b9494b2b755e8aefe2cf1747a65aa7;hp=e1bfb1161957b144342e15908db8400a8a76698d;hpb=5ae3e9a9b7e095956904a2bedbc0845af88434f0;p=platal.git diff --git a/modules/lists.php b/modules/lists.php index e1bfb11..8b417e0 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -44,6 +44,7 @@ class ListsModule extends PLModule 'lists/soptions' => $this->make_hook('soptions', AUTH_MDP), 'lists/check' => $this->make_hook('check', AUTH_MDP), 'admin/lists' => $this->make_hook('admin_all', AUTH_MDP, 'admin'), + 'admin/aliases' => $this->make_hook('aaliases', AUTH_MDP, 'admin') ); } @@ -376,29 +377,35 @@ class ListsModule extends PLModule $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails."); } - global $platal; list(,$members) = $this->client->get_members($liste); - $users = array(); - foreach ($members as $m) { - $users[] = $m[1]; + + if ($action == 'moderators') { + $users = $owners; + $show_moderators = true; + $action = $subaction; + $subaction = ''; + } else { + $show_moderators = false; + $users = array(); + foreach ($members as $m) { + $users[] = $m[1]; + } } + require_once 'userset.inc.php'; - $view = new ArraySet($users); - $view->addMod('trombi', 'Trombinoscope', true, array('with_promo' => true)); + $view = new UserArraySet($users); + $view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true)); + $view->addMod('listmember', 'Annuaire', true); if (empty($GLOBALS['IS_XNET_SITE'])) { $view->addMod('minifiche', 'Mini-fiches', false); } // TODO: Reactivate when the new map is completed. // $view->addMod('geoloc', 'Planisphère'); $view->apply("lists/annu/$liste", $page, $action, $subaction); - if ($action == 'geoloc' && $subaction) { - return; - } $page->changeTpl('lists/annu.tpl'); - $moderos = list_sort_owners($owners[1]); $page->assign_by_ref('details', $owners[0]); - $page->assign_by_ref('owners', $moderos); + $page->assign('show_moderators', $show_moderators); } function handler_archives($page, $liste = null, $action = null, $artid = null) @@ -886,6 +893,62 @@ class ListsModule extends PLModule $listes = $this->client->get_all_lists(); $page->assign_by_ref('listes', $listes); } + + function handler_aaliases($page, $alias = null) + { + global $globals; + require_once 'emails.inc.php'; + $page->setTitle('Administration - Aliases'); + + if (Post::has('new_alias')) { + pl_redirect('admin/aliases/' . Post::t('new_alias') . '@' . $globals->mail->domain); + } + + // If no alias, list them all. + if (is_null($alias)) { + $page->changeTpl('lists/admin_aliases.tpl'); + $page->assign('aliases', array_merge(iterate_list_alias($globals->mail->domain), iterate_list_alias($globals->mail->domain2))); + return; + } + + list($local_part, $domain) = explode('@', $alias); + if (!($globals->mail->domain == $domain || $globals->mail->domain2 == $domain) + || !preg_match("/^[a-zA-Z0-9\-\.]*$/", $local_part)) { + $page->trigErrorRedirect('Le nom de l\'alias est erroné.', $globals->asso('diminutif') . 'admin/aliases'); + } + + // Now we can perform the action. + if (Post::has('del_alias')) { + S::assert_xsrf_token(); + + delete_list_alias($local_part, $domain); + $page->trigSuccessRedirect($alias . ' supprimé.', 'admin/aliases'); + } + + if (Post::has('add_member')) { + S::assert_xsrf_token(); + + if (add_to_list_alias(Post::t('add_member'), $local_part, $domain)) { + $page->trigSuccess('Ajout réussit.'); + } else { + $page->trigError('Ajout infructueux.'); + } + } + + if (Get::has('del_member')) { + S::assert_xsrf_token(); + + if (delete_from_list_alias(Get::t('del_member'), $local_part, $domain)) { + $page->trigSuccess('Suppression réussie.'); + } else { + $page->trigError('Suppression infructueuse.'); + } + } + + $page->changeTpl('lists/admin_edit_alias.tpl'); + $page->assign('members', list_alias_members($local_part, $domain)); + $page->assign('alias', $alias); + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: