Project

General

Profile

« Previous | Next » 

Revision 13701

web/username_prefix.php: user2path(): visually separated steps for easier readability

View differences:

username_prefix.php
7 7

  
8 8
function user2path($user) # multiple @ and nested . OK: a@b.c@url -> url?b.c.a
9 9
{
10
	$path = $user;
11
	
10 12
	# remove padding used to visually separate elements:__x__@y__@url -> x@y@url
11
	$user = preg_replace('/\b__|__\b/', '', $user);
13
	$path = preg_replace('/\b__|__\b/', '', $path);
14
	
12 15
	# translate reverse @-paths into forward .-paths
13
	return implode(".", array_reverse(explode("@", $user)));
16
	$path = implode(".", array_reverse(explode("@", $path)));
17
	
18
	return $path;
14 19
}
15 20

  
16 21
if (!isset($_SERVER["PHP_AUTH_USER"])) # browser first omits Authorization

Also available in: Unified diff