8a42f30e9d72531b6452a88ab307244cdd5d96b0
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 function hook_makeLink($params)
27 global $globals, $platal;
28 $base = $globals->baseurl
. '/' . $platal->ns
. 'lists/archives/' . MLBanana
::$listname;
29 $base = $base . hook_platalMessageLink($params);
30 if (@$params['action'] == 'showext') {
31 $base .= '?action=showext';
36 class MLBanana
extends Banana
38 static public $listname;
39 static public $domain;
41 function __construct($params = null
)
43 Banana
::$spool_root = $globals->banana
->spool_root
;
44 Banana
::$spool_boxlist = false
;
45 Banana
::$msgedit_canattach = true
;
47 Banana
::$msgshow_mimeparts[] = 'source';
49 array_push(Banana
::$msgparse_headers, 'x-org-id', 'x-org-mail');
51 MLBanana
::$listname = $params['listname'];
52 MLBanana
::$domain = $params['domain'];
53 $params['group'] = $params['listname'] . '@' . $params['domain'];
54 parent
::__construct($params, 'MLArchive');
59 global $platal, $globals;
61 $nom = S
::v('prenom') . ' ' . S
::v('nom');
62 $mail = S
::v('bestalias') . '@' . $globals->mail
->domain
;
63 $sig = $nom . ' (' . S
::v('promo') . ')';
64 Banana
::$msgedit_headers['X-Org-Mail'] = S
::v('forlife') . '@' . $globals->mail
->domain
;
67 Banana
::$profile['headers']['From'] = utf8_encode("$nom <$mail>");
68 Banana
::$profile['headers']['Organization'] = 'Utilisateur de Polytechnique.org';
69 Banana
::$profile['signature'] = utf8_encode($sig);
72 Banana
::$page->killPage('forums');
73 Banana
::$page->killPage('subscribe');
80 require_once('banana/mbox.inc.php');
82 class BananaMLArchive
extends BananaMBox
84 public function name()
89 public function getBoxList($mode = Banana
::BOXES_ALL
, $since = 0, $withstats = false
)
92 $spool = $globals->lists
->spool
. '/';
93 $list = glob($spool . '*.mbox', GLOB_ONLYDIR
);
94 if ($list === false
) {
98 foreach ($list as $path) {
99 $path = substr($path, strlen($spool));
100 $path = substr($path, 0, -5);
101 list($domain, $listname) = explode($globals->lists
->vhost_sep
, $path, 2);
102 $group = $listname . '@' . $domain;
103 $groups[$group] = array('desc' => null
, 'msgnum' => null
, 'unread' => null
);
108 public function filename()
110 if (MLBanana
::$listname) {
111 $listname = MLBanana
::$listname;
112 $domain = MLBanana
::$domain;
114 list($listname, $domain) = explode('@', Banana
::$group);
116 return $domain . '_' . $listname;
119 protected function getFileName()
122 $base = $globals->lists
->spool
;
123 if (MLBanana
::$listname) {
124 $listname = MLBanana
::$listname;
125 $domain = MLBanana
::$domain;
127 list($listname, $domain) = explode('@', Banana
::$group);
129 $file = $domain . $globals->lists
->vhost_sep
. $listname . '.mbox';
130 return "$base/$file/$file";