Refactor API structure: add internal handling, update templates, and remove deprecated files

This commit is contained in:
marc-go committed 2026-10-10 13:43:18 +02:00
1 parent 313ffec92c
commit a33de15f0c
16 files changed
+91 -29

No files matched your search

+27
View File
@@ -12,6 +12,7 @@ class gb {
define("APP_DOMAIN", $_SERVER["SERVER_NAME"]);
define("APP_PATH", __DIR__ . "/../");
define("FRONTEND_PATH", __DIR__ . "/");
define("API_PATH", __DIR__ . "/../api/");
define("TEMPLATE_PATH", FRONTEND_PATH . "templates/");
define("TEMPLATE_CONF", TEMPLATE_PATH . "templates.json");
@@ -30,4 +31,30 @@ class gb {
$html->setTemplate("setup");
$html->show();
}
}
// Internal API Call Library
class APICall {
private $response;
private $error;
function __construct($path, $data) {
// Set $internal to true so the api return does not go to the browser
$internal = true;
// Check Path
if (!is_file(API_PATH . $path)) {
$this->error("API Path invalid.");
return false;
}
// Call API
require API_PATH . $path;
// Get return from the API Library
$response = $api->getAnswer();
$this->response = $response;
}
}