Enhance API error handling and response structure; update app name retrieval method
This commit is contained in:
1 parent
95f8e22f11
commit
eb67458ab1
9 files changed
+38
-9
No files matched your search
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// Set debug to true
|
||||
$debug = true;
|
||||
|
||||
// Load Main Library
|
||||
require "../main.php";
|
||||
|
||||
// Init Main Class
|
||||
$gb = new gb($debug);
|
||||
|
||||
// Load and init HTML Loader Library
|
||||
require FRONTEND_PATH . "html_loader.php";
|
||||
$htmlloader = new HTMLLoader();
|
||||
|
||||
// Check Login
|
||||
$call = new APICall("auth/isauth.php");
|
||||
$response = $call->response;
|
||||
|
||||
if (!isset($response["data"]["login"])) {
|
||||
$htmlloader->setPage("login");
|
||||
$htmlloader->show();
|
||||
}
|
||||
@@ -91,9 +91,9 @@ class HTMLLoader {
|
||||
$html = file_get_contents(TEMPLATE_PATH . $template_dir . "/" . $page["dir_name"] . "/" . $page["html_file"]);
|
||||
|
||||
if ($showAppName) {
|
||||
$app_name = file_get_contents("http://" . APP_DOMAIN . "/api/settings/appname.php");
|
||||
$app_name = json_decode($app_name, true);
|
||||
$app_name = $app_name["data"]["application_name"];
|
||||
$call = new APICall("settings/appname.php");
|
||||
$response = $call->response;
|
||||
$app_name = $response["data"]["application_name"];
|
||||
|
||||
$html = str_replace("%appname%", $app_name, $html);
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,4 +40,4 @@ if ($response["data"]["empty"]) {
|
||||
}
|
||||
}
|
||||
|
||||
$htmlLoader->show(["%entrys%" => $html_block]);
|
||||
$htmlLoader->show(["%entrys%" => $html_block]);
|
||||
Reference in new issue
Block a user