From a92669994bb99e9e04eb682295d1c775384ba182 Mon Sep 17 00:00:00 2001 From: rechosen Date: Tue, 13 Aug 2013 16:20:45 +0200 Subject: [ticket/11786] Fix typo and ugly English in the notification system PHPDoc The notification system contained two PHPDoc lines that needed improvement. PHPBB3-11786 --- phpBB/phpbb/notification/type/quote.php | 2 +- phpBB/phpbb/notification/type/report_pm.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 0ed13f36fb..041d9765d5 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -17,7 +17,7 @@ if (!defined('IN_PHPBB')) /** * Post quoting notifications class -* This class handles notifications for quoting users in a post +* This class handles notifications for users being quoted in a post * * @package notifications */ diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 3fa73bab41..89733503b0 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) } /** -* Private message reproted notifications class +* Private message reported notifications class * This class handles notifications for private messages when they are reported * * @package notifications -- cgit v1.2.1 From 564a7cc89dcd2464024b78fe2e70adef771368f2 Mon Sep 17 00:00:00 2001 From: rechosen Date: Tue, 13 Aug 2013 17:05:55 +0200 Subject: [ticket/11786] Further improve wording in phpbb/notification/type/quote.php Further improve wording in phpbb/notification/type/quote.php per suggestion of imkingdavid. PHPBB3-11786 --- phpBB/phpbb/notification/type/quote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 041d9765d5..5a626aa211 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -17,7 +17,7 @@ if (!defined('IN_PHPBB')) /** * Post quoting notifications class -* This class handles notifications for users being quoted in a post +* This class handles notifying users when they have been quoted in a post * * @package notifications */ -- cgit v1.2.1 From 2b1ee16e4fa859ade2160910c529f59ddd1db697 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Mon, 14 Oct 2013 21:18:41 -0500 Subject: [ticket/11919] Remove extra argument to notification manager's sql_fetchfield() PHPBB3-11919 --- phpBB/phpbb/notification/manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index c42c84fb1f..b92b247c74 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -154,7 +154,7 @@ class manager AND nt.notification_type_id = n.notification_type_id AND nt.notification_type_enabled = 1'; $result = $this->db->sql_query($sql); - $unread_count = (int) $this->db->sql_fetchfield('unread_count', $result); + $unread_count = (int) $this->db->sql_fetchfield('unread_count'); $this->db->sql_freeresult($result); } @@ -167,7 +167,7 @@ class manager AND nt.notification_type_id = n.notification_type_id AND nt.notification_type_enabled = 1'; $result = $this->db->sql_query($sql); - $total_count = (int) $this->db->sql_fetchfield('total_count', $result); + $total_count = (int) $this->db->sql_fetchfield('total_count'); $this->db->sql_freeresult($result); } -- cgit v1.2.1 From d607f1c927ed6fb54d6c46eb13b5bcd4133f8cfc Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 24 Oct 2013 02:37:20 -0700 Subject: [ticket/11746] Add "admin activation required" notification. PHPBB3-11746 --- .../notification/type/admin_activate_user.php | 174 +++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 phpBB/phpbb/notification/type/admin_activate_user.php (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php new file mode 100644 index 0000000000..1231c0b75d --- /dev/null +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -0,0 +1,174 @@ + 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER', + 'group' => 'NOTIFICATION_GROUP_ADMINISTRATION', + ); + + /** + * {@inheritdoc} + */ + public function is_available() + { + return ($this->auth->acl_get('a_user') && $this->config['require_activation'] == USER_ACTIVATION_ADMIN); + } + + /** + * {@inheritdoc} + */ + public static function get_item_id($user) + { + return (int) $user['user_id']; + } + + /** + * {@inheritdoc} + */ + public static function get_item_parent_id($post) + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function find_users_for_notification($user, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + // Grab admins that have permission to administer users. + $admin_ary = $this->auth->acl_get_list(false, 'a_user', false); + $users = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array(); + + // Grab founders + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_FOUNDER; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($sql)) + { + $users[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + if (empty($users)) + { + return array(); + } + $users = array_unique($users); + + return $this->check_user_notification_options($users, $options); + } + + /** + * {@inheritdoc} + */ + public function get_avatar() + { + return $this->user_loader->get_avatar($this->item_id); + } + + /** + * {@inheritdoc} + */ + public function get_title() + { + $username = $this->user_loader->get_username($this->item_id, 'no_profile'); + + return $this->user->lang($this->language_key, $username); + } + + /** + * {@inheritdoc} + */ + public function get_email_template() + { + return 'admin_activate'; + } + + /** + * {@inheritdoc} + */ + public function get_email_template_variables() + { + $board_url = generate_board_url(); + $username = $this->user_loader->get_username($this->item_id, 'no_profile'); + + return array( + 'USERNAME' => htmlspecialchars_decode($username), + 'U_USER_DETAILS' => "{$board_url}/memberlist.{$this->php_ext}?mode=viewprofile&u={$this->item_id}", + 'U_ACTIVATE' => "{$board_url}/ucp.{$this->php_ext}?mode=activate&u={$this->item_id}&k={$this->get_data('user_actkey')}", + ); + } + + /** + * {@inheritdoc} + */ + public function get_url() + { + return append_sid($this->phpbb_root_path . 'memberlist.' . $this->php_ext, "mode=viewprofile&u={$this->item_id}"); + } + + /** + * {@inheritdoc} + */ + public function users_to_query() + { + return array($this->item_id); + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($user, $pre_create_data) + { + $this->set_data('user_actkey', $user['user_actkey']); + $this->notification_time = $user['user_regdate']; + + return parent::create_insert_array($user, $pre_create_data); + } +} -- cgit v1.2.1 From 7f58a4572eaca75aecff2da889e67ea151616011 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 28 Oct 2013 22:27:25 +0100 Subject: [ticket/11981] Fix code sniffer complaints PHPBB3-11981 --- phpBB/phpbb/notification/type/approve_topic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index ca5bb67754..9f061b8be1 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -34,7 +34,7 @@ class approve_topic extends \phpbb\notification\type\topic { return 'approve_topic'; } - + /** * Language key used to output the text * -- cgit v1.2.1 From 7aa8f6461f1e85cf91931f56b95384e54fec07c2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 Oct 2013 13:05:28 +0100 Subject: [task/code-sniffer] Remove the IN_PHPBB check side-effect from class files. PHPBB3-11980 --- phpBB/phpbb/notification/exception.php | 8 -------- phpBB/phpbb/notification/manager.php | 8 -------- phpBB/phpbb/notification/method/base.php | 8 -------- phpBB/phpbb/notification/method/email.php | 8 -------- phpBB/phpbb/notification/method/jabber.php | 8 -------- phpBB/phpbb/notification/method/messenger_base.php | 8 -------- phpBB/phpbb/notification/method/method_interface.php | 8 -------- phpBB/phpbb/notification/type/approve_post.php | 8 -------- phpBB/phpbb/notification/type/approve_topic.php | 8 -------- phpBB/phpbb/notification/type/base.php | 8 -------- phpBB/phpbb/notification/type/bookmark.php | 8 -------- phpBB/phpbb/notification/type/disapprove_post.php | 8 -------- phpBB/phpbb/notification/type/disapprove_topic.php | 8 -------- phpBB/phpbb/notification/type/group_request.php | 8 -------- phpBB/phpbb/notification/type/group_request_approved.php | 8 -------- phpBB/phpbb/notification/type/pm.php | 8 -------- phpBB/phpbb/notification/type/post.php | 8 -------- phpBB/phpbb/notification/type/post_in_queue.php | 8 -------- phpBB/phpbb/notification/type/quote.php | 8 -------- phpBB/phpbb/notification/type/report_pm.php | 8 -------- phpBB/phpbb/notification/type/report_pm_closed.php | 8 -------- phpBB/phpbb/notification/type/report_post.php | 8 -------- phpBB/phpbb/notification/type/report_post_closed.php | 8 -------- phpBB/phpbb/notification/type/topic.php | 8 -------- phpBB/phpbb/notification/type/topic_in_queue.php | 8 -------- phpBB/phpbb/notification/type/type_interface.php | 8 -------- 26 files changed, 208 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/exception.php b/phpBB/phpbb/notification/exception.php index 275fb3b542..6bdded3fd8 100644 --- a/phpBB/phpbb/notification/exception.php +++ b/phpBB/phpbb/notification/exception.php @@ -9,14 +9,6 @@ namespace phpbb\notification; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Notifications exception * diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index b92b247c74..a3c9425183 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -9,14 +9,6 @@ namespace phpbb\notification; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Notifications service class * @package notifications diff --git a/phpBB/phpbb/notification/method/base.php b/phpBB/phpbb/notification/method/base.php index 327f964424..4ce42de830 100644 --- a/phpBB/phpbb/notification/method/base.php +++ b/phpBB/phpbb/notification/method/base.php @@ -9,14 +9,6 @@ namespace phpbb\notification\method; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Base notifications method class * @package notifications diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index b761eb5a28..e039fae8de 100644 --- a/phpBB/phpbb/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php @@ -9,14 +9,6 @@ namespace phpbb\notification\method; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Email notification method class * This class handles sending emails for notifications diff --git a/phpBB/phpbb/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php index 6ec21bb735..bdfaf5a6fc 100644 --- a/phpBB/phpbb/notification/method/jabber.php +++ b/phpBB/phpbb/notification/method/jabber.php @@ -9,14 +9,6 @@ namespace phpbb\notification\method; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Jabber notification method class * This class handles sending Jabber messages for notifications diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index b1b30f29b7..7cb38eb59d 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -9,14 +9,6 @@ namespace phpbb\notification\method; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Abstract notification method handling email and jabber notifications * using the phpBB messenger. diff --git a/phpBB/phpbb/notification/method/method_interface.php b/phpBB/phpbb/notification/method/method_interface.php index 0131a8bde0..4830d06b86 100644 --- a/phpBB/phpbb/notification/method/method_interface.php +++ b/phpBB/phpbb/notification/method/method_interface.php @@ -9,14 +9,6 @@ namespace phpbb\notification\method; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Base notifications method interface * @package notifications diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index cf4ec57989..51a9a704b0 100644 --- a/phpBB/phpbb/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Post approved notifications class * This class handles notifications for posts when they are approved (to their authors) diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index 9f061b8be1..6229800c68 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Topic approved notifications class * This class handles notifications for topics when they are approved (for authors) diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 3c44468bb8..951585853f 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Base notifications class * @package notifications diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index 50ea7380af..5e6fdd2523 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Bookmark updating notifications class * This class handles notifications for replies to a bookmarked topic diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index 0c9162ec5c..411d4195c7 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Post disapproved notifications class * This class handles notifications for posts when they are disapproved (for authors) diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index dde6f83ec4..19e9d468ce 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Topic disapproved notifications class * This class handles notifications for topics when they are disapproved (for authors) diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php index 1768a8fffa..e0527fe220 100644 --- a/phpBB/phpbb/notification/type/group_request.php +++ b/phpBB/phpbb/notification/type/group_request.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - class group_request extends \phpbb\notification\type\base { /** diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php index be4a902acd..448f049412 100644 --- a/phpBB/phpbb/notification/type/group_request_approved.php +++ b/phpBB/phpbb/notification/type/group_request_approved.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - class group_request_approved extends \phpbb\notification\type\base { /** diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index bed0807b0f..584a30efa6 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Private message notifications class * This class handles notifications for private messages diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index fe50e7f172..9d5c7b0a4c 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Post notifications class * This class handles notifications for replies to a topic diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php index f05ed1ce9a..db16763583 100644 --- a/phpBB/phpbb/notification/type/post_in_queue.php +++ b/phpBB/phpbb/notification/type/post_in_queue.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Post in queue notifications class * This class handles notifications for posts that are put in the moderation queue (for moderators) diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 8fb433990e..e8527261d8 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Post quoting notifications class * This class handles notifying users when they have been quoted in a post diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 13330e2932..55f6bf946d 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Private message reported notifications class * This class handles notifications for private messages when they are reported diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index 2e4a1ceb30..9d2aac329e 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * PM report closed notifications class * This class handles notifications for when reports are closed on PMs (for the one who reported the PM) diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index c2dad6f1bb..89b497efa6 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Reported post notifications class * This class handles notifications for reported posts diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index 270ccf0a1a..5874d48e31 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Post report closed notifications class * This class handles notifications for when reports are closed on posts (for the one who reported the post) diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 8db02f610b..6198881d8d 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Topic notifications class * This class handles notifications for new topics diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php index 056651bc53..c8c1b5b7e2 100644 --- a/phpBB/phpbb/notification/type/topic_in_queue.php +++ b/phpBB/phpbb/notification/type/topic_in_queue.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Topic in queue notifications class * This class handles notifications for topics when they are put in the moderation queue (for moderators) diff --git a/phpBB/phpbb/notification/type/type_interface.php b/phpBB/phpbb/notification/type/type_interface.php index cfc6cd461e..e3e6898172 100644 --- a/phpBB/phpbb/notification/type/type_interface.php +++ b/phpBB/phpbb/notification/type/type_interface.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Base notifications interface * @package notifications -- cgit v1.2.1 From ef1f99183796f8e246f96bca54ca439bf8ea1750 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 Oct 2013 13:37:29 +0100 Subject: [task/code-sniffer] Replace spaces with tabs. PHPBB3-11980 --- phpBB/phpbb/notification/manager.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index a3c9425183..d77a936413 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -254,8 +254,7 @@ class manager SET notification_read = 1 WHERE notification_time <= " . (int) $time . (($notification_type_name !== false) ? ' AND ' . - (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) - : '') . + (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') . (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') . (($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : ''); $this->db->sql_query($sql); @@ -277,8 +276,7 @@ class manager SET notification_read = 1 WHERE notification_time <= " . (int) $time . (($notification_type_name !== false) ? ' AND ' . - (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) - : '') . + (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') . (($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) : ''); $this->db->sql_query($sql); -- cgit v1.2.1 From 66c08de4cb630cdf19040ada5c685f6e451b2101 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sat, 2 Nov 2013 13:50:09 -0700 Subject: [ticket/11746] The IN_PHPBB check is not necessary. PHPBB3-11746 --- phpBB/phpbb/notification/type/admin_activate_user.php | 8 -------- 1 file changed, 8 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index 1231c0b75d..5f146e18ff 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -9,14 +9,6 @@ namespace phpbb\notification\type; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Admin activation notifications class * This class handles notifications for users requiring admin activation -- cgit v1.2.1 From 287c2550b8689a6fd34043ec4b5652997e9a6ab7 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Wed, 13 Nov 2013 23:58:21 -0800 Subject: [ticket/12008] Update the run time value for the prune notifications cron task PHPBB3-12008 --- phpBB/phpbb/notification/manager.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index d77a936413..2e8652771b 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -27,6 +27,9 @@ class manager /** @var \phpbb\user_loader */ protected $user_loader; + /** @var \phpbb\config\config */ + protected $config; + /** @var \phpbb\db\driver\driver */ protected $db; @@ -58,6 +61,7 @@ class manager * @param array $notification_methods * @param ContainerBuilder $phpbb_container * @param \phpbb\user_loader $user_loader + * @param \phpbb\config\config $config * @param \phpbb\db\driver\driver $db * @param \phpbb\user $user * @param string $phpbb_root_path @@ -67,13 +71,14 @@ class manager * @param string $user_notifications_table * @return \phpbb\notification\manager */ - public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) + public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) { $this->notification_types = $notification_types; $this->notification_methods = $notification_methods; $this->phpbb_container = $phpbb_container; $this->user_loader = $user_loader; + $this->config = $config; $this->db = $db; $this->cache = $cache; $this->user = $user; @@ -797,6 +802,8 @@ class manager WHERE notification_time < ' . (int) $timestamp . (($only_read) ? ' AND notification_read = 1' : ''); $this->db->sql_query($sql); + + $this->config->set('read_notification_last_gc', time(), false); } /** -- cgit v1.2.1 From 44b6f45759485cc33bb71ff50a715f39a8d60089 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 08:11:17 -0800 Subject: [ticket/11484] Display login box for users following email notification link. The link used for the latest post now uses view=unread so redirecting the user using the value for the e parameter is no longer necessary. PHPBB3-11484 --- phpBB/phpbb/notification/type/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 9d5c7b0a4c..c0ef184a19 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -234,7 +234,7 @@ class post extends \phpbb\notification\type\base 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), 'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}", - 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&view=unread#unread", + 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&e=1&view=unread#unread", 'U_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", 'U_FORUM' => generate_board_url() . "/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}", -- cgit v1.2.1 From bcf347420e4fe400d02a6ee58e63839f18a86362 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 13:02:26 -0800 Subject: [ticket/11959] Trim the list of users from post notifications. PHPBB3-11959 --- phpBB/phpbb/notification/type/post.php | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 9d5c7b0a4c..0d07df8adf 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -183,6 +183,10 @@ class post extends \phpbb\notification\type\base 'username' => $this->get_data('post_username'), )), $responders); + $responders_cnt = sizeof($responders); + $responders = $this->trim_user_ary($responders); + $extra_cnt = $responders_cnt - sizeof($responders); + foreach ($responders as $responder) { if ($responder['username']) @@ -194,11 +198,18 @@ class post extends \phpbb\notification\type\base $usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile'); } } + $lang_key = $this->language_key; + + if ($responders_cnt > 4) + { + $lang_key .= '_TRIMMED'; + } return $this->user->lang( - $this->language_key, + $lang_key, implode(', ', $usernames), - censor_text($this->get_data('topic_title')) + censor_text($this->get_data('topic_title')), + $extra_cnt ); } @@ -272,6 +283,22 @@ class post extends \phpbb\notification\type\base } } + return $this->trim_user_ary($users); + } + + /** + * Trim the user array passed down to 3 users if the array contains + * more than 4 users. + * + * @param array $users Array of users + * @return array Trimmed array of user_ids + */ + public function trim_user_ary($users) + { + if (sizeof($users) > 4) + { + array_splice($users, 3); + } return $users; } -- cgit v1.2.1 From 43f454a6c6347827a01a1e31478a846ad05bc7f4 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 13:15:08 -0800 Subject: [ticket/11959] Use COMMA_SEPARATOR to join the user list. PHPBB3-11959 --- phpBB/phpbb/notification/type/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 0d07df8adf..e9f9d48978 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -207,7 +207,7 @@ class post extends \phpbb\notification\type\base return $this->user->lang( $lang_key, - implode(', ', $usernames), + implode($this->user->lang['COMMA_SEPARATOR'], $usernames), censor_text($this->get_data('topic_title')), $extra_cnt ); -- cgit v1.2.1 From e3a28e5e2a451794b322be90e1aef9ad4aee256b Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 13:18:28 -0800 Subject: [ticket/11959] Rename $extra_cnt to something more descriptive. PHPBB3-11959 --- phpBB/phpbb/notification/type/post.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index e9f9d48978..87bd4331b6 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -185,7 +185,7 @@ class post extends \phpbb\notification\type\base $responders_cnt = sizeof($responders); $responders = $this->trim_user_ary($responders); - $extra_cnt = $responders_cnt - sizeof($responders); + $trimmed_responders_cnt = $responders_cnt - sizeof($responders); foreach ($responders as $responder) { @@ -200,7 +200,7 @@ class post extends \phpbb\notification\type\base } $lang_key = $this->language_key; - if ($responders_cnt > 4) + if ($trimmed_responders_cnt) { $lang_key .= '_TRIMMED'; } @@ -209,7 +209,7 @@ class post extends \phpbb\notification\type\base $lang_key, implode($this->user->lang['COMMA_SEPARATOR'], $usernames), censor_text($this->get_data('topic_title')), - $extra_cnt + $trimmed_responders_cnt ); } -- cgit v1.2.1