| 1 | <?php |
| 2 | /*************************************************************************** |
| 3 | * Copyright (C) 2003-2007 Polytechnique.org * |
| 4 | * http://opensource.polytechnique.org/ * |
| 5 | * * |
| 6 | * This program is free software; you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, write to the Free Software * |
| 18 | * Foundation, Inc., * |
| 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | require_once 'banana/banana.inc.php'; |
| 23 | require_once 'banana/hooks.inc.php'; |
| 24 | |
| 25 | function hook_makeLink($params) |
| 26 | { |
| 27 | global $globals, $platal; |
| 28 | $base = $globals->baseurl . $platal->ns . '/lists/archives/' . MLBanana::$listname; |
| 29 | return $base . hook_platalMessageLink($params); |
| 30 | } |
| 31 | |
| 32 | class MLBanana extends Banana |
| 33 | { |
| 34 | static public $listname; |
| 35 | static public $domain; |
| 36 | |
| 37 | function __construct($params = null) |
| 38 | { |
| 39 | Banana::$spool_boxlist = false; |
| 40 | Banana::$msgedit_canattach = true; |
| 41 | array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail'); |
| 42 | |
| 43 | MLBanana::$listname = $params['listname']; |
| 44 | MLBanana::$domain = $params['domain']; |
| 45 | $params['group'] = $params['listname'] . '@' . $params['domain']; |
| 46 | parent::__construct($params, 'MLArchive'); |
| 47 | } |
| 48 | |
| 49 | public function run() |
| 50 | { |
| 51 | global $platal, $globals; |
| 52 | |
| 53 | $nom = S::v('prenom') . ' ' . S::v('nom'); |
| 54 | $mail = S::v('bestalias') . '@' . $globals->mail->domain; |
| 55 | $sig = $nom . ' (' . S::v('promo') . ')'; |
| 56 | Banana::$msgedit_headers['X-Org-Mail'] = S::v('forlife') . '@' . $globals->mail->domain; |
| 57 | |
| 58 | // Build user profile |
| 59 | Banana::$profile['headers']['From'] = utf8_encode("$nom <$mail>"); |
| 60 | Banana::$profile['headers']['Organization'] = 'Utilisateur de Polytechnique.org'; |
| 61 | Banana::$profile['signature'] = utf8_encode($sig); |
| 62 | |
| 63 | // Page design |
| 64 | Banana::$page->killPage('forums'); |
| 65 | Banana::$page->killPage('subscribe'); |
| 66 | |
| 67 | // Run Banana |
| 68 | return parent::run(); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | require_once('banana/mbox.inc.php'); |
| 73 | |
| 74 | class BananaMLArchive extends BananaMBox |
| 75 | { |
| 76 | public function name() |
| 77 | { |
| 78 | return 'MLArchives'; |
| 79 | } |
| 80 | |
| 81 | public function filename() |
| 82 | { |
| 83 | return MLBanana::$domain . '_' . MLBanana::$listname; |
| 84 | } |
| 85 | |
| 86 | protected function getFileName($box) |
| 87 | { |
| 88 | global $globals; |
| 89 | $base = $globals->lists->spool; |
| 90 | $file = MLBanana::$domain . $globals->lists->vhost_sep . MLBanana::$listname . '.mbox'; |
| 91 | return "$base/$file/$file"; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | ?> |