make zid() do the right things when confronted with url fragments
This commit is contained in:
		| @@ -1381,6 +1381,11 @@ function zid($s,$address = '') { | ||||
| 	if (! strlen($s) || strpos($s,'zid=')) | ||||
| 		return $s; | ||||
|  | ||||
| 	$m = parse_url($s); | ||||
| 	$fragment = ((array_key_exists('fragment',$m) && $m['fragment']) ? $m['fragment'] : false); | ||||
| 	if($fragment !== false) | ||||
| 		$s = str_replace('#' . $fragment,'',$s); | ||||
|  | ||||
| 	$has_params = ((strpos($s,'?')) ? true : false); | ||||
| 	$num_slashes = substr_count($s, '/'); | ||||
| 	if (! $has_params) | ||||
| @@ -1401,6 +1406,11 @@ function zid($s,$address = '') { | ||||
| 	else | ||||
| 		$zurl = $s; | ||||
|  | ||||
| 	// put fragment at the end | ||||
|  | ||||
| 	if($fragment) | ||||
| 		$zurl .= '#' . $fragment; | ||||
|  | ||||
| 	$arr = array('url' => $s, 'zid' => urlencode($myaddr), 'result' => $zurl); | ||||
| 	call_hooks('zid', $arr); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user