From 2e0697c70ea4d76b3e0a379a6a1de9929ea9b4dc Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 26 Mar 2019 21:55:48 +0000 Subject: [PATCH 1/2] Notifications do work now again --- src/Content/ForumManager.php | 2 +- src/Core/NotificationsManager.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php index e9dab41ef9..ff2e9aa6f1 100644 --- a/src/Content/ForumManager.php +++ b/src/Content/ForumManager.php @@ -199,7 +199,7 @@ class ForumManager $stmtContacts = DBA::p( "SELECT `contact`.`id`, `contact`.`name`, COUNT(*) AS `count` FROM `item` INNER JOIN `contact` ON `item`.`contact-id` = `contact`.`id` - WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted` AND `item`.`unseen` + WHERE `item`.`uid` = ? AND `item`.`visible` AND NOT `item`.`deleted` AND `item`.`unseen` AND `contact`.`network`= 'dfrn' AND (`contact`.`forum` OR `contact`.`prv`) AND NOT `contact`.`blocked` AND NOT `contact`.`hidden` AND NOT `contact`.`pending` AND NOT `contact`.`archive` diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index bc1d1a00aa..bd877670c6 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -563,7 +563,7 @@ class NotificationsManager extends BaseObject $sql_extra = ""; if (!$all) { - $sql_extra = " AND `ignore` = 0 "; + $sql_extra = " AND NOT `ignore` "; } /// @todo Fetch contact details by "Contact::getDetailsByUrl" instead of queries to contact, fcontact and gcontact @@ -578,8 +578,8 @@ class NotificationsManager extends BaseObject LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id` LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id` - WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 - LIMIT %d, %d", + WHERE `intro`.`uid` = ? $sql_extra AND `intro`.`blocked` = 0 + LIMIT ?, ?", intval($_SESSION['uid']), intval($start), intval($limit) From 83ff2b03826ef105e307ddaadd2b1dfe479afba2 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 26 Mar 2019 21:58:03 +0000 Subject: [PATCH 2/2] We don't need to escape values anymore --- src/Content/ForumManager.php | 2 +- src/Core/NotificationsManager.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php index ff2e9aa6f1..af2c3725c4 100644 --- a/src/Content/ForumManager.php +++ b/src/Content/ForumManager.php @@ -205,7 +205,7 @@ class ForumManager AND NOT `contact`.`pending` AND NOT `contact`.`archive` AND `contact`.`success_update` > `failure_update` GROUP BY `contact`.`id` ", - intval(local_user()) + local_user() ); return DBA::toArray($stmtContacts); diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index bd877670c6..5b2e97005a 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -580,9 +580,9 @@ class NotificationsManager extends BaseObject LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id` WHERE `intro`.`uid` = ? $sql_extra AND `intro`.`blocked` = 0 LIMIT ?, ?", - intval($_SESSION['uid']), - intval($start), - intval($limit) + $_SESSION['uid'], + $start, + $limit ); if (DBA::isResult($stmtNotifies)) { $notifs = $this->formatIntros(DBA::toArray($stmtNotifies));