Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

forum.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 4.19 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   * Forum notifications class
 018   * This class handles notifications for replies to a topic in a forum user subscribed to
 019   */
 020   
 021  class forum 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.forum';
 031      }
 032   
 033      /**
 034       * Notification option data (for outputting to the user)
 035       *
 036       * @var bool|array False if the service should use its default data
 037       *                     Array of data (including keys 'id', 'lang', and 'group')
 038       */
 039      static public $notification_option = [
 040          'lang'    => 'NOTIFICATION_TYPE_FORUM',
 041          'group'    => 'NOTIFICATION_GROUP_POSTING',
 042      ];
 043   
 044      /**
 045       * Find the users who want to receive notifications
 046       *
 047       * @param array $post Data from submit_post
 048       * @param array $options Options for finding users for notification
 049       *
 050       * @return array
 051       */
 052      public function find_users_for_notification($post, $options = [])
 053      {
 054          $options = array_merge([
 055              'ignore_users'        => [],
 056          ], $options);
 057   
 058          $users = [];
 059   
 060          $sql = 'SELECT user_id
 061              FROM ' . FORUMS_WATCH_TABLE . '
 062              WHERE forum_id = ' . (int) $post['forum_id'] . '
 063                  AND notify_status = ' . NOTIFY_YES . '
 064                  AND user_id <> ' . (int) $post['poster_id'];
 065          $result = $this->db->sql_query($sql);
 066          while ($row = $this->db->sql_fetchrow($result))
 067          {
 068              $users[] = (int) $row['user_id'];
 069          }
 070          $this->db->sql_freeresult($result);
 071   
 072          $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true);
 073   
 074          if (empty($notify_users))
 075          {
 076              return [];
 077          }
 078   
 079          // Try to find the users who already have been notified about replies and have not read them
 080          // Just update their notifications
 081          $notified_users = $this->notification_manager->get_notified_users($this->get_type(), [
 082              'item_parent_id'    => static::get_item_parent_id($post),
 083              'read'                => 0,
 084          ]);
 085   
 086          foreach ($notified_users as $user => $notification_data)
 087          {
 088              unset($notify_users[$user]);
 089   
 090              /** @var post $notification */
 091              $notification = $this->notification_manager->get_item_type_class($this->get_type(), $notification_data);
 092              $update_responders = $notification->add_responders($post);
 093              if (!empty($update_responders))
 094              {
 095                  $this->notification_manager->update_notification($notification, $update_responders, [
 096                      'item_parent_id'    => self::get_item_parent_id($post),
 097                      'read'                => 0,
 098                      'user_id'            => $user,
 099                  ]);
 100              }
 101          }
 102   
 103          return $notify_users;
 104      }
 105   
 106      /**
 107       * Get email template
 108       *
 109       * @return string|bool
 110       */
 111      public function get_email_template()
 112      {
 113          return 'forum_notify';
 114      }
 115   
 116      /**
 117       * Get email template variables
 118       *
 119       * @return array
 120       */
 121      public function get_email_template_variables()
 122      {
 123          if ($this->get_data('post_username'))
 124          {
 125              $username = $this->get_data('post_username');
 126          }
 127          else
 128          {
 129              $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username');
 130          }
 131   
 132          return [
 133              'AUTHOR_NAME'                => html_entity_decode($username, ENT_COMPAT),
 134              'FORUM_NAME'                => html_entity_decode(censor_text($this->get_data('forum_name')), ENT_COMPAT),
 135              'POST_SUBJECT'                => html_entity_decode(censor_text($this->get_data('post_subject')), ENT_COMPAT),
 136              'TOPIC_TITLE'                => html_entity_decode(censor_text($this->get_data('topic_title')), ENT_COMPAT),
 137   
 138              'U_VIEW_POST'                => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}",
 139              'U_NEWEST_POST'                => generate_board_url() . "/viewtopic.{$this->php_ext}?t={$this->item_parent_id}&e=1&view=unread#unread",
 140              'U_TOPIC'                    => generate_board_url() . "/viewtopic.{$this->php_ext}?t={$this->item_parent_id}",
 141              'U_VIEW_TOPIC'                => generate_board_url() . "/viewtopic.{$this->php_ext}?t={$this->item_parent_id}",
 142              'U_FORUM'                    => generate_board_url() . "/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}",
 143              'U_STOP_WATCHING_FORUM'        => generate_board_url() . "/viewforum.{$this->php_ext}?uid={$this->user_id}&f={$this->get_data('forum_id')}&unwatch=forum",
 144          ];
 145      }
 146  }
 147