From b033597ada02ef045bc9fbdb2237f81935b73e47 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 11 Nov 2019 21:30:38 +0100 Subject: sse notifications --- Zotlabs/Module/Sse_bs.php | 519 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 519 insertions(+) create mode 100644 Zotlabs/Module/Sse_bs.php (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php new file mode 100644 index 000000000..672a6c5ef --- /dev/null +++ b/Zotlabs/Module/Sse_bs.php @@ -0,0 +1,519 @@ + 0) + self::$offset = argv(2); + else + $_SESSION['sse_loadtime'] = datetime_convert(); + + $network = false; + $home = false; + $pubs = false; + $f = ''; + + switch (argv(1)) { + case 'network': + $network = true; + $f = 'bs_network'; + break; + case 'home': + $home = true; + $f = 'bs_home'; + break; + case 'pubs': + $pubs = true; + $f = 'bs_pubs'; + break; + default: + } + + //hz_syslog('init: ' . argv(1)); + //hz_syslog('offset: ' . argv(2)); + + if(self::$offset && $f) { + $result = self::$f(true); + json_return_and_die($result); + } + + $result = array_merge( + self::bs_network($network), + self::bs_home($home), + self::bs_notify(), + self::bs_intros(), + self::bs_forums(), + self::bs_pubs($pubs), + self::bs_files(), + self::bs_mail(), + self::bs_all_events(), + self::bs_register() + ); + + json_return_and_die($result); + } + + function bs_network($notifications) { + + $result['network']['notifications'] = []; + $result['network']['count'] = 0; + + if(! self::$uid) + return $result; + + $limit = intval(self::$limit); + $offset = self::$offset; + + $sql_extra = ''; + if(! (self::$vnotify & VNOTIFY_LIKE)) + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + + $sql_extra2 = ''; + if(self::$xchans) + $sql_extra2 = " AND (author_xchan IN (" . self::$xchans . ") OR owner_xchan IN (" . self::$xchans . ")) "; + + $item_normal = item_normal(); + + if ($notifications) { + $items = q("SELECT * FROM item + WHERE uid = %d + AND created <= '%s' + AND item_unseen = 1 AND item_wall = 0 + AND author_xchan != '%s' + $item_normal + $sql_extra + $sql_extra2 + ORDER BY created DESC LIMIT $limit OFFSET $offset", + intval(self::$uid), + dbescdate($_SESSION['sse_loadtime']), + dbesc(self::$ob_hash) + ); + + if($items) { + $result['network']['offset'] = ((count($items) == $limit) ? intval($offset + $limit) : -1); + xchan_query($items); + foreach($items as $item) { + $result['network']['notifications'][] = Enotify::format($item); + } + } + else { + $result['network']['offset'] = -1; + } + + } + + $r = q("SELECT count(id) as total FROM item + WHERE uid = %d and item_unseen = 1 AND item_wall = 0 + $item_normal + $sql_extra + AND author_xchan != '%s'", + intval(self::$uid), + dbesc(self::$ob_hash) + ); + + if($r) + $result['network']['count'] = intval($r[0]['total']); + + return $result; + } + + function bs_home($notifications) { + + $result['home']['notifications'] = []; + $result['home']['count'] = 0; + + if(! self::$uid) + return $result; + + $limit = intval(self::$limit); + $offset = self::$offset; + + $sql_extra = ''; + if(! (self::$vnotify & VNOTIFY_LIKE)) + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + + $sql_extra2 = ''; + if(self::$xchans) + $sql_extra2 = " AND (author_xchan IN (" . self::$xchans . ") OR owner_xchan IN (" . self::$xchans . ")) "; + + + $item_normal = item_normal(); + + if ($notifications) { + $items = q("SELECT * FROM item + WHERE uid = %d + AND created <= '%s' + AND item_unseen = 1 AND item_wall = 1 + AND author_xchan != '%s' + $item_normal + $sql_extra + $sql_extra2 + ORDER BY created DESC LIMIT $limit OFFSET $offset", + intval(self::$uid), + dbescdate($_SESSION['sse_loadtime']), + dbesc(self::$ob_hash) + ); + + if($items) { + $result['home']['offset'] = ((count($items) == $limit) ? intval($offset + $limit) : -1); + xchan_query($items); + foreach($items as $item) { + $result['home']['notifications'][] = Enotify::format($item); + } + } + else { + $result['home']['offset'] = -1; + } + + } + + $r = q("SELECT count(id) as total FROM item + WHERE uid = %d and item_unseen = 1 AND item_wall = 1 + $item_normal + $sql_extra + AND author_xchan != '%s'", + intval(self::$uid), + dbesc(self::$ob_hash) + ); + + if($r) + $result['home']['count'] = intval($r[0]['total']); + + return $result; + } + + function bs_pubs($notifications) { + + $result['pubs']['notifications'] = []; + $result['pubs']['count'] = 0; + + if(! isset($_SESSION['static_loadtime'])) + $_SESSION['static_loadtime'] = datetime_convert(); + + $limit = intval(self::$limit); + $offset = self::$offset; + + $sys = get_sys_channel(); + $sql_extra = ''; + if(! (self::$vnotify & VNOTIFY_LIKE)) + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + + $sql_extra2 = ''; + if(self::$xchans) + $sql_extra2 = " AND (author_xchan IN (" . self::$xchans . ") OR owner_xchan IN (" . self::$xchans . ")) "; + + $item_normal = item_normal(); + + if ($notifications) { + $items = q("SELECT * FROM item + WHERE uid = %d + AND created <= '%s' + AND item_unseen = 1 + AND author_xchan != '%s' + AND created > '%s' + $item_normal + $sql_extra + $sql_extra2 + ORDER BY created DESC LIMIT $limit OFFSET $offset", + intval($sys['channel_id']), + dbescdate($_SESSION['sse_loadtime']), + dbesc(self::$ob_hash), + dbescdate($_SESSION['static_loadtime']) + ); + + if($items) { + $result['pubs']['offset'] = ((count($items) == $limit) ? intval($offset + $limit) : -1); + xchan_query($items); + foreach($items as $item) { + $result['pubs']['notifications'][] = Enotify::format($item); + } + } + else { + $result['pubs']['offset'] = -1; + } + + + } + + $r = q("SELECT count(id) as total FROM item + WHERE uid = %d AND item_unseen = 1 + AND created > '%s' + $item_normal + $sql_extra + AND author_xchan != '%s'", + intval($sys['channel_id']), + dbescdate($_SESSION['static_loadtime']), + dbesc(self::$ob_hash) + ); + + if($r) + $result['pubs']['count'] = intval($r[0]['total']); + + return $result; + } + + + function bs_notify() { + + $result['notify']['notifications'] = []; + $result['notify']['count'] = 0; + $result['notify']['offset'] = -1; + + if(! self::$uid) + return $result; + + $r = q("SELECT * FROM notify WHERE uid = %d AND seen = 0 ORDER BY created DESC", + intval(self::$uid) + ); + if($r) { + foreach($r as $rr) { + $result['notify']['notifications'][] = Enotify::format_notify($rr); + } + $result['notify']['count'] = count($r); + } + + return $result; + + } + + function bs_intros() { + + $result['intros']['notifications'] = []; + $result['intros']['count'] = 0; + $result['intros']['offset'] = -1; + + if(! self::$uid) + return $result; + + $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and abook_pending = 1 and abook_self = 0 and abook_ignored = 0 and xchan_deleted = 0 and xchan_orphan = 0 ORDER BY abook_created DESC LIMIT 50", + intval(self::$uid) + ); + + if($r) { + foreach($r as $rr) { + $result['intros']['notifications'][] = Enotify::format_intros($rr); + } + $result['intros']['count'] = count($r); + } + + return $result; + + } + + function bs_forums() { + + $result['forums']['notifications'] = []; + $result['forums']['count'] = 0; + $result['forums']['offset'] = -1; + + if(! self::$uid) + return $result; + + $forums = get_forum_channels(self::$uid); + + if($forums) { + $item_normal = item_normal(); + + $sql_extra = ''; + if(! (self::$vnotify & VNOTIFY_LIKE)) + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + + $fcount = count($forums); + $i = 0; + + for($x = 0; $x < $fcount; $x ++) { + $p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'", + intval(self::$uid), + intval(TERM_FORUM), + dbesc($forums[$x]['xchan_name']) + ); + + $p_str = ids_to_querystr($p, 'parent'); + $p_sql = (($p_str) ? "OR parent IN ( $p_str )" : ''); + + $r = q("select count(id) as unseen from item + where uid = %d and ( owner_xchan = '%s' OR author_xchan = '%s' $p_sql ) and item_unseen = 1 $sql_extra $item_normal", + intval(self::$uid), + dbesc($forums[$x]['xchan_hash']), + dbesc($forums[$x]['xchan_hash']) + ); + + if($r[0]['unseen']) { + $forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id']); + $forums[$x]['name'] = $forums[$x]['xchan_name']; + $forums[$x]['addr'] = $forums[$x]['xchan_addr']; + $forums[$x]['url'] = $forums[$x]['xchan_url']; + $forums[$x]['photo'] = $forums[$x]['xchan_photo_s']; + $forums[$x]['unseen'] = $r[0]['unseen']; + $forums[$x]['private_forum'] = (($forums[$x]['private_forum']) ? 'lock' : ''); + $forums[$x]['message'] = (($forums[$x]['private_forum']) ? t('Private forum') : t('Public forum')); + + unset($forums[$x]['abook_id']); + unset($forums[$x]['xchan_hash']); + unset($forums[$x]['xchan_name']); + unset($forums[$x]['xchan_url']); + unset($forums[$x]['xchan_photo_s']); + + $i = $i + $r[0]['unseen']; + + } + else { + unset($forums[$x]); + } + } + + $result['forums']['count'] = $i; + $result['forums']['notifications'] = array_values($forums); + + } + + return $result; + + } + + function bs_files() { + + $result['files']['notifications'] = []; + $result['files']['count'] = 0; + $result['files']['offset'] = -1; + + if(! self::$uid) + return $result; + + $r = q("SELECT * FROM item + WHERE verb = '%s' + AND obj_type = '%s' + AND uid = %d + AND owner_xchan != '%s' + AND item_unseen = 1", + dbesc(ACTIVITY_POST), + dbesc(ACTIVITY_OBJ_FILE), + intval(self::$uid), + dbesc(self::$ob_hash) + ); + if($r) { + xchan_query($r); + foreach($r as $rr) { + $result['files']['notifications'][] = Enotify::format_files($rr); + } + $result['files']['count'] = count($r); + } + + return $result; + + } + + function bs_mail() { + + $result['mail']['notifications'] = []; + $result['mail']['count'] = 0; + $result['mail']['offset'] = -1; + + if(! self::$uid) + return $result; + + $r = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan + where channel_id = %d and mail_seen = 0 and mail_deleted = 0 + and from_xchan != '%s' order by created desc", + intval(self::$uid), + dbesc(self::$ob_hash) + ); + + if($r) { + foreach($r as $rr) { + $result['mail']['notifications'][] = Enotify::format_mail($rr); + } + $result['mail']['count'] = count($r); + } + + return $result; + + } + + function bs_all_events() { + + $result['all_events']['notifications'] = []; + $result['all_events']['count'] = 0; + $result['all_events']['offset'] = -1; + + if(! self::$uid) + return $result; + + $r = q("SELECT * FROM event left join xchan on event_xchan = xchan_hash + WHERE event.uid = %d AND dtstart < '%s' AND dtstart > '%s' and dismissed = 0 + and etype in ( 'event', 'birthday' ) + ORDER BY dtstart DESC", + intval(self::$uid), + dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval(self::$evdays) . ' days')), + dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) + ); + + if($r) { + foreach($r as $rr) { + $result['all_events']['notifications'][] = Enotify::format_all_events($rr); + } + $result['all_events']['count'] = count($r); + } + + return $result; + } + + function bs_register() { + + $result['register']['notifications'] = []; + $result['register']['count'] = 0; + $result['register']['offset'] = -1; + + if(! self::$uid && ! is_site_admin()) + return $result; + + $r = q("SELECT account_email, account_created from account where (account_flags & %d) > 0", + intval(ACCOUNT_PENDING) + ); + if($r) { + foreach($r as $rr) { + $result['register']['notifications'][] = Enotify::format_register($rr); + } + $result['register']['count'] = count($r); + } + + return $result; + + } + +} -- cgit v1.2.3 From 209d06a8f795282ddf370dff8228d2385004d05a Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 12 Nov 2019 10:11:58 +0000 Subject: better detection for who to send sys notifications (needs addons update) --- Zotlabs/Module/Sse_bs.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 672a6c5ef..c591a00bf 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -27,6 +27,9 @@ class Sse_bs extends Controller { self::$offset = 0; self::$xchans = ''; + if(self::$ob_hash) + set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); + if(!empty($_GET['nquery']) && $_GET['nquery'] !== '%') { $nquery = $_GET['nquery']; -- cgit v1.2.3 From 6e36820b1bbc35bc3d26ff4eca2b63a386b30462 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 12 Nov 2019 21:15:01 +0000 Subject: sse: do not delete xconfig - reset it --- Zotlabs/Module/Sse_bs.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index c591a00bf..c7fcd0542 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -27,8 +27,10 @@ class Sse_bs extends Controller { self::$offset = 0; self::$xchans = ''; - if(self::$ob_hash) + if(self::$ob_hash) { set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); + set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); + } if(!empty($_GET['nquery']) && $_GET['nquery'] !== '%') { $nquery = $_GET['nquery']; -- cgit v1.2.3 From 965c51c2d45a98db10543c5108ac486e4fc6459e Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 15 Nov 2019 20:29:58 +0000 Subject: sse: implement notifications for anonymous visitors (info, notice and pubs) and fix a potential memory leak --- Zotlabs/Module/Sse_bs.php | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index c7fcd0542..270e8b9b9 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -11,6 +11,7 @@ class Sse_bs extends Controller { public static $uid; public static $ob_hash; + public static $sse_id; public static $vnotify; public static $evdays; public static $limit; @@ -21,16 +22,26 @@ class Sse_bs extends Controller { self::$uid = local_channel(); self::$ob_hash = get_observer_hash(); + self::$sse_id = false; + + if(! self::$ob_hash) { + if(session_id()) { + self::$sse_id = true; + self::$ob_hash = 'sse_id.' . session_id(); + } + else { + return; + } + } + self::$vnotify = get_pconfig(self::$uid, 'system', 'vnotify'); self::$evdays = intval(get_pconfig(self::$uid, 'system', 'evdays')); self::$limit = 100; self::$offset = 0; self::$xchans = ''; - if(self::$ob_hash) { - set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); - set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); - } + set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); + set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); if(!empty($_GET['nquery']) && $_GET['nquery'] !== '%') { $nquery = $_GET['nquery']; @@ -69,9 +80,6 @@ class Sse_bs extends Controller { default: } - //hz_syslog('init: ' . argv(1)); - //hz_syslog('offset: ' . argv(2)); - if(self::$offset && $f) { $result = self::$f(true); json_return_and_die($result); @@ -227,6 +235,16 @@ class Sse_bs extends Controller { $result['pubs']['notifications'] = []; $result['pubs']['count'] = 0; + if((observer_prohibited(true))) { + return $result; + } + + if(! intval(get_config('system','open_pubstream',1))) { + if(! get_observer_hash()) { + return $result; + } + } + if(! isset($_SESSION['static_loadtime'])) $_SESSION['static_loadtime'] = datetime_convert(); -- cgit v1.2.3 From 2b08519f5ad2cf7803736b42159f92f754acb0bd Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 28 Nov 2019 08:22:53 +0000 Subject: sse: improve caching fix an issue with removing notifications and move chatpresence expiration to cron --- Zotlabs/Module/Sse_bs.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 270e8b9b9..5e00593ef 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -40,9 +40,6 @@ class Sse_bs extends Controller { self::$offset = 0; self::$xchans = ''; - set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); - set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); - if(!empty($_GET['nquery']) && $_GET['nquery'] !== '%') { $nquery = $_GET['nquery']; @@ -80,6 +77,10 @@ class Sse_bs extends Controller { default: } + set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); + set_xconfig(self::$ob_hash, 'sse', 'notifications', []); // reset the cache + set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); + if(self::$offset && $f) { $result = self::$f(true); json_return_and_die($result); -- cgit v1.2.3 From 161ea6d51fea95be8071bea8e8f0999a25241801 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 7 Dec 2019 13:05:07 +0000 Subject: sse: initial commit to deal with forum notifications --- Zotlabs/Module/Sse_bs.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 5e00593ef..4340876ea 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -77,10 +77,6 @@ class Sse_bs extends Controller { default: } - set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); - set_xconfig(self::$ob_hash, 'sse', 'notifications', []); // reset the cache - set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); - if(self::$offset && $f) { $result = self::$f(true); json_return_and_die($result); @@ -99,6 +95,10 @@ class Sse_bs extends Controller { self::bs_register() ); + set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert()); + set_xconfig(self::$ob_hash, 'sse', 'notifications', []); // reset the cache + set_xconfig(self::$ob_hash, 'sse', 'language', App::$language); + json_return_and_die($result); } @@ -390,22 +390,29 @@ class Sse_bs extends Controller { $p_str = ids_to_querystr($p, 'parent'); $p_sql = (($p_str) ? "OR parent IN ( $p_str )" : ''); - $r = q("select count(id) as unseen from item + $r = q("select mid from item where uid = %d and ( owner_xchan = '%s' OR author_xchan = '%s' $p_sql ) and item_unseen = 1 $sql_extra $item_normal", intval(self::$uid), dbesc($forums[$x]['xchan_hash']), dbesc($forums[$x]['xchan_hash']) ); - if($r[0]['unseen']) { + if($r) { + $mids = flatten_array_recursive($r); + + + foreach($mids as $mid) + $b64mids[] = 'b64.' . base64url_encode($mid); + $forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id']); $forums[$x]['name'] = $forums[$x]['xchan_name']; $forums[$x]['addr'] = $forums[$x]['xchan_addr']; $forums[$x]['url'] = $forums[$x]['xchan_url']; $forums[$x]['photo'] = $forums[$x]['xchan_photo_s']; - $forums[$x]['unseen'] = $r[0]['unseen']; + $forums[$x]['unseen'] = count($b64mids); $forums[$x]['private_forum'] = (($forums[$x]['private_forum']) ? 'lock' : ''); $forums[$x]['message'] = (($forums[$x]['private_forum']) ? t('Private forum') : t('Public forum')); + $forums[$x]['mids'] = json_encode($b64mids); unset($forums[$x]['abook_id']); unset($forums[$x]['xchan_hash']); @@ -413,7 +420,7 @@ class Sse_bs extends Controller { unset($forums[$x]['xchan_url']); unset($forums[$x]['xchan_photo_s']); - $i = $i + $r[0]['unseen']; + $i = $i + count($mids); } else { -- cgit v1.2.3 From 7abcdd34af8796571a0145d16a71a9009b995032 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 25 Jan 2020 14:32:35 +0000 Subject: minor private forum notifications fixes --- Zotlabs/Module/Sse_bs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 4340876ea..90e870330 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -404,7 +404,7 @@ class Sse_bs extends Controller { foreach($mids as $mid) $b64mids[] = 'b64.' . base64url_encode($mid); - $forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id']); + $forums[$x]['notify_link'] = z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id']; $forums[$x]['name'] = $forums[$x]['xchan_name']; $forums[$x]['addr'] = $forums[$x]['xchan_addr']; $forums[$x]['url'] = $forums[$x]['xchan_url']; -- cgit v1.2.3 From 67c9b5d04954012e062ee16619c1c8369582b670 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Apr 2020 06:47:12 +0000 Subject: fix unseen forum posts count --- Zotlabs/Module/Sse_bs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 90e870330..89e852120 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -399,7 +399,7 @@ class Sse_bs extends Controller { if($r) { $mids = flatten_array_recursive($r); - + $b64mids = []; foreach($mids as $mid) $b64mids[] = 'b64.' . base64url_encode($mid); -- cgit v1.2.3 From e588ea8a8b697605c40a13210ab2b4c485d45ade Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 15 Apr 2020 15:39:33 +0000 Subject: fix notification filtering --- Zotlabs/Module/Sse_bs.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 89e852120..c139fd19b 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -119,7 +119,7 @@ class Sse_bs extends Controller { $sql_extra2 = ''; if(self::$xchans) - $sql_extra2 = " AND (author_xchan IN (" . self::$xchans . ") OR owner_xchan IN (" . self::$xchans . ")) "; + $sql_extra2 = " AND author_xchan IN (" . self::$xchans . ") "; $item_normal = item_normal(); @@ -183,7 +183,7 @@ class Sse_bs extends Controller { $sql_extra2 = ''; if(self::$xchans) - $sql_extra2 = " AND (author_xchan IN (" . self::$xchans . ") OR owner_xchan IN (" . self::$xchans . ")) "; + $sql_extra2 = " AND author_xchan IN (" . self::$xchans . ") "; $item_normal = item_normal(); @@ -259,7 +259,7 @@ class Sse_bs extends Controller { $sql_extra2 = ''; if(self::$xchans) - $sql_extra2 = " AND (author_xchan IN (" . self::$xchans . ") OR owner_xchan IN (" . self::$xchans . ")) "; + $sql_extra2 = " AND author_xchan IN (" . self::$xchans . ") "; $item_normal = item_normal(); -- cgit v1.2.3 From b7a655917ed1f7caa5b8b3d9b92fdd578c6252c4 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 23 Apr 2020 18:19:25 +0000 Subject: some work on deprecating ACTIVITY_OBJ_FILE --- Zotlabs/Module/Sse_bs.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index c139fd19b..e4394fe33 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -128,6 +128,7 @@ class Sse_bs extends Controller { WHERE uid = %d AND created <= '%s' AND item_unseen = 1 AND item_wall = 0 + AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal $sql_extra @@ -193,6 +194,7 @@ class Sse_bs extends Controller { WHERE uid = %d AND created <= '%s' AND item_unseen = 1 AND item_wall = 1 + AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal $sql_extra @@ -268,6 +270,7 @@ class Sse_bs extends Controller { WHERE uid = %d AND created <= '%s' AND item_unseen = 1 + AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' AND created > '%s' $item_normal @@ -448,19 +451,18 @@ class Sse_bs extends Controller { $r = q("SELECT * FROM item WHERE verb = '%s' - AND obj_type = '%s' + AND obj_type in ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' AND item_unseen = 1", dbesc(ACTIVITY_POST), - dbesc(ACTIVITY_OBJ_FILE), intval(self::$uid), dbesc(self::$ob_hash) ); if($r) { xchan_query($r); foreach($r as $rr) { - $result['files']['notifications'][] = Enotify::format_files($rr); + $result['files']['notifications'][] = Enotify::format($rr); } $result['files']['count'] = count($r); } -- cgit v1.2.3 From 2b8afd55800754aeb158d77940777ecc2c119d37 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 23 Apr 2020 19:38:19 +0000 Subject: fix file notifications --- Zotlabs/Module/Sse_bs.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index e4394fe33..290c616a9 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -449,12 +449,15 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + $item_normal = item_normal(); + $r = q("SELECT * FROM item WHERE verb = '%s' AND obj_type in ('Document', 'Video', 'Audio', 'Image') AND uid = %d - AND owner_xchan != '%s' - AND item_unseen = 1", + AND author_xchan != '%s' + AND item_unseen = 1 + $item_normal", dbesc(ACTIVITY_POST), intval(self::$uid), dbesc(self::$ob_hash) -- cgit v1.2.3 From e2b10f52e02c4cee77af089a544ec55e62048aba Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 24 Apr 2020 14:25:49 +0000 Subject: more work on deprecating ACTIVITY_OBJ_FILE and adapt mod sharedwithme --- Zotlabs/Module/Sse_bs.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 290c616a9..cb4c54961 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -453,11 +453,12 @@ class Sse_bs extends Controller { $r = q("SELECT * FROM item WHERE verb = '%s' - AND obj_type in ('Document', 'Video', 'Audio', 'Image') + AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND author_xchan != '%s' AND item_unseen = 1 - $item_normal", + $item_normal + ORDER BY created DESC", dbesc(ACTIVITY_POST), intval(self::$uid), dbesc(self::$ob_hash) -- cgit v1.2.3 From de058901c2a8dd5fea09b1594c2ace0b8bd2c90f Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 5 May 2020 07:40:24 +0000 Subject: catch the owner_xchan for activity_share items in notifications filter --- Zotlabs/Module/Sse_bs.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index cb4c54961..a8c0b2299 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -119,7 +119,7 @@ class Sse_bs extends Controller { $sql_extra2 = ''; if(self::$xchans) - $sql_extra2 = " AND author_xchan IN (" . self::$xchans . ") "; + $sql_extra2 = " AND CASE WHEN verb = '" . ACTIVITY_SHARE . "' THEN owner_xchan ELSE author_xchan END IN (" . self::$xchans . ") "; $item_normal = item_normal(); @@ -184,7 +184,7 @@ class Sse_bs extends Controller { $sql_extra2 = ''; if(self::$xchans) - $sql_extra2 = " AND author_xchan IN (" . self::$xchans . ") "; + $sql_extra2 = " AND CASE WHEN verb = '" . ACTIVITY_SHARE . "' THEN owner_xchan ELSE author_xchan END IN (" . self::$xchans . ") "; $item_normal = item_normal(); @@ -261,7 +261,7 @@ class Sse_bs extends Controller { $sql_extra2 = ''; if(self::$xchans) - $sql_extra2 = " AND author_xchan IN (" . self::$xchans . ") "; + $sql_extra2 = " AND CASE WHEN verb = '" . ACTIVITY_SHARE . "' THEN owner_xchan ELSE author_xchan END IN (" . self::$xchans . ") "; $item_normal = item_normal(); -- cgit v1.2.3 From 06d1cf83d2b1acfef5529fe388d2502bea381881 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 5 May 2020 14:51:00 +0000 Subject: deal with polls and votes in enotify --- Zotlabs/Module/Sse_bs.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index a8c0b2299..23bc3c96b 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -327,6 +327,7 @@ class Sse_bs extends Controller { $r = q("SELECT * FROM notify WHERE uid = %d AND seen = 0 ORDER BY created DESC", intval(self::$uid) ); + if($r) { foreach($r as $rr) { $result['notify']['notifications'][] = Enotify::format_notify($rr); -- cgit v1.2.3 From 4270e17bc4ffedd35ddc5e00f7037162e9b95725 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 14 May 2020 09:27:39 +0000 Subject: implement notifications for direct messages --- Zotlabs/Module/Sse_bs.php | 75 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 23bc3c96b..2f3567e70 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -57,6 +57,7 @@ class Sse_bs extends Controller { $_SESSION['sse_loadtime'] = datetime_convert(); $network = false; + $dm = false; $home = false; $pubs = false; $f = ''; @@ -66,6 +67,10 @@ class Sse_bs extends Controller { $network = true; $f = 'bs_network'; break; + case 'dm': + $dm = true; + $f = 'bs_dm'; + break; case 'home': $home = true; $f = 'bs_home'; @@ -84,6 +89,7 @@ class Sse_bs extends Controller { $result = array_merge( self::bs_network($network), + self::bs_dm($dm), self::bs_home($home), self::bs_notify(), self::bs_intros(), @@ -127,7 +133,7 @@ class Sse_bs extends Controller { $items = q("SELECT * FROM item WHERE uid = %d AND created <= '%s' - AND item_unseen = 1 AND item_wall = 0 + AND item_unseen = 1 AND item_wall = 0 AND item_private IN (0, 1) AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal @@ -153,7 +159,7 @@ class Sse_bs extends Controller { } $r = q("SELECT count(id) as total FROM item - WHERE uid = %d and item_unseen = 1 AND item_wall = 0 + WHERE uid = %d and item_unseen = 1 AND item_wall = 0 AND item_private IN (0, 1) $item_normal $sql_extra AND author_xchan != '%s'", @@ -167,6 +173,71 @@ class Sse_bs extends Controller { return $result; } + function bs_dm($notifications) { + + $result['dm']['notifications'] = []; + $result['dm']['count'] = 0; + + if(! self::$uid) + return $result; + + $limit = intval(self::$limit); + $offset = self::$offset; + + $sql_extra = ''; + if(! (self::$vnotify & VNOTIFY_LIKE)) + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + + $sql_extra2 = ''; + if(self::$xchans) + $sql_extra2 = " AND CASE WHEN verb = '" . ACTIVITY_SHARE . "' THEN owner_xchan ELSE author_xchan END IN (" . self::$xchans . ") "; + + $item_normal = item_normal(); + + if ($notifications) { + $items = q("SELECT * FROM item + WHERE uid = %d + AND created <= '%s' + AND item_unseen = 1 AND item_wall = 0 AND item_private = 2 + AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') + AND author_xchan != '%s' + $item_normal + $sql_extra + $sql_extra2 + ORDER BY created DESC LIMIT $limit OFFSET $offset", + intval(self::$uid), + dbescdate($_SESSION['sse_loadtime']), + dbesc(self::$ob_hash) + ); + + if($items) { + $result['dm']['offset'] = ((count($items) == $limit) ? intval($offset + $limit) : -1); + xchan_query($items); + foreach($items as $item) { + $result['dm']['notifications'][] = Enotify::format($item); + } + } + else { + $result['dm']['offset'] = -1; + } + + } + + $r = q("SELECT count(id) as total FROM item + WHERE uid = %d and item_unseen = 1 AND item_wall = 0 AND item_private = 2 + $item_normal + $sql_extra + AND author_xchan != '%s'", + intval(self::$uid), + dbesc(self::$ob_hash) + ); + + if($r) + $result['dm']['count'] = intval($r[0]['total']); + + return $result; + } + function bs_home($notifications) { $result['home']['notifications'] = []; -- cgit v1.2.3 From 06f03eb13a336761c49a353bc69b84323ba34f9c Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 30 Jul 2020 08:21:43 +0000 Subject: respect notifications settings --- Zotlabs/Module/Sse_bs.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 2f3567e70..6d5acf276 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -34,7 +34,7 @@ class Sse_bs extends Controller { } } - self::$vnotify = get_pconfig(self::$uid, 'system', 'vnotify'); + self::$vnotify = get_pconfig(self::$uid, 'system', 'vnotify', -1); self::$evdays = intval(get_pconfig(self::$uid, 'system', 'evdays')); self::$limit = 100; self::$offset = 0; @@ -116,6 +116,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_NETWORK)) + return $result; + $limit = intval(self::$limit); $offset = self::$offset; @@ -181,6 +184,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_MAIL)) + return $result; + $limit = intval(self::$limit); $offset = self::$offset; @@ -246,6 +252,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_CHANNEL)) + return $result; + $limit = intval(self::$limit); $offset = self::$offset; @@ -309,6 +318,9 @@ class Sse_bs extends Controller { $result['pubs']['notifications'] = []; $result['pubs']['count'] = 0; + if(! (self::$vnotify & VNOTIFY_PUBS)) + return $result; + if((observer_prohibited(true))) { return $result; } @@ -395,6 +407,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_SYSTEM)) + return $result; + $r = q("SELECT * FROM notify WHERE uid = %d AND seen = 0 ORDER BY created DESC", intval(self::$uid) ); @@ -419,6 +434,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_INTRO)) + return $result; + $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and abook_pending = 1 and abook_self = 0 and abook_ignored = 0 and xchan_deleted = 0 and xchan_orphan = 0 ORDER BY abook_created DESC LIMIT 50", intval(self::$uid) ); @@ -443,6 +461,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_FORUMS)) + return $result; + $forums = get_forum_channels(self::$uid); if($forums) { @@ -521,6 +542,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_FILES)) + return $result; + $item_normal = item_normal(); $r = q("SELECT * FROM item @@ -556,6 +580,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_MAIL)) + return $result; + $r = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan where channel_id = %d and mail_seen = 0 and mail_deleted = 0 and from_xchan != '%s' order by created desc", @@ -583,6 +610,9 @@ class Sse_bs extends Controller { if(! self::$uid) return $result; + if(! (self::$vnotify & VNOTIFY_EVENT)) + return $result; + $r = q("SELECT * FROM event left join xchan on event_xchan = xchan_hash WHERE event.uid = %d AND dtstart < '%s' AND dtstart > '%s' and dismissed = 0 and etype in ( 'event', 'birthday' ) @@ -611,6 +641,9 @@ class Sse_bs extends Controller { if(! self::$uid && ! is_site_admin()) return $result; + if(! (self::$vnotify & VNOTIFY_REGISTER)) + return $result; + $r = q("SELECT account_email, account_created from account where (account_flags & %d) > 0", intval(ACCOUNT_PENDING) ); -- cgit v1.2.3 From b5b033fe22fc8c6a8b8342a93a13bc3ab3fc7473 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 16 Oct 2020 14:12:30 +0000 Subject: =?UTF-8?q?reduce=20result=20set=20for=20notifications=C3=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zotlabs/Module/Sse_bs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 6d5acf276..0189c4695 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -36,7 +36,7 @@ class Sse_bs extends Controller { self::$vnotify = get_pconfig(self::$uid, 'system', 'vnotify', -1); self::$evdays = intval(get_pconfig(self::$uid, 'system', 'evdays')); - self::$limit = 100; + self::$limit = 30; self::$offset = 0; self::$xchans = ''; -- cgit v1.2.3 From 96de38a1f06193d674f8fe89cb1852e0e4abb4cf Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 22 Oct 2020 11:33:25 +0000 Subject: adapt notifications and mark item seen handling to play well with client side page caching --- Zotlabs/Module/Sse_bs.php | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 0189c4695..e3439e7dd 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -36,12 +36,15 @@ class Sse_bs extends Controller { self::$vnotify = get_pconfig(self::$uid, 'system', 'vnotify', -1); self::$evdays = intval(get_pconfig(self::$uid, 'system', 'evdays')); - self::$limit = 30; + self::$limit = 50; self::$offset = 0; self::$xchans = ''; - if(!empty($_GET['nquery']) && $_GET['nquery'] !== '%') { - $nquery = $_GET['nquery']; + if($_REQUEST['sse_rmids']) + self::mark_read($_REQUEST['sse_rmids']); + + if(!empty($_REQUEST['nquery']) && $_REQUEST['nquery'] !== '%') { + $nquery = $_REQUEST['nquery']; $x = q("SELECT xchan_hash FROM xchan WHERE xchan_name LIKE '%s' OR xchan_addr LIKE '%s'", dbesc($nquery . '%'), @@ -108,6 +111,31 @@ class Sse_bs extends Controller { json_return_and_die($result); } + function mark_read($arr) { + + if(! self::$uid) + return; + + $mids = []; + $str = ''; + + foreach($arr as $a) { + $mids[] = '\'' . dbesc(@base64url_decode(substr($a,4))) . '\''; + } + + $str = implode($mids, ','); + + $x = [ 'channel_id' => self::$uid, 'update' => 'unset' ]; + call_hooks('update_unseen',$x); + + if($x['update'] === 'unset' || intval($x['update'])) { + q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND mid in (". $str . ") AND item_unseen = 1", + intval(self::$uid) + ); + } + + } + function bs_network($notifications) { $result['network']['notifications'] = []; @@ -163,9 +191,10 @@ class Sse_bs extends Controller { $r = q("SELECT count(id) as total FROM item WHERE uid = %d and item_unseen = 1 AND item_wall = 0 AND item_private IN (0, 1) + AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') + AND author_xchan != '%s' $item_normal - $sql_extra - AND author_xchan != '%s'", + $sql_extra", intval(self::$uid), dbesc(self::$ob_hash) ); -- cgit v1.2.3 From cadd6fdfff130a6d3d83f94ae2b1ec4a49416f47 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 1 Nov 2020 12:24:55 +0000 Subject: fix vsprintf() error --- Zotlabs/Module/Sse_bs.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Sse_bs.php') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index e3439e7dd..287c24829 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -129,8 +129,9 @@ class Sse_bs extends Controller { call_hooks('update_unseen',$x); if($x['update'] === 'unset' || intval($x['update'])) { - q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND mid in (". $str . ") AND item_unseen = 1", - intval(self::$uid) + q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND mid in (%s) AND item_unseen = 1", + intval(self::$uid), + $str // this is dbesc() in the above foreach loop ); } -- cgit v1.2.3