From bebd625800fd46a21890d6fae8e3375d42bfdb6a Mon Sep 17 00:00:00 2001 From: marcus <> Date: Mon, 1 May 2006 13:51:23 +0000 Subject: 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. --- framework/Web/THttpRequest.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'framework') 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)); } -- cgit v1.2.3