diff options
Diffstat (limited to 'phpBB/includes/notification')
| -rw-r--r-- | phpBB/includes/notification/manager.php | 15 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/base.php | 5 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/bookmark.php | 3 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/post.php | 3 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/quote.php | 6 |
5 files changed, 22 insertions, 10 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php index 22fa12967a..16fdae6dd0 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/includes/notification/manager.php @@ -94,7 +94,8 @@ class phpbb_notification_manager $sql = 'SELECT COUNT(*) AS count FROM ' . NOTIFICATIONS_TABLE . ' WHERE user_id = ' . (int) $options['user_id'] . ' - AND unread = 1'; + AND unread = 1 + AND is_disabled = 0'; $result = $this->db->sql_query($sql); $unread_count = (int) $this->db->sql_fetchfield('count', $result); $this->db->sql_freeresult($result); @@ -105,7 +106,8 @@ class phpbb_notification_manager // Get the total number of notifications $sql = 'SELECT COUNT(*) AS count FROM ' . NOTIFICATIONS_TABLE . ' - WHERE user_id = ' . (int) $options['user_id']; + WHERE user_id = ' . (int) $options['user_id'] . ' + AND is_disabled = 0'; $result = $this->db->sql_query($sql); $total_count = (int) $this->db->sql_fetchfield('count', $result); $this->db->sql_freeresult($result); @@ -118,7 +120,8 @@ class phpbb_notification_manager FROM ' . NOTIFICATIONS_TABLE . ' WHERE user_id = ' . (int) $options['user_id'] . (($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('notification_id', $options['notification_id']) : ' AND notification_id = ' . (int) $options['notification_id']) : '') . ' - ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); + AND is_disabled = 0 + ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); $result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']); while ($row = $this->db->sql_fetchrow($result)) @@ -135,7 +138,8 @@ class phpbb_notification_manager WHERE user_id = ' . (int) $options['user_id'] . ' AND unread = 1 AND ' . $this->db->sql_in_set('notification_id', array_keys($rowset), true) . ' - ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); + AND is_disabled = 0 + ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); $result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']); while ($row = $this->db->sql_fetchrow($result)) @@ -344,7 +348,8 @@ class phpbb_notification_manager $sql = 'SELECT user_id FROM ' . NOTIFICATIONS_TABLE . " WHERE item_type = '" . $this->db->sql_escape($item_type) . "' - AND item_id = " . (int) $item_id; + AND item_id = " . (int) $item_id . ' + AND is_disabled = 0'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php index f6b61aee49..3aac8a7dd3 100644 --- a/phpBB/includes/notification/type/base.php +++ b/phpBB/includes/notification/type/base.php @@ -42,9 +42,12 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i * Indentification data * item_type * item_id - * item_parent_id // Parent item id (ex: for topic => forum_id, for post => topic_id, etc) + * item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc) * user_id * unread + * is_disabled - EXTENSION AUTHORS TAKE NOTE! This is to prevent errors with notifications from extensions! + * - Set is_disabled to 1 for all your notifications when your extension is disabled so they are ignored and do not cause errors. + * - When your extension is enabled again, set is_disabled to 0 and your notifications will be working again. * * time * data (special serialized field that each notification type can use to store stuff) diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/includes/notification/type/bookmark.php index 8a23859d05..e5435b5829 100644 --- a/phpBB/includes/notification/type/bookmark.php +++ b/phpBB/includes/notification/type/bookmark.php @@ -113,7 +113,8 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post FROM ' . NOTIFICATIONS_TABLE . " WHERE item_type = '" . self::get_item_type() . "' AND item_parent_id = " . (int) self::get_item_parent_id($post) . ' - AND unread = 1'; + AND unread = 1 + AND is_disabled = 0'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php index 76a7846f30..a4792cd7f2 100644 --- a/phpBB/includes/notification/type/post.php +++ b/phpBB/includes/notification/type/post.php @@ -138,7 +138,8 @@ class phpbb_notification_type_post extends phpbb_notification_type_base FROM ' . NOTIFICATIONS_TABLE . " WHERE item_type = '" . self::get_item_type() . "' AND item_parent_id = " . (int) self::get_item_parent_id($post) . ' - AND unread = 1'; + AND unread = 1 + AND is_disabled = 0'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/includes/notification/type/quote.php index 34907ef8d6..4d1e637820 100644 --- a/phpBB/includes/notification/type/quote.php +++ b/phpBB/includes/notification/type/quote.php @@ -132,7 +132,8 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post FROM ' . NOTIFICATIONS_TABLE . " WHERE item_type = '" . self::get_item_type() . "' AND item_parent_id = " . (int) self::get_item_parent_id($post) . ' - AND unread = 1'; + AND unread = 1 + AND is_disabled = 0'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { @@ -161,7 +162,8 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post $sql = 'SELECT user_id FROM ' . NOTIFICATIONS_TABLE . " WHERE item_type = '" . self::get_item_type() . "' - AND item_id = " . self::get_item_id($post); + AND item_id = " . self::get_item_id($post) . ' + AND is_disabled = 0'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { |
