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

group_request.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 3.56 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  class group_request extends \phpbb\notification\type\base
017  {
018      /**
019      * {@inheritdoc}
020      */
021      public function get_type()
022      {
023          return 'notification.type.group_request';
024      }
025   
026      /**
027      * {@inheritdoc}
028      */
029      static public $notification_option = array(
030          'lang'    => 'NOTIFICATION_TYPE_GROUP_REQUEST',
031      );
032   
033      /** @var \phpbb\user_loader */
034      protected $user_loader;
035   
036      public function set_user_loader(\phpbb\user_loader $user_loader)
037      {
038          $this->user_loader = $user_loader;
039      }
040   
041      /**
042      * {@inheritdoc}
043      */
044      public function is_available()
045      {
046          // Leader of any groups?
047          $sql = 'SELECT group_id
048              FROM ' . USER_GROUP_TABLE . '
049              WHERE user_id = ' . (int) $this->user->data['user_id'] . '
050                  AND group_leader = 1';
051          $result = $this->db->sql_query_limit($sql, 1);
052          $row = $this->db->sql_fetchrow($result);
053          $this->db->sql_freeresult($result);
054   
055          return (!empty($row)) ? true : false;
056      }
057   
058      /**
059      * {@inheritdoc}
060      */
061      static public function get_item_id($group)
062      {
063          return (int) $group['user_id'];
064      }
065   
066      /**
067      * {@inheritdoc}
068      */
069      static public function get_item_parent_id($group)
070      {
071          // Group id is the parent
072          return (int) $group['group_id'];
073      }
074   
075      /**
076      * {@inheritdoc}
077      */
078      public function find_users_for_notification($group, $options = array())
079      {
080          $options = array_merge(array(
081              'ignore_users'        => array(),
082          ), $options);
083   
084          $sql = 'SELECT user_id
085              FROM ' . USER_GROUP_TABLE . '
086              WHERE group_leader = 1
087                  AND group_id = ' . (int) $group['group_id'];
088          $result = $this->db->sql_query($sql);
089   
090          $user_ids = array();
091          while ($row = $this->db->sql_fetchrow($result))
092          {
093              $user_ids[] = (int) $row['user_id'];
094          }
095          $this->db->sql_freeresult($result);
096   
097          $this->user_loader->load_users($user_ids);
098   
099          return $this->check_user_notification_options($user_ids, $options);
100      }
101   
102      /**
103      * {@inheritdoc}
104      */
105      public function get_avatar()
106      {
107          return $this->user_loader->get_avatar($this->item_id, false, true);
108      }
109   
110      /**
111      * {@inheritdoc}
112      */
113      public function get_title()
114      {
115          $username = $this->user_loader->get_username($this->item_id, 'no_profile');
116   
117          return $this->language->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name'));
118      }
119   
120      /**
121      * {@inheritdoc}
122      */
123      public function get_email_template()
124      {
125          return 'group_request';
126      }
127   
128      /**
129      * {@inheritdoc}
130      */
131      public function get_email_template_variables()
132      {
133          $user_data = $this->user_loader->get_user($this->item_id);
134   
135          return array(
136              'GROUP_NAME'                   => html_entity_decode($this->get_data('group_name'), ENT_COMPAT),
137              'REQUEST_USERNAME'                => html_entity_decode($user_data['username'], ENT_COMPAT),
138   
139              'U_PENDING'                      => generate_board_url() . "/ucp.{$this->php_ext}?i=groups&mode=manage&action=list&g={$this->item_parent_id}",
140              'U_GROUP'                    => generate_board_url() . "/memberlist.{$this->php_ext}?mode=group&g={$this->item_parent_id}",
141          );
142      }
143   
144      /**
145      * {@inheritdoc}
146      */
147      public function get_url()
148      {
149          return append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext, "i=groups&mode=manage&action=list&g={$this->item_parent_id}");
150      }
151   
152      /**
153      * {@inheritdoc}
154      */
155      public function users_to_query()
156      {
157          return array($this->item_id);
158      }
159   
160      /**
161      * {@inheritdoc}
162      */
163      public function create_insert_array($group, $pre_create_data = array())
164      {
165          $this->set_data('group_name', $group['group_name']);
166   
167          parent::create_insert_array($group, $pre_create_data);
168      }
169  }
170