Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

post_in_queue.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 3.51 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 in queue notifications class
 018  * This class handles notifications for posts that are put in the moderation queue (for moderators)
 019  */
 020   
 021  class post_in_queue 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.post_in_queue';
 031      }
 032   
 033      /**
 034      * Language key used to output the text
 035      *
 036      * @var string
 037      */
 038      protected $language_key = 'NOTIFICATION_POST_IN_QUEUE';
 039   
 040      /**
 041      * Notification option data (for outputting to the user)
 042      *
 043      * @var bool|array False if the service should use it's default data
 044      *                     Array of data (including keys 'id', 'lang', and 'group')
 045      */
 046      static public $notification_option = array(
 047          'id'    => 'notification.type.needs_approval',
 048          'lang'    => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE',
 049          'group'    => 'NOTIFICATION_GROUP_MODERATION',
 050      );
 051   
 052      /**
 053      * Permission to check for (in find_users_for_notification)
 054      *
 055      * @var string Permission name
 056      */
 057      protected $permission = 'm_approve';
 058   
 059      /**
 060      * Is available
 061      */
 062      public function is_available()
 063      {
 064          $has_permission = $this->auth->acl_getf($this->permission, true);
 065   
 066          return (!empty($has_permission));
 067      }
 068   
 069      /**
 070      * Find the users who want to receive notifications
 071      *
 072      * @param array $post Data from the post
 073      * @param array $options Options for finding users for notification
 074      *
 075      * @return array
 076      */
 077      public function find_users_for_notification($post, $options = array())
 078      {
 079          $options = array_merge(array(
 080              'ignore_users'        => array(),
 081          ), $options);
 082   
 083          // 0 is for global moderator permissions
 084          $auth_approve = $this->auth->acl_get_list(false, $this->permission, array($post['forum_id'], 0));
 085   
 086          if (empty($auth_approve))
 087          {
 088              return array();
 089          }
 090   
 091          $has_permission = array();
 092   
 093          if (isset($auth_approve[$post['forum_id']][$this->permission]))
 094          {
 095              $has_permission = $auth_approve[$post['forum_id']][$this->permission];
 096          }
 097   
 098          if (isset($auth_approve[0][$this->permission]))
 099          {
 100              $has_permission = array_unique(array_merge($has_permission, $auth_approve[0][$this->permission]));
 101          }
 102          sort($has_permission);
 103   
 104          $auth_read = $this->auth->acl_get_list($has_permission, 'f_read', $post['forum_id']);
 105          if (empty($auth_read))
 106          {
 107              return array();
 108          }
 109   
 110          return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array(
 111              'item_type'        => static::$notification_option['id'],
 112          )));
 113      }
 114   
 115      /**
 116      * Get the url to this item
 117      *
 118      * @return string URL
 119      */
 120      public function get_url()
 121      {
 122          return append_sid($this->phpbb_root_path . 'mcp.' . $this->php_ext, "i=queue&amp;mode=approve_details&amp;f={$this->get_data('forum_id')}&amp;p={$this->item_id}");
 123      }
 124   
 125      /**
 126      * {inheritDoc}
 127      */
 128      public function get_redirect_url()
 129      {
 130          return parent::get_url();
 131      }
 132   
 133      /**
 134      * {@inheritdoc}
 135      */
 136      public function create_insert_array($post, $pre_create_data = array())
 137      {
 138          parent::create_insert_array($post, $pre_create_data);
 139   
 140          $this->notification_time = time();
 141      }
 142   
 143      /**
 144      * {@inheritdoc}
 145      */
 146      public function get_insert_array()
 147      {
 148          $data = parent::get_insert_array();
 149          $data['notification_time'] = $this->notification_time;
 150   
 151          return $data;
 152      }
 153   
 154      /**
 155      * Get email template
 156      *
 157      * @return string|bool
 158      */
 159      public function get_email_template()
 160      {
 161          return 'post_in_queue';
 162      }
 163  }
 164