Net_NNTP
[ class tree: Net_NNTP ] [ index: Net_NNTP ] [ all elements ]

Source for file group.php

Documentation is available at group.php

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Alexander Merz <alexmerz@php.net>                           |
  17. // |          Heino H. Gehlsen <heino@gehlsen.dk>                         |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: group.php,v 1.2 2005/01/08 20:03:30 heino Exp $
  21. ?>
  22. <html>
  23. <head>
  24.     <title>NNTP news.php.net</title>
  25. </head>
  26. <body>
  27. <?php
  28. require_once "Net/NNTP/Client.php";
  29.  
  30. $nntp = new Net_NNTP_Client();
  31.  
  32. $ret $nntp->connect("news.php.net");
  33. ifPEAR::isError($ret)) {
  34.  echo '<font color="red">No connection to newsserver!</font><br>' ;
  35.  echo $ret->getMessage();
  36. else {
  37.     if(isset($_GET['group'])) {
  38.         $msgdata $nntp->selectGroup($_GET['group']);
  39.         if(PEAR::isError($msgdata)) {
  40.             echo '<font color="red">'.$msgdata->getMessage().'</font><br>' ;        
  41.         else {
  42.             $msgcount $msgdata['last']-$msgdata['first'];
  43.             echo '<h1>'.$_GET['group'].'</h1>';
  44.             echo "<b>Message count:</b>&nbsp;".$msgcount;
  45.             echo "<br><b>Posting allowed:</b>&nbsp;";
  46.             switch$_GET['writable']{
  47.                 case 'y' :
  48.                     echo 'yes';
  49.                     break;
  50.                 case 'n' :
  51.                     echo 'no';
  52.                     break;
  53.                 case 'm' :
  54.                     echo 'moderated';
  55.                     break;         
  56.                 default:
  57.                     echo 'n/a';                       
  58.             }
  59.             echo "<hr>";
  60.             echo "<h2>last 10 messages</h2>";
  61.                 
  62.             $msgs array_reverse($nntp->getOverview$msgcount-9$msgcount));
  63.             foreach($msgs as $msgid => $msgheader{
  64.                 echo '<a href="read.php?msgid='.urlencode($msgid).
  65.                     '&group='.urlencode($_GET['group']).
  66.                     '"><b>'.$msgheader["Subject"].'</b></a><br>';
  67.                 echo 'from:&nbsp;'.$msgheader["From"]."<br>";
  68.                 echo $msgheader["Date"].'<br><br>';
  69.             }        
  70.         }
  71.     else {
  72.         echo '<font color="red">No newsgroup choosed!</font><br>' ;    
  73.     }
  74.     $nntp->quit();
  75. }    
  76. ?>
  77. </body>
  78. </html>

Documentation generated on Mon, 11 Mar 2019 14:30:58 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.