diff options
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/notification/manager.php | 15 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/base.php | 14 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/bookmark.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/post.php | 4 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/quote.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/topic.php | 2 | 
6 files changed, 23 insertions, 16 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php index 8276996b94..fa1fd4b81f 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/includes/notification/manager.php @@ -128,8 +128,13 @@ class phpbb_notification_manager  			$sql = 'SELECT COUNT(n.notification_id) AS unread_count  				FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt  				WHERE n.user_id = ' . (int) $options['user_id'] . ' +<<<<<<< HEAD  					AND n.unread = 1  					AND nt.notification_type = n.item_type +======= +					AND n.notification_read = 0 +					AND nt.notification_type = n.notification_type +>>>>>>> 5cedca0... [ticket/11103] unread -> notification_read  					AND nt.notification_type_enabled = 1';  			$result = $this->db->sql_query($sql);  			$unread_count = (int) $this->db->sql_fetchfield('unread_count', $result); @@ -175,7 +180,7 @@ class phpbb_notification_manager  				$sql = 'SELECT n.*  				FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt  					WHERE n.user_id = ' . (int) $options['user_id'] . ' -						AND n.unread = 1 +						AND n.notification_read = 0  						AND ' . $this->db->sql_in_set('n.notification_id', array_keys($rowset), true) . '  						AND nt.notification_type = n.item_type  						AND nt.notification_type_enabled = 1 @@ -237,7 +242,7 @@ class phpbb_notification_manager  		$time = ($time !== false) ? $time : time();  		$sql = 'UPDATE ' . $this->notifications_table . " -			SET unread = 0 +			SET notification_read = 1  			WHERE notification_time <= " . $time .  				(($item_type !== false) ? ' AND ' . (is_array($item_type) ? $this->db->sql_in_set('item_type', $item_type) : " item_type = '" . $this->db->sql_escape($item_type) . "'") : '') .  				(($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : '') . @@ -267,8 +272,10 @@ class phpbb_notification_manager  		$time = ($time !== false) ? $time : time();  		$sql = 'UPDATE ' . $this->notifications_table . " -			SET unread = 0 +			SET notification_read = 1  			WHERE item_type = '" . $this->db->sql_escape($item_type) . "' +			SET notification_read = 1 +			WHERE notification_type = '" . $this->db->sql_escape($notification_type) . "'  				AND notification_time <= " . $time .  				(($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id) : 'item_parent_id = ' . (int) $item_parent_id) : '') .  				(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : ''); @@ -286,7 +293,7 @@ class phpbb_notification_manager  		$time = ($time !== false) ? $time : time();  		$sql = 'UPDATE ' . $this->notifications_table . " -			SET unread = 0 +			SET notification_read = 1  			WHERE notification_time <= " . $time . '  				AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id);  		$this->db->sql_query($sql); diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php index 45d0e5f60c..cdca9aa642 100644 --- a/phpBB/includes/notification/type/base.php +++ b/phpBB/includes/notification/type/base.php @@ -168,8 +168,8 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i  			'item_type'	   			=> $this->get_type(),  			'item_parent_id'		=> static::get_item_parent_id($type_data), -			'notification_time'					=> time(), -			'unread'				=> true, +			'notification_time'		=> time(), +			'notification_read'		=> false,  			'data'					=> array(),  		), $this->data); @@ -197,7 +197,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i  		unset(  			$data['notification_time'], // Also unsetting time, since it always tries to change the time to current (if you actually need to change the time, over-ride this function)  			$data['notification_id'], -			$data['unread'], +			$data['notification_read'],  			$data['user_id']  		); @@ -252,9 +252,9 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i  			'URL'				=> $this->get_url(),  			'TIME'	   			=> $this->user->format_date($this->notification_time), -			'UNREAD'			=> $this->unread, +			'UNREAD'			=> !$this->notification_read, -			'U_MARK_READ'		=> ($this->unread) ? $u_mark_read : '', +			'U_MARK_READ'		=> (!$this->notification_read) ? $u_mark_read : '',  		);  	} @@ -402,7 +402,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i  	*/  	protected function mark($unread = true, $return = false)  	{ -		$this->unread = (bool) $unread; +		$this->notification_read = (bool) !$unread;  		$where = array(  			"item_type = '" . $this->db->sql_escape($this->item_type) . "'", @@ -417,7 +417,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i  		}  		$sql = 'UPDATE ' . $this->notifications_table . ' -			SET unread = ' . (int) $this->unread . ' +			SET notification_read = ' . (int) $this->notification_read . '  			WHERE ' . $where;  		$this->db->sql_query($sql);  	} diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/includes/notification/type/bookmark.php index 750bd3b6cb..4e48a967d0 100644 --- a/phpBB/includes/notification/type/bookmark.php +++ b/phpBB/includes/notification/type/bookmark.php @@ -105,7 +105,7 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post  			FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt  			WHERE n.item_type = '" . $this->get_type() . "'  				AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . ' -				AND n.unread = 1 +				AND n.notification_read = 0  				AND nt.notification_type = n.item_type  				AND nt.notification_type_enabled = 1';  		$result = $this->db->sql_query($sql); diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php index 5eced0ca83..f29372923e 100644 --- a/phpBB/includes/notification/type/post.php +++ b/phpBB/includes/notification/type/post.php @@ -126,7 +126,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base  			FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt  			WHERE n.item_type = '" . $this->get_type() . "'  				AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . ' -				AND n.unread = 1 +				AND n.notification_read = 0  				AND nt.notification_type = n.item_type  				AND nt.notification_type_enabled = 1';  		$result = $this->db->sql_query($sql); @@ -326,7 +326,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base  		// Make sure that if the user has read the topic, it's marked as read in the notification  		if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time)  		{ -			$this->unread = false; +			$this->notification_read = true;  		}  		return parent::create_insert_array($post, $pre_create_data); diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/includes/notification/type/quote.php index b3a347f98c..5453b267c8 100644 --- a/phpBB/includes/notification/type/quote.php +++ b/phpBB/includes/notification/type/quote.php @@ -124,7 +124,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post  			FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt  			WHERE n.item_type = '" . $this->get_type() . "'  				AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . ' -				AND n.unread = 1 +				AND n.notification_read = 0  				AND nt.notification_type = n.item_type  				AND nt.notification_type_enabled = 1';  		$result = $this->db->sql_query($sql); diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/includes/notification/type/topic.php index 6eb78c30bb..4f51ed4cb1 100644 --- a/phpBB/includes/notification/type/topic.php +++ b/phpBB/includes/notification/type/topic.php @@ -267,7 +267,7 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base  		// Make sure that if the user has read the topic, it's marked as read in the notification  		if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time)  		{ -			$this->unread = false; +			$this->notification_read = true;  		}  		return parent::create_insert_array($post, $pre_create_data);  | 
