mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2026-06-01 13:46:46 -04:00
files reformatted
for better readability
This commit is contained in:
+8
-10
@@ -1,19 +1,17 @@
|
||||
<?php
|
||||
|
||||
if (!file_exists("../config.php"))
|
||||
{
|
||||
header("Location: ../");
|
||||
}
|
||||
else{
|
||||
if (!file_exists("../config.php")) {
|
||||
header("Location: ../");
|
||||
} else {
|
||||
require_once("../config.php");
|
||||
require_once("../classes/constellation.php");
|
||||
|
||||
$limit = (isset($_GET['limit'])?$_GET['limit']:5);
|
||||
$offset = (isset($_GET['offset'])?$_GET['offset']:0);
|
||||
$timestamp = (isset($_GET['timestamp']))?$_GET['timestamp']:time();
|
||||
$limit = (isset($_GET['limit']) ? $_GET['limit'] : 5);
|
||||
$offset = (isset($_GET['offset']) ? $_GET['offset'] : 0);
|
||||
$timestamp = (isset($_GET['timestamp'])) ? $_GET['timestamp'] : time();
|
||||
|
||||
$result = $constellation->get_incidents((isset($_GET['future'])?$_GET['future']:false), $offset, $limit, $timestamp);
|
||||
$result = $constellation->get_incidents((isset($_GET['future']) ? $_GET['future'] : false), $offset, $limit, $timestamp);
|
||||
header('Cache-Control: no-cache');
|
||||
header('Content-type: application/json');
|
||||
echo json_encode($result);
|
||||
}
|
||||
}
|
||||
|
||||
+15
-21
@@ -1,42 +1,36 @@
|
||||
<?php
|
||||
|
||||
if (!file_exists("../config.php"))
|
||||
{
|
||||
if (!file_exists("../config.php")) {
|
||||
header("Location: ../");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
require_once("../config.php");
|
||||
require_once("../classes/constellation.php");
|
||||
header('Cache-Control: no-cache');
|
||||
header('Content-type: application/json');
|
||||
|
||||
if (!isset($_GET['id']))
|
||||
{
|
||||
$array = $constellation->render_status(true, false);
|
||||
echo json_encode($array);
|
||||
}else{
|
||||
$query = $mysqli->prepare("SELECT name FROM services WHERE id=?");
|
||||
$query->bind_param("i", $_GET['id']);
|
||||
$query->execute();
|
||||
if (!isset($_GET['id'])) {
|
||||
$array = $constellation->render_status(true, false);
|
||||
echo json_encode($array);
|
||||
} else {
|
||||
$query = $mysqli->prepare("SELECT name FROM services WHERE id=?");
|
||||
$query->bind_param("i", $_GET['id']);
|
||||
$query->execute();
|
||||
$result = $query->get_result()->fetch_assoc();
|
||||
if (!count($result))
|
||||
{
|
||||
die(json_encode(["error" => _("Service does not exist!")]));
|
||||
if (!count($result)) {
|
||||
die(json_encode(["error" => _("Service does not exist!")]));
|
||||
}
|
||||
|
||||
$sql = $mysqli->prepare("SELECT type FROM services_status INNER JOIN status ON services_status.status_id = status.id WHERE service_id = ? AND `time` <= ? AND (`end_time` >= ? OR `end_time`=0) ORDER BY `time` DESC LIMIT 1");
|
||||
$sql = $mysqli->prepare("SELECT type FROM services_status INNER JOIN status ON services_status.status_id = status.id WHERE service_id = ? AND `time` <= ? AND (`end_time` >= ? OR `end_time`=0) ORDER BY `time` DESC LIMIT 1");
|
||||
|
||||
$sql->bind_param("iii", $id, $timestamp, $timestamp);
|
||||
$sql->execute();
|
||||
$tmp = $sql->get_result();
|
||||
if ($tmp->num_rows)
|
||||
{
|
||||
if ($tmp->num_rows) {
|
||||
$service = new Service($_GET['id'], $result['name'], $tmp->fetch_assoc()['type']);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$service = new Service($_GET['id'], $result['name']);
|
||||
}
|
||||
|
||||
echo json_encode($service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user