diff options
author | Vincent Peugnet <vincent-peugnet@riseup.net> | 2021-03-04 18:19:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 18:19:25 +0100 |
commit | ed5ec86adedf55feeff9b7f2c1bdc22f02ad7ca5 (patch) | |
tree | c9447406ed849fc01a9355c11eb9e6dc34929479 /app | |
parent | f30ec46d410f4c0bf986929e132f8a9efd4d0530 (diff) | |
parent | 696244c8caa95982e90875132d4aaf154a4b6c59 (diff) | |
download | wcms-ed5ec86adedf55feeff9b7f2c1bdc22f02ad7ca5.tar.gz wcms-ed5ec86adedf55feeff9b7f2c1bdc22f02ad7ca5.zip |
Merge pull request #134 from n-peugnet/fix-init-config
fix: init config script
Diffstat (limited to 'app')
-rw-r--r-- | app/class/Config.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/class/Config.php b/app/class/Config.php index 7b2b50c..bfe0f08 100644 --- a/app/class/Config.php +++ b/app/class/Config.php @@ -91,6 +91,10 @@ abstract class Config public static function tojson() { $arr = get_class_vars(get_class()); + // get_class_vars returns default values, we need to update each of them with the current one + foreach ($arr as $key => $value) { + $arr[$key] = self::$$key; + } $json = json_encode($arr, JSON_FORCE_OBJECT | JSON_PRETTY_PRINT); return $json; } @@ -106,7 +110,7 @@ abstract class Config */ public static function getdomain() { - self::$domain = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; + self::$domain = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST']; } /** @@ -114,7 +118,7 @@ abstract class Config */ public static function checkdomain() { - return (self::$domain === $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']); + return (self::$domain === (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST']); } /** |