static public $feed_active = true;
static public $feed_format = 'rss2';
static public $feed_updateOnDemand = false; // Update the feed each time sbd check it
- static public $feed_copyright = null;
+ static public $feed_copyright = null; // Global copyright informations
+ static public $feed_generator = 'Banana @VERSION@'; // Feed generator
+ static public $feed_email = null; // Admin e-mail
static public $feed_namePrefix = 'Banana :: ';
static public $feed_size = 15; // Number of messages in the feed
*/
public $messages = array();
+ /** Last update time
+ */
+ public $lastupdate = 0;
+
/** Create an empty feed
*/
private function __construct()
{
$this->version = BANANA_FEED_VERSION;
$this->group = Banana::$group;
- $this->description = Banana::$protocole->getDescription();
+ $this->description = trim(Banana::$protocole->getDescription());
}
/** Update the feed, using current settings of Banana
$this->messages[$key] = $array;
}
uasort($this->messages, Array('BananaFeed', 'compare'));
+ $this->lastupdate = time();
$this->writeToFile();
}
}
uasort($messages, array('BananaFeed', 'compare'));
$master->messages =& $messages;
+ $master->lastupdate = time();
return $master;
}
class BananaNNTP extends BananaNNTPCore implements BananaProtocoleInterface
{
- private $description = null;
private $ingroup = null;
private $mode = null;
*/
public function getDescription()
{
- if ($this->description) {
- return $this->description;
- }
$descs = $this->xgtitle(Banana::$group);
if (isset($descs[Banana::$group])) {
- $this->description = $descs[Banana::$group];
+ return trim(utf8_encode($descs[Banana::$group]));
}
- return $this->description;
+ return null;
}
/** Return the list of the boxes
@list($lg) = explode('_', Banana::$profile['locale']);
$tpl = 'banana-feed-' . Banana::$feed_format . '.tpl';
$this->assign('copyright', Banana::$feed_copyright);
+ $this->assign('generator', Banana::$feed_generator);
+ $this->assign('email', Banana::$feed_email);
$this->assign('title_prefix', Banana::$feed_namePrefix);
$this->assign('language', $lg);
$this->register_function('rss_date', 'rss_date');
header('Content-Type: application/rss+xml; charset=utf-8');
- echo $this->_run($tpl);
+ echo $this->_run($tpl, false);
exit;
}
/** Code generation
*/
- private function _run($tpl)
+ private function _run($tpl, $ent = true)
{
$this->assign('group', Banana::$group);
$this->assign('artid', Banana::$artid);
$error_level = error_reporting(0);
}
$text = $this->fetch($tpl);
- $text = banana_utf8entities($text);
+ if ($ent) {
+ $text = banana_utf8entities($text);
+ }
if (!Banana::$debug_smarty) {
error_reporting($error_level);
}
<channel>
<title>{$title_prefix}{$feed->group}</title>
<language>{$language}</language>
+ {if $copyright}<copyright><![CDATA[{$copyright}]]></copyright>{/if}
+ {if $email}<webMaster>{$email}</webMaster>{/if}
+ {if $generator}<generator>{$generator}</generator>{/if}
+ <lastBuildDate>{$feed->lastupdate|rss_date}</lastBuildDate>
<link>{url group=$group}</link>
- <description><![CDATA[{$feed->description}]]></description>
+ <description><![CDATA[{$feed->description|default:"-"}]]></description>
{foreach from=$feed->messages key=id item=message}
<item>
<title><![CDATA[{$message.title}]]></title>