Project

General

Profile

1
<?php
2
# parses any dotpath in the query string
3

    
4
require_once dirname(__FILE__)."/util.php";
5

    
6
@list($path, $query) = explode("&", $_SERVER["QUERY_STRING"], 2);
7

    
8
## translate dotpaths (after the last /) to /-paths, e.g. d/a.[b.c] -> d/a/b.c
9
# replace all unescaped . with / , e.g. a.[b.c] -> a/[b.c]
10
# remove any [] escape, e.g. a.b=[c.d] -> a/b=c.d (the ] must be at the end)
11
do
12
{
13
	$old_path = $path;
14
	$path = preg_replace('/^(.*\/)?(?=.)(\.?[^.\/]*?)(?:\[([^\[\]\/]*)\])?\.([^\/]*)$/',
15
		'$1$2$3/$4', $path);
16
} while ($path !== $old_path);
17

    
18
$url = ensure_suffix("/", $_SERVER["PATH_INFO"]).$path
19
	.(isset($query) ? "?&".$query : "");
20
header("Location: ".$url);
21
?>
(20-20/28)