Project

General

Profile

« Previous | Next » 

Revision 13695

web/username_prefix.php: user2path(): added support for padding used to visually separate 1st element of URL (x@url -> x@url)

View differences:

trunk/web/username_prefix.php
6 6
}
7 7

  
8 8
function user2path($user) # multiple @ and nested . OK: a@b.c@url -> url?b.c.a
9
{ return implode(".", array_reverse(explode("@", $user))); }
9
{
10
	# remove padding used to visually separate 1st element: _x_@url -> x@url
11
	$user = preg_replace('/^_*([^@]*?)_*(?=@|$)/', '$1', $user);
12
	# translate reverse @-paths into forward .-paths
13
	return implode(".", array_reverse(explode("@", $user)));
14
}
10 15

  
11 16
if (!isset($_SERVER["PHP_AUTH_USER"])) # browser first omits Authorization
12 17
{

Also available in: Unified diff