493e560cfc0212dd38fd6370911923f6f1149e23
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';
24 function hook_formatDisplayHeader($_header, $_text, $in_spool = false
)
27 case 'from': case 'to': case 'cc': case 'reply-to':
28 $addresses = preg_split("/ *, */", $_text);
30 foreach ($addresses as $address) {
31 $address = BananaMessage
::formatFrom(trim($address));
32 if ($_header == 'from') {
33 if ($id = Banana
::$message->getHeaderValue('x-org-id')) {
34 return $address . ' <a href="profile/' . $id . '" class="popup2" title="' . $id . '">'
35 . '<img src="images/icons/user_suit.gif" title="fiche" alt="" /></a>';
36 } elseif ($id = Banana
::$message->getHeaderValue('x-org-mail')) {
37 list($id, $domain) = explode('@', $id);
38 return $address . ' <a href="profile/' . $id . '" class="popup2" title="' . $id . '">'
39 . '<img src="images/icons/user_suit.gif" title="fiche" alt="" /></a>';
53 $text = stripslashes($_text);
54 if (preg_match('/^(.+?)\s*\[=> (.*?)\]\s*$/u', $text, $matches)) {
57 if (Banana
::$group == $group) {
58 $link = ' [=> ' . $group . ']';
60 $link = ' [=> ' . Banana
::$page->makeLink(array('group' => $group, 'text' => $group)) . ']';
63 $text = banana_catchFormats(banana_htmlentities($text));
65 return array($text, $link);
72 function hook_platalRSS($group)
79 return '/rss/' . $group . S
::v('forlife') . '/' . S
::v('core_rss_hash') . '/rss.xml';
82 function hook_platalMessageLink($params)
85 if (isset($params['first'])) {
86 return $base . '/from/' . $params['first'];
88 if (isset($params['artid'])) {
89 if (@$params['part'] == 'xface') {
91 } elseif (@$params['action'] == 'new') {
93 } elseif (@$params['action'] == 'cancel') {
95 } elseif (@$params['part']) {
96 if (strpos($params['part'], '.') !== false
) {
97 $params['artid'] .= '?part=' . urlencode($params['part']);
100 $base .= '/' . str_replace('/', '.', $params['part']);
105 return $base . '/' . $params['artid'];
108 if (@$params['action'] == 'new') {
109 return $base . '/new';
114 function hook_makeImg($img, $alt, $height, $width)
116 $url = 'images/banana/' . $img;
118 if (!is_null($width)) {
119 $width = ' width="' . $width . '"';
121 if (!is_null($height)) {
122 $height = ' height="' . $height . '"';
125 return '<img src="' . $url . '"' . $height . $width . ' alt="' . $alt . '" />';
128 function hook_makeLink($params)
130 global $globals, $platal;
131 if (Banana
::$protocole->name() == 'NNTP') {
132 $base = $globals->baseurl
. '/banana';
133 if (@$params['action'] == 'rss' ||
@$params['action'] == 'rss2' ||
@$params['action'] == 'atom') {
134 return $base . hook_platalRSS(@$params['group']);
136 if (isset($params['page'])) {
137 return $base . '/' . $params['page'];
139 if (@$params['action'] == 'subscribe') {
140 return $base . '/subscription';
143 if (!isset($params['group'])) {
146 $base .= '/' . $params['group'];
147 } else if (Banana
::$protocole->name() == 'MLArchives') {
148 $base = $globals->baseurl
. '/' . $platal->ns
. 'lists/archives';
149 if (@$params['action'] == 'rss' ||
@$params['action'] == 'rss2' ||
@$params['action'] == 'atom') {
150 return $base . hook_platalRSS(MLBanana
::$listname);
152 $base .= '/' . MLBanana
::$listname;
154 $base = $base . hook_platalMessageLink($params);
155 if (@$params['action'] == 'showext') {
156 $base .= '?action=showext';
161 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: