mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2026-06-02 06:04:44 -04:00
more fixes
This commit is contained in:
@@ -69,7 +69,7 @@ class Constellation
|
||||
* @param boolean $admin
|
||||
* @return array of services
|
||||
*/
|
||||
public function render_status($admin = false, $heading = true){
|
||||
public function render_status($admin = false, $heading = true): array{
|
||||
global $mysqli;
|
||||
|
||||
//$query = $mysqli->query("SELECT id, name, description FROM services");
|
||||
|
||||
@@ -223,7 +223,7 @@ class Incident implements JsonSerializable
|
||||
<?php
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize():mixed {
|
||||
return [
|
||||
"id" => $this->id,
|
||||
"date" => $this->timestamp,
|
||||
|
||||
@@ -150,7 +150,6 @@ class LocaleNegotiator
|
||||
'nl_BE' => 'Nederlands',
|
||||
'nl_NL' => 'Nederlands',
|
||||
'nn_NO' => 'Nynorsk',
|
||||
'nb_NO' => 'Norsk Bokmål',
|
||||
'nso_ZA' => 'Northern sotho',
|
||||
'oc_FR' => 'Occitan',
|
||||
'or_IN' => 'ଓଡ଼ିଆ',
|
||||
|
||||
@@ -130,7 +130,7 @@ class Notification
|
||||
* @param string $msg Body of message
|
||||
* @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 Error handling
|
||||
@@ -155,7 +155,7 @@ class Notification
|
||||
* @param String $uthkey Users token for managing subscription
|
||||
* @return void
|
||||
*/
|
||||
public function submit_queue_email($subscriber, $subject, $msg)
|
||||
public static function submit_queue_email($subscriber, $subject, $msg): bool
|
||||
{
|
||||
// TODO Error handling
|
||||
$mailer = new Mailer();
|
||||
|
||||
+3
-3
@@ -49,7 +49,7 @@ class Queue
|
||||
* Remove task from the queue
|
||||
* @return void
|
||||
*/
|
||||
public function delete_task($task_id){
|
||||
public static function delete_task($task_id){
|
||||
global $mysqli;
|
||||
$stmt = $mysqli->prepare("DELETE FROM queue_task WHERE 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
|
||||
}
|
||||
|
||||
public function update_notification_retries($task_id, $subscriber_id) {
|
||||
public static function update_notification_retries($task_id, $subscriber_id) {
|
||||
global $mysqli;
|
||||
$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->execute();
|
||||
}
|
||||
|
||||
public function delete_notification($task_id, $subscriber_id) {
|
||||
public static function delete_notification($task_id, $subscriber_id) {
|
||||
global $mysqli;
|
||||
$stmt = $mysqli->prepare("DELETE FROM queue_notify WHERE task_id = ? AND subscriber_id = ?");
|
||||
$stmt->bind_param("ii", $task_id, $subscriber_id);
|
||||
|
||||
@@ -8,6 +8,7 @@ class ServiceGroup
|
||||
private $name;
|
||||
private $description;
|
||||
private $visibility_id;
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* Constructs servicegroup from its data.
|
||||
@@ -16,7 +17,7 @@ class ServiceGroup
|
||||
* @param String $description tooltip text
|
||||
* @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?
|
||||
|
||||
+2
-2
@@ -180,7 +180,7 @@ class Service implements JsonSerializable
|
||||
* @param Service[] $array array of services
|
||||
* @return void
|
||||
*/
|
||||
public static function current_status($array){
|
||||
public static function current_status($array): void{
|
||||
global $all, $some, $classes;
|
||||
$statuses = array(0,0,0,0);
|
||||
$worst = 5;
|
||||
@@ -258,7 +258,7 @@ class Service implements JsonSerializable
|
||||
}
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): mixed {
|
||||
global $statuses;
|
||||
return [
|
||||
"id" => $this->id,
|
||||
|
||||
Reference in New Issue
Block a user