aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-07-20 13:08:52 +0000
committerMario <mario@mariovavti.com>2024-07-20 13:08:52 +0000
commit3fca63a15f50743952ce87672974145a0c2b4abb (patch)
treea2830e990b59d976e8aa602ee6e0b56490dc8b50 /boot.php
parentc47900f36684c0d7e470240a6d7c1f26cefb4e81 (diff)
downloadvolse-hubzilla-3fca63a15f50743952ce87672974145a0c2b4abb.tar.gz
volse-hubzilla-3fca63a15f50743952ce87672974145a0c2b4abb.tar.bz2
volse-hubzilla-3fca63a15f50743952ce87672974145a0c2b4abb.zip
Revert "Revert "more work on sse sys messages""
This reverts commit c22f633ae0d42b5a0076a11dd08952817a613342
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php94
1 files changed, 14 insertions, 80 deletions
diff --git a/boot.php b/boot.php
index 78ad668ca..2b9e8ccba 100644
--- a/boot.php
+++ b/boot.php
@@ -1897,57 +1897,22 @@ function can_view_public_stream() {
*/
function notice($s) {
- /*
- if(! session_id())
- return;
-
- if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array();
-
- // ignore duplicated error messages which haven't yet been displayed
- // - typically seen as multiple 'permission denied' messages
- // as a result of auto-reloading a protected page with &JS=1
-
- if(in_array($s, $_SESSION['sysmsg']))
- return;
-
- 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;
- }
+ if (!session_id()) {
+ return;
}
- $x = null;
-
- $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 = [];
+ if (!isset($_SESSION['sysmsg'])) {
+ $_SESSION['sysmsg'] = [];
}
- if ($x === null) {
- $x = get_xconfig($hash, 'sse', 'notifications', []);
- }
+ // ignore duplicated error messages which haven't yet been displayed
- if (isset($x['notice']) && in_array($s, $x['notice']['notifications'])) {
+ if (in_array($s, $_SESSION['sysmsg'])) {
return;
}
if (App::$interactive) {
- $x['notice']['notifications'][] = $s;
- set_xconfig($hash, 'sse', 'notifications', $x);
+ $_SESSION['sysmsg'][] = $s;
}
}
@@ -1964,53 +1929,22 @@ function notice($s) {
*/
function info($s) {
- /*
- if(! session_id())
- return;
-
- if(! x($_SESSION, 'sysmsg_info'))
- $_SESSION['sysmsg_info'] = array();
-
- if(in_array($s, $_SESSION['sysmsg_info']))
- return;
-
- 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;
- }
+ if (!session_id()) {
+ return;
}
- $x = null;
-
- $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 = [];
+ if (!isset($_SESSION['sysmsg_info'])) {
+ $_SESSION['sysmsg_info'] = [];
}
- if ($x === null) {
- $x = get_xconfig($hash, 'sse', 'notifications', []);
- }
+ // ignore duplicated error messages which haven't yet been displayed
- if (isset($x['info']) && in_array($s, $x['info']['notifications'])) {
+ if (in_array($s, $_SESSION['sysmsg_info'])) {
return;
}
if (App::$interactive) {
- $x['info']['notifications'][] = $s;
- set_xconfig($hash, 'sse', 'notifications', $x);
+ $_SESSION['sysmsg_info'][] = $s;
}
}