[ticket/17010] Resolve use of undefined variable and possibly wrong type

PHPBB3-17010
This commit is contained in:
Marc Alexander 2023-01-30 21:39:49 +01:00
parent a8dc08a219
commit 974b7a9184
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -176,7 +176,7 @@ class webpush extends messenger_base
$result = $this->db->sql_query($sql); $result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) while ($row = $this->db->sql_fetchrow($result))
{ {
if (isset($user_subscriptions[$row['user_id']])) if (isset($user_subscription_map[$row['user_id']]))
{ {
$user_subscription_map[$row['user_id']] += $row; $user_subscription_map[$row['user_id']] += $row;
} }
@ -274,7 +274,7 @@ class webpush extends messenger_base
public function mark_notifications($notification_type_id, $item_id, $user_id, $time = false, $mark_read = true) public function mark_notifications($notification_type_id, $item_id, $user_id, $time = false, $mark_read = true)
{ {
$sql = 'DELETE FROM ' . $this->notification_webpush_table . ' $sql = 'DELETE FROM ' . $this->notification_webpush_table . '
WHERE ' . ($notification_type_id !== false ? $this->db->sql_in_set('notification_type_id', $notification_type_id) : '1=1') . WHERE ' . ($notification_type_id !== false ? $this->db->sql_in_set('notification_type_id', is_array($notification_type_id) ? $notification_type_id : [$notification_type_id]) : '1=1') .
($user_id !== false ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : '') . ($user_id !== false ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : '') .
($item_id !== false ? ' AND ' . $this->db->sql_in_set('item_id', $item_id) : ''); ($item_id !== false ? ' AND ' . $this->db->sql_in_set('item_id', $item_id) : '');
$this->db->sql_query($sql); $this->db->sql_query($sql);
@ -286,7 +286,7 @@ class webpush extends messenger_base
public function mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time = false, $mark_read = true) public function mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time = false, $mark_read = true)
{ {
$sql = 'DELETE FROM ' . $this->notification_webpush_table . ' $sql = 'DELETE FROM ' . $this->notification_webpush_table . '
WHERE ' . ($notification_type_id !== false ? $this->db->sql_in_set('notification_type_id', $notification_type_id) : '1=1') . WHERE ' . ($notification_type_id !== false ? $this->db->sql_in_set('notification_type_id', is_array($notification_type_id) ? $notification_type_id : [$notification_type_id]) : '1=1') .
($user_id !== false ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : '') . ($user_id !== false ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : '') .
($item_parent_id !== false ? ' AND ' . $this->db->sql_in_set('item_parent_id', $item_parent_id, false, true) : ''); ($item_parent_id !== false ? ' AND ' . $this->db->sql_in_set('item_parent_id', $item_parent_id, false, true) : '');
$this->db->sql_query($sql); $this->db->sql_query($sql);