From: x2000habouzit Date: Thu, 19 Feb 2004 17:26:30 +0000 (+0000) Subject: manquait un include X-Git-Tag: xorg/old~1858 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=10198a85bbda61e8c0b6b1b06c08ce75dc5af3cc;p=platal.git manquait un include --- diff --git a/include/poster.inc.php b/include/poster.inc.php new file mode 100644 index 0000000..79a93c5 --- /dev/null +++ b/include/poster.inc.php @@ -0,0 +1,49 @@ +from = $from; + $this->newsgroups = $newsgroups; + $this->subject = $subject; + $this->body = ""; + $this->header = "User-Agent: PHP/" . phpversion()."\n". + "Mime-Version: 1.0\n"; + $this->header .= + "Content-Type: text/plain; charset=iso-8859-1\n". + "Content-Transfer-Encoding: 8bit\n"; + } + + function addHeader($text) + { + $this->header .= "$text\n"; + } + + function setBody($text) + { + $this->body = $text; + } + + function post() + { + global $news_server,$news_port,$news_web_pass,$news_web_user; + $this->header .= "From: {$this->from}\n"; + $this->header .= "Subject: {$this->subject}\n"; + $this->header .= "Newsgroups: {$this->newsgroups}\n"; + $this->header .= "\n"; + + $nntp = new nntp("$news_server:$news_port"); + if (!$nntp->authinfo($news_web_user,$news_web_pass)) { + $nntp->quit(); + return false; + } + $res = $nntp->post($this->header.$this->body); + $nntp->quit(); + return $res; + } +} +?>