cvs: php-news-web / README article.php common.inc getpart.php group.php index.php

From: Date: Wed, 22 Dec 2004 22:39:19 +0000
Subject: cvs: php-news-web / README article.php common.inc getpart.php group.php index.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-26945@lists.php.net to get a copy of this message
wez Wed Dec 22 17:39:19 2004 EDT Modified files: /php-news-web README article.php common.inc getpart.php group.php index.php Log: centralize NNTP host config; patch by Sean Coates http://cvs.php.net/diff.php/php-news-web/README?r1=1.2&r2=1.3&ty=u Index: php-news-web/README diff -u php-news-web/README:1.2 php-news-web/README:1.3 --- php-news-web/README:1.2 Sun Mar 11 00:04:51 2001 +++ php-news-web/README Wed Dec 22 17:39:19 2004 @@ -38,3 +38,14 @@ oh, and this uses direct socket functions instead of the php imap extension because nntp is a drop-dead-easy protocol, and i'm allergic to the c-client code. + +--- +SC.2004.09.03: +Here are the appropriate Rewrite rules for apache: + RewriteEngine on + RewriteRule ^/(php.+)/start/([0-9]+) /group.php?group=$1&i=$2 [L] + RewriteRule ^/(php.+)/([0-9]+) /article.php?group=$1&article=$2 [L] + RewriteRule ^/(php[^/]+)(/)?$ /group.php?group=$1 [L] + +Also note that register_globals must be on. + http://cvs.php.net/diff.php/php-news-web/article.php?r1=1.26&r2=1.27&ty=u Index: php-news-web/article.php diff -u php-news-web/article.php:1.26 php-news-web/article.php:1.27 --- php-news-web/article.php:1.26 Wed Aug 4 16:49:27 2004 +++ php-news-web/article.php Wed Dec 22 17:39:19 2004 @@ -6,7 +6,7 @@ require 'common.inc'; require 'nntp.inc'; -$s = nntp_connect("news.php.net") +$s = nntp_connect(NNTP_HOST) or die("failed to connect to news server"); if ($group) { @@ -171,14 +171,14 @@ echo '<td class="headerlabel">References:</td><td class="headervalue">'; $r = explode(" ", $ref); $c = 1; - $s = nntp_connect("news.php.net") + $s = nntp_connect(NNTP_HOST) or die("failed to connect to news server"); while (list($k,$v) = each($r)) { if (!$v) continue; $v = trim($v); if (!preg_match("/^<.+>\$/", $v)) continue; $res2 = nntp_cmd($s, "XPATH $v",223) - or die("failed to get reference article id ".htmlspecialchars($v)); + or print("failed to get reference article id ".htmlspecialchars($v)."<br />\n"); list(,$v) = split("/", trim($res2)); if (empty($v)) continue; echo "<a href=\"/$group/".htmlspecialchars(urlencode($v))."\">".($c++)."</a>\n"; http://cvs.php.net/diff.php/php-news-web/common.inc?r1=1.24&r2=1.25&ty=u Index: php-news-web/common.inc diff -u php-news-web/common.inc:1.24 php-news-web/common.inc:1.25 --- php-news-web/common.inc:1.24 Tue Jun 22 04:38:38 2004 +++ php-news-web/common.inc Wed Dec 22 17:39:19 2004 @@ -1,5 +1,7 @@ <?php # vim:ft=php:ts=2:sw=2:et +define('NNTP_HOST', 'localhost'); + function head($title="PHP news") { header("Content-type: text/html; charset=utf-8"); ?> @@ -17,7 +19,7 @@ <a href="/index.php"><img src="/i/l.gif" border="0" width="120" height="64" alt="php" /></a> </td> <td align="right" valign="bottom"> - PHP.net <a href="news://news.php.net/" clas="top">news server</a> web interface + PHP.net <a href="news://<?php echo NNTP_HOST; ?>/" clas="top">news server</a> web interface </td> </tr> <tr bgcolor="#333366"> http://cvs.php.net/diff.php/php-news-web/getpart.php?r1=1.1&r2=1.2&ty=u Index: php-news-web/getpart.php diff -u php-news-web/getpart.php:1.1 php-news-web/getpart.php:1.2 --- php-news-web/getpart.php:1.1 Wed Jan 15 23:24:54 2003 +++ php-news-web/getpart.php Wed Dec 22 17:39:19 2004 @@ -6,7 +6,7 @@ require 'common.inc'; require 'nntp.inc'; -$s = nntp_connect("news.php.net") +$s = nntp_connect(NNTP_HOST) or die("failed to connect to news server"); if ($group) { http://cvs.php.net/diff.php/php-news-web/group.php?r1=1.17&r2=1.18&ty=u Index: php-news-web/group.php diff -u php-news-web/group.php:1.17 php-news-web/group.php:1.18 --- php-news-web/group.php:1.17 Wed Aug 4 12:48:50 2004 +++ php-news-web/group.php Wed Dec 22 17:39:19 2004 @@ -3,7 +3,7 @@ require 'common.inc'; require 'nntp.inc'; -$s = nntp_connect("news.php.net") +$s = nntp_connect(NNTP_HOST) or die("failed to connect to news server"); $res = nntp_cmd($s,"GROUP $group",211) @@ -21,8 +21,8 @@ echo '<?xml version="1.0" encoding="utf-8"?>';?> <rss version="0.93"> <channel> - <title>news.php.net: <?echo $group?></title> - <link>http://news.php.net/group.php?group=<?echo $group?></link> + <title><?php echo $_SERVER['HTTP_HOST']; ?>: <?echo $group?></title> + <link>http://<?php echo $_SERVER['HTTP_HOST']; ?>/group.php?group=<?echo $group?></link> <description></description> <? break; case 'rdf': @@ -33,9 +33,9 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://my.netscape.com/rdf/simple/0.9/"> <channel> - <title>news.php.net: <?echo $group?></title> - <link>http://news.php.net/group.php?group=<?echo $group?></link> - <description><?echo $group?> Mailinglist at news.php.net</description> + <title><?php echo $_SERVER['HTTP_HOST']; ?>: <?echo $group?></title> + <link>http://<?php echo $_SERVER['HTTP_HOST']; ?>/group.php?group=<?echo $group?></link> + <description><?echo $group?> Newsgroup at <?php echo NNTP_HOST; ?></description> <language>en-US</language> </channel> <? @@ -65,7 +65,7 @@ switch($format) { case 'rss': echo "<item>\n"; - echo "<link>http://news.php.net/$group/$n</link>\n"; + echo "<link>http://{$_SERVER['HTTP_HOST']}/$group/$n</link>\n"; echo "<title>", format_subject($subj, $charset), "</title>\n"; echo "<description>", htmlspecialchars(format_author($author, $charset)), "</description>\n"; echo "<pubDate>$date822</pubDate>\n"; @@ -74,7 +74,7 @@ case 'rdf': echo "<item>\n"; echo "<title>", format_subject($subj, $charset), "</title>\n"; - echo "<link>http://news.php.net/$group/$n</link>\n"; + echo "<link>http://{$_SERVER['HTTP_HOST']}/$group/$n</link>\n"; echo "<description>", htmlspecialchars(format_author($author, $charset)), "</description>\n"; echo "<pubDate>$date822</pubDate>\n"; echo "</item>\n"; http://cvs.php.net/diff.php/php-news-web/index.php?r1=1.5&r2=1.6&ty=u Index: php-news-web/index.php diff -u php-news-web/index.php:1.5 php-news-web/index.php:1.6 --- php-news-web/index.php:1.5 Mon Jun 21 13:22:31 2004 +++ php-news-web/index.php Wed Dec 22 17:39:19 2004 @@ -3,7 +3,7 @@ require 'common.inc'; require 'nntp.inc'; -$s = nntp_connect("news.php.net") +$s = nntp_connect(NNTP_HOST) or die("failed to connect to news server"); nntp_cmd($s,"LIST",215) @@ -43,8 +43,8 @@ ?> <h1>Welcome!</h1> <p>This is a completely experimental interface to the PHP mailing -lists as reflected on the <a href="news://news.php.net/">news.php.net -NNTP server</a>.</p> +lists as reflected on the <a href="news://<?php echo NNTP_HOST; ?>/"> +<?php echo NNTP_HOST; ?> NNTP server</a>.</p> <p>There may be a little more info <a href="README">here</a>.</p> <p>The news server software that is used is also available from <a href="http://trainedmonkey.com/colobus/">here</a>.</p>

« previous php.mirrors (#26945) next »