From 502ef5c173b2ca1220725d9814022102ea5dd749 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 23 Mar 2006 12:11:49 +0000 Subject: Added a new parameter to constructUrl() for encoding GET parameters. --- framework/Web/THttpRequest.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'framework/Web/THttpRequest.php') diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index d3a8480a..2fd02d1d 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -436,16 +436,25 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar * @param string service parameter * @param array GET parameters, null if not needed * @param boolean whether to encode the ampersand in URL, defaults to false. + * @param boolean whether to encode the GET parameters (their names and values), defaults to true. * @return string URL */ - public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=false) + public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=false,$encodeGetItems=true) { $url=$serviceID.'='.$serviceParam; $amp=$encodeAmpersand?'&':'&'; if(is_array($getItems) || $getItems instanceof Traversable) { - foreach($getItems as $name=>$value) - $url.=$amp.urlencode($name).'='.urlencode($value); + if($encodeGetItems) + { + foreach($getItems as $name=>$value) + $url.=$amp.urlencode($name).'='.urlencode($value); + } + else + { + foreach($getItems as $name=>$value) + $url.=$amp.$name.'='.$value; + } } if($this->getUrlFormat()==='Path') { -- cgit v1.2.3