Refactor API structure: update internal handling, enhance input retrieval, and improve template loading

This commit is contained in:
marc-go committed 2026-10-10 15:05:24 +02:00
1 parent a33de15f0c
commit 9cb50d7d28
13 files changed
+181 -95

No files matched your search

+8 -7
View File
@@ -12,7 +12,7 @@ class gb {
define("APP_DOMAIN", $_SERVER["SERVER_NAME"]);
define("APP_PATH", __DIR__ . "/../");
define("FRONTEND_PATH", __DIR__ . "/");
define("API_PATH", __DIR__ . "/../api/");
define("API_DIR", __DIR__ . "/../api/");
define("TEMPLATE_PATH", FRONTEND_PATH . "templates/");
define("TEMPLATE_CONF", TEMPLATE_PATH . "templates.json");
@@ -28,29 +28,30 @@ class gb {
$html = new HTMLLoader();
// Set template to Setup an show it
$html->setTemplate("setup");
$html->show();
$html->setTemplate("standard");
$html->setPage("setup");
$html->show([], false);
}
}
// Internal API Call Library
class APICall {
private $response;
public $response;
private $error;
function __construct($path, $data) {
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)) {
if (!is_file(API_DIR . $path)) {
$this->error("API Path invalid.");
return false;
}
// Call API
require API_PATH . $path;
require API_DIR . $path;
// Get return from the API Library
$response = $api->getAnswer();