Skip to content
Snippets Groups Projects
Commit 776b36ec authored by Andreas Gohr's avatar Andreas Gohr
Browse files

fix for double encoding when using mailguard

darcs-hash:20051021223434-7ad00-b6364357c2cc0af50bfdd1490debbb198d3ee5a6.gz
parent 42905504
No related branches found
No related tags found
No related merge requests found
<?php
require_once DOKU_INC.'inc/common.php';
class common_obfuscate_test extends UnitTestCase {
function test_none(){
global $conf;
$conf['mailguard'] = 'none';
$this->assertEqual(obfuscate('jon-doe@example.com'), 'jon-doe@example.com');
}
function test_hex(){
global $conf;
$conf['mailguard'] = 'hex';
print obfuscate('andi@foobar.com');
$this->assertEqual(obfuscate('jon-doe@example.com'),
'&#x6a;&#x6f;&#x6e;&#x2d;&#x64;&#x6f;&#x65;&#x40;&#x65;&#x78;&#x61;&#x6d;&#x70;&#x6c;&#x65;&#x2e;&#x63;&#x6f;&#x6d;');
}
function test_visible(){
global $conf;
$conf['mailguard'] = 'visible';
$this->assertEqual(obfuscate('jon-doe@example.com'), 'jon [dash] doe [at] example [dot] com');
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :
......@@ -671,9 +671,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
//we just test for image here - we need to encode the title our self
$this->_getLinkTitle($name, $address, $isImage);
if ( !$isImage ) {
$link['class']='mail';
$link['class']='mail JSnocheck';
} else {
$link['class']='media';
$link['class']='media JSnocheck';
}
$address = $this->_xmlEntities($address);
......@@ -684,8 +684,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
}else{
$name = $this->_xmlEntities($name);
}
$link['url'] = 'mailto:'.rawurlencode($address);
if($conf['mailguard'] == 'visible') $address = rawurlencode($address);
$link['url'] = 'mailto:'.$address;
$link['name'] = $name;
$link['title'] = $title;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment