X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Flists.php;h=11c5d3f579898c0ec3e9c777481dfdcf09d3799a;hb=23fb3e6f6b1376a432eb3142dd43f6e609980f8d;hp=93151c212de1771cfa0afd47c4d502152702b7de;hpb=21c7c593d7100a887f984c49a82c03eb32169fc4;p=platal.git diff --git a/modules/lists.php b/modules/lists.php index 93151c2..11c5d3f 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -1,6 +1,6 @@ $this->make_hook('lists', AUTH_MDP), - 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP, 'user', NO_AUTH), + 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP, 'user', NO_AUTH), 'lists/create' => $this->make_hook('create', AUTH_MDP), 'lists/members' => $this->make_hook('members', AUTH_COOKIE), + 'lists/csv' => $this->make_hook('csv', AUTH_COOKIE), 'lists/annu' => $this->make_hook('annu', AUTH_COOKIE), 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE), 'lists/archives/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS), @@ -42,7 +43,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/lists' => $this->make_hook('admin_all', AUTH_MDP, 'admin'), ); } @@ -337,6 +338,25 @@ class ListsModule extends PLModule } } + function handler_csv(PlPage &$page, $liste = null) + { + if (is_null($liste)) { + return PL_NOT_FOUND; + } + $this->prepare_client($page); + $members = $this->client->get_members($liste); + $list = list_fetch_names(list_extract_members($members[1])); + header('Content-Type: text/x-csv; charset=utf-8;'); + header('Pragma: '); + header('Cache-Control: '); + + echo "email,nom,prenom,promo\n"; + foreach ($list as $member) { + echo @$member['email'] . ',' . @$member['nom'] . ',' . @$member['prenom'] . ',' . @$member['promo'] . "\n"; + } + exit; + } + function handler_annu(&$page, $liste = null, $action = null, $subaction = null) { if (is_null($liste)) { @@ -526,6 +546,21 @@ class ListsModule extends PLModule $msg = str_replace("%(listname)s", $liste, $msg); $page->assign('msg', $msg); return; + } elseif (Get::has('mid') && Env::has('mok')) { + $page->changeTpl('lists/moderate_mail.tpl'); + require_once('banana/moderate.inc.php'); + $params = array('listname' => $liste, 'domain' => $domain, + 'artid' => Get::i('mid'), 'part' => Get::v('part'), 'action' => Get::v('action')); + $params['client'] = $this->client; + run_banana($page, 'ModerationBanana', $params); + + $msg = file_get_contents('/etc/mailman/fr/accept.txt'); + $msg = str_replace("%(adminaddr)s", "$liste-owner@{$domain}", $msg); + $msg = str_replace("%(request)s", "<< SUJET DU MAIL >>", $msg); + $msg = str_replace("%(reason)s", "<< TON EXPLICATION >>", $msg); + $msg = str_replace("%(listname)s", $liste, $msg); + $page->assign('msg', $msg); + return; } $mail = $this->moderate_mail($domain, $liste, Env::i('mid')); @@ -806,12 +841,16 @@ class ListsModule extends PLModule $type, $liste.$app.$domain); } $page->assign('deleted', true); + $page->trigSuccess('La liste a été détruite !'); } else { $page->kill('Une erreur est survenue lors de la suppression de la liste.
' . 'Contact les administrateurs du site pour régler le problème : ' . 'support@polytechnique.org'); } } elseif (list($details,$options) = $this->client->get_owner_options($liste)) { + if (!$details['own']) { + $page->trigWarning('Tu n\'es pas administrateur de la liste, mais du site.'); + } $page->assign_by_ref('details', $details); $page->assign_by_ref('options', $options); $page->assign('bogo_level', $this->client->get_bogo_level($liste));