cvs: php-bugs-web /rss bug.php
| From: | Hannes Magnusson | Date: | Sun, 07 Jan 2007 08:10:15 +0000 |
| Subject: | cvs: php-bugs-web /rss bug.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-33712@lists.php.net to get a copy of this message | ||
bjori Sun Jan 7 08:10:15 2007 UTC
Modified files:
/php-bugs-web/rss bug.php
Log:
Spam protect user email addressess
# Copy & pasted from includes/functions.php
http://cvs.php.net/viewvc.cgi/php-bugs-web/rss/bug.php?r1=1.8&r2=1.9&diff_format=u
Index: php-bugs-web/rss/bug.php
diff -u php-bugs-web/rss/bug.php:1.8 php-bugs-web/rss/bug.php:1.9
--- php-bugs-web/rss/bug.php:1.8 Wed Sep 1 17:07:49 2004
+++ php-bugs-web/rss/bug.php Sun Jan 7 08:10:15 2007
@@ -66,7 +66,7 @@
echo ' <link>http://bugs.php.net/' .
intval($bug['id']) . "</link>\n";
echo ' <description>';
echo utf8_encode(htmlspecialchars("{$bug['bug_type']}\n"));
- echo utf8_encode(htmlspecialchars("{$bug['email']}\n"));
+ echo utf8_encode(htmlspecialchars(spam_protect($bug['email']))) . "\n";
echo date('n/j/Y g:i A',$bug['submitted'] . "\n");
echo utf8_encode(htmlspecialchars("PHP: {$bug['php_version']} OS:
{$bug['php_os']}\n\n"));
echo utf8_encode(htmlspecialchars($bug['ldesc']));
@@ -86,7 +86,7 @@
case 'rss':
default:
echo " <item>\n";
- echo ' <title>' . utf8_encode(htmlspecialchars($row['email'])) .
"</title>\n";
+ echo ' <title>' .
utf8_encode(htmlspecialchars(spam_protect($row['email']))) . "</title>\n";
echo " <link>http://bugs.php.net/{$bug['id']}</link>\n";
echo ' <description>' .
utf8_encode(htmlspecialchars($row['comment'])) . "</description>\n";
echo ' <dc:date>' . date('Y-m-d',$row['added']) .
"</dc:date>\n";
@@ -108,5 +108,16 @@
echo "</rdf:RDF>\n";
}
}
+/* Email spam protection */
+function spam_protect($txt){
+ $translate = array('@' => ' at ', '.' => ' dot ');
+
+ /* php.net addresses are not protected! */
+ if (preg_match('/^(.+)@php\.net/i', $txt)) {
+ return $txt;
+ } else {
+ return strtr($txt, $translate);
+ }
+}
?>