diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2007-01-24 11:13:06 +0100 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2007-01-24 11:13:06 +0100 |
commit | da9f31c579b1d16d9a1a27ff627fa4e68a70531f (patch) | |
tree | a6f24a27727725bc935294b529fdfa89787e73f4 | |
parent | 2ea4044fe6adc821853ef4f360c95a6f97df0558 (diff) | |
download | rpg-da9f31c579b1d16d9a1a27ff627fa4e68a70531f.tar.gz rpg-da9f31c579b1d16d9a1a27ff627fa4e68a70531f.tar.bz2 |
moved simple URL handling from renderer to handler
darcs-hash:20070124101306-6e07b-f3b325915c5b379c5ec8ae3bcf21943be1942e83.gz
-rw-r--r-- | inc/parser/handler.php | 23 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 4 |
2 files changed, 14 insertions, 13 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 20c01b1eb..18ec004d3 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -534,15 +534,20 @@ class Doku_Handler { } function externallink($match, $state, $pos) { - // Prevent use of multibyte strings in URLs - // See: http://www.boingboing.net/2005/02/06/shmoo_group_exploit_.html - // Not worried about other charsets so long as page is output as UTF-8 - /*if ( strlen($match) != utf8_strlen($match) ) { - $this->_addCall('cdata',array($match), $pos); - } else {*/ - - $this->_addCall('externallink',array($match, NULL), $pos); - //} + $url = $match; + $title = null; + + // add protocol on simple short URLs + if(substr($url,0,3) == 'ftp' && (substr($url,0,6) != 'ftp://')){ + $title = $url; + $url = 'ftp://'.$url; + } + if(substr($url,0,3) == 'www' && (substr($url,0,7) != 'http://')){ + $title = $url; + $url = 'http://'.$url; + } + + $this->_addCall('externallink',array($url, $title), $pos); return true; } diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 9a6ed7a91..97b99d824 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -541,10 +541,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $name = $this->_getLinkTitle($name, $url, $isImage); - // add protocol on simple short URLs - if(substr($url,0,3) == 'ftp' && (substr($url,0,6) != 'ftp://')) $url = 'ftp://'.$url; - if(substr($url,0,3) == 'www') $url = 'http://'.$url; - if ( !$isImage ) { $class='urlextern'; } else { |