aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2012-10-09 10:30:55 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2012-10-09 10:30:55 -0500
commit7411d1d1bdb2e6cc61d5e97d15e184351ea67c64 (patch)
treeb4673e60430dfabdc4e4f935c722e27b2d18be13
parent7a92594bc0b2985019559e85c7d6067c7e9cd1b1 (diff)
downloadforums-7411d1d1bdb2e6cc61d5e97d15e184351ea67c64.tar
forums-7411d1d1bdb2e6cc61d5e97d15e184351ea67c64.tar.gz
forums-7411d1d1bdb2e6cc61d5e97d15e184351ea67c64.tar.bz2
forums-7411d1d1bdb2e6cc61d5e97d15e184351ea67c64.tar.xz
forums-7411d1d1bdb2e6cc61d5e97d15e184351ea67c64.zip
[ticket/11103] Starting work on the reported posts notification
PHPBB3-11103
-rw-r--r--phpBB/includes/notification/type/post_in_queue.php11
-rw-r--r--phpBB/includes/notification/type/report.php85
2 files changed, 94 insertions, 2 deletions
diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/includes/notification/type/post_in_queue.php
index 9c4f0ab8d3..60b4bb4937 100644
--- a/phpBB/includes/notification/type/post_in_queue.php
+++ b/phpBB/includes/notification/type/post_in_queue.php
@@ -49,6 +49,13 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
);
/**
+ * Permission to check for (in find_users_for_notification)
+ *
+ * @var string Permission name
+ */
+ protected $permission = 'm_approve';
+
+ /**
* Get the type of notification this is
* phpbb_notification_type_
*/
@@ -62,7 +69,7 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
*/
public function is_available()
{
- $m_approve = $this->auth->acl_getf('m_approve', true);
+ $m_approve = $this->auth->acl_getf($this->permission, true);
return (!empty($m_approve));
}
@@ -80,7 +87,7 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
'ignore_users' => array(),
), $options);
- $auth_approve = $this->auth->acl_get_list(false, 'm_approve', $post['forum_id']);
+ $auth_approve = $this->auth->acl_get_list(false, $this->permission, $post['forum_id']);
if (empty($auth_approve))
{
diff --git a/phpBB/includes/notification/type/report.php b/phpBB/includes/notification/type/report.php
new file mode 100644
index 0000000000..76c37c99f0
--- /dev/null
+++ b/phpBB/includes/notification/type/report.php
@@ -0,0 +1,85 @@
+<?php
+/**
+*
+* @package notifications
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Post notifications class
+* This class handles notifications for replies to a topic
+*
+* @package notifications
+*/
+class phpbb_notification_type_report extends phpbb_notification_type_post_in_queue
+{
+ /**
+ * Email template to use to send notifications
+ *
+ * @var string
+ */
+ public $email_template = 'topic_notify';
+
+ /**
+ * Language key used to output the text
+ *
+ * @var string
+ */
+ protected $language_key = 'NOTIFICATION_REPORT';
+
+ /**
+ * Permission to check for (in find_users_for_notification)
+ *
+ * @var string Permission name
+ */
+ protected $permission = 'm_report';
+
+ /**
+ * Get the type of notification this is
+ * phpbb_notification_type_
+ */
+ public static function get_item_type()
+ {
+ return 'report';
+ }
+
+ /**
+ * Get email template variables
+ *
+ * @return array
+ */
+ public function get_email_template_variables()
+ {
+ return array(
+ 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))),
+ '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_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')}",
+ 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?uid={$this->user_id}&f={$this->get_data('forum_id')}&t={$this->item_parent_id}&unwatch=topic",
+ );
+ }
+
+ /**
+ * Get the url to this item
+ *
+ * @return string URL
+ */
+ public function get_url()
+ {
+ return append_sid($this->phpbb_root_path . 'mcp.' . $this->php_ext, "f={$this->get_data('forum_id')}&amp;p={$this->item_id}&amp;i=reports&amp;mode=report_details#reports");
+ }
+}