php-news patch
| From: | Nuno Lopes | Date: | Tue, 19 Apr 2005 17:48:48 +0000 |
| Subject: | php-news patch | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-27972@lists.php.net to get a copy of this message | ||
Hi,
Attached is a patch for php-news-web that fixes a bug when displaying non-english pages like this: http://news.php.net/php.doc.fr/3991
I've also nuked the warnings/notices I've found.
Nuno
Index: article.php =================================================================== RCS file: /repository/php-news-web/article.php,v retrieving revision 1.32 diff -u -r1.32 article.php --- article.php 13 Feb 2005 15:02:06 -0000 1.32 +++ article.php 19 Apr 2005 17:46:09 -0000 @@ -40,13 +40,14 @@ $boundaries = array(); $lk = ''; $linebuf = ''; +$insig = false; while (!feof($s)) { $line = fgets($s); if ($line == ".\r\n") break; if ($inheaders && ($line == "\n" || $line == "\r\n")) { $inheaders = 0; if ($headers['content-type'] - && preg_match("/charset=(\"|'|)(.+)\\1/is", $headers['content-type'], $m)) { + && preg_match('/charset=("|\'|)([1-9a-zA-Z-]+)\1/is', $headers['content-type'], $m)) { $charset = trim($m[2]); } if ($headers['content-type'] @@ -108,7 +109,7 @@ if ($inheaders) { - list($k,$v) = explode(": ", $line, 2); + @list($k,$v) = explode(": ", $line, 2); if ($k && $v) { $headers[strtolower($k)] = $v; $lk = strtolower($k); @@ -210,7 +211,7 @@ echo " </tr>\n"; echo " <tr>\n"; # references - if ($headers["references"] || $headers["in-reply-to"]) { + if (!empty($headers['references']) || !empty($headers['in-reply-to'])) { $ref = $headers["references"] ? $headers["references"] : $headers["in-reply-to"]; echo ' <td class="headerlabel">References:</td>' . "\n"; echo ' <td class="headervalue">';
Index: article.php =================================================================== RCS file: /repository/php-news-web/article.php,v retrieving revision 1.32 diff -u -r1.32 article.php --- article.php 13 Feb 2005 15:02:06 -0000 1.32 +++ article.php 19 Apr 2005 17:46:09 -0000 @@ -40,13 +40,14 @@ $boundaries = array(); $lk = ''; $linebuf = ''; +$insig = false; while (!feof($s)) { $line = fgets($s); if ($line == ".\r\n") break; if ($inheaders && ($line == "\n" || $line == "\r\n")) { $inheaders = 0; if ($headers['content-type'] - && preg_match("/charset=(\"|'|)(.+)\\1/is", $headers['content-type'], $m)) { + && preg_match('/charset=("|\'|)([1-9a-zA-Z-]+)\1/is', $headers['content-type'], $m)) { $charset = trim($m[2]); } if ($headers['content-type'] @@ -108,7 +109,7 @@ if ($inheaders) { - list($k,$v) = explode(": ", $line, 2); + @list($k,$v) = explode(": ", $line, 2); if ($k && $v) { $headers[strtolower($k)] = $v; $lk = strtolower($k); @@ -210,7 +211,7 @@ echo " </tr>\n"; echo " <tr>\n"; # references - if ($headers["references"] || $headers["in-reply-to"]) { + if (!empty($headers['references']) || !empty($headers['in-reply-to'])) { $ref = $headers["references"] ? $headers["references"] : $headers["in-reply-to"]; echo ' <td class="headerlabel">References:</td>' . "\n"; echo ' <td class="headervalue">';