Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

ucp_resend.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 5.53 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  /**
015  * @ignore
016  */
017  if (!defined('IN_PHPBB'))
018  {
019      exit;
020  }
021   
022  /**
023  * ucp_resend
024  * Resending activation emails
025  */
026  class ucp_resend
027  {
028      var $u_action;
029   
030      function main($id, $mode)
031      {
032          global $config, $phpbb_root_path, $phpEx;
033          global $db, $user, $auth, $template, $request;
034   
035          $username    = $request->variable('username', '', true);
036          $email        = strtolower($request->variable('email', ''));
037          $submit        = (isset($_POST['submit'])) ? true : false;
038   
039          add_form_key('ucp_resend');
040   
041          if ($submit)
042          {
043              if (!check_form_key('ucp_resend'))
044              {
045                  trigger_error('FORM_INVALID');
046              }
047   
048              $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_actkey_expiration, user_inactive_reason
049                  FROM ' . USERS_TABLE . "
050                  WHERE user_email = '" . $db->sql_escape($email) . "'
051                      AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
052              $result = $db->sql_query($sql);
053              $user_row = $db->sql_fetchrow($result);
054              $db->sql_freeresult($result);
055   
056              if (!$user_row)
057              {
058                  trigger_error('NO_EMAIL_USER');
059              }
060   
061              if ($user_row['user_type'] == USER_IGNORE)
062              {
063                  trigger_error('NO_USER');
064              }
065   
066              if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE)
067              {
068                  trigger_error('ACCOUNT_ALREADY_ACTIVATED');
069              }
070   
071              if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL))
072              {
073                  trigger_error('ACCOUNT_DEACTIVATED');
074              }
075   
076              // Do not resend activation email if valid one still exists
077              if (!empty($user_row['user_actkey']) && (int) $user_row['user_actkey_expiration'] >= time())
078              {
079                  trigger_error('ACTIVATION_ALREADY_SENT');
080              }
081   
082              // Determine coppa status on group (REGISTERED(_COPPA))
083              $sql = 'SELECT group_name, group_type
084                  FROM ' . GROUPS_TABLE . '
085                  WHERE group_id = ' . $user_row['group_id'];
086              $result = $db->sql_query($sql);
087              $row = $db->sql_fetchrow($result);
088              $db->sql_freeresult($result);
089   
090              if (!$row)
091              {
092                  trigger_error('NO_GROUP');
093              }
094   
095              $coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false;
096   
097              include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
098              $messenger = new messenger(false);
099   
100              if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa)
101              {
102                  $messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']);
103                  $messenger->set_addresses($user_row);
104   
105                  $messenger->anti_abuse_headers($config, $user);
106   
107                  $messenger->assign_vars(array(
108                      'WELCOME_MSG'    => html_entity_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), ENT_COMPAT),
109                      'USERNAME'        => html_entity_decode($user_row['username'], ENT_COMPAT),
110                      'U_ACTIVATE'    => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
111                  );
112   
113                  if ($coppa)
114                  {
115                      $messenger->assign_vars(array(
116                          'FAX_INFO'        => $config['coppa_fax'],
117                          'MAIL_INFO'        => $config['coppa_mail'],
118                          'EMAIL_ADDRESS'    => $user_row['user_email'])
119                      );
120                  }
121   
122                  $messenger->send(NOTIFY_EMAIL);
123              }
124   
125              if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
126              {
127                  // Grab an array of user_id's with a_user permissions ... these users can activate a user
128                  $admin_ary = $auth->acl_get_list(false, 'a_user', false);
129   
130                  $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
131                      FROM ' . USERS_TABLE . '
132                      WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']);
133                  $result = $db->sql_query($sql);
134   
135                  while ($row = $db->sql_fetchrow($result))
136                  {
137                      $messenger->template('admin_activate', $row['user_lang']);
138                      $messenger->set_addresses($row);
139   
140                      $messenger->anti_abuse_headers($config, $user);
141   
142                      $messenger->assign_vars(array(
143                          'USERNAME'            => html_entity_decode($user_row['username'], ENT_COMPAT),
144                          'U_USER_DETAILS'    => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}",
145                          'U_ACTIVATE'        => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
146                      );
147   
148                      $messenger->send($row['user_notify_type']);
149                  }
150                  $db->sql_freeresult($result);
151              }
152   
153              $this->update_activation_expiration();
154   
155              meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
156   
157              $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
158              $message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
159              trigger_error($message);
160          }
161   
162          $template->assign_vars(array(
163              'USERNAME'            => $username,
164              'EMAIL'                => $email,
165              'S_PROFILE_ACTION'    => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act'))
166          );
167   
168          $this->tpl_name = 'ucp_resend';
169          $this->page_title = 'UCP_RESEND';
170      }
171   
172      /**
173       * Update activation expiration to 1 day from now
174       *
175       * @return void
176       */
177      protected function update_activation_expiration(): void
178      {
179          global $db, $user;
180   
181          $sql_ary = [
182              'user_actkey_expiration'    => $user::get_token_expiration(),
183          ];
184   
185          $sql = 'UPDATE ' . USERS_TABLE . '
186              SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
187              WHERE user_id = ' . (int) $user->id();
188          $db->sql_query($sql);
189      }
190  }
191