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

bookmark.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 3.02 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  * Bookmark updating notifications class
018  * This class handles notifications for replies to a bookmarked topic
019  */
020   
021  class bookmark 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.bookmark';
031      }
032   
033      /**
034      * Language key used to output the text
035      *
036      * @var string
037      */
038      protected $language_key = 'NOTIFICATION_BOOKMARK';
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          'lang'    => 'NOTIFICATION_TYPE_BOOKMARK',
048          'group'    => 'NOTIFICATION_GROUP_POSTING',
049      );
050   
051      /**
052      * Is available
053      */
054      public function is_available()
055      {
056          return $this->config['allow_bookmarks'];
057      }
058   
059      /**
060      * Find the users who want to receive notifications
061      *
062      * @param array $post Data from submit_post
063      * @param array $options Options for finding users for notification
064      *
065      * @return array
066      */
067      public function find_users_for_notification($post, $options = array())
068      {
069          $options = array_merge(array(
070              'ignore_users'        => array(),
071          ), $options);
072   
073          $users = array();
074   
075          $sql = 'SELECT user_id
076              FROM ' . BOOKMARKS_TABLE . '
077              WHERE ' . $this->db->sql_in_set('topic_id', $post['topic_id']) . '
078                  AND user_id <> ' . (int) $post['poster_id'];
079          $result = $this->db->sql_query($sql);
080          while ($row = $this->db->sql_fetchrow($result))
081          {
082              $users[] = (int) $row['user_id'];
083          }
084          $this->db->sql_freeresult($result);
085   
086          $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true);
087   
088          if (empty($notify_users))
089          {
090              return array();
091          }
092   
093          // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
094          $notified_users = $this->notification_manager->get_notified_users($this->get_type(), array(
095              'item_parent_id'    => static::get_item_parent_id($post),
096              'read'                => 0,
097          ));
098   
099          foreach ($notified_users as $user => $notification_data)
100          {
101              unset($notify_users[$user]);
102   
103              /** @var bookmark $notification */
104              $notification = $this->notification_manager->get_item_type_class($this->get_type(), $notification_data);
105              $update_responders = $notification->add_responders($post);
106              if (!empty($update_responders))
107              {
108                  $this->notification_manager->update_notification($notification, $update_responders, array(
109                      'item_parent_id'    => self::get_item_parent_id($post),
110                      'read'                => 0,
111                      'user_id'            => $user,
112                  ));
113              }
114          }
115   
116          return $notify_users;
117      }
118   
119      /**
120      * Get email template
121      *
122      * @return string|bool
123      */
124      public function get_email_template()
125      {
126          return 'bookmark';
127      }
128  }
129