summaryrefslogtreecommitdiff
path: root/framework/Web/THttpRequest.php
diff options
context:
space:
mode:
authorxue <>2006-05-01 15:40:31 +0000
committerxue <>2006-05-01 15:40:31 +0000
commitc5983c0440913cd67f3744c7dda3c3bfc7eee0ed (patch)
treed20f9c309cb212d309231d8a990fff11b512e973 /framework/Web/THttpRequest.php
parentddfafaac2c1f18aca0fda3b4157acd935b9ac9a2 (diff)
Merge from 3.0 branch till 1004.
Diffstat (limited to 'framework/Web/THttpRequest.php')
-rw-r--r--framework/Web/THttpRequest.php34
1 files changed, 27 insertions, 7 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 5ec09fc9..71237fa1 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -161,10 +161,13 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
$paths=explode('/',$pathInfo);
$n=count($paths);
$getVariables=array();
- for($i=0;$i<$n;++$i)
+ for($i=0;$i<$n-1;++$i)
{
- if($i+1<$n)
- $getVariables[$paths[$i]]=$paths[++$i];
+ $name=$paths[$i];
+ if(($pos=strpos($name,'[]'))!==false)
+ $getVariables[substr($name,0,$pos)][]=$paths[++$i];
+ else
+ $getVariables[$name]=$paths[++$i];
}
$this->_items=array_merge($getVariables,array_merge($_GET,$_POST));
}
@@ -452,24 +455,41 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
if($encodeGetItems)
{
foreach($getItems as $name=>$value)
- $url.=$amp.urlencode($name).'='.urlencode($value);
+ {
+ if(is_array($value))
+ {
+ $name=urlencode($name.'[]');
+ foreach($value as $v)
+ $url.=$amp.$name.'='.$v;
+ }
+ else
+ $url.=$amp.urlencode($name).'='.urlencode($value);
+ }
}
else
{
foreach($getItems as $name=>$value)
- $url.=$amp.$name.'='.$value;
+ {
+ if(is_array($value))
+ {
+ foreach($value as $v)
+ $url.=$amp.$name.'[]='.$v;
+ }
+ else
+ $url.=$amp.$name.'='.$value;
+ }
}
}
if($this->getUrlFormat()==='Path')
{
$url=strtr($url,array($amp=>'/','?'=>'/','='=>'/'));
- if(defined('SID') && SID != '')
+ 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;
}
else
{
- if(defined('SID') && SID != '')
+ if(defined('SID') && SID != '' && !((int)ini_get('session.use_cookies')===1 && ((int)ini_get('session.use_only_cookies')===1)))
$url.=$amp.SID;
return $this->getApplicationUrl().'?'.$url;
}