X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fpost.inc.php;h=b85f23d0174e92594698a2797e166c5a8c636fb5;hb=261210bc9c416cca0d9b79ab215526d4c93b098a;hp=20ab505a8d5513a48ba93518c17a6771c7ed73ea;hpb=df7b8d75acbc3865833c35998293e4584c399866;p=banana.git diff --git a/banana/post.inc.php b/banana/post.inc.php index 20ab505..b85f23d 100644 --- a/banana/post.inc.php +++ b/banana/post.inc.php @@ -23,6 +23,8 @@ class BananaPost var $pj; /** poster name */ var $name; + /** test validity */ + var $valid = true; /** constructor * @param $_id STRING MSGNUM or MSGID (a group should be selected in this case) @@ -33,12 +35,17 @@ class BananaPost $this->id = $_id; $this->pj = array(); $this->messages = array(); - $this->_header(); + if (!$this->_header()) { + $this->valid = false; + return null; + } + if ($body = $banana->nntp->body($_id)) { $this->body = join("\n", $body); } else { - return ($this = null); + $this->valid = false; + return null; } if (isset($this->headers['content-transfer-encoding'])) { @@ -150,7 +157,11 @@ class BananaPost break; } } - return Array('headers' => $local_headers, 'body' => join("\n", $lines)); + $local_body = join("\n", $lines); + if (preg_match("/quoted-printable/", $local_headers['content-transfer-encoding'])) { + $local_body = quoted_printable_decode($local_body); + } + return Array('headers' => $local_headers, 'body' => $local_body); } /** add an attachment @@ -250,7 +261,7 @@ class BananaPost $this->body = iconv($matches[1], 'utf-8', $this->body); } else { $this->body = utf8_encode($this->body); - } + } return true; } @@ -259,7 +270,6 @@ class BananaPost global $banana; $hdrs = $banana->nntp->head($this->id); if (!$hdrs) { - $this = null; return false; } @@ -288,6 +298,7 @@ class BananaPost $this->name = $this->headers['from']; $this->name = preg_replace('/<[^ ]*>/', '', $this->name); $this->name = trim($this->name); + return true; } function checkcancel() @@ -332,15 +343,24 @@ class BananaPost $res = ''; $res .= ''; + $res .= ''; $res .= '
'._b_('En-têtes').'
'; foreach ($banana->show_hdr as $hdr) { if (isset($this->headers[$hdr])) { $res2 = formatdisplayheader($hdr, $this->headers[$hdr]); - if ($res2) { + if ($res2 && ($hdr != 'x-face' || !$banana->formatxface)) { $res .= '\n"; + } else if ($res2) { + $xface = $res2; } } } + $res .= '
'.header_translate($hdr)."$res2
'; + + if ($xface) { + $res .= $xface; + } + $res .= '
'._b_('Corps'); if (count($this->messages) > 1) { @@ -353,7 +373,10 @@ class BananaPost preg_match("@text/([^;]+);@", $this->messages[$i]['headers']['content-type'], $format); $format = textFormat_translate($format[1]); if ($i != $partid) { - $res .= ''.$format.''; + $res .= makeHREF(Array('group' => $banana->state['group'], + 'artid' => $this->id, + 'part' => $i), + $format); } else { $res .= $format; } @@ -380,8 +403,16 @@ class BananaPost $i = 0; foreach ($this->pj as $file) { $res .= $file['filename'].' ('.$file['MIME'].') : '; - $res .= 'télécharger'; - $res .= ' . aperçu'; + $res .= makeHREF(Array('group' => $banana->state['group'], + 'artid' => $this->id, + 'pj' => $i), + _b_('télécharger')); + $res .= ' . '; + $res .= makeHREF(Array('group' => $banana->state['group'], + 'artid' => $this->id, + 'pj' => $i, + 'action'=> 'view'), + _b_('aperçu')); $res .= '
'; $i++; } @@ -396,4 +427,5 @@ class BananaPost } } +// vim:set et sw=4 sts=4 ts=4 ?>