Author Topic: Snippet to protect email addresses from spam  (Read 22839 times)

Mr._T

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #25 on: December 10, 2007, 04:57:20 PM »
You're right, this one does not work:

aaa.bbb@somewhere.net?subject=Mailme

This is a problem anyway, this looks then like javascript:mdscr(...)?subject=Mailme. JS does not accept this. But this ones should work, I got this working on a customer's website with the file I posted:

aaa.bbb@somewhere.net
aaabbb@somewhere.net

Will take a look on the regex later on.

Regards, Thomas

Mr._T

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #26 on: December 10, 2007, 05:14:50 PM »
Got the reason why it does not work. As long as you do not specifiy the same email address again between the anchor tag, it works, if you specify an email address, it will match rather also something with the second one.

So, we can say, this works:
Code: [Select]
<a class="someclass" href="mailto:some.one@onthe.net">Mailme</a>
<a href="mailto:some.one@onthe.net" class="someclass">Mailme</a>

This will not work:
Code: [Select]
<a href="mailto:some.one@onthe.net?subject=hello" class="someclass">Mailme</a>
<a href="mailto:some.one@onthe.net">some.one@onthe.net</a>

I think I'll take some time and rework the patch, I think we can change it a little bit to get it working.

Regards, Thomas

Mr._T

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #27 on: December 11, 2007, 12:54:15 PM »
Played around a lot and modified frontend.funtions.p hp so, that it matches now most cases. One thing I changed is, if there's an email address, regardless if there's a 'mailto:' tag or not, we want to protect it anyway. With this new replacement I was also able to fix the problem with the additional parameters like '?subject=...'. The solution was quite easy - I added it to the encryption and is now part of the encrypted string.

Be careful with the replacement strings. If you use tags like <em style=""> or <img src="/path/to/at.gof">, the ending quotes may mess up the link. I think, replacing '@' with '(at)' and '.' with '(dot)' is quite enough.

Please test it on your own risk, but I think it is quite safe, it works for me quite fine.

Regards, Thomas

P.S.: Christian, when you verify the modified class, could you create a new package (maybe v.0.31)?



[gelöscht durch Administrator]

Mr._T

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #28 on: December 19, 2007, 01:56:35 PM »
What I recognized is that plugins may bypass the encryption, for instance the guestbook. Anyone who enters a valid email address there, will be kept in clear text. Have to investigate, why...

Regards, Thomas

doc

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #29 on: December 19, 2007, 03:44:24 PM »
Hello,

well as I stated in my first Reply #15, this module does only work for the content typed into WYSIWYG pages, nothing else.
Quote from: doc, reply#15
The aim of the function is to protect email addresses shown at the WB frontend (WYSIWYG pages) from beeing ...

The frontend output of modules is realised via view.php. However, you can make use of the function spam_protect_emails defined in frontend.functions.php.

Include /frameworks/frontend.functions.php file to the view.php of the module. Then use PHP output buffering in the view.php of your module. Save the output in a variable e.g. $output_view (PHP functions: ob_start; ob_get_contents are your friend). Then filter the output via:
Code: [Select]
<?php $output_view spam_protect_emails($output_view); ?>
Then stop the buffer and output the cleaned string with echo.

Regards Christian
« Last Edit: December 19, 2007, 03:46:35 PM by doc »

Offline RolfP

  • Posts: 18
Re: Snippet to protect email addresses from spam
« Reply #30 on: December 25, 2007, 10:51:43 AM »
Hi,

the snippet is pretty cool, but I am running in some problems with a multilingual site and the use of an intro page. This results in
Fatal error: Call to undefined function spam_protect_emails() in ...\framework\class.frontend.php on line 275

So it seems the intro page does not include the frontend.functions. php

Has someone a workaround?

Rolf

doc

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #31 on: February 08, 2008, 06:47:23 PM »
Hello,

the spam protection will be implemented as Admin module into the upcoming WB 2.7 version. Can be switched on/off (off per default). The regular expression was adapted to fix all the knwon problems of todays spam protection.

Regards Christian

POPDUM

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #32 on: February 13, 2008, 12:04:08 PM »
Hi Christian,

I would like to have your code snippet to protect email addreses. From where can I download it? You mention an attached zip file, but somehow I cannot find it.

I thank you very much for your help.

doc

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #33 on: February 13, 2008, 12:45:15 PM »
Hello,

you need to login to the forum to view and download attached files. The files are attached in this thread. If you have time, wait for WB 2.7 which ships with this new feature.

Regards Christian

POPDUM

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #34 on: February 13, 2008, 01:06:27 PM »
Thank you Christian, I found it on the forum. I will switch to 2.7, but, I already have it integrated for my customer.

Great job!

doc

  • Guest
Re: Snippet to protect email addresses from spam
« Reply #35 on: April 10, 2008, 07:41:30 PM »
Hello,

closed this thread as this patch is no longer supported for WB 2.6.x or lower. The solution is part of the WB 2.7 admin tools (output-filter).

Regards Christian

 

postern-length