瀏覽代碼

Clarify if config.php not setup or db permission error

CauseFX 4 年之前
父節點
當前提交
1a5e2b6f14
共有 1 個文件被更改,包括 12 次插入6 次删除
  1. 12 6
      api/classes/organizr.class.php

+ 12 - 6
api/classes/organizr.class.php

@@ -578,9 +578,13 @@ class Organizr
 	private function checkWritableDB()
 	private function checkWritableDB()
 	{
 	{
 		if ($this->hasDB()) {
 		if ($this->hasDB()) {
-			$db = is_writable($this->config['dbLocation'] . $this->config['dbName']);
-			if (!$db) {
-				die($this->showHTML('Organizr DB is not writable!', 'Please check permissions and/or disk space'));
+			if (isset($this->config['dbLocation']) && isset($this->config['dbName'])) {
+				$db = is_writable($this->config['dbLocation'] . $this->config['dbName']);
+				if (!$db) {
+					die($this->showHTML('Organizr DB is not writable!', 'Please check permissions and/or disk space'));
+				}
+			} else {
+				die($this->showHTML('Config File Malformed', 'dbLocation and/or dbName is not listed in config.php'));
 			}
 			}
 		}
 		}
 	}
 	}
@@ -2853,7 +2857,7 @@ class Organizr
 	
 	
 	public function updateConfigMultiple($array)
 	public function updateConfigMultiple($array)
 	{
 	{
-		return ($this->updateConfig($array)) ? true : false;
+		return (bool)$this->updateConfig($array);
 	}
 	}
 	
 	
 	public function updateConfigItems($array)
 	public function updateConfigItems($array)
@@ -2883,10 +2887,11 @@ class Organizr
 			}
 			}
 			if (strtolower($k) !== 'formkey') {
 			if (strtolower($k) !== 'formkey') {
 				$newItem[$k] = $v;
 				$newItem[$k] = $v;
+				$this->config[$k] = $v;
 			}
 			}
 		}
 		}
 		$this->setAPIResponse('success', 'Config items updated', 200);
 		$this->setAPIResponse('success', 'Config items updated', 200);
-		return ($this->updateConfig($newItem)) ? true : false;
+		return (bool)$this->updateConfig($newItem);
 	}
 	}
 	
 	
 	public function updateConfigItem($array)
 	public function updateConfigItem($array)
@@ -2907,7 +2912,8 @@ class Organizr
 		$newItem = array(
 		$newItem = array(
 			$array['name'] => $array['value']
 			$array['name'] => $array['value']
 		);
 		);
-		return ($this->updateConfig($newItem)) ? true : false;
+		$this->config[$array['name']] = $array['value'];
+		return (bool)$this->updateConfig($newItem);
 	}
 	}
 	
 	
 	public function ignoreNewsId($id)
 	public function ignoreNewsId($id)