1 (edited by 505 2005-04-16 12:25)

Topic: Spam Protect Email 1.0.1a

##
##
##      Mod title:  Spam Protect Emails
##
##      Mod version:  1.0.1a
##      Works on PunBB:  1.2.x
##      Release date:  2005-04-15
##      Author:  Daniel Vijge (vijge@dse.nl)
##
##      Description:  Spam protect email addresses in [email]tags. With this mod you can
##                    protect email address in posts against automatic harvesting.
##                    When the cursor hovers over an email address the user
##                    sees something like "javascript:mail_to('ocknvq<gocknBgzcorng0eqo')"
##                    in the status bar.
##                    When select, copy and paste and email address you will get
##                    email@remove-this.example.com
##                    Clicking on the link opens the mail program with the correct address.
##                    Addresses are normally readable to humans, but computers will have a hard
##                    time.
##                    To convert e-mails in text to clickable, spam-protected links preform
##                    steps 11 and 12. Else, skip these steps. (The default setup of punBB does
##                    not have the option to convert e-mail addresses, only www/ftp-links.)
##
##   Affected files:  header.php
##                    include/parser.php
##
##       Affects DB:  No
##
##            Notes:  You can change the encryption algoritm to create a better encryption
##                    (harder to automatically decode). In the function handle_email_tag()
##                    change the number in "$charValue+=intval(2);" to a number of your choice.
##                    Open 'uncrypt_email.js" and change "r += String.fromCharCode(n-(2));" to
##                    the same number.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Download

Change log
1.0.1a: Fix in regex code (thanks tuyau45 for pointing this out)
1.0.1: Fix possible bad coding/decoding of addresses
         Option to decode e-mail adressen in text (not in  tag)

Re: Spam Protect Email 1.0.1a

But in 1.2.*, e-mail addresses are never displayed to guest users, so you don't need to worry about harvesters.

Edit: AHA! It's for e-mail addresses in the actual posts. Cool smile

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Spam Protect Email 1.0.1a

Can i use it on 1.2.3?

Re: Spam Protect Email 1.0.1a

it works in 1.2.4 !!!

Re: Spam Protect Email 1.0.1a

Very cool!

6

Re: Spam Protect Email 1.0.1a

well it did not for me in 1.2.4 it was giving me and error in parser.php at line 324 wich is in mine

    // This thing takes a while! smile
    $text = preg_replace($pattern, $replace, $text);

Re: Spam Protect Email 1.0.1a

I got a old forum with plenty of email in the posts. I would like to use this mod : Spam Protect Email 1.0.0 to "code" all the email adresses in viewtopic and post ... How I should process ?

8

Re: Spam Protect Email 1.0.1a

New version, 1.0.1.

Changes:
- Fix possible bad coding/decoding of addresses
- Option to decode e-mail adressen in text (not in tag)

Re: Spam Protect Email 1.0.1a

There is a bug :


If you add (remove the space inside the tags)

[ email]myname@mydomain.com[ /email] produces myname@mydomain.com
[ email=myname@mydomain.com]My e-mail address[ /email] produces My e-mail address


you expect this

myname@remove-this.mydomain.com produces myname@mydomain.com
My e-mail address produces My e-mail address


but you get

urcp"uv{ng?^$fkurnc{1urcp@o{fqockp0eqo>1c@')">myname@remove-this.remove-this.mydomain.com produces myname@remove-this.mydomain.com
urcp"uv{ng?^$fkurnc{1urcp@o{fqockp0eqo>1c@')">My e-mail address produces My e-mail address

the  pb should come from the regex here because the adress is encrypt twice

$text = preg_replace('#((mailto:)?([\w\d][\w\d$.-]*[\w\d]@[\w\d][\w\d.-]*[\w\d]\.[a-z0-9]{2,5}))#ie', 'handle_email_tag(\'$3\')', $text);

good luck

10 (edited by 505 2005-04-16 12:29)

Re: Spam Protect Email 1.0.1a

Thanks for pointing that out tuyau45! I release 1.0.1a were this problem is (hopefully) fixed. I could use some testing feedback. If you have installed this mod and have problems (or everything is working fine), please post here.

If you already downloaded and installed 1.0.1, open parser.php, goto line 347 (the last regex in the do_clickable function) and replace it with:

$text = preg_replace('#([\s\(\)])((mailto:)?([\w\d][\w\d$.-]*[\w\d]@[\w\d][\w\d.-]*[\w\d]\.[a-z0-9]{2,5}))((/[^"\s\(\)<\[]*)?)#ie', '\'$1\'.handle_email_tag(\'$2\')', $text);

Re: Spam Protect Email 1.0.1a

Great it seems to be perfect now !!!!

Thanks

12 (edited by fpouget 2005-09-08 03:40)

Re: Spam Protect Email 1.0.1a

Hello,

The mod is not any more compatible with the 1.2.7,

I try to move to the my punbb forum to the 1.2.7 version.

But there is a change in parser.php (I presume) which affect the mod


     

 Mod Spam Protect Emails
      '#\[email\](.*?)\[/email\]#e',
      '#\[email=(.*?)\](.*?)\[/email\]#e',

1.2.7
     

 '#\[email\]([^\[]*?)\[/email\]#',
      '#\[email=([^\[]*?)\](.*?)\[/email\]#',

I try that
      1.2.7 mix with Mod Spam Protect Emails
     

  '#\[email\]([^\[]*?)\[/email\]#e',
      '#\[email=([^\[]*?)\](.*?)\[/email\]#e',

but is doesn't work


You can do the test with :

[email]myname@mydomain.com[/email] produit myname@mydomain.com
[email=myname@mydomain.com]Mon adresse e-mail[/email] produit Mon adresse e-mail

Thanks

Re: Spam Protect Email 1.0.1a

Sorry,

It works perfectly with 1.2.7.

you shoud replace the Mod Spam Protect Emails code with the one from the 1.2.7

'#\[email\](.*?)\[/email\]#e',
'#\[email=(.*?)\](.*?)\[/email\]#e',

14

Re: Spam Protect Email 1.0.1a

After I upgraded my own forums to 1.2.7 I will look at my code and release a new version of the mod, so everyone can apply it straight away. Thanks for mentioning this.