summaryrefslogtreecommitdiff
blob: 0234b2b25645421e57e0081a7b2de8405de2917d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// Makes all URLs absolute
function url($url='') {
	global $S;
	if (strlen($url) == 0) {
		return $S['conf']['url'].($S['conf']['mod_rewrite']?'':'/index.php');
	} elseif (substr($url, 0, 7) == 'http://') {
		return $url;
	}
	if ($S['conf']['mod_rewrite']) {
		return $S['conf']['url'].'/'.$url;
	} else {
		if (strpos($url, '?')) {
			$q=substr($url, strpos($url, '?')+1);
			$url=substr($url, 0, strpos($url, '?'));
		}
		if (strlen($url)) {
			return $S['conf']['url'].'/index.php?req='.$url.(isset($q)?'&'.$q:'');
		} else {
			return $S['conf']['url'].'/index.php?'.$q;
		}
	}
}
?>