Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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_activate.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 4.66 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_activate
024  * User activation
025  */
026  class ucp_activate
027  {
028      var $u_action;
029   
030      function main($id, $mode)
031      {
032          global $config, $phpbb_root_path, $phpEx, $request;
033          global $db, $user, $auth, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
034   
035          $user_id = $request->variable('u', 0);
036          $key = $request->variable('k', '');
037   
038          $sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason
039              FROM ' . USERS_TABLE . "
040              WHERE user_id = $user_id";
041          $result = $db->sql_query($sql);
042          $user_row = $db->sql_fetchrow($result);
043          $db->sql_freeresult($result);
044   
045          if (!$user_row)
046          {
047              trigger_error('NO_USER');
048          }
049   
050          if ($user_row['user_type'] <> USER_INACTIVE && !$user_row['user_newpasswd'])
051          {
052              meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
053              trigger_error('ALREADY_ACTIVATED');
054          }
055   
056          if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL || $user_row['user_actkey'] !== $key)
057          {
058              trigger_error('WRONG_ACTIVATION');
059          }
060   
061          // Do not allow activating by non administrators when admin activation is on
062          // Only activation type the user should be able to do is INACTIVE_REMIND
063          // or activate a new password which is not an activation state :@
064          if (!$user_row['user_newpasswd'] && $user_row['user_inactive_reason'] != INACTIVE_REMIND && $config['require_activation'] == USER_ACTIVATION_ADMIN && !$auth->acl_get('a_user'))
065          {
066              if (!$user->data['is_registered'])
067              {
068                  login_box('', $user->lang['NO_AUTH_OPERATION']);
069              }
070              send_status_line(403, 'Forbidden');
071              trigger_error('NO_AUTH_OPERATION');
072          }
073   
074          $update_password = ($user_row['user_newpasswd']) ? true : false;
075   
076          if ($update_password)
077          {
078              $sql_ary = array(
079                  'user_actkey'        => '',
080                  'user_password'        => $user_row['user_newpasswd'],
081                  'user_newpasswd'    => '',
082                  'user_login_attempts'    => 0,
083              );
084   
085              $sql = 'UPDATE ' . USERS_TABLE . '
086                  SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
087                  WHERE user_id = ' . $user_row['user_id'];
088              $db->sql_query($sql);
089   
090              $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array(
091                  'reportee_id' => $user_row['user_id'],
092                  $user_row['username']
093              ));
094          }
095   
096          if (!$update_password)
097          {
098              include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
099   
100              user_active_flip('activate', $user_row['user_id']);
101   
102              $sql = 'UPDATE ' . USERS_TABLE . "
103                  SET user_actkey = ''
104                  WHERE user_id = {$user_row['user_id']}";
105              $db->sql_query($sql);
106   
107              // Create the correct logs
108              $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE_USER', false, array(
109                  'reportee_id' => $user_row['user_id']
110              ));
111   
112              if ($auth->acl_get('a_user'))
113              {
114                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE', false, array($user_row['username']));
115              }
116          }
117   
118          if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
119          {
120              /* @var $phpbb_notifications \phpbb\notification\manager */
121              $phpbb_notifications = $phpbb_container->get('notification_manager');
122              $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);
123   
124              include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
125   
126              $messenger = new messenger(false);
127   
128              $messenger->template('admin_welcome_activated', $user_row['user_lang']);
129   
130              $messenger->set_addresses($user_row);
131   
132              $messenger->anti_abuse_headers($config, $user);
133   
134              $messenger->assign_vars(array(
135                  'USERNAME'    => htmlspecialchars_decode($user_row['username']))
136              );
137   
138              $messenger->send($user_row['user_notify_type']);
139   
140              $message = 'ACCOUNT_ACTIVE_ADMIN';
141          }
142          else
143          {
144              if (!$update_password)
145              {
146                  $message = ($user_row['user_inactive_reason'] == INACTIVE_PROFILE) ? 'ACCOUNT_ACTIVE_PROFILE' : 'ACCOUNT_ACTIVE';
147              }
148              else
149              {
150                  $message = 'PASSWORD_ACTIVATED';
151              }
152          }
153   
154          /**
155          * This event can be used to modify data after user account's activation
156          *
157          * @event core.ucp_activate_after
158          * @var    array    user_row    Array with some user data
159          * @var    string    message        Language string of the message that will be displayed to the user
160          * @since 3.1.6-RC1
161          */
162          $vars = array('user_row', 'message');
163          extract($phpbb_dispatcher->trigger_event('core.ucp_activate_after', compact($vars)));
164   
165          meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
166          trigger_error($user->lang[$message]);
167      }
168  }
169