Finish API documentation and token auth (references #5)

This commit is contained in:
Bernd Bestel
2018-04-21 19:18:00 +02:00
parent 9bd6aac09c
commit 99b2a84667
40 changed files with 1617 additions and 128 deletions

View File

@@ -4,8 +4,16 @@ namespace Grocy\Helpers;
class UrlManager
{
public function __construct(string $basePath) {
$this->BasePath = $basePath;
public function __construct(string $basePath)
{
if ($basePath === '/')
{
$this->BasePath = $this->GetBaseUrl();
}
else
{
$this->BasePath = $basePath;
}
}
protected $BasePath;
@@ -14,4 +22,9 @@ class UrlManager
{
return rtrim($this->BasePath, '/') . $relativePath;
}
private function GetBaseUrl()
{
return (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
}
}