'autoup' => 1);
static public $boxpattern;
static public $withtabs = true;
+ static public $baseurl = null;
static public $mimeparts = array();
### Spool ###
static public $spool_root = '/var/spool/banana';
static public $spool_max = 3000;
static public $spool_tbefore = 5;
- static public $spool_tafter = 5;
- static public $spool_tmax = 50;
+ static public $spool_tcontext= 10;
+ static public $spool_tmax = 10;
static public $spool_boxlist = true;
### Message processing ###
### 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',
+ 'organization', 'date');
+ 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;
static public $msgshow_withthread = true;
static public $msgshow_javascript = true;
+ static public $msgshow_pgpcheck = true;
+ static public $msgshow_pgppath = 'gpg';
+ static public $msgshow_pgpoptions = '';
+
/** Match an url
* Should be included in a regexp delimited using /, !, , or @ (eg: "/$url_regexp/ui")
* If it matches, return 3 main parts :
#######
# 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
*/
protected function loadParams()
{
+ foreach ($this->params as &$value) {
+ if ($value === "") {
+ $value = null;
+ }
+ }
Banana::$group = isset($this->params['group']) ? $this->params['group'] : null;
Banana::$artid = isset($this->params['artid']) ? $this->params['artid'] : null;
Banana::$first = isset($this->params['first']) ? $this->params['first'] : null;
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);
if (!is_utf8($hdr_values[$header])) {
$hdr_values[$header] = utf8_encode($hdr_values[$header]);
}
- if ($headers != 'Subject') {
- $hdr_values[$header] = str_replace(', ', ',', $hdr_values[$header]);
- }
}
+ $values = split('[,; ]', $hdr_values[$hdrs['dest']]);
+ $hdr_values[$hdrs['dest']] = preg_replace('/,+/', ',', implode(',', $values));
if (!is_null($artid)) {
$old =& $this->loadMessage($group, $artid);
- $hdr_values['References'] = $old->getHeaderValue('references') . $old->getHeaderValue('message-id');
+ $hdr_values['References'] = $old->getHeaderValue('references') . ' ' . $old->getHeaderValue('message-id');
}
$msg = null;
if (isset($_POST['body']) && !is_utf8($_POST['body'])) {
} else {
Banana::$page->trig(_b_('Une erreur est survenue lors de l\'envoi du message :') . '<br />'
. Banana::$protocole->lastError());
+ $body = $_POST['body'];
}
}
} else {
if (Banana::$profile['signature']) {
$body .= "\n\n-- \n" . Banana::$profile['signature'];
}
- Banana::$page->assign('body', $body);
}
+ Banana::$page->assign('body', $body);
Banana::$page->assign('maxfilesize', Banana::$msgedit_maxfilesize);
Banana::$page->assign('can_attach', Banana::$msgedit_canattach);
print "\n";
}
}
-
+
/**************************************************************************/
/* Private functions */
/**************************************************************************/
$clean = false;
if (php_sapi_name() != 'cli') {
if ($group == @$_SESSION['banana_group'] && isset($_SESSION['banana_spool'])) {
- Banana::$spool = unserialize($_SESSION['banana_spool']);
+ Banana::$spool =& $_SESSION['banana_spool'];
$clean = @(Banana::$profile['lastnews'] != $_SESSION['banana_lastnews']);
} else {
unset($_SESSION['banana_message']);
if (php_sapi_name() != 'cli') {
$_SESSION['banana_group'] = $group;
if (!Banana::$profile['display']) {
- $_SESSION['banana_spool'] = serialize(Banana::$spool);
+ $_SESSION['banana_spool'] =& Banana::$spool;
$_SESSION['banana_lastnews'] = Banana::$profile['lastnews'];
}
}
Banana::load('message');
if ($group == @$_SESSION['banana_group'] && $artid == @$_SESSION['banana_artid']
&& isset($_SESSION['banana_message'])) {
- $message = unserialize($_SESSION['banana_message']);
+ $message =& $_SESSION['banana_message'];
Banana::$msgshow_headers = $_SESSION['banana_showhdr'];
} else {
$message = Banana::$protocole->getMessage($artid);
$_SESSION['banana_group'] = $group;
$_SESSION['banana_artid'] = $artid;
- $_SESSION['banana_message'] = serialize($message);
+ $_SESSION['banana_message'] =& $message;
$_SESSION['banana_showhdr'] = Banana::$msgshow_headers;
}
Banana::$message =& $message;
Banana::$spool->delId($artid);
if ($group == $_SESSION['banana_group']) {
if (!Banana::$profile['display']) {
- $_SESSION['banana_spool'] = serialize(Banana::$spool);
+ $_SESSION['banana_spool'] =& Banana::$spool;
}
if ($artid == $_SESSION['banana_artid']) {
unset($_SESSION['banana_message']);
return true;
}
- static private function load($file)
+ static public function load($file)
{
$file = strtolower($file) . '.inc.php';
if (!@include_once dirname(__FILE__) . "/$file") {