diff options
Diffstat (limited to 'boot.php')
-rwxr-xr-x | boot.php | 75 |
1 files changed, 74 insertions, 1 deletions
@@ -50,7 +50,7 @@ require_once('include/attach.php'); require_once('include/bbcode.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '4.5' ); +define ( 'STD_VERSION', '4.7' ); define ( 'ZOT_REVISION', '6.0a' ); define ( 'DB_UPDATE_VERSION', 1234 ); @@ -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,40 @@ function notice($s) { if(App::$interactive) { $_SESSION['sysmsg'][] = $s; } +*/ + + $hash = get_observer_hash(); + $sse_id = false; + + if(! $hash) { + if(session_id()) { + $sse_id = true; + $hash = 'sse_id.' . session_id(); + } + else { + return; + } + } + + $t = get_xconfig($hash, 'sse', 'timestamp', NULL_DATE); + + if(datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) { + set_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', 'notifications', $x); + } + } /** @@ -1839,8 +1875,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 +1888,40 @@ function info($s) { if(App::$interactive) $_SESSION['sysmsg_info'][] = $s; +*/ + + $hash = get_observer_hash(); + $sse_id = false; + + if(! $hash) { + if(session_id()) { + $sse_id = true; + $hash = 'sse_id.' . session_id(); + } + else { + return; + } + } + + $t = get_xconfig($hash, 'sse', 'timestamp', NULL_DATE); + + if(datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) { + set_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', 'notifications', $x); + } + } /** |