Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 05:50:10 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
149667 Posts in 21100 Topics by 7538 Members
Latest Member: ionline
* Home Help Search Login Register
Pages: 1 [2]   Go Down
Print
Author Topic: Snippet to protect email addresses from spam  (Read 13024 times)
Mr._T

Offline Offline

Posts: 36


« 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
Logged
Mr._T

Offline Offline

Posts: 36


« 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:
<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:
<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
Logged
Mr._T

Offline Offline

Posts: 36


« 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)?

Logged
Mr._T

Offline Offline

Posts: 36


« 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
Logged
doc
Guest
« 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:
<?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 » Logged
RolfP

Offline Offline

Posts: 18


« 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
Logged
doc
Guest
« 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
Logged
POPDUM

Offline Offline

Posts: 23


« 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.
Logged
doc
Guest
« 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
Logged
POPDUM

Offline Offline

Posts: 23


« 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!
Logged
doc
Guest
« Reply #35 on: April 10, 2008, 06: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
Logged
Pages: 1 [2]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!