mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2025-02-03 09:44:13 -05:00
send new incident to subscriber
This commit is contained in:
parent
781c938118
commit
d02ebc25ab
@ -159,8 +159,22 @@ class Incident implements JsonSerializable
|
|||||||
$stmt->bind_param("ii", $service, $status_id);
|
$stmt->bind_param("ii", $service, $status_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$query = $stmt->get_result();
|
$query = $stmt->get_result();
|
||||||
|
|
||||||
|
$query = $mysqli->query("SELECT * FROM services_subscriber WHERE serviceIDFK=" . $service);
|
||||||
|
while($subscriber = $query->fetch_assoc()){
|
||||||
|
$subscriberQuery = $mysqli->query("SELECT * FROM subscribers WHERE userID=" . $subscriber['userIDFK']);
|
||||||
|
while($subscriberData = $subscriberQuery->fetch_assoc()){
|
||||||
|
$telegramID = $subscriberData['telegramID'];
|
||||||
|
$firstname = $subscriberData['firstname'];
|
||||||
|
$lastname = $subscriberData['lastname'];
|
||||||
|
|
||||||
|
$tg_message = urlencode('Hi ' . $firstname . chr(10) . 'There is a status update on a service that you have subscribed. <a href="' . WEB_URL . '">View online</a>');
|
||||||
|
$response = json_decode(file_get_contents("https://api.telegram.org/bot" . TG_BOT_API_TOKEN . "/sendMessage?chat_id=" . $telegramID . "&parse_mode=HTML&text=" . $tg_message));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
header("Location: ".WEB_URL."/admin");
|
// header("Location: ".WEB_URL."/admin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user