summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY4
-rw-r--r--UPGRADE7
-rw-r--r--framework/Web/THttpRequest.php46
3 files changed, 35 insertions, 22 deletions
diff --git a/HISTORY b/HISTORY
index 6b704ee7..06875881 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,11 +1,11 @@
Version 3.0.1 June 1, 2006
==========================
ENH: Ticket#150 - TDataGrid and TDataList now render table section tags (Qiang)
-ENH: Ticket#151 - added sanity check GET parameters in constructUrl() (Qiang)
ENH: Ticket#152 - constituent parts of TWizard are exposed (Qiang)
+ENH: added sanity check to calling event handlers (Qiang)
CHG: Ticket#153 - TAssetManager now ignores .svn directories (Qiang)
CHG: Ticket#154 - HTML comments are now parsed as regular template strings (Qiang)
-ENH: added sanity check to calling event handlers (Qiang)
+CHG: Ticket#151 - URL format is modified to handle empty GET values (Qiang)
NEW: TTableHeaderRow, TTableFooterRow and table section support (Qiang)
Version 3.0.0 May 1, 2006
diff --git a/UPGRADE b/UPGRADE
index 8b89eb57..478da933 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -16,6 +16,13 @@ for both A and B.
Upgrading from v3.0.0
---------------------
+- URL format is modified when THttpRequest.UrlFormat=='Path'.
+ This modification affects both the URLs generated by calling constructUrl()
+ and the URLs understood by PRADO. In particular, PRADO now understands
+ the following URL format:
+ /index.php/ServiceID,ServiceParam/Name1,Value1/Name2,Value2/...
+ In v3.0.0, the above URL is written as:
+ /index.php/ServiceID/ServiceParam/Name1/Value1/Name2/Value2/...
Upgrading from v3.0.0 RC2
-------------------------
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 9b06076e..4e04ecca 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -60,6 +60,11 @@
class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,IModule
{
/**
+ * Separator used to separate GET variable name and value when URL format is Path.
+ */
+ const URL_PARAM_SEPARATOR=',';
+
+ /**
* @var boolean whether the module is initialized
*/
private $_initialized=false;
@@ -159,15 +164,22 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
if($this->getUrlFormat()==='Path' && ($pathInfo=trim($this->_pathInfo,'/'))!=='')
{
$paths=explode('/',$pathInfo);
- $n=count($paths);
- $getVariables=array();
- for($i=0;$i<$n-1;++$i)
+ foreach($paths as $path)
{
- $name=$paths[$i];
- if(($pos=strpos($name,'[]'))!==false)
- $getVariables[substr($name,0,$pos)][]=$paths[++$i];
- else
- $getVariables[$name]=$paths[++$i];
+ if(($path=trim($path))!=='')
+ {
+ if(($pos=strpos($path,','))!==false)
+ {
+ $name=substr($path,0,$pos);
+ $value=substr($path,$pos+1);
+ if(($pos=strpos($name,'[]'))!==false)
+ $getVariables[substr($name,0,$pos)][]=$value;
+ else
+ $getVariables[$name]=$value;
+ }
+ else
+ $getVariables[$path]='';
+ }
}
$this->_items=array_merge($getVariables,array_merge($_GET,$_POST));
}
@@ -224,7 +236,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
/**
* Sets the format of URLs constructed and interpretted by the request module.
* A 'Get' URL format is like index.php?name1=value1&name2=value2
- * while a 'Path' URL format is like index.php/name1/value1/name2/value.
+ * while a 'Path' URL format is like index.php/name1,value1/name2,value.
* Changing the UrlFormat will affect {@link constructUrl} and how GET variables
* are parsed.
* @param string the format of URLs. Valid values include 'Path' and 'Get'.
@@ -460,12 +472,9 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
{
$name=urlencode($name.'[]');
foreach($value as $v)
- {
- if(($v=trim($v))!=='')
- $url.=$amp.$name.'='.$v;
- }
+ $url.=$amp.$name.'='.$v;
}
- else if(($value=trim($value))!=='')
+ else
$url.=$amp.urlencode($name).'='.urlencode($value);
}
}
@@ -476,19 +485,16 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
if(is_array($value))
{
foreach($value as $v)
- {
- if(($v=trim($v))!=='')
- $url.=$amp.$name.'[]='.$v;
- }
+ $url.=$amp.$name.'[]='.$v;
}
- else if(($value=trim($value))!=='')
+ else
$url.=$amp.$name.'='.$value;
}
}
}
if($this->getUrlFormat()==='Path')
{
- $url=strtr($url,array($amp=>'/','?'=>'/','='=>'/'));
+ $url=strtr($url,array($amp=>'/','?'=>'/','='=>self::URL_PARAM_SEPARATOR));
if(defined('SID') && SID != '' && !((int)ini_get('session.use_cookies')===1 && ((int)ini_get('session.use_only_cookies')===1)))
$url.='?'.SID;
return $this->getApplicationUrl().'/'.$url;