mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2024-11-23 12:48:39 -05:00
more fixes
This commit is contained in:
parent
8731add072
commit
9d5ab1f0d2
@ -69,7 +69,7 @@ class Constellation
|
|||||||
* @param boolean $admin
|
* @param boolean $admin
|
||||||
* @return array of services
|
* @return array of services
|
||||||
*/
|
*/
|
||||||
public function render_status($admin = false, $heading = true){
|
public function render_status($admin = false, $heading = true): array{
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
|
|
||||||
//$query = $mysqli->query("SELECT id, name, description FROM services");
|
//$query = $mysqli->query("SELECT id, name, description FROM services");
|
||||||
|
@ -223,7 +223,7 @@ class Incident implements JsonSerializable
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize() {
|
public function jsonSerialize():mixed {
|
||||||
return [
|
return [
|
||||||
"id" => $this->id,
|
"id" => $this->id,
|
||||||
"date" => $this->timestamp,
|
"date" => $this->timestamp,
|
||||||
|
@ -150,7 +150,6 @@ class LocaleNegotiator
|
|||||||
'nl_BE' => 'Nederlands',
|
'nl_BE' => 'Nederlands',
|
||||||
'nl_NL' => 'Nederlands',
|
'nl_NL' => 'Nederlands',
|
||||||
'nn_NO' => 'Nynorsk',
|
'nn_NO' => 'Nynorsk',
|
||||||
'nb_NO' => 'Norsk Bokmål',
|
|
||||||
'nso_ZA' => 'Northern sotho',
|
'nso_ZA' => 'Northern sotho',
|
||||||
'oc_FR' => 'Occitan',
|
'oc_FR' => 'Occitan',
|
||||||
'or_IN' => 'ଓଡ଼ିଆ',
|
'or_IN' => 'ଓଡ଼ିଆ',
|
||||||
|
@ -130,7 +130,7 @@ class Notification
|
|||||||
* @param string $msg Body of message
|
* @param string $msg Body of message
|
||||||
* @return boolean true = Sent / False = failed
|
* @return boolean true = Sent / False = failed
|
||||||
*/
|
*/
|
||||||
public function submit_queue_telegram($userID, $firstname, $msg)
|
public static function submit_queue_telegram($userID, $firstname, $msg)
|
||||||
{
|
{
|
||||||
// TODO Handle limitations (Max 30 different subscribers per second)
|
// TODO Handle limitations (Max 30 different subscribers per second)
|
||||||
// TODO Error handling
|
// TODO Error handling
|
||||||
@ -155,7 +155,7 @@ class Notification
|
|||||||
* @param String $uthkey Users token for managing subscription
|
* @param String $uthkey Users token for managing subscription
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function submit_queue_email($subscriber, $subject, $msg)
|
public static function submit_queue_email($subscriber, $subject, $msg): bool
|
||||||
{
|
{
|
||||||
// TODO Error handling
|
// TODO Error handling
|
||||||
$mailer = new Mailer();
|
$mailer = new Mailer();
|
||||||
|
@ -49,7 +49,7 @@ class Queue
|
|||||||
* Remove task from the queue
|
* Remove task from the queue
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete_task($task_id){
|
public static function delete_task($task_id){
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
$stmt = $mysqli->prepare("DELETE FROM queue_task WHERE id = ?");
|
$stmt = $mysqli->prepare("DELETE FROM queue_task WHERE id = ?");
|
||||||
$stmt->bind_param("i", $task_id);
|
$stmt->bind_param("i", $task_id);
|
||||||
@ -98,14 +98,14 @@ class Queue
|
|||||||
$this->set_task_status($this->all_status['ready']); // Make task available for release
|
$this->set_task_status($this->all_status['ready']); // Make task available for release
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_notification_retries($task_id, $subscriber_id) {
|
public static function update_notification_retries($task_id, $subscriber_id) {
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
$stmt = $mysqli->prepare("UPDATE queue_notify SET retries = retries+1 WHERE task_id = ? AND subscriber_id = ?");
|
$stmt = $mysqli->prepare("UPDATE queue_notify SET retries = retries+1 WHERE task_id = ? AND subscriber_id = ?");
|
||||||
$stmt->bind_param("ii", $task_id, $subscriber_id);
|
$stmt->bind_param("ii", $task_id, $subscriber_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete_notification($task_id, $subscriber_id) {
|
public static function delete_notification($task_id, $subscriber_id) {
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
$stmt = $mysqli->prepare("DELETE FROM queue_notify WHERE task_id = ? AND subscriber_id = ?");
|
$stmt = $mysqli->prepare("DELETE FROM queue_notify WHERE task_id = ? AND subscriber_id = ?");
|
||||||
$stmt->bind_param("ii", $task_id, $subscriber_id);
|
$stmt->bind_param("ii", $task_id, $subscriber_id);
|
||||||
|
@ -8,6 +8,7 @@ class ServiceGroup
|
|||||||
private $name;
|
private $name;
|
||||||
private $description;
|
private $description;
|
||||||
private $visibility_id;
|
private $visibility_id;
|
||||||
|
private $status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs servicegroup from its data.
|
* Constructs servicegroup from its data.
|
||||||
@ -16,7 +17,7 @@ class ServiceGroup
|
|||||||
* @param String $description tooltip text
|
* @param String $description tooltip text
|
||||||
* @param int $visibility_id how to display group items
|
* @param int $visibility_id how to display group items
|
||||||
*/
|
*/
|
||||||
function __construct($id, $name, $description, $visibility_id)
|
function __construct($id, $name, $description, $visibility_id, $status)
|
||||||
|
|
||||||
{
|
{
|
||||||
//TODO: Maybe get data from ID?
|
//TODO: Maybe get data from ID?
|
||||||
|
@ -180,7 +180,7 @@ class Service implements JsonSerializable
|
|||||||
* @param Service[] $array array of services
|
* @param Service[] $array array of services
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function current_status($array){
|
public static function current_status($array): void{
|
||||||
global $all, $some, $classes;
|
global $all, $some, $classes;
|
||||||
$statuses = array(0,0,0,0);
|
$statuses = array(0,0,0,0);
|
||||||
$worst = 5;
|
$worst = 5;
|
||||||
@ -258,7 +258,7 @@ class Service implements JsonSerializable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize() {
|
public function jsonSerialize(): mixed {
|
||||||
global $statuses;
|
global $statuses;
|
||||||
return [
|
return [
|
||||||
"id" => $this->id,
|
"id" => $this->id,
|
||||||
|
@ -100,7 +100,7 @@ Template::render_header("Status");
|
|||||||
<?php $constellation->render_status();?>
|
<?php $constellation->render_status();?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($mysqli->query("SELECT count(*) FROM status")->num_rows)
|
<?php if ($mysqli->query("SELECT count(*) FROM status"))
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div id="timeline">
|
<div id="timeline">
|
||||||
|
15
template.php
15
template.php
@ -59,7 +59,7 @@ class Template{
|
|||||||
<?php
|
<?php
|
||||||
if(defined('admin') && !admin){
|
if(defined('admin') && !admin){
|
||||||
$headfile = fopen("head.txt", "r") or die("Unable to open head.txt!");
|
$headfile = fopen("head.txt", "r") or die("Unable to open head.txt!");
|
||||||
$head_additionalcode = fread($versionfile,filesize("head.txt"));
|
$head_additionalcode = fread($versionfile ?? "Version2Beta8",filesize("head.txt"));
|
||||||
fclose($headfile);
|
fclose($headfile);
|
||||||
echo $head_additionalcode;
|
echo $head_additionalcode;
|
||||||
}
|
}
|
||||||
@ -72,6 +72,7 @@ class Template{
|
|||||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/bootstrap.min.css">
|
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/main.css" media="screen">
|
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/main.css" media="screen">
|
||||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/print.css" media="print">
|
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/print.css" media="print">
|
||||||
|
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/custom.css" media="screen">
|
||||||
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_URL;?>/favicon/apple-icon-57x57.png">
|
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_URL;?>/favicon/apple-icon-57x57.png">
|
||||||
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_URL;?>/favicon/apple-icon-60x60.png">
|
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_URL;?>/favicon/apple-icon-60x60.png">
|
||||||
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_URL;?>/favicon/apple-icon-72x72.png">
|
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_URL;?>/favicon/apple-icon-72x72.png">
|
||||||
@ -90,6 +91,17 @@ class Template{
|
|||||||
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
|
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet">
|
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
.navbar, #footerwrap {
|
||||||
|
display: none!important;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin-top: 5px!important;
|
||||||
|
}
|
||||||
|
.text-center h2 {
|
||||||
|
display:none!important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="navbar navbar-default" role="navigation">
|
<div class="navbar navbar-default" role="navigation">
|
||||||
@ -238,6 +250,7 @@ class Template{
|
|||||||
<?php }?>
|
<?php }?>
|
||||||
<script src="<?php echo WEB_URL;?>/js/vendor/bootstrap.min.js"></script>
|
<script src="<?php echo WEB_URL;?>/js/vendor/bootstrap.min.js"></script>
|
||||||
<script src="<?php echo WEB_URL;?>/js/main.js"></script>
|
<script src="<?php echo WEB_URL;?>/js/main.js"></script>
|
||||||
|
<script src="<?php echo WEB_URL;?>/js/custom.js"></script>
|
||||||
<?php if ( defined('GOOGLE_RECAPTCHA') ) { ?><script src='https://www.google.com/recaptcha/api.js'></script><?php }?>
|
<?php if ( defined('GOOGLE_RECAPTCHA') ) { ?><script src='https://www.google.com/recaptcha/api.js'></script><?php }?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user