4880a536bc9c68eaa4352569e606e7d43e97f5f5
2 /***************************************************************************
3 * Copyright (C) 2003-2007 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
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. *
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. *
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 *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 require_once 'banana/banana.inc.php';
23 require_once 'banana/hooks.inc.php';
25 class MLBanana
extends Banana
27 static public $listname;
28 static public $domain;
30 function __construct($forlife, $params = null
)
33 Banana
::$spool_root = $globals->banana
->spool_root
;
34 Banana
::$spool_boxlist = false
;
35 Banana
::$msgedit_canattach = true
;
36 Banana
::$debug_mbox = ($globals->debug
& DEBUG_BT
);
37 Banana
::$debug_smarty = ($globals->debug
& DEBUG_SMARTY
);
38 Banana
::$mbox_helper = $globals->banana
->mbox_helper
;
40 Banana
::$msgshow_mimeparts[] = 'source';
42 array_push(Banana
::$msgparse_headers, 'x-org-id', 'x-org-mail');
43 if (!S
::v('core_rss_hash')) {
44 Banana
::$feed_active = false
;
47 MLBanana
::$listname = $params['listname'];
48 MLBanana
::$domain = $params['domain'];
49 $params['group'] = $params['listname'] . '@' . $params['domain'];
50 parent
::__construct($params, 'MLArchive');
55 global $platal, $globals;
57 $nom = S
::v('prenom') . ' ' . S
::v('nom');
58 $mail = S
::v('bestalias') . '@' . $globals->mail
->domain
;
59 $sig = $nom . ' (' . S
::v('promo') . ')';
60 Banana
::$msgedit_headers['X-Org-Mail'] = S
::v('forlife') . '@' . $globals->mail
->domain
;
63 Banana
::$profile['headers']['From'] = "$nom <$mail>";
64 Banana
::$profile['headers']['Organization'] = 'Utilisateur de Polytechnique.org';
65 Banana
::$profile['signature'] = $sig;
68 Banana
::$page->killPage('forums');
69 Banana
::$page->killPage('subscribe');
76 require_once('banana/mbox.inc.php');
78 class BananaMLArchive
extends BananaMBox
80 public function name()
85 public function getBoxList($mode = Banana
::BOXES_ALL
, $since = 0, $withstats = false
)
88 $spool = $globals->lists
->spool
. '/';
89 $list = glob($spool . '*.mbox/*.mbox');
90 if ($list === false
) {
94 foreach ($list as $path) {
95 $path = substr($path, strpos($path, 'mbox/') +
5);
96 $path = substr($path, 0, -5);
97 list($domain, $listname) = explode($globals->lists
->vhost_sep
, $path, 2);
98 $group = $listname . '@' . $domain;
99 $groups[$group] = array('desc' => null
, 'msgnum' => null
, 'unread' => null
);
104 public function filename()
106 if (MLBanana
::$listname) {
107 $listname = MLBanana
::$listname;
108 $domain = MLBanana
::$domain;
110 list($listname, $domain) = explode('@', Banana
::$group);
112 return $domain . '_' . $listname;
115 protected function getFileName()
118 $base = $globals->lists
->spool
;
119 if (MLBanana
::$listname) {
120 $listname = MLBanana
::$listname;
121 $domain = MLBanana
::$domain;
123 list($listname, $domain) = explode('@', Banana
::$group);
125 $file = $domain . $globals->lists
->vhost_sep
. $listname . '.mbox';
126 return "$base/$file/$file";
130 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: