I'm trying to convert my site to use Drupal for easier maintenance in the future. I'm having a few problems, mostly related to working on a theme and trying to convert my own workflow. However, there are a couple of general things that seem to require me to hack the core.

My current web site is at http://www.astrofoto.org/. It's a home-grown "CMS" that lets me just drop HTML fragments on the server (to which I have full access), and uses a home-grown pseudo-theme based on CSS and my own class.rFastTemplate.php.

One of things my page generator does as a post-processing step is pass the text through a filter that munges e-mail addresses. The PHPcode looks like this:

// Munge e-mail addresses to prevent bots from getting them
function munge_emails ($matches) {
    $prefix = '<script type="text/javascript">document.write(decodeBase64("';
    $suffix = '"));</script>';
    return $prefix . base64_encode($matches[1]) . $suffix;
}

$buffer = preg_replace_callback ('!(<a href="mailto:[^"]*">.*?</a>)!is',
				 "munge_emails", $buffer);

And there is also a supporting javascript file included that implements decodeBase64().

This munging provides at least a small hurdle for spambots harvesting e-mail addresses.

Ideally, I'd like to do this same thing (filter everything through the above), but as a first pass, I added a static insert into the footer. filter_xss_admin doesn't quite allow everything through. I had to modify it to allow the script tag. Next I have to find where to get my new javascript file loaded in the head area. But ideally, I'd like to simply add this as a post filter prior to the print for text which would get the same effect as I have on my current site---all emails get munged on output.

roland

Comments

rbroberts’s picture

I found an immediate solution to the javascript load issue in this post. This allows me to put in the static footer when combined with the hacked filter_xss_admin().