New in the Journal

Archive of all articles

From my feed reader

Microblog

Journal

Anti-Spam-Links in eZ Publish

Standardmäßig werden Links in XML-Blöcken im Open Source-CMS eZ Publish nicht gegen Spam geschützt. Insbesondere bei mailto-Links wäre eine Verschleierung jedoch sinnvoll (wenngleich jede Form einfach zu entschlüsseln sein dürfte).

Zumindest einen Basisschutz bietet das folgende Link-Template, das alle Links, die mit “mailto” beginnen, sowie deren Inhalt in HTML-Entities mit numerischer Notation entsprechend deren ASCII-Wert umwandelt. Bitte mögliche unerwünschte Effekte bedenken! Dies ist nur eine Modifikation des Standard-Templates für ezxml-Link-Tags, mit dem man das Standard-Template für ein bestimmtes Layout überschreiben kann. Es muss also unter /design/ [eigenes-layout] /templates/content/datatype/view/ ezxmltags/link.tpl abgelegt werden.

{***** this entities mailto links and content || should reside in design directory as templates/content/datatype/view/ezxmltags/link.tpl *****}{if $href|contains( 'mailto:' )}{*****entity-ed mailto link strings*****}<a href="{def $href_ord=$href|ord()}{foreach $href_ord as $href_char}&#{$href_char};{/foreach}"{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{def $content_ord=$content|ord()}{foreach $content_ord as $content_char}&#{$content_char};{/foreach}</a>{else}{*****normal link*****}<a href={$href|ezurl}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>{/if}
comments powered by Disqus