diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | app/class/Config.php | 8 | ||||
-rw-r--r-- | app/class/Modelrender.php | 2 |
3 files changed, 8 insertions, 4 deletions
@@ -145,7 +145,7 @@ vendor: composer.json composer.lock # Install JS dependencies. node_modules: package.json package-lock.json @echo Installing JS dependencies... - npm install --loglevel=error + npm install --loglevel=error --also=dev # Clean files generated by `make all`. .PHONY: clean 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']); } /** diff --git a/app/class/Modelrender.php b/app/class/Modelrender.php index 2e59da3..47c7d3c 100644 --- a/app/class/Modelrender.php +++ b/app/class/Modelrender.php @@ -359,7 +359,7 @@ class Modelrender extends Modelpage public function media(string $text): string { $regex = '%(src|href)="([\w\-]+(\/([\w\-])+)*\.[a-z0-9]{1,5})"%'; - $text = preg_replace($regex, '$1="' . Model::mediapath() . '$2" target="_blank" class="media"', $text); + $text = preg_replace($regex, '$1="' . Model::mediapath() . '$2" target="_blank"', $text); if (!is_string($text)) { //throw new Exception('Rendering error -> media module'); } |