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.6.2 2005/11/27 21:49:10 heino Exp $
  21.  
  22. $host 'news.php.net';
  23. $debug = false;
  24.  
  25. ?>
  26. <html>
  27.  
  28. <head>
  29.     <title>NNTP <?php echo $host?></title>
  30. </head>
  31.  
  32. <body>
  33. <?php
  34.  
  35. if (!isset($_GET['group'])) {
  36.     die('<font color="red">No newsgroup choosed!</font><br>');
  37. }
  38.  
  39. $group $_GET['group'];
  40.  
  41. require_once "Net/NNTP/Client.php";
  42.  
  43. $nntp = new Net_NNTP_Client();
  44. $nntp->setDebug($debug);
  45.  
  46. $posting $nntp->connect($host);
  47. if (PEAR::isError($posting)) {
  48.     echo '<font color="red">No connection to newsserver!</font><br>';
  49.     die ($posting->getMessage());
  50. }
  51.  
  52. $currentgroup $nntp->selectGroup($group);
  53. if (PEAR::isError($currentgroup)) {
  54.     echo '<font color="red">' $currentgroup->getMessage('</font><br>';
  55. }
  56.  
  57. $messageCount $currentgroup['last'$currentgroup['first'];
  58.  
  59. echo '<h1>'$group'</h1>';
  60. echo '<b>Message count:</b>&nbsp;'$messageCount;
  61. echo '<br><b>Posting: </b>&nbsp;';
  62. switch ($_GET['writable']{
  63.     case 'y' :
  64.         echo 'Allowed';
  65.         break;
  66.     case 'n' :
  67.         echo 'Disallowed';
  68.         break;
  69.     case 'm' :
  70.         echo 'Moderated';
  71.         break;         
  72.     default:
  73.         echo 'Unknown';
  74. }
  75. echo '<hr>';
  76. echo '<h2>last 10 messages</h2>';
  77.                 
  78. $overview $nntp->getOverview$messageCount-9$messageCount);
  79. if (PEAR::isError($overview)) {
  80.     die('<font color="red">' $overview->getMessage('</font><br>');
  81. }
  82.  
  83. foreach ($overview as $message{
  84.     $messageNumber $message['Number'];
  85.     $messageID $message['Message-ID'];
  86.  
  87.     echo '<a href="read.php?msgid='urlencode($messageID)'&group='urlencode($_GET['group'])'"><b>'$message['Subject']'</b></a><br>';
  88.     echo 'from:&nbsp;'$message['From']'<br>';
  89.     echo $message['Date']'<br><br>';
  90. }
  91.  
  92. $nntp->quit();
  93.  
  94. ?>
  95. </body>
  96.  
  97. </html>

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