diff options
author | ctrlaltca <> | 2013-01-16 08:57:12 +0000 |
---|---|---|
committer | ctrlaltca <> | 2013-01-16 08:57:12 +0000 |
commit | 97395e66b2d930a21ea18498889ddd72e6d77ef2 (patch) | |
tree | b1032feaa7b2901db8742fd641bc349e2979fdf0 | |
parent | 33c1798a05c95d98d36842ab0a26b32f642788f5 (diff) |
Added a new UrlFormat for TUrlManager: HiddenPath; works like the 'Path' format, but hides the entryscript.php name
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/GettingStarted/NewFeatures.page | 1 | ||||
-rw-r--r-- | framework/Web/THttpRequest.php | 2 | ||||
-rw-r--r-- | framework/Web/TUrlManager.php | 30 |
4 files changed, 29 insertions, 5 deletions
@@ -20,6 +20,7 @@ BUG: Issue #431 - TReCaptcha does not work well with active controls (Gabor) BUG: Issue #432 - Double slash with URL Tags in www root (ctrlaltca) EHN: Permit to change the default cipher in TSecurityManager::setEncryption(); changed the default cipher from 3DES to AES256 (ctrlaltca) +EHN: Added a new UrlFormat for TUrlManager: HiddenPath; works like the 'Path' format, but hides the entryscript.php name (ctrlaltca) EHN: Use php's hash_hmac() when available in TSecurityManager, and permit the use of all algorithms supported by php (ctrlaltca) EHN: Use mbstring when available in TSecurityManager to better handle multibyte text (ctrlaltca) EHN: Updated TinyMCE to 3.5.6 (ctrlaltca) diff --git a/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page b/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page index fe171946..98adc925 100644 --- a/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page +++ b/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page @@ -9,6 +9,7 @@ This page summarizes the main new features that are introduced in each PRADO rel <h2 id="8001">Version 3.2.1</h2> <ul> <li>TSecurityManager has been enhanced to support all the ciphers available in php</a></li> +<li>Added a new UrlFormat for TUrlManager: HiddenPath; works like the 'Path' format, but hides the entryscript.php name</a></li> <li>Updated external packages</a></li> </ul> diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 13a8be56..8e58d304 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -1320,6 +1320,7 @@ class TUri extends TComponent * The following enumerable values are defined: * - Get: the URL format is like /path/to/index.php?name1=value1&name2=value2... * - Path: the URL format is like /path/to/index.php/name1,value1/name2,value2... + * - HiddenPath: the URL format is like /path/to/name1,value1/name2,value2... * * @author Qiang Xue <qiang.xue@gmail.com> * @version $Id$ @@ -1330,5 +1331,6 @@ class THttpRequestUrlFormat extends TEnumerable { const Get='Get'; const Path='Path'; + const HiddenPath='HiddenPath'; } diff --git a/framework/Web/TUrlManager.php b/framework/Web/TUrlManager.php index 0e6c78e3..75abdcf1 100644 --- a/framework/Web/TUrlManager.php +++ b/framework/Web/TUrlManager.php @@ -44,6 +44,18 @@ class TUrlManager extends TModule * If {@link THttpRequest::setUrlFormat THttpRequest.UrlFormat} is 'Path', * the following format is used instead: * /entryscript.php/serviceID/serviceParameter/get1,value1/get2,value2... + * If {@link THttpRequest::setUrlFormat THttpRequest.UrlFormat} is 'HiddenPath', + * then entryscript.php will be hidden and the following format is used instead: + * /serviceID/serviceParameter/get1,value1/get2,value2... + * In order to use the 'HiddenPath' format you need proper url rewrite configuration; + * here's an example for Apache's .htaccess: + * <cdde> + * Options +FollowSymLinks + * RewriteEngine On + * RewriteCond %{REQUEST_FILENAME} !-d + * RewriteCond %{REQUEST_FILENAME} !-f + * RewriteRule ^(.*)$ index.php/$1 [L] + * </code> * @param string service ID * @param string service parameter * @param array GET parameters, null if not provided @@ -87,10 +99,16 @@ class TUrlManager extends TModule } } } - if($request->getUrlFormat()===THttpRequestUrlFormat::Path) - return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); - else - return $request->getApplicationUrl().'?'.$url; + + switch($request->getUrlFormat()) + { + case THttpRequestUrlFormat::Path: + return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); + case THttpRequestUrlFormat::HiddenPath: + return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); + default: + return $request->getApplicationUrl().'?'.$url; + } } /** @@ -110,7 +128,9 @@ class TUrlManager extends TModule { $request=$this->getRequest(); $pathInfo=trim($request->getPathInfo(),'/'); - if($request->getUrlFormat()===THttpRequestUrlFormat::Path && $pathInfo!=='') + if(($request->getUrlFormat()===THttpRequestUrlFormat::Path || + $request->getUrlFormat()===THttpRequestUrlFormat::HiddenPath) && + $pathInfo!=='') { $separator=$request->getUrlParamSeparator(); $paths=explode('/',$pathInfo); |