aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_url.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2009-02-05 03:03:30 +0000
committerrvelices <rv-github@modusoptimus.com>2009-02-05 03:03:30 +0000
commite34c68cb891bf7382958056d4d3c9e56cf6f4a43 (patch)
treef9e92716b4729704b8a4e57c09eb182ab16f1436 /include/functions_url.inc.php
parente71d84ebfbb3659a08ff4034f0f35113d7243a6d (diff)
- 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/trunk@3126 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_url.inc.php33
1 files changed, 17 insertions, 16 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index 4b97039b7..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