1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

[ticket/10758] Extract obtain_user_data for the benefit of tests.

PHPBB3-10758
This commit is contained in:
Oleg Pudeyev 2012-12-19 21:50:03 -05:00
parent 7b9092ea3b
commit 9a1df948c6
2 changed files with 21 additions and 6 deletions

View File

@ -952,12 +952,7 @@ class acp_permissions
if ($user_id != $user->data['user_id'])
{
$sql = 'SELECT user_id, username, user_permissions, user_type
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$userdata = $auth->obtain_user_data($user_id);
}
else
{

View File

@ -102,6 +102,26 @@ class phpbb_auth
return;
}
/**
* Retrieves data wanted by acl function from the database for the
* specified user.
*
* @param int $user_id User ID
* @return array User attributes
*/
public function obtain_user_data($user_id)
{
global $db;
$sql = 'SELECT user_id, username, user_permissions, user_type
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$user_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
return $user_data;
}
/**
* Fill ACL array with relevant bitstrings from user_permissions column
* @access private