public function getOverview($first, $last) { SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->getOverView(" . $first . "," . $last . ")"); $this->connect(); try { $this->registerTryCommand(); $headerList = $this->_nntp->getOverview($first . '-' . $last); /* * Remove the <> around the messageid */ foreach ($headerList as $k => $v) { $headerList[$k]['Message-ID'] = substr($headerList[$k]['Message-ID'], 1, -1); $headerList[$k]['References'] = substr($headerList[$k]['References'], 1, -1); } # foreach return $headerList; } catch (Exception $x) { $this->registerError($x); /** * Try this operation again, but make sure we are not overloading * the NNTP server with useless requests */ if ($this->tooManyErrors()) { throw $x; } else { return $this->getOverview($first, $last); } # else } # catch }
/** * Fetch an overview of article(s) in the currently selected group. * * @param null $range * @param bool $names * @param bool $forceNames * * @return mixed On success : (array) Multidimensional array with article headers. * On failure : (object) PEAR_Error. * * @access public */ public function getOverview($range = null, $names = true, $forceNames = true) { $connected = $this->_checkConnection(); if ($connected !== true) { return $connected; } // Enabled header compression if not enabled. $this->_enableCompression(); return parent::getOverview($range, $names, $forceNames); }
echo "<br><b>Posting allowed:</b> "; switch ($_GET['writable']) { case 'y': echo 'yes'; break; case 'n': echo 'no'; break; case 'm': echo 'moderated'; break; default: echo 'n/a'; } echo "<hr>"; echo "<h2>last 10 messages</h2>"; $msgs = array_reverse($nntp->getOverview($msgcount - 9, $msgcount)); foreach ($msgs as $msgid => $msgheader) { echo '<a href="read.php?msgid=' . urlencode($msgid) . '&group=' . urlencode($_GET['group']) . '"><b>' . $msgheader["Subject"] . '</b></a><br>'; echo 'from: ' . $msgheader["From"] . "<br>"; echo $msgheader["Date"] . '<br><br>'; } } } else { echo '<font color="red">No newsgroup choosed!</font><br>'; } $nntp->quit(); } ?> </body> </html>