From 1248ebac1f106382e4c0cc888e6598d5eccf3eef Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Wed, 5 Jan 2005 08:19:16 +0000 Subject: [PATCH] post is now in the lib too. have to work on the actions now. --- include/banana.inc.php.in | 42 ++++++++++++++++- include/misc.inc.php | 2 +- include/post.inc.php | 2 +- post.php | 112 +--------------------------------------------- 4 files changed, 45 insertions(+), 113 deletions(-) diff --git a/include/banana.inc.php.in b/include/banana.inc.php.in index 413ddbe..3758c20 100644 --- a/include/banana.inc.php.in +++ b/include/banana.inc.php.in @@ -30,7 +30,7 @@ class Banana var $host = 'news://localhost:119/'; - var $profile = Array( 'name' => 'Anonymous '', 'org' => '', + var $profile = Array( 'name' => 'Anonymous ', 'sig' => '', 'org' => '', 'customhdr' =>'', 'display' => 0, 'lastnews' => 0, 'locale' => 'fr_FR', 'subscribe' => array()); var $nntp; @@ -121,6 +121,46 @@ class Banana return $res.$cuts; } + function action_newFup($group, $id = -1) + { + $subject = $body = ''; + $target = $group; + + if ($id > 0) { + $this->nntp->group($group); + $this->newPost($id); + if ($this->post) { + $subject = preg_replace("/^re\s*:\s*/i", 'Re: ', $this->post->headers['subject']); + $body = $this->post->name." "._b_("a écrit")." :\n".wrap($this->post->body, "> "); + $target = isset($this->post->headers['followup-to']) ? $this->post->headers['followup-to'] : $this->post->headers['newsgroups']; + } + } + + $this->nntp->quit(); + + $cuts = displayshortcuts(); + $html = '

'._b_('Nouveau message').'

'.$cuts; + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $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').'
'; + if ($id > 0) { + $html .= ''; + } + $html .= '
'; + + return $html.$cuts; + } + /**************************************************************************/ /* */ /**************************************************************************/ diff --git a/include/misc.inc.php b/include/misc.inc.php index a478bdb..1d85354 100644 --- a/include/misc.inc.php +++ b/include/misc.inc.php @@ -120,7 +120,7 @@ function fancyDate($stamp) { } elseif ($today == 1 + $dday) { $format = _b_('hier')." %H:%M"; } elseif ($today < 7 + $dday) { - $format = '%A %H:%M'; + $format = '%a %H:%M'; } else { $format = '%a %e %b'; } diff --git a/include/post.inc.php b/include/post.inc.php index b855a3b..b892b1e 100644 --- a/include/post.inc.php +++ b/include/post.inc.php @@ -39,7 +39,7 @@ class BananaPost } } - if (preg_match('!charset=([^;]*);!', $this->headers['content-type'], $matches)) { + if (preg_match('!charset=([^;]*)\s*(;|$)!', $this->headers['content-type'], $matches)) { $this->body = iconv($matches[1], 'iso-8859-1', $this->body); } } diff --git a/post.php b/post.php index d76909b..ab792cb 100644 --- a/post.php +++ b/post.php @@ -13,118 +13,10 @@ require_once("include/header.inc.php"); if (isset($_REQUEST['group'])) { $group = htmlentities(strtolower($_REQUEST['group'])); } -if (isset($_REQUEST['id'])) { - $id = htmlentities(strtolower($_REQUEST['id'])); -} - -if (isset($group)) { - $target = $group; -} - -if (isset($group) && isset($id) && isset($_REQUEST['type']) && ($_REQUEST['type']=='followup')) { - $banana->nntp->group($group); - $banana->newPost($id); - $body = ''; - if ($banana->post) { - $subject = (preg_match("/^re\s*:\s*/i", $banana->post->headers['subject']) ? '' : 'Re: ').$banana->post->headers['subject']; - $body = $banana->post->name." wrote :\n".wrap($banana->post->body, "> "); - $target = isset($banana->post->headers['followup-to']) ? $banana->post->headers['followup-to'] : $banana->post->headers['newsgroups']; - } -} -$banana->nntp->quit(); -?> -

- -

-action_newFup($group, $id); -?> - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - profile['name']); ?> -
- - - -
- - - -
- - - -
- - - profile['org']; ?> -
- -
- -
- - - - - - - - -
-
- -- 2.1.4