$insig = 1; } if ($insig && $line == "\r\n") { echo "</span>"; $insig = 0; } if (!$insig && substr($line, 0, 4) == ">") { echo "<span class=\"quote\">{$line}</span>"; } else { echo $line; } } } if ($inheaders && !$started) { head("{$group}: " . $headers['subject']); start_article($group, $masterheaders, $charset); } if ($insig) { echo "</span>"; } echo " </pre>\n"; echo " </blockquote>\n"; function start_article($group, $headers, $charset) { echo " <blockquote>\n"; echo ' <table border="0" cellpadding="2" cellspacing="2" width="100%">' . "\n"; # from echo ' <tr class="vcard">' . "\n"; echo ' <td class="headerlabel">From:</td>' . "\n"; echo ' <td class="headervalue">' . format_author($headers['from'], $charset) . "</td>\n"; # date
$refCount = 0; foreach ($references as $messageId) { if (!$messageId) { continue; } if ($refCount >= REFERENCES_LIMIT) { break; } $refsResolved[] = $nntpClient->xpath($messageId); $refCount++; } } catch (Exception $e) { error($e->getMessage()); } head("{$group}: " . format_title($mail['headers']['subject'], 'utf-8')); start_article($mail, $refsResolved); $lines = preg_split("@(?<=\r\n|\n)@", $mail['text']); $insig = 0; foreach ($lines as $line) { # fix lines that started with a period and got escaped if (substr($line, 0, 2) == "..") { $line = substr($line, 1); } # this is some amazingly simplistic code to color quotes/signatures # differently, and turn links into real links. it actually appears # to work fairly well, but could easily be made more sophistimicated. /* NOQUOTES? Why? It creates invalid HTML: http:"x */ $line = htmlentities($line, ENT_QUOTES, "utf-8"); $line = preg_replace("/((mailto|https?|ftp|nntp|news):.+?)(>|\\s|\\)|\\.\\s|\$)/", "<a href=\"\\1\">\\1</a>\\3", $line); if (!$insig && ($line == "-- \r\n" || $line == "--\r\n")) { echo "<span class=\"signature\">";