Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

admin_activate_user.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 3.42 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  * 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      public static $notification_option = array(
 040          'lang'    => 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER',
 041          'group'    => 'NOTIFICATION_GROUP_ADMINISTRATION',
 042      );
 043   
 044      /**
 045      * {@inheritdoc}
 046      */
 047      public function is_available()
 048      {
 049          return ($this->auth->acl_get('a_user') && $this->config['require_activation'] == USER_ACTIVATION_ADMIN);
 050      }
 051   
 052      /**
 053      * {@inheritdoc}
 054      */
 055      public static function get_item_id($user)
 056      {
 057          return (int) $user['user_id'];
 058      }
 059   
 060      /**
 061      * {@inheritdoc}
 062      */
 063      public static function get_item_parent_id($post)
 064      {
 065          return 0;
 066      }
 067   
 068      /**
 069      * {@inheritdoc}
 070      */
 071      public function find_users_for_notification($user, $options = array())
 072      {
 073          $options = array_merge(array(
 074              'ignore_users'    => array(),
 075          ), $options);
 076   
 077          // Grab admins that have permission to administer users.
 078          $admin_ary = $this->auth->acl_get_list(false, 'a_user', false);
 079          $users = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
 080   
 081          // Grab founders
 082          $sql = 'SELECT user_id
 083              FROM ' . USERS_TABLE . '
 084              WHERE user_type = ' . USER_FOUNDER;
 085          $result = $this->db->sql_query($sql);
 086   
 087          while ($row = $this->db->sql_fetchrow($result))
 088          {
 089              $users[] = (int) $row['user_id'];
 090          }
 091          $this->db->sql_freeresult($result);
 092   
 093          if (empty($users))
 094          {
 095              return array();
 096          }
 097          $users = array_unique($users);
 098   
 099          return $this->check_user_notification_options($users, $options);
 100      }
 101   
 102      /**
 103      * {@inheritdoc}
 104      */
 105      public function get_avatar()
 106      {
 107          return $this->user_loader->get_avatar($this->item_id);
 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->user->lang($this->language_key, $username);
 118      }
 119   
 120      /**
 121      * {@inheritdoc}
 122      */
 123      public function get_email_template()
 124      {
 125          return 'admin_activate';
 126      }
 127   
 128      /**
 129      * {@inheritdoc}
 130      */
 131      public function get_email_template_variables()
 132      {
 133          $board_url = generate_board_url();
 134          $username = $this->user_loader->get_username($this->item_id, 'username');
 135   
 136          return array(
 137              'USERNAME'            => htmlspecialchars_decode($username),
 138              'U_USER_DETAILS'    => "{$board_url}/memberlist.{$this->php_ext}?mode=viewprofile&u={$this->item_id}",
 139              'U_ACTIVATE'        => "{$board_url}/ucp.{$this->php_ext}?mode=activate&u={$this->item_id}&k={$this->get_data('user_actkey')}",
 140          );
 141      }
 142   
 143      /**
 144      * {@inheritdoc}
 145      */
 146      public function get_url()
 147      {
 148          return $this->user_loader->get_username($this->item_id, 'profile');
 149      }
 150   
 151      /**
 152      * {@inheritdoc}
 153      */
 154      public function users_to_query()
 155      {
 156          return array($this->item_id);
 157      }
 158   
 159      /**
 160      * {@inheritdoc}
 161      */
 162      public function create_insert_array($user, $pre_create_data)
 163      {
 164          $this->set_data('user_actkey', $user['user_actkey']);
 165          $this->notification_time = $user['user_regdate'];
 166   
 167          return parent::create_insert_array($user, $pre_create_data);
 168      }
 169  }
 170