087cfda9a3f6e7ab02d5ef9ce53ec0ee1bfd796a
2 /***************************************************************************
3 * Copyright (C) 2003-2011 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/hooks.inc.php';
24 class PlatalBananaMLPage
extends PlatalBananaPage
26 public function __construct()
28 parent
::__construct();
30 $this->handler
= 'BananaMLHandler';
31 $this->base
= $platal->pl_self(1);
35 class BananaMLHandler
extends BananaHandler
37 public function template()
39 return 'lists/archives.tpl';
43 class MLBanana
extends Banana
45 static public $listname;
46 static public $domain;
49 function __construct(User
&$user, $params = null
)
54 Banana
::$spool_root = $globals->spoolroot
. '/spool/banana/';
55 Banana
::$spool_boxlist = false
;
56 Banana
::$msgedit_canattach = true
;
57 Banana
::$debug_mbox = ($globals->debug
& DEBUG_BT
);
58 Banana
::$debug_smarty = ($globals->debug
& DEBUG_SMARTY
);
59 Banana
::$mbox_helper = $globals->spoolroot
. '/banana/mbox-helper/mbox-helper';
60 Banana
::$feed_updateOnDemand = true
;
62 Banana
::$msgshow_mimeparts[] = 'source';
64 array_push(Banana
::$msgparse_headers, 'x-org-id', 'x-org-mail');
65 Banana
::$feed_active = S
::hasAuthToken();
67 MLBanana
::$listname = $params['listname'];
68 MLBanana
::$domain = $params['domain'];
69 $params['group'] = $params['listname'] . '@' . $params['domain'];
70 parent
::__construct($params, 'MLArchive', 'PlatalBananaMLPage');
75 global $platal, $globals;
77 $nom = S
::v('prenom') . ' ' . S
::v('nom');
78 $mail = $this->user
->bestEmail();
79 $sig = $nom . ' (' . S
::v('promo') . ')';
80 Banana
::$msgedit_headers['X-Org-Mail'] = $this->user
->forlifeEmail();
83 $req = XDB
::query('SELECT tree_unread, tree_read
85 WHERE uid= {?}', $this->user
->id());
86 if (!(list($unread, $read) = $req->fetchOneRow())) {
90 Banana
::$tree_unread = $unread;
91 Banana
::$tree_read = $read;
94 Banana
::$profile['headers']['From'] = "$nom <$mail>";
95 Banana
::$profile['headers']['Organization'] = make_Organization();
96 Banana
::$profile['signature'] = $sig;
99 Banana
::$page->killPage('forums');
100 Banana
::$page->killPage('subscribe');
103 return parent
::run();
107 require_once dirname(__FILE__
) . '/../../banana/banana/mbox.inc.php';
109 class BananaMLArchive
extends BananaMBox
111 public function name()
116 public function getBoxList($mode = Banana
::BOXES_ALL
, $since = 0, $withstats = false
)
119 $spool = $globals->lists
->spool
. '/';
120 $list = glob($spool . '*.mbox/*.mbox');
121 if ($list === false
) {
125 foreach ($list as $path) {
126 $path = substr($path, strpos($path, 'mbox/') +
5);
127 $path = substr($path, 0, -5);
128 list($domain, $listname) = explode($globals->lists
->vhost_sep
, $path, 2);
129 $group = $listname . '@' . $domain;
130 $groups[$group] = array('desc' => null
, 'msgnum' => null
, 'unread' => null
);
135 public function filename()
137 if (MLBanana
::$listname) {
138 $listname = MLBanana
::$listname;
139 $domain = MLBanana
::$domain;
141 list($listname, $domain) = explode('@', Banana
::$group);
143 return $domain . '_' . $listname;
146 protected function getFileName()
149 $base = $globals->lists
->spool
;
150 if (MLBanana
::$listname) {
151 $listname = MLBanana
::$listname;
152 $domain = MLBanana
::$domain;
154 list($listname, $domain) = explode('@', Banana
::$group);
156 $file = $domain . $globals->lists
->vhost_sep
. $listname . '.mbox';
157 return "$base/$file/$file";
161 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: