aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-15 20:29:58 +0000
committerMario <mario@mariovavti.com>2019-11-15 20:29:58 +0000
commit965c51c2d45a98db10543c5108ac486e4fc6459e (patch)
treee0563eb6b283be784b21b8f605b62c84d9899dbc /boot.php
parent5a6b14f8787927ee6ea99c622d02875811d3a74a (diff)
downloadvolse-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-xboot.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/boot.php b/boot.php
index b0b838231..b4e472d47 100755
--- a/boot.php
+++ b/boot.php
@@ -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', []);