[dokuwiki] Re: Spam to mail adress despite mailguard

  • From: "William Lee" <william.lee@xxxxxxxxxxxxxx>
  • To: <dokuwiki@xxxxxxxxxxxxx>
  • Date: Sun, 6 Aug 2006 22:06:39 +0100

Dear All,

As a antidote to this problem I wrote the following plugin a while ago for my own use. It works on dokuwiki 2005-09-?? release.

{{mailform>recipient}}

It sends an email to admin, the person specified in 'recipient', (whose email is looked up from the 'users.auth' file), and the person who most recently edited the page, whose email is looked up similarly.

See it in action at www.sailingsource.com/cherub/test/doku.php/playground

Hope that helps,

Will

This is 'syntax.php' in lib/plugins/mailform

<?php
/**
* Plugin Mailform: Makes a mailform which hides the email addr from potential spammers.
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
*/


if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');


/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_mailform extends DokuWiki_Syntax_Plugin {

/**
* return some info
*/
function getInfo(){
return array(
'author' => 'William Lee',
'email' => 'william.lee@xxxxxxxxxxxxxx',
'date' => '2006-06-09',
'name' => 'Mailform Plugin',
'desc' => 'Makes a form which emails the user whose wiki id matches the pagename, or failing that the last editor of the page, or to a specified wiki-id. The data is lifted from the users.auth file',
'url' => 'www.uk-cherub.org',
);
}


function getType(){ return 'substition'; }
function getPType(){ return 'normal'; }
function getSort(){ return 79; }
function connectTo($mode) { $this->Lexer->addSpecialPattern('\{\{mailform>.*?\}\}',$mode,'plugin_mailform'); }


/**
* Handle the match
*/
function handle($match, $state, $pos, &$handler){
GLOBAL $INFO;
$recipients["entered"] = substr($match,11,-2);
$recipients["pagename"] = rtrim(substr(strrchr($INFO['filepath'],'/'),1),'.txt');
$recipients["editor"] = $INFO['editor'];
return $recipients;
}



/**
* Create output
*/
function render($mode, &$renderer, $data) {
if($mode == 'xhtml'){
$renderer->doc .='<A HREF="'.DOKU_BASE.'lib/exe/mailform.php?entered='.$data["entered"].'&pagename='.$data["pagename"].'&editor='.$data["editor"].'&base='.DOKU_BASE.'">Contact.</A>';
return true;
}
return false;
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :
?>


This is /exe/mailform.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<?php
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
// print_r($_GET);


include('/home/websites/cherub/test/lib/tpl/default/topheader.php');

?>
<HTML>
<HEAD>
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo ($_GET["base"]); ?>lib/tpl/default/design.css" />
</HEAD>
<BODY>


<div class="dokuwiki">

<FORM METHOD="POST" ACTION="<?php echo ($_GET["base"]); ?>lib/exe/mailform2.php" ENCTYPE="x-www-form-urlencoded">
<INPUT TYPE=hidden NAME=abcentered VALUE="<?php echo($_GET["entered"]); ?>">
<INPUT TYPE=hidden NAME=defpagename VALUE="<?php echo($_GET["pagename"]); ?>">
<INPUT TYPE=hidden NAME=ghieditor VALUE="<?php echo($_GET["editor"]); ?>">
<INPUT TYPE=hidden NAME=jklbase VALUE="<?php echo($_GET["base"]); ?>">


<TABLE CELLPADDING="2" CELLSPACING="2" BORDER="0" ALIGN="CENTER">
<TR>
<TD class="maintdpos" COLSPAN="2">
<H3>Enter your Message and Details</H3>
</TD>
</TR>
<TR>
<TD class="maintdpos" COLSPAN="2">
<H3>You</H3>
</TD>
</TR>
<TR>
<TD class="maintdpos">Your Name:</TD>
<TD class="maintdpos"><INPUT TYPE="text" NAME="zweuser" SIZE="30" MAXLENGTH="40"></TD>
</TR>
<TR>
<TD class="maintdpos">Your email address:</TD>
<TD class="maintdpos"><INPUT TYPE="text" NAME="grxemail" SIZE="30" MAXLENGTH="40"></TD>
</TR>
<TR>
<TD class="maintdpos" COLSPAN="2">
<H3>Your Message</H3>
</TD>
</TR>
<TR>
<TD class="maintdpos" COLSPAN="2"><TEXTAREA NAME="klqcontent" ROWS="10" COLS="50"></TEXTAREA></TD>
</TR>
<TR>
<TD class="maintdpos"><INPUT TYPE="submit" VALUE="Post Details"></TD>
<TD class="maintdpos"><INPUT TYPE="reset" VALUE="Clear Form"></TD>
</TR>
</TABLE>
</FORM>
<P>
<?php include('/home/websites/cherub/test/lib/tpl/default/footer.php'); ?>
</P>
</BODY>
</HTML>





----- Original Message ----- From: "Terence J. Grant" <tjgrant@xxxxxxxxxxxx>
To: <dokuwiki@xxxxxxxxxxxxx>
Sent: Sunday, August 06, 2006 2:36 AM
Subject: [dokuwiki] Re: Spam to mail adress despite mailguard



Although I don't think too much care should be spent on mail obfuscation
(because at one point it always seems useless and frustrating anyway),
I'd like it to be a bit better.
What about at least a combination of 'visible' and 'hex'?
And I wouldn't mind a third and/or fourth obfuscation mode either ...

Before DokuWiki, I used a simple javascript to obscure against email collectors.


I can imagine a fairly simple scheme (xor site title against email
address) that could be easily done and probably fairly improbable for
a spider to figure out.

Essentially in php, xor name against title, output hex with function
call, and for javascript, do some kind of onclick or whatnot and
re-xor against the title(which would be hard coded in a javascript
var.)

I've not done a syntax plugin yet though; is it easy enough to
"overload" the email parser portion or would this have to be done in
the code itself? Or is this enough (Andi) for you to do yourself? If
not I could write up some concept code.

--
--Terence J. Grant(tjgrant@xxxxxxxxxxxx)
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

________________________________________________________________________

Doctors.net.uk education: totally independent, totally free.
http://www.doctors.net.uk/education
_______________________________________________________________________



-- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: