2e8d8f9523815f0dee5013d521f0bf4cbae34dfc
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 ********************************************************************************/
23 * @param $_nntp RESOURCE handle to NNTP socket
24 * @param $_id STRING MSGNUM or MSGID (a group should be selected in this case)
26 function NNTPPost(&$_nntp, $_id) {
28 $this->_header($_nntp);
30 $this->body
= join("\n", $_nntp->body($_id));
32 if (isset($this->headers
['content-transfer-encoding'])) {
33 if (preg_match("/base64/", $this->headers
['content-transfer-encoding'])) {
34 $this->body
= base64_decode($this->body
);
35 } elseif (preg_match("/quoted-printable/", $this->headers
['content-transfer-encoding'])) {
36 $this->body
= quoted_printable_decode($this->body
);
40 if (preg_match('!charset=([^;]*);!', $this->headers
['content-type'], $matches)) {
41 $this->body
= iconv($matches[1], 'iso-8859-1', $this->body
);
45 function _header(&$_nntp)
48 $hdrs = $_nntp->head($this->nb
);
56 foreach ($hdrs as $line) {
57 if (preg_match("/^[\t\r ]+/", $line)) {
58 $line = ($hdr=="X-Face"?
"":" ").ltrim($line);
59 if (in_array($hdr, $news['head'])) {
60 $this->headers
[$hdr] .= $line;
63 list($hdr, $val) = split(":[ \t\r]*", $line, 2);
64 $hdr = strtolower($hdr);
65 if (in_array($hdr, $news['head'])) {
66 $this->headers
[$hdr] = $val;
71 foreach ($news['hdecode'] as $hdr) {
72 if (isset($this->headers
[$hdr])) {
73 $this->headers
[$hdr] = headerDecode($this->headers
[$hdr]);
77 $this->name
= $this->headers
['from'];
78 $this->name
= preg_replace('/<[^ ]*>/', '', $this->name
);
79 $this->name
= trim($this->name
);