diff options
author | Mario <mario@mariovavti.com> | 2019-11-15 20:29:58 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-11-15 20:29:58 +0000 |
commit | 965c51c2d45a98db10543c5108ac486e4fc6459e (patch) | |
tree | e0563eb6b283be784b21b8f605b62c84d9899dbc /boot.php | |
parent | 5a6b14f8787927ee6ea99c622d02875811d3a74a (diff) | |
download | volse-hubzilla-965c51c2d45a98db10543c5108ac486e4fc6459e.tar.gz volse-hubzilla-965c51c2d45a98db10543c5108ac486e4fc6459e.tar.bz2 volse-hubzilla-965c51c2d45a98db10543c5108ac486e4fc6459e.zip |
sse: implement notifications for anonymous visitors (info, notice and pubs) and fix a potential memory leak
Diffstat (limited to 'boot.php')
-rwxr-xr-x | boot.php | 29 |
1 files changed, 22 insertions, 7 deletions
@@ -1831,12 +1831,19 @@ function notice($s) { */ $hash = get_observer_hash(); + $sse_id = false; - if (! $hash) - return; - + if(! $hash) { + if(session_id()) { + $sse_id = true; + $hash = 'sse_id.' . session_id(); + } + else { + return; + } + } - $t = get_xconfig($hash, 'sse', 'timestamp'); + $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', []); @@ -1884,11 +1891,19 @@ function info($s) { */ $hash = get_observer_hash(); + $sse_id = false; - if (! $hash) - return; + if(! $hash) { + if(session_id()) { + $sse_id = true; + $hash = 'sse_id.' . session_id(); + } + else { + return; + } + } - $t = get_xconfig($hash, 'sse', 'timestamp'); + $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', []); |