Update file permissions and enhance error handling in API responses

This commit is contained in:
admin committed 2026-10-10 21:26:38 +02:00
1 parent eb67458ab1
commit ce0777bb33
8 files changed
+28 -6

No files matched your search

+14 -2
View File
@@ -220,10 +220,18 @@ class gbAPI {
if (!is_file($db_path)) {
$api->answer(500, [
"error" => "database_not_found",
"error_display" => "The Database was not found."
"error_text" => "The Database was not found."
], true);
}
if (!is_writeable($db_path)) {
$this->answer(500, [
"error" => "database_not_writeable",
"error_text" => "The Database is not writeable."
]);
return;
}
$db = new PDO("sqlite:" . $db_path);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
@@ -243,6 +251,10 @@ class gbAPI {
$value = $this->dbCommand($command, true, true, [":name" => $key]);
return $value[0]["value"];
if (isset($value[0]["value"])) {
return $value[0]["value"];
}else{
return;
}
}
}