mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/16955] Clean up reset_password and user_loader
PHPBB3-16955
This commit is contained in:
parent
6ad0b533d9
commit
1c02b1a7b5
2 changed files with 12 additions and 12 deletions
|
@ -22,7 +22,7 @@ use phpbb\exception\http_exception;
|
||||||
use phpbb\language\language;
|
use phpbb\language\language;
|
||||||
use phpbb\log\log_interface;
|
use phpbb\log\log_interface;
|
||||||
use phpbb\passwords\manager;
|
use phpbb\passwords\manager;
|
||||||
use phpbb\request\request_interface;
|
use phpbb\request\request;
|
||||||
use phpbb\template\template;
|
use phpbb\template\template;
|
||||||
use phpbb\user;
|
use phpbb\user;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
@ -53,7 +53,7 @@ class reset_password
|
||||||
/** @var manager */
|
/** @var manager */
|
||||||
protected $passwords_manager;
|
protected $passwords_manager;
|
||||||
|
|
||||||
/** @var request_interface */
|
/** @var request */
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
/** @var template */
|
/** @var template */
|
||||||
|
@ -81,7 +81,7 @@ class reset_password
|
||||||
* @param language $language
|
* @param language $language
|
||||||
* @param log_interface $log
|
* @param log_interface $log
|
||||||
* @param manager $passwords_manager
|
* @param manager $passwords_manager
|
||||||
* @param request_interface $request
|
* @param request $request
|
||||||
* @param template $template
|
* @param template $template
|
||||||
* @param user $user
|
* @param user $user
|
||||||
* @param string $users_table
|
* @param string $users_table
|
||||||
|
@ -90,7 +90,7 @@ class reset_password
|
||||||
*/
|
*/
|
||||||
public function __construct(config $config, driver_interface $db, dispatcher $dispatcher, helper $helper,
|
public function __construct(config $config, driver_interface $db, dispatcher $dispatcher, helper $helper,
|
||||||
language $language, log_interface $log, manager $passwords_manager,
|
language $language, log_interface $log, manager $passwords_manager,
|
||||||
request_interface $request, template $template, user $user, string $users_table,
|
request $request, template $template, user $user, string $users_table,
|
||||||
string $root_path, string $php_ext)
|
string $root_path, string $php_ext)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
|
@ -132,10 +132,10 @@ class user_loader
|
||||||
* @param bool $query Should we query the database if this user has not yet been loaded?
|
* @param bool $query Should we query the database if this user has not yet been loaded?
|
||||||
* Typically this should be left as false and you should make sure
|
* Typically this should be left as false and you should make sure
|
||||||
* you load users ahead of time with load_users()
|
* you load users ahead of time with load_users()
|
||||||
* @return array|bool Row from the database of the user or Anonymous if the user wasn't loaded/does not exist
|
* @return array|false Row from the database of the user or Anonymous if the user wasn't loaded/does not exist
|
||||||
* or bool False if the anonymous user was not loaded
|
* or bool False if the anonymous user was not loaded
|
||||||
*/
|
*/
|
||||||
public function get_user($user_id, $query = false)
|
public function get_user(int $user_id, bool $query = false)
|
||||||
{
|
{
|
||||||
if (isset($this->users[$user_id]))
|
if (isset($this->users[$user_id]))
|
||||||
{
|
{
|
||||||
|
@ -162,14 +162,14 @@ class user_loader
|
||||||
* colour (for obtaining the user colour)
|
* colour (for obtaining the user colour)
|
||||||
* full (for obtaining a html string representing a coloured link to the users profile)
|
* full (for obtaining a html string representing a coloured link to the users profile)
|
||||||
* no_profile (the same as full but forcing no profile link)
|
* no_profile (the same as full but forcing no profile link)
|
||||||
* @param string $guest_username Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
|
* @param string|bool $guest_username Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
|
||||||
* @param string $custom_profile_url Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id}
|
* @param string|bool $custom_profile_url Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id}
|
||||||
* @param bool $query Should we query the database if this user has not yet been loaded?
|
* @param bool $query Should we query the database if this user has not yet been loaded?
|
||||||
* Typically this should be left as false and you should make sure
|
* Typically this should be left as false and you should make sure
|
||||||
* you load users ahead of time with load_users()
|
* you load users ahead of time with load_users()
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_username($user_id, $mode, $guest_username = false, $custom_profile_url = false, $query = false)
|
public function get_username(int $user_id, string $mode, $guest_username = false, $custom_profile_url = false, bool $query = false): string
|
||||||
{
|
{
|
||||||
if (!($user = $this->get_user($user_id, $query)))
|
if (!($user = $this->get_user($user_id, $query)))
|
||||||
{
|
{
|
||||||
|
@ -215,11 +215,11 @@ class user_loader
|
||||||
* you load users ahead of time with load_users()
|
* you load users ahead of time with load_users()
|
||||||
* @return array Array with keys 'rank_title', 'rank_img', and 'rank_img_src'
|
* @return array Array with keys 'rank_title', 'rank_img', and 'rank_img_src'
|
||||||
*/
|
*/
|
||||||
public function get_rank($user_id, $query = false)
|
public function get_rank(int $user_id, bool $query = false): array
|
||||||
{
|
{
|
||||||
if (!($user = $this->get_user($user_id, $query)))
|
if (!($user = $this->get_user($user_id, $query)))
|
||||||
{
|
{
|
||||||
return '';
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('phpbb_get_user_rank'))
|
if (!function_exists('phpbb_get_user_rank'))
|
||||||
|
@ -233,7 +233,7 @@ class user_loader
|
||||||
'rank_img_src',
|
'rank_img_src',
|
||||||
);
|
);
|
||||||
|
|
||||||
$user_rank_data = phpbb_get_user_rank($user, (($user['user_id'] == ANONYMOUS) ? false : $user['user_posts']));
|
$user_rank_data = phpbb_get_user_rank($user, ($user['user_id'] == ANONYMOUS ? false : $user['user_posts']));
|
||||||
$rank['rank_title'] = $user_rank_data['title'];
|
$rank['rank_title'] = $user_rank_data['title'];
|
||||||
$rank['rank_img'] = $user_rank_data['img'];
|
$rank['rank_img'] = $user_rank_data['img'];
|
||||||
$rank['rank_img_src'] = $user_rank_data['img_src'];
|
$rank['rank_img_src'] = $user_rank_data['img_src'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue