2 /***************************************************************************
3 * Copyright (C) 2003-2009 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 PlatalBananaMLPage
extends PlatalBananaPage
27 public function __construct()
29 parent
::__construct();
31 $this->handler
= 'BananaMLHandler';
32 $this->base
= $platal->pl_self(1);
36 class BananaMLHandler
extends BananaHandler
38 public function template()
40 return 'lists/archives.tpl';
44 class MLBanana
extends Banana
46 static public $listname;
47 static public $domain;
50 function __construct(User
&$user, $params = null
)
55 Banana
::$spool_root = $globals->banana
->spool_root
;
56 Banana
::$spool_boxlist = false
;
57 Banana
::$msgedit_canattach = true
;
58 Banana
::$debug_mbox = ($globals->debug
& DEBUG_BT
);
59 Banana
::$debug_smarty = ($globals->debug
& DEBUG_SMARTY
);
60 Banana
::$mbox_helper = $globals->banana
->mbox_helper
;
61 Banana
::$feed_updateOnDemand = true
;
63 Banana
::$msgshow_mimeparts[] = 'source';
65 array_push(Banana
::$msgparse_headers, 'x-org-id', 'x-org-mail');
66 if (!S
::v('core_rss_hash')) {
67 Banana
::$feed_active = false
;
70 MLBanana
::$listname = $params['listname'];
71 MLBanana
::$domain = $params['domain'];
72 $params['group'] = $params['listname'] . '@' . $params['domain'];
73 parent
::__construct($params, 'MLArchive', 'PlatalBananaMLPage');
78 global $platal, $globals;
80 $nom = S
::v('prenom') . ' ' . S
::v('nom');
81 $mail = $this->user
->bestEmail();
82 $sig = $nom . ' (' . S
::v('promo') . ')';
83 Banana
::$msgedit_headers['X-Org-Mail'] = $this->user
->forlifeEmail();
86 $req = XDB
::query("SELECT tree_unread, tree_read
87 FROM {$globals->banana->table_prefix}profils
88 WHERE uid={?}", S
::i('uid'));
89 if (!(list($unread, $read) = $req->fetchOneRow())) {
93 Banana
::$tree_unread = $unread;
94 Banana
::$tree_read = $read;
97 Banana
::$profile['headers']['From'] = "$nom <$mail>";
98 Banana
::$profile['headers']['Organization'] = make_Organization();
99 Banana
::$profile['signature'] = $sig;
102 Banana
::$page->killPage('forums');
103 Banana
::$page->killPage('subscribe');
106 return parent
::run();
110 require_once('banana/mbox.inc.php');
112 class BananaMLArchive
extends BananaMBox
114 public function name()
119 public function getBoxList($mode = Banana
::BOXES_ALL
, $since = 0, $withstats = false
)
122 $spool = $globals->lists
->spool
. '/';
123 $list = glob($spool . '*.mbox/*.mbox');
124 if ($list === false
) {
128 foreach ($list as $path) {
129 $path = substr($path, strpos($path, 'mbox/') +
5);
130 $path = substr($path, 0, -5);
131 list($domain, $listname) = explode($globals->lists
->vhost_sep
, $path, 2);
132 $group = $listname . '@' . $domain;
133 $groups[$group] = array('desc' => null
, 'msgnum' => null
, 'unread' => null
);
138 public function filename()
140 if (MLBanana
::$listname) {
141 $listname = MLBanana
::$listname;
142 $domain = MLBanana
::$domain;
144 list($listname, $domain) = explode('@', Banana
::$group);
146 return $domain . '_' . $listname;
149 protected function getFileName()
152 $base = $globals->lists
->spool
;
153 if (MLBanana
::$listname) {
154 $listname = MLBanana
::$listname;
155 $domain = MLBanana
::$domain;
157 list($listname, $domain) = explode('@', Banana
::$group);
159 $file = $domain . $globals->lists
->vhost_sep
. $listname . '.mbox';
160 return "$base/$file/$file";
164 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: