mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-20 07:21:30 +02:00
[ticket/16345] Small improvements
PHPBB3-16346
This commit is contained in:
@@ -95,8 +95,6 @@ class auth
|
||||
$this->acl_cache($userdata);
|
||||
$this->_fill_acl($userdata['user_permissions']);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +211,7 @@ class auth
|
||||
* @param bool $clean set to true if only values needs to be returned which are set/unset
|
||||
*
|
||||
* @return array Contains the forum ids with the specified permission set to true.
|
||||
This is a nested array: array => forum_id => permission => true
|
||||
* This is a nested array: array => forum_id => permission => true
|
||||
*/
|
||||
function acl_getf($opt, $clean = false)
|
||||
{
|
||||
@@ -524,19 +522,19 @@ class auth
|
||||
ORDER BY role_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$this->role_cache = array();
|
||||
$role_cache = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
||||
$role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($this->role_cache as $role_id => $role_options)
|
||||
foreach ($role_cache as $role_id => $role_options)
|
||||
{
|
||||
$this->role_cache[$role_id] = serialize($role_options);
|
||||
$role_cache[$role_id] = serialize($role_options);
|
||||
}
|
||||
|
||||
$cache->put('_role_cache', $this->role_cache);
|
||||
$cache->put('_role_cache', $role_cache);
|
||||
|
||||
// Now empty user permissions
|
||||
$where_sql = '';
|
||||
@@ -562,8 +560,6 @@ class auth
|
||||
*/
|
||||
$vars = array('user_id');
|
||||
extract($phpbb_dispatcher->trigger_event('core.acl_clear_prefetch_after', compact($vars)));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -828,9 +824,9 @@ class auth
|
||||
global $db, $cache;
|
||||
|
||||
// Check if the role-cache is there
|
||||
if (($this->role_cache = $cache->get('_role_cache')) === false)
|
||||
if (($role_cache = $cache->get('_role_cache')) === false)
|
||||
{
|
||||
$this->role_cache = array();
|
||||
$role_cache = array();
|
||||
|
||||
// We pre-fetch roles
|
||||
$sql = 'SELECT *
|
||||
@@ -840,16 +836,16 @@ class auth
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
||||
$role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($this->role_cache as $role_id => $role_options)
|
||||
foreach ($role_cache as $role_id => $role_options)
|
||||
{
|
||||
$this->role_cache[$role_id] = serialize($role_options);
|
||||
$role_cache[$role_id] = serialize($role_options);
|
||||
}
|
||||
|
||||
$cache->put('_role_cache', $this->role_cache);
|
||||
$cache->put('_role_cache', $role_cache);
|
||||
}
|
||||
|
||||
$hold_ary = array();
|
||||
@@ -865,7 +861,7 @@ class auth
|
||||
// If a role is assigned, assign all options included within this role. Else, only set this one option.
|
||||
if ($row['auth_role_id'])
|
||||
{
|
||||
$hold_ary[$row['forum_id']] = (empty($hold_ary[$row['forum_id']])) ? unserialize($this->role_cache[$row['auth_role_id']]) : $hold_ary[$row['forum_id']] + unserialize($this->role_cache[$row['auth_role_id']]);
|
||||
$hold_ary[$row['forum_id']] = (empty($hold_ary[$row['forum_id']])) ? unserialize($role_cache[$row['auth_role_id']]) : $hold_ary[$row['forum_id']] + unserialize($role_cache[$row['auth_role_id']]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -890,9 +886,9 @@ class auth
|
||||
{
|
||||
$this->_set_group_hold_ary($hold_ary[$row['forum_id']], $row['auth_option_id'], $row['auth_setting']);
|
||||
}
|
||||
else if (!empty($this->role_cache[$row['auth_role_id']]))
|
||||
else if (!empty($role_cache[$row['auth_role_id']]))
|
||||
{
|
||||
foreach (unserialize($this->role_cache[$row['auth_role_id']]) as $option_id => $setting)
|
||||
foreach (unserialize($role_cache[$row['auth_role_id']]) as $option_id => $setting)
|
||||
{
|
||||
$this->_set_group_hold_ary($hold_ary[$row['forum_id']], $option_id, $setting);
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@ use phpbb\captcha\factory;
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\passwords\manager;
|
||||
use phpbb\request\request_interface;
|
||||
use phpbb\user;
|
||||
|
||||
/**
|
||||
@@ -35,18 +34,9 @@ class db extends base
|
||||
/** @var driver_interface DBAL driver instance */
|
||||
protected $db;
|
||||
|
||||
/** @var request_interface Request object */
|
||||
protected $request;
|
||||
|
||||
/** @var user User object */
|
||||
protected $user;
|
||||
|
||||
/** @var string phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* phpBB passwords manager
|
||||
*
|
||||
@@ -61,21 +51,15 @@ class db extends base
|
||||
* @param config $config
|
||||
* @param driver_interface $db
|
||||
* @param manager $passwords_manager
|
||||
* @param request_interface $request
|
||||
* @param user $user
|
||||
* @param string $phpbb_root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
public function __construct(factory $captcha_factory, config $config, driver_interface $db, manager $passwords_manager, request_interface $request, user $user, $phpbb_root_path, $php_ext)
|
||||
public function __construct(factory $captcha_factory, config $config, driver_interface $db, manager $passwords_manager, user $user)
|
||||
{
|
||||
$this->captcha_factory = $captcha_factory;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->passwords_manager = $passwords_manager;
|
||||
$this->request = $request;
|
||||
$this->user = $user;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user