cvs: php-news-web / common.inc group.php
| From: | James Cox | Date: | Mon, 20 May 2002 13:28:59 +0000 |
| Subject: | cvs: php-news-web / common.inc group.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-10331@lists.php.net to get a copy of this message | ||
imajes Mon May 20 09:28:59 2002 EDT
Modified files:
/php-news-web common.inc group.php
Log:
make it all wrap nice.
Index: php-news-web/common.inc
diff -u php-news-web/common.inc:1.13 php-news-web/common.inc:1.14
--- php-news-web/common.inc:1.13 Mon May 20 08:37:06 2002
+++ php-news-web/common.inc Mon May 20 09:28:57 2002
@@ -79,24 +79,32 @@
function format_author($a) {
$a = preg_replace("/=\\?(.+?)\\?([qb])\\?(.+?)\\?=/ie",
"decode_header('\\1','\\2','\\3')", $a);
if (preg_match("/^\s*(.+)\s+\\(\"?(.+?)\"?\\)\s*$/",$a,$ar)) {
- return "<a href=\"mailto:".htmlspecialchars(urlencode($ar[1]))."\">".htmlspecialchars($ar[2])."</a>";
+ return "<a href=\"mailto:".htmlspecialchars(urlencode($ar[1]))."\">".str_replace("
", " ", htmlspecialchars($ar[2]))."</a>";
}
if (preg_match("/^\s*\"?(.+?)\"?\s*<(.+)>\s*$/",$a,$ar)) {
- return "<a href=\"mailto:".htmlspecialchars(urlencode($ar[2]))."\">".htmlspecialchars($ar[1])."</a>";
+ return "<a href=\"mailto:".htmlspecialchars(urlencode($ar[2]))."\">".str_replace("
", " ", htmlspecialchars($ar[1]))."</a>";
}
if (ereg("@",$a)) {
return "<a href=\"mailto:".htmlspecialchars(urlencode($a))."\">".htmlspecialchars($a)."</a>";
}
- return htmlspecialchars($a);
+ return str_replace(" ", " ", htmlspecialchars($a));
}
function format_subject($s) {
+ global $article;
$s = preg_replace("/=\\?(.+?)\\?([qb])\\?(.+?)\\?=/ie",
"decode_header('\\1','\\2','\\3')", $s);
$s = preg_replace("/^(Re: *)?\[(PHP|PEAR)(-.*)?\] /i", "\\1", $s);
- return htmlspecialchars($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 nl2br(htmlspecialchars($s));
}
function format_date($d) {
$d = strtotime($d);
- return strftime("%c", $d);
+ $d = strftime("%c", $d);
+ return str_replace(" ", " ", $d);
}
Index: php-news-web/group.php
diff -u php-news-web/group.php:1.8 php-news-web/group.php:1.9
--- php-news-web/group.php:1.8 Thu May 2 11:06:08 2002
+++ php-news-web/group.php Mon May 20 09:28:58 2002
@@ -40,7 +40,7 @@
$line = chop($line);
list($n,$subj,$author,$odate,$messageid,$references,$bytes,$lines,$extra)
= explode("\t", $line, 9);
- $date = date("H:i:s M/d/y", strtotime($odate));
+/* $date = date("H:i:s M/d/y", strtotime($odate)); */
$date822 = date("r", strtotime($odate));
switch($format) {
@@ -60,7 +60,7 @@
echo format_subject($subj);
echo "</td>";
echo "<td
class=\"$class\">".format_author($author)."</td>\n";
- echo "<td
class=\"$class\"><tt>$date</tt></td>\n";
+ echo "<td align=\"center\" class=\"$class\"><tt>" .
format_date($odate) . "</tt></td>\n";
echo "<td align=\"right\"
class=\"$class\">$lines</td>\n";
}
$class = $class == "even" ? "odd" : "even";