From b6c6979fa2bc2a54befe6a451579ce8ff5515445 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Sat, 21 Jan 2006 20:27:47 +0100 Subject: [PATCH] urlencode -> rawurlencode (related to #685) This changes nearly all occurences of urlencode to rawurlencode. The latter encodes spaces as %20 while the former uses a + sign. For the use in browser URLs %20 is the correct form. darcs-hash:20060121192747-7ad00-6563b77368a41f071609495c6a145982938a8301.gz --- inc/common.php | 8 ++++---- inc/parser/xhtml.php | 8 ++++---- inc/template.php | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/inc/common.php b/inc/common.php index 8ad55efff..c943ffa3c 100644 --- a/inc/common.php +++ b/inc/common.php @@ -101,7 +101,7 @@ function buildURLparams($params){ if($amp) $url .= '&'; $url .= $key.'='; - $url .= urlencode($val); + $url .= rawurlencode($val); $amp = true; } return $url; @@ -232,7 +232,7 @@ function idfilter($id,$ue=true){ $id = strtr($id,':',';'); } if($ue){ - $id = urlencode($id); + $id = rawurlencode($id); $id = str_replace('%3A',':',$id); //keep as colon $id = str_replace('%2F','/',$id); //keep as slash } @@ -296,9 +296,9 @@ function ml($id='',$more='',$direct=true){ $xlink .= 'lib/exe/fetch.php'; if($more){ $xlink .= '?'.$more; - $xlink .= '&media='.urlencode($id); + $xlink .= '&media='.rawurlencode($id); }else{ - $xlink .= '?media='.urlencode($id); + $xlink .= '?media='.rawurlencode($id); } return $xlink; } diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index d03939542..9fd31f3b2 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -510,7 +510,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //add search string if($search){ ($conf['userewrite']) ? $link['url'].='?s=' : $link['url'].='&s='; - $link['url'] .= urlencode($search); + $link['url'] .= rawurlencode($search); } //keep hash @@ -594,7 +594,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //replace placeholder if(preg_match('#\{(URL|NAME|SCHEME|HOST|PORT|PATH|QUERY)\}#',$url)){ //use placeholders - $url = str_replace('{URL}',urlencode($wikiUri),$url); + $url = str_replace('{URL}',rawurlencode($wikiUri),$url); $url = str_replace('{NAME}',$wikiUri,$url); $parsed = parse_url($wikiUri); if(!$parsed['port']) $parsed['port'] = 80; @@ -606,9 +606,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['url'] = $url; }else{ //default - $link['url'] = $url.urlencode($wikiUri); + $link['url'] = $url.rawurlencode($wikiUri); } - if($hash) $link['url'] .= '#'.urlencode($hash); + if($hash) $link['url'] .= '#'.rawurlencode($hash); $link['title'] = htmlspecialchars($link['url']); diff --git a/inc/template.php b/inc/template.php index 315373e21..7fc824bd5 100644 --- a/inc/template.php +++ b/inc/template.php @@ -688,7 +688,7 @@ function tpl_mediafilelist(){ $ask = $lang['del_confirm'].'\\n'; $ask .= $item['id']; - $del = '<a href="'.DOKU_BASE.'lib/exe/media.php?delete='.urlencode($item['id']).'" '. + $del = '<a href="'.DOKU_BASE.'lib/exe/media.php?delete='.rawurlencode($item['id']).'" '. 'onclick="return confirm(\''.$ask.'\')" onkeypress="return confirm(\''.$ask.'\')">'. '<img src="'.DOKU_BASE.'lib/images/del.png" alt="'.$lang['btn_delete'].'" '. 'title="'.$lang['btn_delete'].'" /></a>'; @@ -739,7 +739,7 @@ function tpl_mediafilelist(){ //add edit button if($AUTH >= AUTH_UPLOAD && $item['meta']->getField('File.Mime') == 'image/jpeg'){ - print '<a href="'.DOKU_BASE.'lib/exe/media.php?edit='.urlencode($item['id']).'">'; + print '<a href="'.DOKU_BASE.'lib/exe/media.php?edit='.rawurlencode($item['id']).'">'; print '<img src="'.DOKU_BASE.'lib/images/edit.gif" alt="'.$lang['metaedit'].'" title="'.$lang['metaedit'].'" />'; print '</a>'; } @@ -927,7 +927,7 @@ function tpl_indexerWebBug(){ if(isHiddenPage($ID)) return; //no need to index hidden pages $p = array(); - $p['src'] = DOKU_BASE.'lib/exe/indexer.php?id='.urlencode($ID). + $p['src'] = DOKU_BASE.'lib/exe/indexer.php?id='.rawurlencode($ID). '&'.time(); $p['width'] = 1; $p['height'] = 1; -- GitLab