[ Index ]

PHP Cross Reference of phpBB-3.1.12-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      public static $notification_option = array(
  40          'lang'    => 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER',
  41          'group'    => 'NOTIFICATION_GROUP_ADMINISTRATION',
  42      );
  43  
  44      /**
  45      * {@inheritdoc}
  46      */
  47  	public function is_available()
  48      {
  49          return ($this->auth->acl_get('a_user') && $this->config['require_activation'] == USER_ACTIVATION_ADMIN);
  50      }
  51  
  52      /**
  53      * {@inheritdoc}
  54      */
  55  	public static function get_item_id($user)
  56      {
  57          return (int) $user['user_id'];
  58      }
  59  
  60      /**
  61      * {@inheritdoc}
  62      */
  63  	public static function get_item_parent_id($post)
  64      {
  65          return 0;
  66      }
  67  
  68      /**
  69      * {@inheritdoc}
  70      */
  71  	public function find_users_for_notification($user, $options = array())
  72      {
  73          $options = array_merge(array(
  74              'ignore_users'    => array(),
  75          ), $options);
  76  
  77          // Grab admins that have permission to administer users.
  78          $admin_ary = $this->auth->acl_get_list(false, 'a_user', false);
  79          $users = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
  80  
  81          // Grab founders
  82          $sql = 'SELECT user_id
  83              FROM ' . USERS_TABLE . '
  84              WHERE user_type = ' . USER_FOUNDER;
  85          $result = $this->db->sql_query($sql);
  86  
  87          while ($row = $this->db->sql_fetchrow($result))
  88          {
  89              $users[] = (int) $row['user_id'];
  90          }
  91          $this->db->sql_freeresult($result);
  92  
  93          if (empty($users))
  94          {
  95              return array();
  96          }
  97          $users = array_unique($users);
  98  
  99          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, 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->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  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1