summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-05-01 15:32:11 +0000
committerxue <>2006-05-01 15:32:11 +0000
commit898d9d86fede3805340298e373d517e2a2314fc6 (patch)
tree7c30900af669fd68b23910daf894e09aced85390
parentbebd625800fd46a21890d6fae8e3375d42bfdb6a (diff)
Fixed an issue about appending SID in the constructed URL.3.0.0
-rw-r--r--framework/Web/THttpRequest.php46
1 files changed, 27 insertions, 19 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index bf0ede17..71237fa1 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -161,22 +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) {
- $varName = $paths[$i];
- $varVal = $paths[++$i];
- if (strpos($varName, '[]') == strlen($varName)-2) {
- $varName = substr($varName,0, strpos($varName, '[]'));
- if (isset($getVariables[$varName])) {
- $getVariables[$varName][] = $varVal;
- } else {
- $getVariables[$varName] = array($varVal);
- }
- } else {
- $getVariables[$varName]=$varVal;
- }
- }
+ $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));
}
@@ -464,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;
}