static function run_banana($page, $params = null) { $page->changeTpl('banana/index.tpl'); $page->setTitle('Forums & PA'); require_once 'banana/forum.inc.php'; run_banana($page, 'ForumsBanana', $params); }
function handler_moderate($page, $liste = null) { if (is_null($liste)) { return PL_NOT_FOUND; } $mlist = $this->prepare_list($liste); if (!$this->is_group_admin($page)) { $this->verify_list_owner($page, $mlist); } $page->changeTpl('lists/moderate.tpl'); $page->register_modifier('hdc', 'list_header_decode'); if (Env::has('sadd') || Env::has('sdel')) { S::assert_xsrf_token(); if (Env::has('sadd')) { // Ensure the moderated request is still active $sub = $mlist->getPendingSubscription(Env::v('sadd')); $mlist->handleRequest(MailingList::REQ_SUBSCRIBE, Env::v('sadd')); $info = "validée"; } if (Post::has('sdel')) { // Ensure the moderated request is still active $sub = $mlist->getPendingSubscription(Env::v('sdel')); $mlist->handleRequest(MailingList::REQ_REJECT, Post::v('sdel'), Post::v('reason')); $info = "refusée"; } if ($sub) { $mailer = new PlMailer(); $mailer->setFrom($mlist->getAddress(MailingList::KIND_BOUNCE)); $mailer->addTo($mlist->getAddress(MailingList::KIND_OWNER)); $mailer->addHeader('Reply-To', $mlist->getAddress(MailingList::KIND_OWNER)); $mailer->setSubject("L'inscription de {$sub['name']} a été {$info}"); $text = "L'inscription de {$sub['name']} à la liste " . $mlist->address . " a été {$info} par " . S::user()->fullName(true) . ".\n"; if (trim(Post::v('reason'))) { $text .= "\nLa raison invoquée est :\n" . Post::v('reason'); } $mailer->setTxtBody(wordwrap($text, 72)); $mailer->send(); } if (Env::has('sadd')) { pl_redirect('lists/moderate/' . $liste); } } if (Post::has('moderate_mails') && Post::has('select_mails')) { S::assert_xsrf_token(); $mails = array_keys(Post::v('select_mails')); foreach ($mails as $mail) { $this->moderate_mail($mlist, $mail); } } elseif (Env::has('mid')) { if (Get::has('mid') && !Env::has('mok') && !Env::has('mdel')) { require_once 'banana/moderate.inc.php'; $page->changeTpl('lists/moderate_mail.tpl'); $params = array('listname' => $mlist->mbox, 'domain' => $mlist->domain, 'artid' => Get::i('mid'), 'part' => Get::v('part'), 'action' => Get::v('action')); $params['client'] = $this->prepare_client(); run_banana($page, 'ModerationBanana', $params); $msg = file_get_contents('/etc/mailman/fr/refuse.txt'); $msg = str_replace("%(adminaddr)s", $mlist->getAddress(MailingList::KIND_OWNER), $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; } $this->moderate_mail($mlist, Env::i('mid')); } elseif (Env::has('sid')) { if (list($subs, $mails) = $this->get_pending_ops($mlist)) { foreach ($subs as $user) { if ($user['id'] == Env::v('sid')) { $page->changeTpl('lists/moderate_sub.tpl'); $page->assign('del_user', $user); return; } } } } if (list($subs, $mails) = $this->get_pending_ops($mlist)) { foreach ($mails as $key => $mail) { $mails[$key]['stamp'] = strftime("%Y%m%d%H%M%S", $mail['stamp']); if ($mail['fromx']) { $page->assign('with_fromx', true); } else { $page->assign('with_nonfromx', true); } } $page->assign_by_ref('subs', $subs); $page->assign_by_ref('mails', $mails); } else { $page->kill("La liste n'existe pas ou tu n'as pas le droit de la modérer."); } }
function handler_forum($page, $group = null, $artid = null) { global $globals; $page->changeTpl('xnetgrp/forum.tpl'); if (!$globals->asso('forum')) { return PL_NOT_FOUND; } require_once 'banana/forum.inc.php'; $get = array(); get_banana_params($get, $globals->asso('forum'), $group, $artid); run_banana($page, 'ForumsBanana', $get); }