+Wed, 15 Aug 2007 Florent Bruneau <florent.bruneau@m4x.org>
+
+ * Bugfix: don't show an empty forum when it contains no unread post
+
Sat, 23 Jun 2007 Florent Bruneau <florent.bruneau@m4x.org>
* Add the year of the post in the spool for post older than 90 days
### Message display ###
static public $msgshow_headers = array('from', 'newsgroups', 'followup-to', 'to', 'cc', 'reply-to',
'organization', 'date', 'references', 'in-reply-to');
- static public $msgshow_mimeparts = array('multipart/report', 'multipart/mixed',
+ static public $msgshow_mimeparts = array('multipart/report', 'multipart/mixed',
'text/html', 'text/plain', 'text/enriched', 'text', 'message');
static public $msgshow_xface = true;
static public $msgshow_wrap = 80;
#######
# Constants
-#######
+#######
// Actions
const ACTION_BOX_NEEDED = 1; // mask
$classname = 'Banana' . $protocole;
if (!class_exists($classname)) {
Banana::load($protocole);
- }
+ }
Banana::$protocole = new $classname(Banana::$group);
// build the page
Banana::$action = Banana::ACTION_BOX_FEED;
return;
}
-
+
// Look for the action to execute
if (is_null(Banana::$group)) {
if ($action == 'subscribe') {
}
return;
}
-
+
if (is_null(Banana::$artid)) {
if ($action == 'new') {
Banana::$action = Banana::ACTION_MSG_NEW;
{
// Configure locales
setlocale(LC_ALL, Banana::$profile['locale']);
-
+
// Check if the state is valid
if (Banana::$protocole->lastErrNo()) {
return Banana::$page->kill(_b_('Une erreur a été rencontrée lors de la connexion au serveur') . '<br />'
}
if (Banana::$action & Banana::ACTION_BOX_NEEDED) {
if(Banana::$boxpattern && !preg_match('/' . Banana::$boxpattern . '/i', Banana::$group)) {
- Banana::$page->setPage('group');
+ Banana::$page->setPage('group');
return Banana::$page->kill(_b_("Ce newsgroup n'existe pas ou vous n'avez pas l'autorisation d'y accéder"));
}
}
$headers[$hdrs['dest']] = $dest;
if ($reply) {
$headers[$hdrs['reply']] = $reply;
- }
+ }
$headers['Subject'] = $subject;
$msg = BananaMessage::newMessage($headers, $body);
if (Banana::$protocole->send($msg)) {
{
Banana::load('feed');
if (Banana::$group) {
- if (Banana::$feed_updateOnDemand) {
- $this->loadSpool(Banana::$group);
- }
+ if (Banana::$feed_updateOnDemand) {
+ $this->loadSpool(Banana::$group);
+ }
$feed =& BananaFeed::getFeed();
$feed->toXML();
}
if (Banana::$spool_boxlist) {
$groups = Banana::$protocole->getBoxList(Banana::BOXES_SUB, Banana::$profile['lastnews'], true);
Banana::$page->assign('groups', $groups);
- }
+ }
Banana::$page->assign_by_ref('message', $msg);
Banana::$page->assign('extimages', Banana::$msgshow_hasextimages);
Banana::$page->assign('headers', Banana::$msgshow_headers);
print "\n";
}
}
-
+
/**************************************************************************/
/* Private functions */
/**************************************************************************/
$spool =& Banana::$spool;
} else {
$spool =& BananaSpool::readFromFile($group);
- }
+ }
if (is_null($spool)) {
$spool = new BananaSpool($group);
}
if ($this->mode == Banana::SPOOL_ALL) {
file_put_contents($file, serialize($this));
- }
+ }
}
private function build()
}
$clean = $this->clean($first, $last, $msgnum);
$update = $this->update($first, $last, $msgnum);
-
+
if ($clean || $update) {
$this->saveToFile();
}
}
-
+
private function clean(&$first, &$last, $msgnum)
{
$do_save = false;
private function update(&$first, &$last, $msgnum)
{
- if ($first > $last || !$msgnum) {
+ if ($first > $last || !$msgnum) {
return false;
}
$p = $this->overview[$p]->parent;
} else {
$p = null;
- }
+ }
}
}
}
$this->mode = $mode;
switch ($mode) {
case Banana::SPOOL_UNREAD:
+ $num = max(array_keys($this->overview));
+ if ($this->overview[$num]->isread) {
+ break;
+ }
foreach ($this->roots as $k=>$i) {
if ($this->overview[$i]->descunread == 0) {
$this->killdesc($i);
if ($msgid !== false) {
unset($this->roots[$msgid]);
}
-
+
if ($write) {
$this->saveToFile();
}
* @param $_index INTEGER linear number of post in the tree
* @param $_first INTEGER linear number of first post displayed
* @param $_last INTEGER linear number of last post displayed
- * @param $_ref STRING MSGNUM of current post
+ * @param $_ref STRING MSGNUM of current post
* @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
{
static $spfx_f, $spfx_n, $spfx_Tnd, $spfx_Lnd, $spfx_snd, $spfx_T, $spfx_L, $spfx_s, $spfx_e, $spfx_I;
if (!isset($spfx_f)) {
- $spfx_f = Banana::$page->makeImg(Array('img' => 'k1', 'alt' => 'o', 'height' => 21, 'width' => 9));
+ $spfx_f = Banana::$page->makeImg(Array('img' => 'k1', 'alt' => 'o', 'height' => 21, 'width' => 9));
$spfx_n = Banana::$page->makeImg(Array('img' => 'k2', 'alt' => '*', 'height' => 21, 'width' => 9));
$spfx_Tnd = Banana::$page->makeImg(Array('img' => 'T-direct', 'alt' => '+', 'height' => 21, 'width' => 12));
$spfx_Lnd = Banana::$page->makeImg(Array('img' => 'L-direct', 'alt' => '`', 'height' => 21, 'width' => 12));
if ($hc) {
return $res;
}
- }
+ }
$_index ++;
$children = $overview->children;
$id_parent = $this->overview[$id_cur]->parent;
if (is_null($id_parent)) break;
$pos = array_search($id_cur, $this->overview[$id_parent]->children);
-
+
for ($i = 0; $i < $pos ; $i++) {
$ndx += $this->overview[$this->overview[$id_parent]->children[$i]]->desc;
}
if (count($this->overview[$id]->children) != 0) {
return $this->overview[$id]->children[0];
}
-
+
$cur = $id;
while (true) {
$parent = $this->overview[$cur]->parent;
$unread = $this->_nextUnread($child);
if (!is_null($unread)) {
return $unread;
- }
+ }
}
return null;
}
$cur = $parent;
} while(!is_null($cur));
return null;
- }
+ }
}
// vim:set et sw=4 sts=4 ts=4 enc=utf-8: