[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/includes/ucp/ -> ucp_resend.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  /**
  15  * @ignore
  16  */
  17  if (!defined('IN_PHPBB'))
  18  {
  19      exit;
  20  }
  21  
  22  /**
  23  * ucp_resend
  24  * Resending activation emails
  25  */
  26  class ucp_resend
  27  {
  28      var $u_action;
  29  
  30  	function main($id, $mode)
  31      {
  32          global $config, $phpbb_root_path, $phpEx;
  33          global $db, $user, $auth, $template;
  34  
  35          $username    = request_var('username', '', true);
  36          $email        = strtolower(request_var('email', ''));
  37          $submit        = (isset($_POST['submit'])) ? true : false;
  38  
  39          add_form_key('ucp_resend');
  40  
  41          if ($submit)
  42          {
  43              if (!check_form_key('ucp_resend'))
  44              {
  45                  trigger_error('FORM_INVALID');
  46              }
  47  
  48              $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason
  49                  FROM ' . USERS_TABLE . "
  50                  WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
  51                      AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
  52              $result = $db->sql_query($sql);
  53              $user_row = $db->sql_fetchrow($result);
  54              $db->sql_freeresult($result);
  55  
  56              if (!$user_row)
  57              {
  58                  trigger_error('NO_EMAIL_USER');
  59              }
  60  
  61              if ($user_row['user_type'] == USER_IGNORE)
  62              {
  63                  trigger_error('NO_USER');
  64              }
  65  
  66              if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE)
  67              {
  68                  trigger_error('ACCOUNT_ALREADY_ACTIVATED');
  69              }
  70  
  71              if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL))
  72              {
  73                  trigger_error('ACCOUNT_DEACTIVATED');
  74              }
  75  
  76              // Determine coppa status on group (REGISTERED(_COPPA))
  77              $sql = 'SELECT group_name, group_type
  78                  FROM ' . GROUPS_TABLE . '
  79                  WHERE group_id = ' . $user_row['group_id'];
  80              $result = $db->sql_query($sql);
  81              $row = $db->sql_fetchrow($result);
  82              $db->sql_freeresult($result);
  83  
  84              if (!$row)
  85              {
  86                  trigger_error('NO_GROUP');
  87              }
  88  
  89              $coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false;
  90  
  91              include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
  92              $messenger = new messenger(false);
  93  
  94              if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa)
  95              {
  96                  $messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']);
  97                  $messenger->set_addresses($user_row);
  98  
  99                  $messenger->anti_abuse_headers($config, $user);
 100  
 101                  $messenger->assign_vars(array(
 102                      'WELCOME_MSG'    => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
 103                      'USERNAME'        => htmlspecialchars_decode($user_row['username']),
 104                      'U_ACTIVATE'    => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
 105                  );
 106  
 107                  if ($coppa)
 108                  {
 109                      $messenger->assign_vars(array(
 110                          'FAX_INFO'        => $config['coppa_fax'],
 111                          'MAIL_INFO'        => $config['coppa_mail'],
 112                          'EMAIL_ADDRESS'    => $user_row['user_email'])
 113                      );
 114                  }
 115  
 116                  $messenger->send(NOTIFY_EMAIL);
 117              }
 118  
 119              if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
 120              {
 121                  // Grab an array of user_id's with a_user permissions ... these users can activate a user
 122                  $admin_ary = $auth->acl_get_list(false, 'a_user', false);
 123  
 124                  $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
 125                      FROM ' . USERS_TABLE . '
 126                      WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']);
 127                  $result = $db->sql_query($sql);
 128  
 129                  while ($row = $db->sql_fetchrow($result))
 130                  {
 131                      $messenger->template('admin_activate', $row['user_lang']);
 132                      $messenger->set_addresses($row);
 133  
 134                      $messenger->anti_abuse_headers($config, $user);
 135  
 136                      $messenger->assign_vars(array(
 137                          'USERNAME'            => htmlspecialchars_decode($user_row['username']),
 138                          'U_USER_DETAILS'    => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}",
 139                          'U_ACTIVATE'        => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
 140                      );
 141  
 142                      $messenger->send($row['user_notify_type']);
 143                  }
 144                  $db->sql_freeresult($result);
 145              }
 146  
 147              meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
 148  
 149              $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
 150              $message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
 151              trigger_error($message);
 152          }
 153  
 154          $template->assign_vars(array(
 155              'USERNAME'            => $username,
 156              'EMAIL'                => $email,
 157              'S_PROFILE_ACTION'    => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act'))
 158          );
 159  
 160          $this->tpl_name = 'ucp_resend';
 161          $this->page_title = 'UCP_RESEND';
 162      }
 163  }


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