summaryrefslogtreecommitdiff
path: root/src/frontend/util.php
blob: a758d113af355a4a86c927879777d74da0aabf96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
function url_join($base, $path) {
  $url = (new http\URL($base))
    ->mod(array ("path" => $path), http\Url::JOIN_PATH|http\URL::SANITIZE_PATH);
  return $url->toString();
}

// Get a url with a path relative to the
// current script's path.
function url_rel($path) {
  return url_join(
    $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
    $path);
}
?>