Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 3.80 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_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;
033          global $db, $user, $auth, $template, $phpbb_container;
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_var('username', '', true);
041          $email        = strtolower(request_var('email', ''));
042          $submit        = (isset($_POST['submit'])) ? true : false;
043   
044          if ($submit)
045          {
046              $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
047                  FROM ' . USERS_TABLE . "
048                  WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
049                      AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
050              $result = $db->sql_query($sql);
051              $user_row = $db->sql_fetchrow($result);
052              $db->sql_freeresult($result);
053   
054              if (!$user_row)
055              {
056                  trigger_error('NO_EMAIL_USER');
057              }
058   
059              if ($user_row['user_type'] == USER_IGNORE)
060              {
061                  trigger_error('NO_USER');
062              }
063   
064              if ($user_row['user_type'] == USER_INACTIVE)
065              {
066                  if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL)
067                  {
068                      trigger_error('ACCOUNT_DEACTIVATED');
069                  }
070                  else
071                  {
072                      trigger_error('ACCOUNT_NOT_ACTIVATED');
073                  }
074              }
075   
076              // Check users permissions
077              $auth2 = new \phpbb\auth\auth();
078              $auth2->acl($user_row);
079   
080              if (!$auth2->acl_get('u_chgpasswd'))
081              {
082                  trigger_error('NO_AUTH_PASSWORD_REMINDER');
083              }
084   
085              $server_url = generate_board_url();
086   
087              // Make password at least 8 characters long, make it longer if admin wants to.
088              // gen_rand_string() however has a limit of 12 or 13.
089              $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars'])));
090   
091              // For the activation key a random length between 6 and 10 will do.
092              $user_actkey = gen_rand_string(mt_rand(6, 10));
093   
094              // Instantiate passwords manager
095              $passwords_manager = $phpbb_container->get('passwords.manager');
096   
097              $sql = 'UPDATE ' . USERS_TABLE . "
098                  SET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'
099                  WHERE user_id = " . $user_row['user_id'];
100              $db->sql_query($sql);
101   
102              include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
103   
104              $messenger = new messenger(false);
105   
106              $messenger->template('user_activate_passwd', $user_row['user_lang']);
107   
108              $messenger->set_addresses($user_row);
109   
110              $messenger->anti_abuse_headers($config, $user);
111   
112              $messenger->assign_vars(array(
113                  'USERNAME'        => htmlspecialchars_decode($user_row['username']),
114                  'PASSWORD'        => htmlspecialchars_decode($user_password),
115                  'U_ACTIVATE'    => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey")
116              );
117   
118              $messenger->send($user_row['user_notify_type']);
119   
120              meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
121   
122              $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
123              trigger_error($message);
124          }
125   
126          $template->assign_vars(array(
127              'USERNAME'            => $username,
128              'EMAIL'                => $email,
129              'S_PROFILE_ACTION'    => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword'))
130          );
131   
132          $this->tpl_name = 'ucp_remind';
133          $this->page_title = 'UCP_REMIND';
134      }
135  }
136