summaryrefslogtreecommitdiff
path: root/framework/Web/THttpRequest.php
diff options
context:
space:
mode:
authormarcus <>2006-05-01 13:51:23 +0000
committermarcus <>2006-05-01 13:51:23 +0000
commitbebd625800fd46a21890d6fae8e3375d42bfdb6a (patch)
tree38c4720ff4d49f330a6321b7a45c7fe5e42d8039 /framework/Web/THttpRequest.php
parent884af5e651e9157dfc406fd476a51d46279a8721 (diff)
changelog (marcus):
Added support for array values to be passed through the uri when using the 'path' UriFormat. This allows a uri to be constructed with a format of domain.com/page/Home/var[]/1/var[]/3 if needed. A call to $this->Request->itemAt('var') in this case would return an array of array('1','3');. At the moment, only single dimension arrays are supported.
Diffstat (limited to 'framework/Web/THttpRequest.php')
-rw-r--r--framework/Web/THttpRequest.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 5ec09fc9..bf0ede17 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -163,8 +163,20 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
$getVariables=array();
for($i=0;$i<$n;++$i)
{
- if($i+1<$n)
- $getVariables[$paths[$i]]=$paths[++$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;
+ }
+ }
}
$this->_items=array_merge($getVariables,array_merge($_GET,$_POST));
}