Add missing function.

This commit is contained in:
Michael R Sweet 2008-01-29 06:08:59 +00:00
parent 66a4800d57
commit 33b00b147a

View File

@ -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 <anonymous@minixml.org>";
//
// '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 .= " <I>at</I> ";
else
$nemail .= " at ";
break;
case '<' :
if ($i > 0)
$i = $len;
break;
case '>' :
break;
case '&' ;
$nemail .= "&amp;";
break;
default :
$nemail .= $email[$i];
break;
}
}
return (trim($nemail));
}
//
// 'format_date()' - Format a RFC 2822 date string.
//