diff --git a/src/includes/class.lang.php b/src/includes/class.lang.php index 879b791..cdb3ed5 100644 --- a/src/includes/class.lang.php +++ b/src/includes/class.lang.php @@ -54,6 +54,9 @@ class Lang { $this->code = $code; $json = json_decode($jsonString, true); + if ($json === null) { + $json = array(); + } //load default language if ( $code != $this->default ) { @@ -72,6 +75,9 @@ class Lang } $defStr = file_get_contents($this->langDir(). "{$this->default}.json"); $this->strings = json_decode($defStr, true); + if ($this->strings === null) { + die("Invalid JSON in default language file (". htmlspecialchars($this->default). ".json)"); + } } function get($key) diff --git a/src/settings.php b/src/settings.php index 9417200..8869239 100644 --- a/src/settings.php +++ b/src/settings.php @@ -153,6 +153,9 @@ function selectOptionsA($a, $key, $default=null) $s = ''; if($default !== null && !isset($a[$key])) $key = $default; foreach($a as $k=>$v) { + if (!is_array($v)) { + $v = array('name' => $k); + } $s .= '';