[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/notification/type/ -> admin_activate_user.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\notification\type;
  15  
  16  /**
  17  * Admin activation notifications class
  18  * This class handles notifications for users requiring admin activation
  19  */
  20  
  21  class admin_activate_user extends \phpbb\notification\type\base
  22  {
  23      /**
  24      * {@inheritdoc}
  25      */
  26  	public function get_type()
  27      {
  28          return 'notification.type.admin_activate_user';
  29      }
  30  
  31      /**
  32      * {@inheritdoc}
  33      */
  34      protected $language_key = 'NOTIFICATION_ADMIN_ACTIVATE_USER';
  35  
  36      /**
  37      * {@inheritdoc}
  38      */
  39      static public $notification_option = array(
  40          'lang'    => 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER',
  41          'group'    => 'NOTIFICATION_GROUP_ADMINISTRATION',
  42      );
  43  
  44      /** @var \phpbb\user_loader */
  45      protected $user_loader;
  46  
  47      /** @var \phpbb\config\config */
  48      protected $config;
  49  
  50  	public function set_config(\phpbb\config\config $config)
  51      {
  52          $this->config = $config;
  53      }
  54  
  55  	public function set_user_loader(\phpbb\user_loader $user_loader)
  56      {
  57          $this->user_loader = $user_loader;
  58      }
  59  
  60      /**
  61      * {@inheritdoc}
  62      */
  63  	public function is_available()
  64      {
  65          return ($this->auth->acl_get('a_user') && $this->config['require_activation'] == USER_ACTIVATION_ADMIN);
  66      }
  67  
  68      /**
  69      * {@inheritdoc}
  70      */
  71  	static public function get_item_id($user)
  72      {
  73          return (int) $user['user_id'];
  74      }
  75  
  76      /**
  77      * {@inheritdoc}
  78      */
  79  	static public function get_item_parent_id($post)
  80      {
  81          return 0;
  82      }
  83  
  84      /**
  85      * {@inheritdoc}
  86      */
  87  	public function find_users_for_notification($user, $options = array())
  88      {
  89          $options = array_merge(array(
  90              'ignore_users'    => array(),
  91          ), $options);
  92  
  93          // Grab admins that have permission to administer users.
  94          $admin_ary = $this->auth->acl_get_list(false, 'a_user', false);
  95          $users = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
  96  
  97          // Grab founders
  98          $sql = 'SELECT user_id
  99              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'            => html_entity_decode($username, ENT_COMPAT),
 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 = array())
 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  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1