diff options
author | xue <> | 2006-07-21 15:05:29 +0000 |
---|---|---|
committer | xue <> | 2006-07-21 15:05:29 +0000 |
commit | c72a6d328f37bb6b5eaa5c7eeab6c06a1936255a (patch) | |
tree | 30b79813d668eb49606eaf2029859f8e827de585 /framework/Web | |
parent | 5f1dcbd50104b0d13d2d3e207cf0c2bbb5fd8cf5 (diff) |
Fixed #292.
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/THttpRequest.php | 41 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateControl.php | 1 |
2 files changed, 38 insertions, 4 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index b908db53..6cd11113 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -181,7 +181,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar $getVariables[$path]='';
}
}
- $this->_items=array_merge($getVariables,array_merge($_GET,$_POST));
+ $this->_items=array_merge($this->parseUrl(),$_POST);
}
else
$this->_items=array_merge($_GET,$_POST);
@@ -293,7 +293,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar {
return ($this->getIsSecureConnection() ? "https://" : "http://") . $_SERVER ['HTTP_HOST'];
}
-
+
/**
* @return string entry script URL (w/o host part)
*/
@@ -309,7 +309,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar {
return $this->getBaseUrl() . $this->getApplicationUrl();
}
-
+
/**
* @return string application entry script file path (processed w/ realpath())
*/
@@ -465,6 +465,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar /**
* Constructs a URL that is recognizable by Prado.
* You may override this method to provide your own way of URL formatting.
+ * If you do so, you may also need to override {@link parseUrl} so that the URL can be properly parsed.
* The URL is constructed as the following format:
* /entryscript.php?serviceID=serviceParameter&get1=value1&...
* @param string service ID
@@ -473,6 +474,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar * @param boolean whether to encode the ampersand in URL, defaults to false.
* @param boolean whether to encode the GET parameters (their names and values), defaults to true.
* @return string URL
+ * @see parseUrl
*/
public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=false,$encodeGetItems=true)
{
@@ -524,6 +526,39 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar }
/**
+ * Parses the request URL and returns an array of input parameters (including GET variables).
+ * @return array list of input parameters, indexed by parameter names
+ */
+ protected function parseUrl()
+ {
+ if($this->_pathInfo!=='')
+ {
+ $paths=explode('/',$this->_pathInfo);
+ $getVariables=$_GET;
+ foreach($paths as $path)
+ {
+ 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]='';
+ }
+ }
+ return $getVariables;
+ }
+ else
+ return $_GET;
+ }
+
+ /**
* Resolves the requested servie.
* This method implements a URL-based service resolution.
* A URL in the format of /index.php?sp=serviceID.serviceParameter
diff --git a/framework/Web/UI/TTemplateControl.php b/framework/Web/UI/TTemplateControl.php index 0595a9e5..c7364d4b 100644 --- a/framework/Web/UI/TTemplateControl.php +++ b/framework/Web/UI/TTemplateControl.php @@ -119,7 +119,6 @@ class TTemplateControl extends TCompositeControl {
Prado::trace("Loading template ".get_class($this),'System.Web.UI.TTemplateControl');
$template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this));
- self::$_template[get_class($this)]=$template;
return $template;
}
|