aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/boot.php b/boot.php
index a9d93b5ae..9588d2c2a 100755
--- a/boot.php
+++ b/boot.php
@@ -1811,6 +1811,8 @@ function can_view_public_stream() {
* @param string $s Text to display
*/
function notice($s) {
+
+/*
if(! session_id())
return;
@@ -1826,6 +1828,34 @@ function notice($s) {
if(App::$interactive) {
$_SESSION['sysmsg'][] = $s;
}
+*/
+
+ $hash = get_observer_hash();
+
+ if (! $hash)
+ return;
+
+
+ $t = get_xconfig($hash, 'sse', 'timestamp');
+
+ if(datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) {
+ del_xconfig($hash, 'sse', 'notifications');
+ }
+
+ $x = get_xconfig($hash, 'sse', 'notifications');
+
+ if ($x === false)
+ $x = [];
+
+ if (isset($x['notice']) && in_array($s, $x['notice']['notifications']))
+ return;
+
+ if (App::$interactive) {
+ $x['notice']['notifications'][] = $s;
+ set_xconfig($hash, 'sse', 'timestamp', datetime_convert());
+ set_xconfig($hash, 'sse', 'notifications', $x);
+ }
+
}
/**
@@ -1839,8 +1869,11 @@ function notice($s) {
* @param string $s Text to display
*/
function info($s) {
+
+/*
if(! session_id())
return;
+
if(! x($_SESSION, 'sysmsg_info'))
$_SESSION['sysmsg_info'] = array();
@@ -1849,6 +1882,33 @@ function info($s) {
if(App::$interactive)
$_SESSION['sysmsg_info'][] = $s;
+*/
+
+ $hash = get_observer_hash();
+
+ if (! $hash)
+ return;
+
+ $t = get_xconfig($hash, 'sse', 'timestamp');
+
+ if(datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) {
+ del_xconfig($hash, 'sse', 'notifications');
+ }
+
+ $x = get_xconfig($hash, 'sse', 'notifications');
+
+ if($x === false)
+ $x = [];
+
+ if(isset($x['info']) && in_array($s, $x['info']['notifications']))
+ return;
+
+ if(App::$interactive) {
+ $x['info']['notifications'][] = $s;
+ set_xconfig($hash, 'sse', 'timestamp', datetime_convert());
+ set_xconfig($hash, 'sse', 'notifications', $x);
+ }
+
}
/**