From 33b00b147aca904e7453c66b4e23a93e944d84d7 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 29 Jan 2008 06:08:59 +0000 Subject: [PATCH] Add missing function. --- www/forums.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/www/forums.php b/www/forums.php index 1f4298f..551d693 100644 --- a/www/forums.php +++ b/www/forums.php @@ -6,6 +6,8 @@ // // Contents: // +// sanitize_email() - Convert an email address to something a SPAMbot +// can't read... // format_date() - Format a RFC 2822 date string. // nntp_close() - Close a news server thing... // nntp_command() - Send a command and get the response... @@ -51,6 +53,53 @@ if ($from == "" || $from == "Anonymous") $from = "Anonymous "; +// +// 'sanitize_email()' - Convert an email address to something a SPAMbot +// can't read... +// + +function // O - Sanitized email +sanitize_email($email, // I - Email address + $html = 1) // I - HTML format? +{ + $nemail = ""; + $len = strlen($email); + + for ($i = 0; $i < $len; $i ++) + { + switch ($email[$i]) + { + case '@' : + if ($i > 0) + $i = $len; + else if ($html) + $nemail .= " at "; + else + $nemail .= " at "; + break; + + case '<' : + if ($i > 0) + $i = $len; + break; + + case '>' : + break; + + case '&' ; + $nemail .= "&"; + break; + + default : + $nemail .= $email[$i]; + break; + } + } + + return (trim($nemail)); +} + + // // 'format_date()' - Format a RFC 2822 date string. //