cvs: phpweb /include shared-manual.inc
| From: | Gabor Hojtsy | Date: | Fri, 15 Nov 2002 20:03:16 +0000 |
| Subject: | cvs: phpweb /include shared-manual.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-13612@lists.php.net to get a copy of this message | ||
goba Fri Nov 15 15:03:16 2002 EDT
Modified files:
/phpweb/include shared-manual.inc
Log:
Adding safe email printing to printed pages
Index: phpweb/include/shared-manual.inc
diff -u phpweb/include/shared-manual.inc:1.152 phpweb/include/shared-manual.inc:1.153
--- phpweb/include/shared-manual.inc:1.152 Sat Nov 9 10:27:15 2002
+++ phpweb/include/shared-manual.inc Fri Nov 15 15:03:16 2002
@@ -119,6 +119,12 @@
}
+// Try to make email address printing safe (protect from spammers)
+function safeEmail($email)
+{
+ return str_replace(array('@', '.'), array(' at ', ' dot
'), $email);
+}
+
// Print out one user note entry
function makeEntry($date,$name,$blurb,$id=0) {
global $MAGIC_COOKIE;
@@ -134,10 +140,9 @@
$name = htmlspecialchars($name);
if ($name && $name != "php-general@lists.php.net" && $name !=
"user@example.com") {
if (ereg("(.+)@(.+)\.(.+)",$name)) {
- $name = str_replace('@', ' at ', $name);
- $name = str_replace('.', ' dot ', $name);
- }
- echo "<b>".$name."</b><br>\n";
+ $name = safeEmail($name);
+ }
+ echo "<b>".$name."</b><br>\n";
}
echo date("d-M-Y h:i",$date);
?>
@@ -359,13 +364,11 @@
// Make manual user note entry for printing
function makePrintEntry($date,$name,$blurb,$id=0) {
- $name = htmlspecialchars($name);
if ($name && $name != "php-general@lists.php.net" && $name !=
"user@example.com") {
if (ereg("(.+)@(.+)\.(.+)",$name)) {
- echo "<b><a href=\"mailto:".$name."\">".$name."</a></b><br>\n";
- } else {
- echo "<b>".$name."</b><br>\n";
+ $name = safeEmail($name);
}
+ echo "<b>".$name."</b><br>\n";
}
echo date("d-M-Y h:i",$date) . "<br><br>";
echo clean_note($blurb) . "<br><hr noshade size=\"1\"
width=\"50%\" align=\"center\">";