mirror of
https://codeberg.org/vlw/victorwesterlund.com.git
synced 2025-09-14 03:23:41 +02:00
Fixed scope issue
This commit is contained in:
parent
ca08e18965
commit
471dc0d8da
1 changed files with 11 additions and 10 deletions
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
$api = $_GET["api"];
|
$api = preg_replace("/[^a-z0-9]/i","-",$_GET["api"]); // Replace special chars
|
||||||
|
|
||||||
function response($online = false) {
|
// Return the API state
|
||||||
$isError = $online ? true : false;
|
function online($online = false) {
|
||||||
$message = $online ? "Online" : "Offline";
|
$isError = $online === true ? true : false;
|
||||||
$color = $online ? "green" : "lightgrey";
|
$message = $online === true ? "Online" : "Offline";
|
||||||
|
$color = $online === true ? "green" : "lightgrey";
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
"schemaVersion" => 1,
|
"schemaVersion" => 1,
|
||||||
|
@ -20,13 +21,13 @@
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStatus() {
|
function checkStatus($api) {
|
||||||
if(!is_dir($api)) {
|
if(!file_exists($api)) {
|
||||||
response(false);
|
online(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
response(true);
|
online(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatus();
|
checkStatus($api);
|
Loading…
Add table
Reference in a new issue