From 80110636e39525f21676fa41ecdd6bd06372dc16 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Sun, 16 Jul 2006 14:56:31 +0000 Subject: [PATCH] Display post edition form if nntp posting returns an error git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@115 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- banana/banana.inc.php.in | 66 +++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 2cb894c..0166d80 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -330,12 +330,22 @@ 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'] = 'message'; + } 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 = 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(), "> ") + . $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; } } @@ -343,39 +353,43 @@ class Banana $html = '
'; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= ''; + . '" method="post" accept-charset="utf-8">' + . '
'._b_('En-têtes').'
'._b_('Nom').''.htmlentities($this->profile['name']).'
'._b_('Sujet').'
'._b_('Forums').'
'._b_('Suivi à').'
'._b_('Organisation').''.$this->profile['org'].'
'._b_('Corps').'
' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . ''; if ($this->can_attach) { - $html .= ''; - $html .= ''; + $html .= '' + . ''; } $html .= ''; - $html .= '
' . _b_('En-têtes') . '
' . _b_('Nom') . '' . htmlentities($this->profile['name']) . '
' . _b_('Sujet') . '
' . _b_('Forums') . '
' . _b_('Suivi à') . '
' . _b_('Organisation') . '' . $this->profile['org'] . '
' . _b_('Corps') . '
'._b_('Pièce jointe').'
'; - $html .= '
' . _b_('Pièce jointe') . '
' + . '' + . '
'; if ($id > 0) { $html .= ''; } - $html .= ''; - $html .= '
'; + $html .= '' + . '' + . ''; return $html; } function action_doFup($group, $artid = -1) { - if ( ! ( is_utf8($_POST['subject']) && is_utf8($_POST['name']) - && is_utf8($_POST['org']) && is_utf8($_POST['body']) ) - ) { - foreach(array('subject', 'name', 'org', 'body') as $key) { + if ( ! (is_utf8($_POST['subject']) && is_utf8($_POST['body']))) { + foreach(Array('subject', 'body') as $key) { $_POST[$key] = utf8_encode($_POST[$key]); } } @@ -457,7 +471,7 @@ class Banana redirectInBanana($dir); } else { return '

' . _b_('Impossible de poster le message') . '

' - . $this->action_showThread($group, $artid); + . $this->action_newFup($group, $artid); } } -- 2.1.4