2 /********************************************************************************
3 * include/posts.inc.php : class for posts
4 * -----------------------
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
24 * @param $_id STRING MSGNUM or MSGID (a group should be selected in this case)
26 function BananaPost($_id)
32 $this->body
= join("\n", $banana->nntp
->body($_id));
34 if (isset($this->headers
['content-transfer-encoding'])) {
35 if (preg_match("/base64/", $this->headers
['content-transfer-encoding'])) {
36 $this->body
= base64_decode($this->body
);
37 } elseif (preg_match("/quoted-printable/", $this->headers
['content-transfer-encoding'])) {
38 $this->body
= quoted_printable_decode($this->body
);
42 if (preg_match('!charset=([^;]*);!', $this->headers
['content-type'], $matches)) {
43 $this->body
= iconv($matches[1], 'iso-8859-1', $this->body
);
50 $hdrs = $banana->nntp
->head($this->nb
);
57 foreach ($hdrs as $line) {
58 if (preg_match("/^[\t\r ]+/", $line)) {
59 $line = ($hdr=="X-Face"?
"":" ").ltrim($line);
60 if (in_array($hdr, $banana->parse_hdr
)) {
61 $this->headers
[$hdr] .= $line;
64 list($hdr, $val) = split(":[ \t\r]*", $line, 2);
65 $hdr = strtolower($hdr);
66 if (in_array($hdr, $banana->parse_hdr
)) {
67 $this->headers
[$hdr] = $val;
72 foreach ($banana->hdecode
as $hdr) {
73 if (isset($this->headers
[$hdr])) {
74 $this->headers
[$hdr] = headerDecode($this->headers
[$hdr]);
78 $this->name
= $this->headers
['from'];
79 $this->name
= preg_replace('/<[^ ]*>/', '', $this->name
);
80 $this->name
= trim($this->name
);