Tim Düsterhus 65aa289037 Fix handling of missing parent messages in ThreadTree
The logic to correctly associate messages where the parent message is not in
the archives already existed by means of `ThreadTree::$extraRootChildren`,
however the “extra root” threads were not correctly printed, because
`printThread()` required the message at the root of the thread to exist.

Fix this by printing a placeholder “Unknown message” for unknown messageIds and
then printing the children as usual.

Fixes php/web-php#35
2026-03-09 16:14:57 -04:00
2021-04-04 12:28:00 +03:00
2013-02-27 22:22:51 +01:00
2025-04-06 12:25:53 -07:00

PHP.net News Server Web Interface

You may run this project using PHP's built-in web server for local development.

git clone https://github.com/php/web-news.git
cd web-news/
NNTP_HOST=news.php.net php -S localhost:8080 .router.php

this is all very ugly. just proof-of-concept, really.

the biggest thing to do would be to do something smart with mime-encoded messages. but keeping the current property of not slurping the whole damn message into memory just to do so.

another thing to do would be to support posting. to avoid completely anonymous posting, this could require confirming the email address before allowing posts. to do this without actually having to maintain a database of users, we could send an email containing md5(md5("email:timestamp").$secret) (where $secret is some value that is kept secret. duh.) and then let the user "log in" by supplying their email address and this code, and storing that in a cookie. depends on a secret for 'security', but like i said, it avoids having to maintain any sort of state on the server side. blocking email addresses for posting will be easy enough if anyone ever abuses the system.

should also probably protect email addresses from harvesters. then again, anyone who wanted to harvest email addresses could just crawl the nntp server directly. or they can crawl any of the other mail archives that don't protect the addresses.

keeping track of a .newsrc-like state for users would be cool, too. too bad there's no Set::IntSpan for php.

perhaps chasing up the references: chain to display the thread when displaying an article would be interesting. i have a feeling that building some sort of index is going to be desirable at some point. should use jwz's threading algorithm. http://www.jwz.org/doc/threading.html

ftp://ftp.isi.edu/in-notes/rfc2047.txt explains how to decode encoded header fields. handling utf-8 and iso-8859-1 should be pretty easy. could use the gnu recode functions to do this in a general way, i think.

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]
Description
⚠️ ARCHIVED: Original GitHub repository no longer exists. Preserved as backup on 2026-01-22T16:26:18.675Z
Readme 17 MiB
Languages
PHP 89.1%
CSS 10.9%