summaryrefslogtreecommitdiff
path: root/src/web/core/core.php
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-10-20 16:49:11 -0400
committerFreya Murphy <freya@freyacat.org>2024-10-20 16:49:11 -0400
commitcec4fb7ede7fee7b5621c096f3d5a4863b7b484e (patch)
tree9f0af211e9b2f9035220d94d07cd8edf381f61c1 /src/web/core/core.php
parentupdate john (diff)
downloadwebsite-cec4fb7ede7fee7b5621c096f3d5a4863b7b484e.tar.gz
website-cec4fb7ede7fee7b5621c096f3d5a4863b7b484e.tar.bz2
website-cec4fb7ede7fee7b5621c096f3d5a4863b7b484e.zip
refactor config and add allowed_hosts
Diffstat (limited to 'src/web/core/core.php')
-rw-r--r--src/web/core/core.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/web/core/core.php b/src/web/core/core.php
index feaecdf..4c341c2 100644
--- a/src/web/core/core.php
+++ b/src/web/core/core.php
@@ -43,10 +43,16 @@ abstract class Core {
$host = $_SERVER['HTTP_HOST'];
- if (ENVIRONMENT == 'production')
- $host = lang('domain');
+ if (ENVIRONMENT == 'production') {
+ $default = CONFIG['domain'];
+ $allowed = CONFIG['allowed_hosts'];
+ if (!is_array($allowed))
+ $allowed = [$allowed];
+ if (!in_array($host, $allowed))
+ $host = $default;
+ }
- $base = lang('base_path');
+ $base = CONFIG['base_path'];
$url = "{$scheme}://{$host}{$base}{$path}";
if ($timestamp) {
$time = Core::asset_stamp($path);