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

approve_post.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 3.29 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 approved notifications class
018  * This class handles notifications for posts when they are approved (to their authors)
019  */
020   
021  class approve_post 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.approve_post';
031      }
032   
033      /**
034      * Language key used to output the text
035      *
036      * @var string
037      */
038      protected $language_key = 'NOTIFICATION_POST_APPROVED';
039   
040      /**
041      * Inherit notification read status from post.
042      *
043      * @var bool
044      */
045      protected $inherit_read_status = false;
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 = array(
054          'id'    => 'moderation_queue',
055          'lang'    => 'NOTIFICATION_TYPE_MODERATION_QUEUE',
056          'group'    => 'NOTIFICATION_GROUP_POSTING',
057      );
058   
059      /**
060      * Is available
061      */
062      public function is_available()
063      {
064          return !$this->auth->acl_get('m_approve');
065      }
066   
067      /**
068      * Find the users who want to receive notifications
069      *
070      * @param array $post Data from submit_post
071      * @param array $options Options for finding users for notification
072      *
073      * @return array
074      */
075      public function find_users_for_notification($post, $options = array())
076      {
077          $options = array_merge(array(
078              'ignore_users'        => array(),
079          ), $options);
080   
081          return $this->get_authorised_recipients(array($post['poster_id']), $post['forum_id'], array_merge($options, array(
082              'item_type'        => static::$notification_option['id'],
083          )));
084      }
085   
086      /**
087      * Pre create insert array function
088      * This allows you to perform certain actions, like run a query
089      * and load data, before create_insert_array() is run. The data
090      * returned from this function will be sent to create_insert_array().
091      *
092      * @param array $post Post data from submit_post
093      * @param array $notify_users Notify users list
094      *         Formatted from find_users_for_notification()
095      * @return array Whatever you want to send to create_insert_array().
096      */
097      public function pre_create_insert_array($post, $notify_users)
098      {
099          // In the parent class, this is used to check if the post is already
100          // read by a user and marks the notification read if it was marked read.
101          // Returning an empty array in effect, forces it to be marked as unread
102          // (and also saves a query)
103          return array();
104      }
105   
106      /**
107      * {@inheritdoc}
108      */
109      public function create_insert_array($post, $pre_create_data = array())
110      {
111          $this->set_data('post_subject', $post['post_subject']);
112   
113          parent::create_insert_array($post, $pre_create_data);
114   
115          $this->notification_time = time();
116      }
117   
118      /**
119      * {@inheritdoc}
120      */
121      public function get_insert_array()
122      {
123          $data = parent::get_insert_array();
124          $data['notification_time'] = $this->notification_time;
125   
126          return $data;
127      }
128   
129      /**
130      * Get email template
131      *
132      * @return string|bool
133      */
134      public function get_email_template()
135      {
136          return 'post_approved';
137      }
138   
139      /**
140      * {inheritDoc}
141      */
142      public function get_redirect_url()
143      {
144          return $this->get_url();
145      }
146  }
147