本文整理汇总了PHP中phpbb\auth\auth::acl_get_list方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::acl_get_list方法的具体用法?PHP auth::acl_get_list怎么用?PHP auth::acl_get_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\auth\auth
的用法示例。
在下文中一共展示了auth::acl_get_list方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admins_and_mods
private function admins_and_mods()
{
// grab all admins
$admin_ary = $this->auth->acl_get_list(false, 'a_', false);
$admin_ary = !empty($admin_ary[0]['a_']) ? $admin_ary[0]['a_'] : array();
//grab all mods
$mod_ary = $this->auth->acl_get_list(false, 'm_', false);
$mod_ary = !empty($mod_ary[0]['m_']) ? $mod_ary[0]['m_'] : array();
$admin_mod_array = array_unique(array_merge($admin_ary, $mod_ary));
if (sizeof($admin_mod_array)) {
if (in_array($this->user->data['user_id'], $admin_mod_array)) {
return true;
}
}
return false;
}
示例2: store_forum_id
public function store_forum_id($event)
{
#echo "<h2>Forum ID: $event[forum_id]</h2>";
$this->theCurrentForumId = $event['forum_id'];
$result = $this->auth->acl_get_list(false, 'm_', $this->theCurrentForumId);
$this->localMods = $result[$this->theCurrentForumId]['m_'];
#var_dump($this->localMods);
}
示例3: get_authorised_recipients
/**
* Get a list of users that are authorised to receive notifications
*
* @param array $users Array of users that have subscribed to a notification
* @param int $forum_id Forum ID of the forum
* @param array $options Array of notification options
* @param bool $sort Whether the users array should be sorted. Default: false
* @return array Array of users that are authorised recipients
*/
protected function get_authorised_recipients($users, $forum_id, $options, $sort = false)
{
if (empty($users)) {
return array();
}
$users = array_unique($users);
if ($sort) {
sort($users);
}
$auth_read = $this->auth->acl_get_list($users, 'f_read', $forum_id);
if (empty($auth_read)) {
return array();
}
return $this->check_user_notification_options($auth_read[$forum_id]['f_read'], $options);
}
示例4: topposters
public function topposters()
{
$howmany = $this->howmany();
$sql_where = $this->ignore_users();
//set two variables for the sql
$sql_and = $sql_other = '';
if (($user_posts = $this->cache->get('_top_five_posters')) === false) {
$user_posts = $admin_mod_array = array();
// quick check for forum moderators and administrators
// some may not want to show them
$show_admins_mods = $this->config['top_five_show_admins_mods'];
if (!$show_admins_mods) {
// grab all admins
$admin_ary = $this->auth->acl_get_list(false, 'a_', false);
$admin_ary = !empty($admin_ary[0]['a_']) ? $admin_ary[0]['a_'] : array();
//grab all mods
$mod_ary = $this->auth->acl_get_list(false, 'm_', false);
$mod_ary = !empty($mod_ary[0]['m_']) ? $mod_ary[0]['m_'] : array();
$admin_mod_array = array_unique(array_merge($admin_ary, $mod_ary));
if (sizeof($admin_mod_array)) {
$sql_and = empty($sql_where) ? ' WHERE' : ' AND';
$sql_and .= ' ' . $this->db->sql_in_set('user_id', $admin_mod_array, true);
}
}
$sql_other = empty($sql_and) && empty($sql_where) ? ' WHERE' : ' AND';
$sql_other .= ' user_posts <> 0';
// do the main sql query
$sql = 'SELECT user_id, username, user_colour, user_posts
FROM ' . USERS_TABLE . '
' . $sql_where . ' ' . $sql_and . '
' . $sql_other . '
ORDER BY user_posts DESC';
$result = $this->db->sql_query_limit($sql, $howmany);
while ($row = $this->db->sql_fetchrow($result)) {
$user_posts[$row['user_id']] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'user_posts' => $row['user_posts']);
}
$this->db->sql_freeresult($result);
// cache this data for 5 minutes, this improves performance
$this->cache->put('_top_five_posters', $user_posts, 300);
}
foreach ($user_posts as $row) {
$username_string = $this->auth->acl_get('u_viewprofile') ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']);
$this->template->assign_block_vars('top_five_active', array('S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'author_id=' . $row['user_id'] . '&sr=posts'), 'POSTS' => number_format($row['user_posts']), 'USERNAME_FULL' => $username_string));
}
}
示例5: phpbb_update_foes
/**
* Removes moderators and administrators from foe lists.
*
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\auth\auth $auth Authentication object
* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
* @return null
*/
function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false)
{
// update foes for some user
if (is_array($user_id) && sizeof($user_id)) {
$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
WHERE ' . $db->sql_in_set('zebra_id', $user_id) . '
AND foe = 1';
$db->sql_query($sql);
return;
}
// update foes for some group
if (is_array($group_id) && sizeof($group_id)) {
// Grab group settings...
$sql_ary = array('SELECT' => 'a.group_id', 'FROM' => array(ACL_OPTIONS_TABLE => 'ao', ACL_GROUPS_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), 'ON' => 'a.auth_role_id = r.role_id')), 'WHERE' => '(ao.auth_option_id = a.auth_option_id OR ao.auth_option_id = r.auth_option_id)
AND ' . $db->sql_in_set('a.group_id', $group_id) . "\n\t\t\t\tAND ao.auth_option IN ('a_', 'm_')", 'GROUP_BY' => 'a.group_id');
$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
$groups = array();
while ($row = $db->sql_fetchrow($result)) {
$groups[] = (int) $row['group_id'];
}
$db->sql_freeresult($result);
if (!sizeof($groups)) {
return;
}
switch ($db->get_sql_layer()) {
case 'mysqli':
case 'mysql4':
$sql = 'DELETE ' . ($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=') ? 'z.*' : ZEBRA_TABLE) . '
FROM ' . ZEBRA_TABLE . ' z, ' . USER_GROUP_TABLE . ' ug
WHERE z.zebra_id = ug.user_id
AND z.foe = 1
AND ' . $db->sql_in_set('ug.group_id', $groups);
$db->sql_query($sql);
break;
default:
$sql = 'SELECT user_id
FROM ' . USER_GROUP_TABLE . '
WHERE ' . $db->sql_in_set('group_id', $groups);
$result = $db->sql_query($sql);
$users = array();
while ($row = $db->sql_fetchrow($result)) {
$users[] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
if (sizeof($users)) {
$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
WHERE ' . $db->sql_in_set('zebra_id', $users) . '
AND foe = 1';
$db->sql_query($sql);
}
break;
}
return;
}
// update foes for everyone
$perms = array();
foreach ($auth->acl_get_list(false, array('a_', 'm_'), false) as $forum_id => $forum_ary) {
foreach ($forum_ary as $auth_option => $user_ary) {
$perms = array_merge($perms, $user_ary);
}
}
if (sizeof($perms)) {
$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
WHERE ' . $db->sql_in_set('zebra_id', array_unique($perms)) . '
AND foe = 1';
$db->sql_query($sql);
}
unset($perms);
}