X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fbanana.inc.php.in;h=86df2508d2f21e16badafb7b5d4b5a4dda9e2173;hb=ee5478a3f239b39d1481a9f3390c3e8701a556e5;hp=50eb0a9c624c00c01ef0504b7eee93a61191ee82;hpb=02198aceaeb7fee2c759ecf9896ed3b2f69f9ac4;p=banana.git
diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in
index 50eb0a9..86df250 100644
--- a/banana/banana.inc.php.in
+++ b/banana/banana.inc.php.in
@@ -12,9 +12,12 @@ class Banana
var $maxspool = 3000;
var $hdecode = array('from','name','organization','subject');
- var $parse_hdr = array('content-disposition', 'content-transfer-encoding', 'content-type', 'date', 'followup-to', 'from',
- 'message-id', 'newsgroups', 'organization', 'references', 'subject', 'x-face');
- var $show_hdr = array('from', 'subject', 'newsgroups', 'followup', 'date', 'organization', 'references', 'x-face');
+ var $parse_hdr = array('content-disposition', 'content-transfer-encoding',
+ 'content-type', 'content-id', 'date', 'followup-to',
+ 'from', 'message-id', 'newsgroups', 'organization',
+ 'references', 'subject', 'x-face');
+ var $show_hdr = array('from', 'newsgroups', 'followup', 'date',
+ 'organization', 'references', 'x-face');
/** Favorites MIMEtypes to use, by order for reading multipart messages
*/
@@ -50,7 +53,7 @@ class Banana
* $matches[2] = "http://www.polytechnique.org"
* $matches[3] = "]"
*/
- var $url_regexp = '(["\[])?((?:https?|ftp|news)://(?:&|,?[a-z@0-9.~%$£µ&i#\-+=_/\?])*)(["\]])?';
+ var $url_regexp = '(["\[])?((?:https?|ftp|news)://(?:&|\.*,*[a-z@0-9~%$£µ&i#\-+=_/\?])*)(["\]])?';
/** Boundary for multipart messages
@@ -75,7 +78,7 @@ class Banana
var $profile = Array( 'name' => 'Anonymous '._b_('Impossible de contacter le serveur').' '._b_('Impossible de contacter le serveur').' '
+ if (!is_null($group)
+ && isset($banana->grp_pattern) && !preg_match('/' . $banana->grp_pattern . '/', $group)) {
+ $banana->state['page'] = 'error';
+ return makeTable(' '
. $group . _b_(' : ce newsgroup n\'existe pas ou vous n\'avez pas l\'autorisation d\'y accéder')
- . '
'._b_('Les forums suivants ont été créés depuis ton dernier passage :').'
'; $res .= $this->newgroups->to_html(); } $this->nntp->quit(); - return $res.$cuts; + return $res; } function action_listSubs() @@ -217,8 +225,7 @@ class Banana $this->_require('groups'); $this->groups = new BananaGroups(BANANA_GROUP_ALL); - $cuts = displayshortcuts(); - $res = ''._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'
'; + return ''._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'
'; } - $cuts = displayshortcuts(); - $res = ''._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'
'; + return ''._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'
'; } $this->nntp->quit(); if ($this->post->get_attachment($pjid, $action)) { return ""; } else { - return displayshortcuts().''._b_('Impossible d\'accéder à la pièce jointe.').'
'; + return ''._b_('Impossible d\'accéder à la pièce jointe.').'
'; } } @@ -313,10 +316,14 @@ class Banana . "\n" . "Message canceled with Banana"; if ($this->nntp->post($msg)) { + $ndx = $this->spool->getndx($artid) - 1; + if ($ndx > 50) { + $ndx = 0; + } $this->spool->delid($id); $this->nntp->quit(); redirectInBanana(Array('group' => $group, - 'first' => $id)); + 'first' => $ndx)); } else { return ''._b_('Impossible d\'annuler le message').'
'; } @@ -327,54 +334,75 @@ class Banana $subject = $body = ''; $target = $group; - if ($id > 0) { + if (@$_POST['action'] == 'new') { + $subject = $_POST['subject']; + $body = $_POST['body']; + $target = $_POST['newsgroups']; + $followup = $_POST['followup']; + $this->state['page'] = 'action'; + $this->state['group'] = $group; + $this->state['action'] = 'new'; + if ($id != -1) { + $this->state['artid'] = $id; + } + } elseif ($id > 0) { $this->nntp->group($group); if ($this->_newPost($id)) { - $subject = preg_replace("/^re\s*:\s*/i", '', 'Re: '.$this->post->headers['subject']); - $body = utf8_encode($this->post->name." "._b_("a écrit"))." :\n".wrap($this->post->get_body(), "> "); - $target = isset($this->post->headers['followup-to']) ? $this->post->headers['followup-to'] : $this->post->headers['newsgroups']; + $subject = 'Re: ' . preg_replace("/^re\s*:\s*/i", '', $this->post->headers['subject']); + $body = to_entities(utf8_encode($this->post->name." "._b_("a écrit"))." :\n" + . wrap($this->post->get_body(), "> ")) + . ($this->profile['sig'] ? "\n\n-- \n". $this->profile['sig'] : ''); + $target = isset($this->post->headers['followup-to']) ? + $this->post->headers['followup-to'] : $this->post->headers['newsgroups']; + $followup = null; } + } else { + $targe = $group; + $subject = $followup = null; + $body = $this->profile['sig'] ? "\n\n-- \n". $this->profile['sig'] : ''; } $this->nntp->quit(); - $cuts = displayshortcuts(); - $html = '' . _b_('Impossible de poster le message') . '
' - . $this->action_showThread($group, $artid); + return '' . _b_('Impossible de poster le message. Le serveur a retourné l\'erreur :') . '
' + . '' . utf8_encode($this->nntp->lasterrortext) .'' + . $this->action_newFup($group, $artid); } }