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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ucp_remind.php
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_remind
024 * Sending password reminders
025 */
026 class ucp_remind
027 {
028 var $u_action;
029
030 function main($id, $mode)
031 {
032 global $config, $phpbb_root_path, $phpEx, $request;
033 global $db, $user, $template, $phpbb_container, $phpbb_dispatcher;
034
035 if (!$config['allow_password_reset'])
036 {
037 trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
038 }
039
040 $username = $request->variable('username', '', true);
041 $email = strtolower($request->variable('email', ''));
042 $submit = (isset($_POST['submit'])) ? true : false;
043
044 if ($submit)
045 {
046 $sql_array = array(
047 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason',
048 'FROM' => array(USERS_TABLE => 'u'),
049 'WHERE' => "user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
050 AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"
051 );
052
053 /**
054 * Change SQL query for fetching user data
055 *
056 * @event core.ucp_remind_modify_select_sql
057 * @var string email User's email from the form
058 * @var string username User's username from the form
059 * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE
060 * @since 3.1.11-RC1
061 */
062 $vars = array(
063 'email',
064 'username',
065 'sql_array',
066 );
067 extract($phpbb_dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars)));
068
069 $sql = $db->sql_build_query('SELECT', $sql_array);
070 $result = $db->sql_query($sql);
071 $user_row = $db->sql_fetchrow($result);
072 $db->sql_freeresult($result);
073
074 if (!$user_row)
075 {
076 trigger_error('NO_EMAIL_USER');
077 }
078
079 if ($user_row['user_type'] == USER_IGNORE)
080 {
081 trigger_error('NO_USER');
082 }
083
084 if ($user_row['user_type'] == USER_INACTIVE)
085 {
086 if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL)
087 {
088 trigger_error('ACCOUNT_DEACTIVATED');
089 }
090 else
091 {
092 trigger_error('ACCOUNT_NOT_ACTIVATED');
093 }
094 }
095
096 // Check users permissions
097 $auth2 = new \phpbb\auth\auth();
098 $auth2->acl($user_row);
099
100 if (!$auth2->acl_get('u_chgpasswd'))
101 {
102 send_status_line(403, 'Forbidden');
103 trigger_error('NO_AUTH_PASSWORD_REMINDER');
104 }
105
106 $server_url = generate_board_url();
107
108 // Make password at least 8 characters long, make it longer if admin wants to.
109 // gen_rand_string() however has a limit of 12 or 13.
110 $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars'])));
111
112 // For the activation key a random length between 6 and 10 will do.
113 $user_actkey = gen_rand_string(mt_rand(6, 10));
114
115 // Instantiate passwords manager
116 /* @var $manager \phpbb\passwords\manager */
117 $passwords_manager = $phpbb_container->get('passwords.manager');
118
119 $sql = 'UPDATE ' . USERS_TABLE . "
120 SET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'
121 WHERE user_id = " . $user_row['user_id'];
122 $db->sql_query($sql);
123
124 include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
125
126 $messenger = new messenger(false);
127
128 $messenger->template('user_activate_passwd', $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 'PASSWORD' => htmlspecialchars_decode($user_password),
137 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey")
138 );
139
140 $messenger->send($user_row['user_notify_type']);
141
142 meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
143
144 $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
145 trigger_error($message);
146 }
147
148 $template->assign_vars(array(
149 'USERNAME' => $username,
150 'EMAIL' => $email,
151 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword'))
152 );
153
154 $this->tpl_name = 'ucp_remind';
155 $this->page_title = 'UCP_REMIND';
156 }
157 }
158