2024-01-13 05:54:42 +05:30
|
|
|
<?php
|
|
|
|
// Notifications
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-20 02:32:51 +05:30
|
|
|
// Notices queue
|
|
|
|
$NTFY_NoticesQueue = array();
|
2024-01-13 05:54:42 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add new notice with selected type
|
|
|
|
function NTFY_AddNotice (string $text, string $type = "fail") {
|
2024-01-20 02:32:51 +05:30
|
|
|
global $NTFY_NoticesQueue;
|
2024-01-13 05:54:42 +05:30
|
|
|
switch ($type) {
|
|
|
|
case "fail":
|
2024-01-20 02:32:51 +05:30
|
|
|
$NTFY_NoticesQueue[] = "<div class=\"notification_fail\"><p>$text</p></div>";
|
2024-01-13 05:54:42 +05:30
|
|
|
break;
|
2024-03-07 22:28:39 +05:30
|
|
|
case "warning":
|
|
|
|
$NTFY_NoticesQueue[] = "<div class=\"notification_warning\"><p>$text</p></div>";
|
|
|
|
break;
|
2024-01-15 07:28:29 +05:30
|
|
|
case "success":
|
2024-01-20 02:32:51 +05:30
|
|
|
$NTFY_NoticesQueue[] = "<div class=\"notification_success\"><p>$text</p></div>";
|
2024-01-15 07:28:29 +05:30
|
|
|
break;
|
2024-01-13 05:54:42 +05:30
|
|
|
default:
|
|
|
|
die("invalid notification type: $type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Echo all notifications
|
|
|
|
function NTFY_EchoAllNotices () {
|
2024-01-20 02:32:51 +05:30
|
|
|
global $NTFY_NoticesQueue;
|
|
|
|
foreach ($NTFY_NoticesQueue as $notice) {
|
2024-01-13 05:54:42 +05:30
|
|
|
echo "$notice\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|