Stop comment spam with this Captcha solution that generates random anti-spam words. The GD Library is required to display the Captcha image, and the FreeType library is needed to be able to use fonts within the image.
Peter's Custom Anti-Spam Image for eZ Publish
Version 1.1
Compatible with eZ Publish 3.8+
Install instructions:
French instructions here:
http://luxpopuli.fr/ez_publish__1...spam_image_image_anti_spam_aleatoire
1) Unzip the customantispam directory into the eZ Publish extension directory.
2) Activate the extension in the eZ Publish Administration Interface by clicking on the Setup tab, then the Extensions menu item.
3) Run the SQL query in customantispamtables.sql to insert the necessary tables into the same database as your eZ Publish installation.
4) Add a policy under the Anonymous Role (click the User accounts tab, then the Roles and Policies link) to grant full access to the customantispam module.
5) Add a new workflow. Click the Setup tab, then the Workflows menu item. Click the New workflow group button and enter any name you want (such as "Anti-spam").
a) In the new workflow group, click the New workflow button. Name it "Anti-spam" and select the event "Event / Custom anti-spam", then click the Add event button.
b) Alternatively, you can add the "Custom anti-spam" event to a multiplexer workflow. This is useful if you have several events that you need to run in the "content / publish / before" trigger (in step 6). In that case, select the event "Event / Multiplexer", then click the Add event button. There are many more options in the Multiplexer event, such as affected sections, languages, classes, versions and users. For this workflow, you can leave all of the options as "all". If you are using this extension to filter objects of the Comment class, select that under the Classes to run workflow list box. In the Workflow to run dropdown list, select the "Anti-spam" workflow. Then, click the OK button.
6) Add a new trigger by clicking the Setup tab, then the Triggers menu item. Under the "content" module, "publish" function and "before" connection type, select the workflow "anti-spam" then click the Apply changes button.
7) Find your comment template (for ezwebin, it's extension/ezwebin/design/ezwebin/override/templates/edit/comment.tpl).
Add {set-block scope=root variable=cache_ttl}0{/set-block} at the top of your template.
If you are putting the anti-spam protection into a different template (such as directly in a blog post if you are using Kristof's powercontent extension at
http://ezpedia.org/wiki/en/ez/powercontent to add a comment form directly in a template), add cache-blocks around the sections of the page preceding and following the anti-spam code:
{cache-block}
Start of page
{/cache-block}
anti-spam code
{cache-block}
Rest of page
{/cache-block}
However, cache-blocks are probably not necessary if you are editing the edit/comment.tpl template.
Add the following code to the form, usually above the message text area:
<div class="block">
{def $antispam = custom_anti_spam()}
<label>Anti-spam word</label><div class="labelbreak"></div>
<input type="hidden" name="matchthis" value="{$antispam}" />
<a href={concat("/customantispam/audio/(audio)/",$antispam)|ezurl("double")}><img src={concat("/customantispam/image/(image)/",$antispam)|ezurl("double")} style="border: 1px solid black" alt="Click to hear an audio file of the anti-spam word"/></a><div class="labelbreak"></div>
<input type="text" name="securitycode" size="10" />
</div>
Comments
Registration
Peter Keung
Wednesday 26 September 2007 8:45:35 pm
Any suggestions to modify it for the user module are welcome!
User register and Anti-Spam
Radek Kuchta
Wednesday 26 September 2007 7:51:02 am
Is it possible to use this ext. for user registration form? I know, that I need trigger for "user" module for that but I have no idea how to do it. Can anybody give me advice?
No more .htaccess hacking required
Peter Keung
Friday 21 September 2007 7:52:19 am
Add a Rewrite Cond in .htaccess
Peter Keung
Saturday 08 September 2007 7:06:16 pm
The customantispamhandler.php is an error on my part, as I shouldn't have included settings/content.ini.append.php in the package. That will be fixed when I release the next version.
However, that shouldn't have caused the problem. Is the image simply showing "Anti-Spam image" (the alt value)? If so, you probably need to add a RewriteCond to your .htaccess file in order to prevent that specific image files from being rewritten according to the other rewrite rules:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/extension/customantispam/cas_image\.php
Object edit handler?
Stefano Maffulli
Tuesday 28 August 2007 4:26:29 pm
Error:
Cound not find content object edit handler ( defined in content.ini ) : extension/customantispam/content/customantispamhandler.php
What did I do wrong? Running it on eZP 3.8.6. Thanks