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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
admin_activate_user.php
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 * Admin activation notifications class
018 * This class handles notifications for users requiring admin activation
019 */
020
021 class admin_activate_user extends \phpbb\notification\type\base
022 {
023 /**
024 * {@inheritdoc}
025 */
026 public function get_type()
027 {
028 return 'notification.type.admin_activate_user';
029 }
030
031 /**
032 * {@inheritdoc}
033 */
034 protected $language_key = 'NOTIFICATION_ADMIN_ACTIVATE_USER';
035
036 /**
037 * {@inheritdoc}
038 */
039 static public $notification_option = array(
040 'lang' => 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER',
041 'group' => 'NOTIFICATION_GROUP_ADMINISTRATION',
042 );
043
044 /** @var \phpbb\user_loader */
045 protected $user_loader;
046
047 /** @var \phpbb\config\config */
048 protected $config;
049
050 public function set_config(\phpbb\config\config $config)
051 {
052 $this->config = $config;
053 }
054
055 public function set_user_loader(\phpbb\user_loader $user_loader)
056 {
057 $this->user_loader = $user_loader;
058 }
059
060 /**
061 * {@inheritdoc}
062 */
063 public function is_available()
064 {
065 return ($this->auth->acl_get('a_user') && $this->config['require_activation'] == USER_ACTIVATION_ADMIN);
066 }
067
068 /**
069 * {@inheritdoc}
070 */
071 static public function get_item_id($user)
072 {
073 return (int) $user['user_id'];
074 }
075
076 /**
077 * {@inheritdoc}
078 */
079 static public function get_item_parent_id($post)
080 {
081 return 0;
082 }
083
084 /**
085 * {@inheritdoc}
086 */
087 public function find_users_for_notification($user, $options = array())
088 {
089 $options = array_merge(array(
090 'ignore_users' => array(),
091 ), $options);
092
093 // Grab admins that have permission to administer users.
094 $admin_ary = $this->auth->acl_get_list(false, 'a_user', false);
095 $users = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
096
097 // Grab founders
098 $sql = 'SELECT user_id
099 FROM ' . USERS_TABLE . '
100 WHERE user_type = ' . USER_FOUNDER;
101 $result = $this->db->sql_query($sql);
102
103 while ($row = $this->db->sql_fetchrow($result))
104 {
105 $users[] = (int) $row['user_id'];
106 }
107 $this->db->sql_freeresult($result);
108
109 if (empty($users))
110 {
111 return array();
112 }
113 $users = array_unique($users);
114
115 return $this->check_user_notification_options($users, $options);
116 }
117
118 /**
119 * {@inheritdoc}
120 */
121 public function get_avatar()
122 {
123 return $this->user_loader->get_avatar($this->item_id, false, true);
124 }
125
126 /**
127 * {@inheritdoc}
128 */
129 public function get_title()
130 {
131 $username = $this->user_loader->get_username($this->item_id, 'no_profile');
132
133 return $this->language->lang($this->language_key, $username);
134 }
135
136 /**
137 * {@inheritdoc}
138 */
139 public function get_email_template()
140 {
141 return 'admin_activate';
142 }
143
144 /**
145 * {@inheritdoc}
146 */
147 public function get_email_template_variables()
148 {
149 $board_url = generate_board_url();
150 $username = $this->user_loader->get_username($this->item_id, 'username');
151
152 return array(
153 'USERNAME' => htmlspecialchars_decode($username),
154 'U_USER_DETAILS' => "{$board_url}/memberlist.{$this->php_ext}?mode=viewprofile&u={$this->item_id}",
155 'U_ACTIVATE' => "{$board_url}/ucp.{$this->php_ext}?mode=activate&u={$this->item_id}&k={$this->get_data('user_actkey')}",
156 );
157 }
158
159 /**
160 * {@inheritdoc}
161 */
162 public function get_url()
163 {
164 return $this->user_loader->get_username($this->item_id, 'profile');
165 }
166
167 /**
168 * {@inheritdoc}
169 */
170 public function users_to_query()
171 {
172 return array($this->item_id);
173 }
174
175 /**
176 * {@inheritdoc}
177 */
178 public function create_insert_array($user, $pre_create_data)
179 {
180 $this->set_data('user_actkey', $user['user_actkey']);
181 $this->notification_time = $user['user_regdate'];
182
183 parent::create_insert_array($user, $pre_create_data);
184 }
185 }
186