From ab13651952c7ce3a5048e5b7d2f2d62d61a71de8 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 25 Nov 2006 20:42:54 +0000 Subject: constructUrl encodes ampersand by default now. --- HISTORY | 1 + UPGRADE | 2 ++ framework/Web/Services/TPageService.php | 4 ++-- framework/Web/THttpRequest.php | 2 +- framework/Web/THttpResponse.php | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index 64bd3e19..0b6bc7dd 100644 --- a/HISTORY +++ b/HISTORY @@ -6,6 +6,7 @@ ENH: Ticket#446 - Added TMetaTagCollection.getMetaTagByID method (Qiang) CHG: Ticket#437 - __autoload is replaced by spl_autoload_register (Qiang) CHG: Ticket#454 - Redundant PHP Version Check CHG: TRepeater does not render anymore for empty item template (Qiang) +CHG: THttpRequest.constructUrl() now encodes ampersand by default (Qiang) Version 3.0.5 October 23, 2006 ============================== diff --git a/UPGRADE b/UPGRADE index 3df993e7..44539b1f 100644 --- a/UPGRADE +++ b/UPGRADE @@ -16,6 +16,8 @@ for both A and B. Upgrading from v3.0.5 --------------------- - TRepeater does not render anymore for empty item template. +- constructUrl() now encodes ampersand by default. This should have minimal + impact on any existing PRADO applications, though. Upgrading from v3.0.4 --------------------- diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index 98e53156..5d9e74fb 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -462,11 +462,11 @@ class TPageService extends TService * Constructs a URL with specified page path and GET parameters. * @param string page path * @param array list of GET parameters, null if no GET parameters required - * @param boolean whether to encode the ampersand in URL, defaults to false. + * @param boolean whether to encode the ampersand in URL, defaults to true. * @param boolean whether to encode the GET parameters (their names and values), defaults to true. * @return string URL for the page and GET parameters */ - public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=false,$encodeGetItems=true) + public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true) { return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems); } diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index b9d8d1ea..bb7b4281 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -487,7 +487,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar * @return string URL * @see parseUrl */ - public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=false,$encodeGetItems=true) + public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true) { $url=$serviceID.'='.$serviceParam; $amp=$encodeAmpersand?'&':'&'; diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index 50932920..a7a949f0 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -285,7 +285,7 @@ class THttpResponse extends TModule implements ITextWriter $this->getApplication()->onEndRequest(); if($url[0]==='/') $url=$this->getRequest()->getBaseUrl().$url; - header('Location: '.$url); + header('Location: '.str_replace('&','&',$url)); exit(); } -- cgit v1.2.3