aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_url.inc.php
diff options
context:
space:
mode:
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