Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

report_post_closed.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 4.47 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013   
014  namespace phpbb\notification\type;
015   
016  /**
017  * Post report closed notifications class
018  * This class handles notifications for when reports are closed on posts (for the one who reported the post)
019  */
020   
021  class report_post_closed extends \phpbb\notification\type\post
022  {
023      /**
024      * Get notification type name
025      *
026      * @return string
027      */
028      public function get_type()
029      {
030          return 'notification.type.report_post_closed';
031      }
032   
033      /**
034      * Email template to use to send notifications
035      *
036      * @var string
037      */
038      public $email_template = 'report_closed';
039   
040      /**
041      * Language key used to output the text
042      *
043      * @var string
044      */
045      protected $language_key = 'NOTIFICATION_REPORT_CLOSED';
046   
047      /**
048      * Notification option data (for outputting to the user)
049      *
050      * @var bool|array False if the service should use it's default data
051      *                     Array of data (including keys 'id', 'lang', and 'group')
052      */
053      static public $notification_option = [
054          'id'    => 'notification.type.report_post_closed',
055          'lang'    => 'NOTIFICATION_TYPE_REPORT_CLOSED',
056          'group'    => 'NOTIFICATION_GROUP_MISCELLANEOUS',
057      ];
058   
059      /**
060      * Inherit notification read status from post.
061      *
062      * @var bool
063      */
064      protected $inherit_read_status = false;
065   
066      public function is_available()
067      {
068          return $this->auth->acl_getf_global('f_report');
069      }
070   
071      /**
072      * Find the users who want to receive notifications
073      *
074      * @param array $post Data from submit_post
075      * @param array $options Options for finding users for notification
076      *
077      * @return array
078      */
079      public function find_users_for_notification($post, $options = [])
080      {
081          $options = array_merge([
082              'ignore_users'        => [],
083          ], $options);
084   
085          if ($post['reporter'] == $this->user->data['user_id'])
086          {
087              return [];
088          }
089   
090          return $this->check_user_notification_options([$post['reporter']], $options);
091      }
092   
093      /**
094      * Get email template
095      *
096      * @return string|bool
097      */
098      public function get_email_template()
099      {
100          return $this->email_template;
101      }
102   
103      /**
104      * Get email template variables
105      *
106      * @return array
107      */
108      public function get_email_template_variables()
109      {
110          $post_username = $this->get_data('post_username') ?: $this->user_loader->get_username($this->get_data('poster_id'), 'username');
111          $closer_username = $this->user_loader->get_username($this->get_data('closer_id'), 'username');
112   
113          return [
114              'AUTHOR_NAME'    => html_entity_decode($post_username, ENT_COMPAT),
115              'CLOSER_NAME'    => html_entity_decode($closer_username, ENT_COMPAT),
116              'POST_SUBJECT'    => html_entity_decode(censor_text($this->get_data('post_subject')), ENT_COMPAT),
117              'TOPIC_TITLE'    => html_entity_decode(censor_text($this->get_data('topic_title')), ENT_COMPAT),
118   
119              'U_VIEW_POST'    => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}",
120          ];
121      }
122   
123      /**
124      * Get the url to this item
125      *
126      * @return string URL
127      */
128      public function get_url()
129      {
130          return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "p={$this->item_id}#p{$this->item_id}");
131      }
132   
133      /**
134      * {inheritDoc}
135      */
136      public function get_redirect_url()
137      {
138          return $this->get_url();
139      }
140   
141      /**
142      * Get the HTML formatted title of this notification
143      *
144      * @return string
145      */
146      public function get_title()
147      {
148          $username = $this->user_loader->get_username($this->get_data('closer_id'), 'no_profile');
149   
150          return $this->language->lang(
151              $this->language_key,
152              $username
153          );
154      }
155   
156      /**
157      * Get the HTML formatted reference of the notification
158      *
159      * @return string
160      */
161      public function get_reference()
162      {
163          return $this->language->lang(
164              'NOTIFICATION_REFERENCE',
165              censor_text($this->get_data('post_subject'))
166          );
167      }
168   
169      /**
170      * Get the user's avatar
171      */
172      public function get_avatar()
173      {
174          return $this->user_loader->get_avatar($this->get_data('closer_id'), false, true);
175      }
176   
177      /**
178      * Users needed to query before this notification can be displayed
179      *
180      * @return array Array of user_ids
181      */
182      public function users_to_query()
183      {
184          return [$this->get_data('closer_id')];
185      }
186   
187      /**
188      * {@inheritdoc}
189      */
190      public function create_insert_array($post, $pre_create_data = [])
191      {
192          $this->set_data('closer_id', $post['closer_id']);
193   
194          parent::create_insert_array($post, $pre_create_data);
195   
196          $this->notification_time = time();
197      }
198   
199      /**
200      * {@inheritdoc}
201      */
202      public function get_insert_array()
203      {
204          $data = parent::get_insert_array();
205          $data['notification_time'] = $this->notification_time;
206   
207          return $data;
208      }
209  }
210