From 0eb6f56a9ae6af541e4c12dec0235da0b508d65d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 5 Mar 2013 11:46:58 -0600 Subject: [PATCH] [ticket/11402] Fix undefined index in post/topic_in_queue PHPBB3-11402 --- .../notification/type/post_in_queue.php | 18 ++++++++++--- .../notification/type/topic_in_queue.php | 25 ++++++++++++++++--- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/includes/notification/type/post_in_queue.php index 1c29bee3cd..9c719205e6 100644 --- a/phpBB/includes/notification/type/post_in_queue.php +++ b/phpBB/includes/notification/type/post_in_queue.php @@ -64,9 +64,9 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post */ public function is_available() { - $m_approve = $this->auth->acl_getf($this->permission, true); + $has_permission = $this->auth->acl_getf($this->permission, true); - return (!empty($m_approve)); + return (!empty($has_permission)); } /** @@ -90,9 +90,19 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post return array(); } - $auth_approve[$post['forum_id']] = array_unique(array_merge($auth_approve[$post['forum_id']], $auth_approve[0])); + $has_permission = array(); - return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, array( + if (isset($auth_approve[$post['forum_id']][$this->permission])) + { + $has_permission = $auth_approve[$post['forum_id']][$this->permission]; + } + + if (isset($auth_approve[0][$this->permission])) + { + $has_permission = array_unique(array_merge($has_permission, $auth_approve[0][$this->permission])); + } + + return $this->check_user_notification_options($has_permission, array_merge($options, array( 'item_type' => self::$notification_option['id'], ))); } diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/includes/notification/type/topic_in_queue.php index dc0b9f9869..c501434c43 100644 --- a/phpBB/includes/notification/type/topic_in_queue.php +++ b/phpBB/includes/notification/type/topic_in_queue.php @@ -52,14 +52,21 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top 'group' => 'NOTIFICATION_GROUP_MODERATION', ); + /** + * Permission to check for (in find_users_for_notification) + * + * @var string Permission name + */ + protected $permission = 'm_approve'; + /** * Is available */ public function is_available() { - $m_approve = $this->auth->acl_getf('m_approve', true); + $has_permission = $this->auth->acl_getf($this->permission, true); - return (!empty($m_approve)); + return (!empty($has_permission)); } /** @@ -83,9 +90,19 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top return array(); } - $auth_approve[$topic['forum_id']] = array_unique(array_merge($auth_approve[$topic['forum_id']], $auth_approve[0])); + $has_permission = array(); - return $this->check_user_notification_options($auth_approve[$topic['forum_id']]['m_approve'], array_merge($options, array( + if (isset($auth_approve[$topic['forum_id']][$this->permission])) + { + $has_permission = $auth_approve[$topic['forum_id']][$this->permission]; + } + + if (isset($auth_approve[0][$this->permission])) + { + $has_permission = array_unique(array_merge($has_permission, $auth_approve[0][$this->permission])); + } + + return $this->check_user_notification_options($has_permission, array_merge($options, array( 'item_type' => self::$notification_option['id'], ))); }