Project

General

Profile

« Previous | Next » 

Revision 13625

web/username_prefix.php: use if statements instead of `? :` for clarity

View differences:

trunk/web/username_prefix.php
8 8
}
9 9
else
10 10
{
11
	$subpath = user2path($_SERVER["PHP_AUTH_USER"]);
12
	header("Location: ".($subpath !== ""
13
			? ($_SERVER["QUERY_STRING"] !== ""
14
				? /*prepend to query string*/$_SERVER["SCRIPT_URL"]
15
					."?.".$subpath.ltrim($_SERVER["QUERY_STRING"], "@")
16
				: $_SERVER["REQUEST_URI"]/*ends in ? */.$subpath
17
			)
18
			: rtrim($_SERVER["REQUEST_URI"], "?") #user empty->just display page
19
		));
11
	$dest = "";
12
	if ($_SERVER["PHP_AUTH_USER"] !== "")
13
	{
14
		$subpath = "."/*force dotpath*/.user2path($_SERVER["PHP_AUTH_USER"]);
15
		if ($_SERVER["QUERY_STRING"] !== "") # prepend to query string
16
			$dest = $_SERVER["SCRIPT_URL"]."?".$subpath
17
			.ltrim($_SERVER["QUERY_STRING"], "@");
18
		else $dest = $_SERVER["REQUEST_URI"]/*ends in ? */.$subpath;
19
	}
20
	else $dest = rtrim($_SERVER["REQUEST_URI"], "?"); # user empty->display page
21
	
22
	header("Location: ".$dest);
20 23
}
21 24
?>

Also available in: Unified diff