aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_url.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2009-02-05 03:04:27 +0000
committerrvelices <rv-github@modusoptimus.com>2009-02-05 03:04:27 +0000
commitb019ad9b5556b96342aa4c271143219261432229 (patch)
tree7c917eca8d78af02fa915909efa8fec0039b7aee /include/functions_url.inc.php
parenta44e905d0ba68c995ebe066792b9b348c45599cc (diff)
merge r 3126 from trunk
- embellish_url compacts now .. - some trigger improvements (render_category_description) - improved perf of duplicate_xxx_url ( rewrote func params_for_duplication and remove some vars from $page ) git-svn-id: http://piwigo.org/svn/branches/2.0@3127 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_url.inc.php31
1 files changed, 16 insertions, 15 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index d06221edc..49e3fa429 100644
--- a/include/functions_url.inc.php
+++ b/include/functions_url.inc.php
@@ -38,7 +38,7 @@ function get_root_url()
{// TODO - add HERE the possibility to call PWG functions from external scripts
$root_url = PHPWG_ROOT_PATH;
}
- if ( dirname($root_url)!='.' )
+ if ( strncmp($root_url, './', 2) != 0 )
{
return $root_url;
}
@@ -170,21 +170,11 @@ function params_for_duplication($redefined, $removed)
{
global $page;
- if (count($removed) > 0)
- {
- $params = array();
+ $params = $page;
- foreach ($page as $page_item_key => $page_item_value)
- {
- if (!in_array($page_item_key, $removed))
- {
- $params[$page_item_key] = $page_item_value;
- }
- }
- }
- else
+ foreach ($removed as $param_key)
{
- $params = $page;
+ unset($params[$param_key]);
}
foreach ($redefined as $redefined_param => $redefined_value)
@@ -722,7 +712,18 @@ function unset_make_full_url()
*/
function embellish_url($url)
{
- return str_replace('/./', '/', $url);
+ $url = str_replace('/./', '/', $url);
+ while ( ($dotdot = strpos($url, '/../', 1) ) !== false )
+ {
+ $before = strrpos($url, '/', -(strlen($url)-$dotdot+1) );
+ if ($before !== false)
+ {
+ $url = substr_replace($url, '', $before, $dotdot-$before+3);
+ }
+ else
+ break;
+ }
+ return $url;
}
?> \ No newline at end of file