cvs: php-news-web / article.php common.inc
| From: | James Cox | Date: | Mon, 25 Nov 2002 06:02:54 +0000 |
| Subject: | cvs: php-news-web / article.php common.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-13866@lists.php.net to get a copy of this message | ||
imajes Mon Nov 25 01:02:54 2002 EDT
Modified files:
/php-news-web article.php common.inc
Log:
hack to prevent <br /> from entering into browser title bars... yes, i could have used an
arg to format_subject, but this was quicker.
Index: php-news-web/article.php
diff -u php-news-web/article.php:1.19 php-news-web/article.php:1.20
--- php-news-web/article.php:1.19 Mon Oct 14 20:55:37 2002
+++ php-news-web/article.php Mon Nov 25 01:02:54 2002
@@ -41,7 +41,7 @@
$mimetype = trim(strtolower($m[1]));
}
if (!$started) {
- head("$group: ".format_subject($headers[subject], $charset));
+ head("$group: ".format_title($headers[subject], $charset));
start_article($group,$headers,$charset);
$started = 1;
}
Index: php-news-web/common.inc
diff -u php-news-web/common.inc:1.19 php-news-web/common.inc:1.20
--- php-news-web/common.inc:1.19 Sun Sep 15 08:50:08 2002
+++ php-news-web/common.inc Mon Nov 25 01:02:54 2002
@@ -118,6 +118,20 @@
return nl2br(htmlspecialchars($s));
}
+
+function format_title($s, $charset) {
+ global $article;
+ $s = recode_header($s, $charset);
+ $s = preg_replace("/^(Re: *)?\[(PHP|PEAR)(-.*)?\] /i", "\\1", $s);
+ // make this look better on the preview page..
+ if (strlen($s) > 150 && !isset($article)) {
+ $s = substr($s, 0, 150) . "...";
+ } else {
+ $s = wordwrap($s, 150);
+ }
+ return $s;
+}
+
function format_date($d) {
$d = strtotime($d);
$d = strftime("%c", $d);