X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fspool.inc.php;h=2a6be2e31d9474429d74df95b83478c25c86fdee;hb=55336123892d166ad156911be4a65ffe25b6bac5;hp=c7a7daeb85471109d0434be7befed00cf7f9c297;hpb=fb6428c855e1be6fed8326d1ddecbf7a4eab3f60;p=banana.git
diff --git a/banana/spool.inc.php b/banana/spool.inc.php
index c7a7dae..2a6be2e 100644
--- a/banana/spool.inc.php
+++ b/banana/spool.inc.php
@@ -107,19 +107,19 @@ class BananaSpool
$first = $banana->maxspool ? max($groupinfo[2] - $banana->maxspool, $groupinfo[1]) : $groupinfo[1];
$last = $groupinfo[2];
- if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
- $mids = array_keys($this->overview);
- foreach ($mids as $id) {
- if (($first <= $last && ($id < $first || $id > $last))
- || ($first > $last && $id < $first && $id > $last))
- {
+ if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
+ $mids = array_keys($this->overview);
+ foreach ($mids as $id) {
+ if (($first <= $last && ($id < $first || $id > $last))
+ || ($first > $last && $id < $first && $id > $last))
+ {
$this->delid($id, false);
$do_save = true;
}
}
if (!empty($this->overview)) {
$first = max(array_keys($this->overview))+1;
- }
+ }
} else {
unset($this->overview, $this->ids);
$this->version = BANANA_SPOOL_VERSION;
@@ -178,7 +178,7 @@ class BananaSpool
$msgids = $banana->nntp->xhdr('Message-ID', $arg);
$refs = $banana->nntp->xhdr('References', $arg);
- if (is_array($this->ids)) {
+ if (is_array(@$this->ids)) {
$this->ids = array_merge($this->ids, array_flip($msgids));
} else {
$this->ids = array_flip($msgids);
@@ -186,7 +186,7 @@ class BananaSpool
foreach ($msgids as $id=>$msgid) {
$msg = new BananaSpoolHead($dates[$id], $subjects[$id], $froms[$id]);
- $refs[$id] = str_replace('><', '> <', $refs[$id]);
+ $refs[$id] = str_replace('><', '> <', @$refs[$id]);
$msgrefs = preg_split("/[ \t]/", strtr($refs[$id], $this->ids));
$parents = preg_grep('/^\d+$/', $msgrefs);
$msg->parent = array_pop($parents);
@@ -309,20 +309,24 @@ class BananaSpool
* @param $_pfx_node STRING prefix used for current node
* @param $_pfx_end STRING prefix used for children of current node
* @param $_head BOOLEAN true if first post in thread
+ *
+ * If you want to analyse subject, you can define the function hook_getSubject(&$subject) which
+ * take the subject as a reference parameter, transform this subject to be displaid in the spool
+ * view and return a string. This string will be put after the subject.
*/
function _to_html($_id, $_index, $_first=0, $_last=0, $_ref="", $_pfx_node="", $_pfx_end="", $_head=true)
{
- $spfx_f = '';
- $spfx_n = '
';
- $spfx_Tnd = '
';
- $spfx_Lnd = '
';
- $spfx_snd = '
';
- $spfx_T = '
';
- $spfx_L = '
';
- $spfx_s = '
';
- $spfx_e = '
';
- $spfx_I = '
';
+ $spfx_f = makeImg('k1.gif', 'o', 21, 9);
+ $spfx_n = makeImg('k2.gif', '*', 21, 9);
+ $spfx_Tnd = makeImg('T-direct.gif', '+', 21, 12);
+ $spfx_Lnd = makeImg('L-direct.gif', '`', 21, 12);
+ $spfx_snd = makeImg('s-direct.gif', '-', 21, 5);
+ $spfx_T = makeImg('T.gif', '+', 21, 12);
+ $spfx_L = makeImg('L.gif', '`', 21, 12);
+ $spfx_s = makeImg('s.gif', '-', 21, 5);
+ $spfx_e = makeImg('e.gif', ' ', 21, 12);
+ $spfx_I = makeImg('I.gif', '|', 21, 12);
if ($_index + $this->overview[$_id]->desc < $_first || $_index > $_last) {
return;
@@ -342,12 +346,19 @@ class BananaSpool
if (strlen($subject) == 0) {
$subject = _b_('(pas de sujet)');
}
+ $link = null;
+ if (function_exists('hook_getSubject')) {
+ $link = hook_getSubject($subject);
+ }
+ $subject = formatPlainText(htmlentities($subject));
if ($_index == $_ref) {
- $res .= ''.htmlentities($subject).'';
+ $res .= '' . $subject . $link . '';
} else {
$res .= makeHREF(Array('group' => $this->group,
- 'artid' => $_id),
- htmlentities($subject));
+ 'artid' => $_id),
+ $subject,
+ $subject)
+ . $link;
}
$res .= "\n
'._b_('Date').' | '; - $res .= ''._b_('Sujet').' | '; - $res .= ''._b_('Auteur').' |
---|---|---|
' . _b_('Date') . ' | '; + $res .= '' . $new . _b_('Sujet') . ' | '; + $res .= '' . _b_('Auteur') . ' |
' . _b_('Aperçu de ') + . makeHREF(Array('group' => $this->group), + $this->group) + . ' | ||
'._b_('Aucun message dans ce forum').' | ||
' + . $banana->groups->to_html() + . ' |