cvs: pearweb /public_html/bugs/include functions.inc
| From: | Daniel Convissor | Date: | Tue, 08 Jun 2004 05:41:29 +0000 |
| Subject: | cvs: pearweb /public_html/bugs/include functions.inc | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-20350@lists.php.net to get a copy of this message | ||
danielc Tue Jun 8 01:41:29 2004 EDT
Modified files:
/pearweb/public_html/bugs/include functions.inc
Log:
TWEAK spam_protect():
* Make it also obfuscate @php.net addresses. Bug #1449.
* Add docblock.
* Use HTML character entities to further obfuscate things.
http://cvs.php.net/diff.php/pearweb/public_html/bugs/include/functions.inc?r1=1.38&r2=1.39&ty=u
Index: pearweb/public_html/bugs/include/functions.inc
diff -u pearweb/public_html/bugs/include/functions.inc:1.38
pearweb/public_html/bugs/include/functions.inc:1.39
--- pearweb/public_html/bugs/include/functions.inc:1.38 Mon Jun 7 16:29:18 2004
+++ pearweb/public_html/bugs/include/functions.inc Tue Jun 8 01:41:29 2004
@@ -1,18 +1,23 @@
<?php /* vim: set noet ts=4 sw=4 ft=php : */
-// $Id: functions.inc,v 1.38 2004/06/07 20:29:18 dufuz Exp $
+// $Id: functions.inc,v 1.39 2004/06/08 05:41:29 danielc Exp $
-/* Email spam protection */
+/**
+ * Obfuscates email addresses to hinder spammer's spiders
+ *
+ * Turns "@" into character entities that get interpreted as "at" and
+ * turns "." into character entities that get interpreted as "dot".
+ *
+ * @param string $txt the email address to be obfuscated
+ * @return string the altered email address
+ */
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);
- }
+ $translate = array(
+ '@' => ' at ',
+ '.' => ' dot ',
+ );
+ return strtr($txt, $translate);
}
/* scrub user input so it can be re-output */