Extension talk:EmailObfuscator

From MediaWiki.org
Jump to navigation Jump to search

Bot-accessible data problem[edit]

The problem with the methodology used by this extension is that you still have to specify the email address in a computer accessible way. It's wonderful that the HTML page lacks the plaintext email addresses, but they're still viewable in the page source.

All a bot creator would have to do is tell the bot to pull down the action=raw verisions of pages and parse them for instances of email addresses, and the functionality provided by this extension would be completely circumvented.

One thing that might work would be to pull the email address of a user (which is only available to the wiki system), then build that out using JS. So instead of this:

<mail address='admin@example.com' description='some description'>Some Text</mail>

You'd have this:

<mail user='SomeAdminUser' description='some description'>Some Text</mail>

Just a thought. --Jimbojw 17:03, 12 April 2007 (UTC)

The Extension:Enkoder can do this after some changes have been made to it. See Extension talk:Enkoder. --Rebbyte 13:17, 15 April 2008 (UTC)

Doesn't work with MW 1.11.1[edit]

This extension needs to be altered to use the correct parameters for ParserAfterStrip (IE to set $text and return true instead of just returning the text) - if you use as is, you will get this error:

Detected bug in an extension! Hook obfuscateEmailAddress failed to return a value; should return true to continue hook processing or false to abort.

I don't think it would take much to fix it - if I can I figure out the etiquette around posting updates here, I will post my efforts at a fix.

Cheers,

Pamela

Doesn't work with SVN (1.12a) either[edit]

Same error however, hook problem.

As for contributions, I suppose leaving it in here (Talk) would be OK?

Kjikaqawej 06:02, 17 February 2008 (UTC)

Solution for hook error; additional error[edit]

Ensuring that the function returns a value fixes the issues raised above. Edit this section:

function obfuscateEmailAddress() {
	// Declaring the global parser..
	global $wgParser;

	// Setting the hook to parse <mail></mail> tags from the parser output..
	$wgParser->setHook( 'mail', 'startObfuscate' );
}

adding in just a single line that returns a true value:

function obfuscateEmailAddress() {
	// Declaring the global parser..
	global $wgParser;

	// Setting the hook to parse <mail></mail> tags from the parser output..
	$wgParser->setHook( 'mail', 'startObfuscate' );
	return true;
}


However I then get a separate issue in that the obfuscated link doesn't actually work. The link is correctly obfuscated to:

<A HREF="&#109;&#97;&#105;&#108;...

But clicking on that link doesn't work as a mailto link. Possibly this is an issue more with the way the browser interprets the URI? (I'm using FireFox 3.0.5 if that makes a difference.) When clicked, the link tries to load a page in the local directory with the obfuscated text as its name. Unobfuscating even the "mailto:" still doesn't work, as although it is then correctly read as an e-mail link, the e-mail address remains obfuscated when passed to the e-mail client, which then tries to write a message to "&amp;#101;&amp;#45;&amp;#109;&amp;#97;...".

Stelio 17:54, 19 January 2009 (UTC)