Firefox PHP

Hiding superfluous e-mail addresses

Posted by Gwaihir 
Hiding superfluous e-mail addresses
November 30, 2003 09:40PM
Hi,

I've set up Phorum to receive postings through e-mail. If people send in replies to other mails these will contain e-mail addresses, which then appear in the postings.

Example:
---
Author: Gwaihir
Date: 11-30-03 19:12

Current posting text

----- Original Message -----
Wrom: UTFJMVRE
To: me@somewhere.com
Sent: Monday, December 01, 2003 2:11 AM
Subject: Draadjestest 1

Body of older message
---

I don't want them there for reasons of privacy and (mostly) spam harvesting.

Has anyone written a mod for this purpose so far (Phorum 3.4.4 - Stable)? If so, where can I find it?

If not, I'll write one in the next few days (shouldn't be hard) and post it here in hope that some out here will comment on it to optimize it.
Ok, I wrote a few lines of code that change any "me@somewhere.com" found into a less spammable "me@s.. ". As far as I can tell it does a goed job of taking these out and responds fairly intelligent to alternate texts with an "@" in there.

A very simple mod to install: in the file include/post_functions.php find the function censor and add a few lines directly above its return statement so it will look like this:

function censor($author, $subject, $email, $body)
{
<snipped code here out of this post for shortness>

//hide e-mail addresses
$pattern = "/([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-])[a-z0-9-]*(\.[a-z0-9-]+)+/i";
$author = preg_replace($pattern, "\$1.. ", $author);
$subject = preg_replace($pattern, "\$1.. ", $subject);
$body = preg_replace($pattern, "\$1.. ", $body);

return(array($author, $subject, $email, $body));
}

That's all.
Do you have this working some where I can see it at? Also can I admin still see emails? From kroqmusic@aol.com email me please I dont want to miss your reply on the bord.

Gwaihir wrote:

> Ok, I wrote a few lines of code that change any
> "me@somewhere.com" found into a less spammable "me@s.. ". As
> far as I can tell it does a goed job of taking these out and
> responds fairly intelligent to alternate texts with an "@" in
> there.
>
> A very simple mod to install: in the file
> include/post_functions.php find the function censor and add a
> few lines directly above its return statement so it will look
> like this:
>
> function censor($author, $subject, $email, $body)
> {
> <snipped code here out of this post for shortness>
>
> //hide e-mail addresses
> $pattern =
> "/([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-])[a-z0-9-]*(\.[a-z0-9-]+)+/i";
> $author = preg_replace($pattern, "\$1.. ", $author);
> $subject = preg_replace($pattern, "\$1.. ", $subject);
> $body = preg_replace($pattern, "\$1.. ", $body);
>
> return(array($author, $subject, $email, $body));
> }
>
> That's all.
Sorry, you do not have permission to post/reply in this forum.