本文整理汇总了PHP中phpbb\auth\auth::acl_getf方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::acl_getf方法的具体用法?PHP auth::acl_getf怎么用?PHP auth::acl_getf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\auth\auth
的用法示例。
在下文中一共展示了auth::acl_getf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_disallowed_forums
/**
* Get an array of disallowed forums
*
* @param bool $disallow_access Whether the array for disallowing access
* should be filled
* @return array Array of forums the user is not allowed to access
*/
public function get_disallowed_forums($disallow_access)
{
if ($disallow_access == true) {
$disallow_access = array_unique(array_keys($this->auth->acl_getf('!f_read', true)));
} else {
$disallow_access = array();
}
return $disallow_access;
}
示例2: __construct
/**
* Constructor
*
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\config\config $config Config object
* @param \phpbb\content_visibility $content_visibility Content visibility
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\user $user User object
* @param integer $cache_time Cache results for 3 hours by default
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\content_visibility $content_visibility, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $cache_time = 10800)
{
$this->auth = $auth;
$this->config = $config;
$this->content_visibility = $content_visibility;
$this->db = $db;
$this->user = $user;
$this->cache_time = $cache_time;
$this->ex_fid_ary = array_unique(array_keys($this->auth->acl_getf('!f_read', true)));
}
示例3: __construct
/**
* Constructor
*
* @param auth $auth Auth object
* @param config $config Config object
* @param content_visibility $content_visibility Content visibility
* @param driver_interface $db Database connection
* @param user $user User object
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension
* @param integer $cache_time Cache results for 3 hours by default
*/
public function __construct(auth $auth, config $config, content_visibility $content_visibility, driver_interface $db, user $user, $phpbb_root_path, $php_ext, $cache_time = 10800)
{
$this->auth = $auth;
$this->config = $config;
$this->content_visibility = $content_visibility;
$this->db = $db;
$this->user = $user;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->cache_time = $cache_time;
$this->ex_fid_ary = array_unique(array_keys($this->auth->acl_getf('!f_read', true)));
}
示例4: get_global_visibility_sql
/**
* Create topic/post visibility SQL for all forums on the board
*
* Note: Read permissions are not checked. Forums without read permissions
* should be in $exclude_forum_ids
*
* @param $mode string Either "topic" or "post"
* @param $exclude_forum_ids array Array of forum ids which are excluded
* @param $table_alias string Table alias to prefix in SQL queries
* @return string The appropriate combination SQL logic for topic/post_visibility
*/
public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '')
{
$where_sqls = array();
$approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids);
if (sizeof($exclude_forum_ids))
{
$where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . '
AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')';
}
else
{
$where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
}
if (sizeof($approve_forums))
{
$where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
return '(' . implode(' OR ', $where_sqls) . ')';
}
// There is only one element, so we just return that one
return $where_sqls[0];
}
示例5: get_global_visibility_sql
/**
* Create topic/post visibility SQL for all forums on the board
*
* Note: Read permissions are not checked. Forums without read permissions
* should be in $exclude_forum_ids
*
* @param $mode string Either "topic" or "post"
* @param $exclude_forum_ids array Array of forum ids which are excluded
* @param $table_alias string Table alias to prefix in SQL queries
* @return string The appropriate combination SQL logic for topic/post_visibility
*/
public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '')
{
$where_sqls = array();
$approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids);
$visibility_sql_overwrite = null;
/**
* Allow changing the result of calling get_global_visibility_sql
*
* @event core.phpbb_content_visibility_get_global_visibility_before
* @var array where_sqls The action the user tried to execute
* @var string mode Either "topic" or "post" depending on the query this is being used in
* @var array forum_ids Array of forum ids which the posts/topics are limited to
* @var string table_alias Table alias to prefix in SQL queries
* @var array approve_forums Array of forums where the user has m_approve permissions
* @var string visibility_sql_overwrite Forces the function to return an implosion of where_sqls (joined by "OR")
* @since 3.1.3-RC1
*/
$vars = array('where_sqls', 'mode', 'forum_ids', 'table_alias', 'approve_forums', 'visibility_sql_overwrite');
extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_global_visibility_before', compact($vars)));
if ($visibility_sql_overwrite) {
return $visibility_sql_overwrite;
}
if (sizeof($exclude_forum_ids)) {
$where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . '
AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')';
} else {
$where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
}
if (sizeof($approve_forums)) {
$where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
return '(' . implode(' OR ', $where_sqls) . ')';
}
// There is only one element, so we just return that one
return $where_sqls[0];
}
示例6:
function get_moderator_approve_forums()
{
static $forum_ids;
if (!isset($forum_ids)) {
$forum_ids = array_keys($this->auth->acl_getf('m_approve', true));
}
return $forum_ids;
}
示例7: _get_allowed_forums
/**
* @return array
*/
private function _get_allowed_forums()
{
$allowed_forums = array_unique(array_keys($this->auth->acl_getf('f_download', true)));
if (sizeof($this->settings['forum_ids'])) {
$allowed_forums = array_intersect($this->settings['forum_ids'], $allowed_forums);
}
return array_map('intval', $allowed_forums);
}
示例8: parse_template
/**
* Parse template variables for module
*
* @param int $module_id Module ID
* @param string $type Module type (center or side)
*
* @return string Template file name or false if nothing should
* be displayed
*/
protected function parse_template($module_id, $type)
{
$attach_forums = false;
$where = '';
// Get filetypes and put them into an array
$filetypes = $this->get_selected_filetypes($module_id);
if ($this->config['board3_attachments_forum_ids_' . $module_id] !== '') {
$attach_forums_config = strpos($this->config['board3_attachments_forum_ids_' . $module_id], ',') !== false ? explode(',', $this->config['board3_attachments_forum_ids_' . $module_id]) : array($this->config['board3_attachments_forum_ids_' . $module_id]);
$forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true)));
if ($this->config['board3_attachments_forum_exclude_' . $module_id]) {
$forum_list = array_unique(array_diff($forum_list, $attach_forums_config));
} else {
$forum_list = array_unique(array_intersect($attach_forums_config, $forum_list));
}
} else {
$forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true)));
}
if (sizeof($forum_list)) {
$attach_forums = true;
$where = 'AND ' . $this->db->sql_in_set('t.forum_id', $forum_list);
}
if (sizeof($filetypes)) {
if ($this->config['board3_attachments_exclude_' . $module_id]) {
$where .= ' AND ' . $this->db->sql_in_set('a.extension', $filetypes, true);
} else {
$where .= ' AND ' . $this->db->sql_in_set('a.extension', $filetypes);
}
}
if ($attach_forums === true) {
// Just grab all attachment info from database
$sql = 'SELECT
a.*,
t.forum_id
FROM
' . ATTACHMENTS_TABLE . ' a,
' . TOPICS_TABLE . ' t
WHERE
a.topic_id <> 0
AND a.topic_id = t.topic_id
' . $where . '
ORDER BY
filetime ' . (!$this->config['display_order'] ? 'DESC' : 'ASC') . ', post_msg_id ASC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_attachments_number_' . $module_id], 0, 600);
while ($row = $this->db->sql_fetchrow($result)) {
$size_lang = $row['filesize'] >= 1048576 ? $this->user->lang['MIB'] : ($row['filesize'] >= 1024 ? $this->user->lang['KIB'] : $this->user->lang['BYTES']);
$row['filesize'] = $row['filesize'] >= 1048576 ? round(round($row['filesize'] / 1048576 * 100) / 100, 2) : ($row['filesize'] >= 1024 ? round(round($row['filesize'] / 1024 * 100) / 100, 2) : $row['filesize']);
$raw_filename = utf8_substr($row['real_filename'], 0, strrpos($row['real_filename'], '.'));
$replace = character_limit($raw_filename, $this->config['board3_attach_max_length_' . $module_id]);
$this->template->assign_block_vars('attach_' . $type, array('FILESIZE' => $row['filesize'] . ' ' . $size_lang, 'FILETIME' => $this->user->format_date($row['filetime']), 'DOWNLOAD_COUNT' => (int) $row['download_count'], 'FILENAME' => $replace, 'REAL_FILENAME' => $row['real_filename'], 'PHYSICAL_FILENAME' => basename($row['physical_filename']), 'ATTACH_ID' => $row['attach_id'], 'POST_IDS' => !empty($post_ids[$row['attach_id']]) ? $post_ids[$row['attach_id']] : '', 'POST_MSG_ID' => $row['post_msg_id'], 'U_FILE' => append_sid($this->phpbb_root_path . 'download/file.' . $this->php_ext, 'id=' . $row['attach_id']), 'U_TOPIC' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, 'p=' . $row['post_msg_id'] . '#p' . $row['post_msg_id'])));
}
$this->db->sql_freeresult($result);
$this->template->assign_var('S_DISPLAY_ATTACHMENTS', true);
} else {
$this->template->assign_var('S_DISPLAY_ATTACHMENTS', false);
}
return 'attachments_' . $type . '.html';
}
示例9: search_modify_param_before
/**
* Modify search params to exclude forum ids
*
* @param object $event The event object
* @return null
* @access public
*/
public function search_modify_param_before($event)
{
$ex_fid_ary = $event['ex_fid_ary'];
$forum_ids = $this->auth->acl_getf('!f_topic_view', true);
if (sizeof($forum_ids)) {
$ex_fid_ary = array_unique(array_merge(array_keys($forum_ids), $ex_fid_ary));
}
$event['ex_fid_ary'] = $ex_fid_ary;
}
示例10: array_all_thanks
public function array_all_thanks($post_list, $forum_id)
{
$poster_list = array();
// max post thanks
if (isset($this->config['thanks_post_reput_view']) ? $this->config['thanks_post_reput_view'] : false) {
$sql = 'SELECT MAX(tally) AS max_post_thanks
FROM (SELECT post_id, COUNT(*) AS tally FROM ' . $this->thanks_table . ' GROUP BY post_id) t';
$result = $this->db->sql_query($sql);
$this->max_post_thanks = (int) $this->db->sql_fetchfield('max_post_thanks');
$this->db->sql_freeresult($result);
} else {
$this->max_post_thanks = 1;
}
//array all user who say thanks on viewtopic page
if ($this->auth->acl_get('f_thanks', $forum_id)) {
$sql_array = array('SELECT' => 't.*, u.username, u.username_clean, u.user_colour', 'FROM' => array($this->thanks_table => 't', $this->users_table => 'u'), 'WHERE' => 'u.user_id = t.user_id AND ' . $this->db->sql_in_set('t.post_id', $post_list), 'ORDER_BY' => 't.thanks_time ASC');
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->thankers[] = array('user_id' => $row['user_id'], 'poster_id' => $row['poster_id'], 'post_id' => $row['post_id'], 'thanks_time' => $row['thanks_time'], 'username' => $row['username'], 'username_clean' => $row['username_clean'], 'user_colour' => $row['user_colour']);
}
$this->db->sql_freeresult($result);
}
//array thanks_count for all poster on viewtopic page
if (isset($this->config['thanks_counters_view']) ? $this->config['thanks_counters_view'] : false) {
$sql = 'SELECT DISTINCT poster_id FROM ' . $this->posts_table . ' WHERE ' . $this->db->sql_in_set('post_id', $post_list);
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$poster_list[] = $row['poster_id'];
$this->poster_list_count[$row['poster_id']]['R'] = $this->poster_list_count[$row['poster_id']]['G'] = 0;
}
$this->db->sql_freeresult($result);
$ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true));
$ex_fid_ary = sizeof($ex_fid_ary) ? $ex_fid_ary : false;
$sql = 'SELECT *, COUNT(poster_id) AS poster_count FROM ' . $this->thanks_table . '
WHERE ' . $this->db->sql_in_set('poster_id', $poster_list) . '
AND ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . '
GROUP BY poster_id';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->poster_list_count[$row['poster_id']]['R'] = $row['poster_count'];
}
$this->db->sql_freeresult($result);
$sql = 'SELECT *, COUNT(user_id) AS user_count FROM ' . $this->thanks_table . '
WHERE ' . $this->db->sql_in_set('user_id', $poster_list) . '
AND ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . '
GROUP BY user_id';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->poster_list_count[$row['user_id']]['G'] = $row['user_count'];
}
$this->db->sql_freeresult($result);
}
return;
}
示例11: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
if (!function_exists('get_user_rank')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
if ($this->user->data['is_registered']) {
//
// + new posts since last visit & you post number
//
$ex_fid_ary = array_unique(array_merge(array_keys($this->auth->acl_getf('!f_read', true)), array_keys($this->auth->acl_getf('!f_search', true))));
if ($this->auth->acl_get('m_approve')) {
$m_approve_fid_sql = '';
} else {
if ($this->auth->acl_getf_global('m_approve')) {
$m_approve_fid_ary = array_diff(array_keys($this->auth->acl_getf('!m_approve', true)), $ex_fid_ary);
$m_approve_fid_sql = ' AND (p.post_visibility = 1' . (sizeof($m_approve_fid_ary) ? ' OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
} else {
$m_approve_fid_sql = ' AND p.post_visibility = 1';
}
}
$sql = 'SELECT COUNT(DISTINCT t.topic_id) as total
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_last_post_time > ' . (int) $this->user->data['user_lastvisit'] . '
AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . (sizeof($ex_fid_ary) ? 'AND ' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
$result = $this->db->sql_query($sql, 600);
$new_posts_count = (int) $this->db->sql_fetchfield('total');
$this->db->sql_freeresult($result);
// unread posts
$sql_where = 'AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . (sizeof($ex_fid_ary) ? 'AND ' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
$unread_list = get_unread_topics($this->user->data['user_id'], $sql_where, 'ORDER BY t.topic_id DESC');
$unread_posts_count = sizeof($unread_list);
// Get user avatar and rank
$user_id = $this->user->data['user_id'];
$username = $this->user->data['username'];
$colour = $this->user->data['user_colour'];
$avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($this->user->data, 'user'), 'USER_AVATAR');
$rank_title = $rank_img = $rank_img_src = '';
\get_user_rank($this->user->data['user_rank'], $this->user->data['user_posts'], $rank_title, $rank_img, $rank_img_src);
// Assign specific vars
$this->template->assign_vars(array('L_NEW_POSTS' => $this->user->lang['SEARCH_NEW'] . ' (' . $new_posts_count . ')', 'L_SELF_POSTS' => $this->user->lang['SEARCH_SELF'] . ' (' . $this->user->data['user_posts'] . ')', 'L_UNREAD_POSTS' => $this->user->lang['SEARCH_UNREAD'] . ' (' . $unread_posts_count . ')', 'B3P_AVATAR_IMG' => $avatar_img, 'B3P_RANK_TITLE' => $rank_title, 'B3P_RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour), 'U_NEW_POSTS' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'search_id=newposts'), 'U_SELF_POSTS' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'search_id=egosearch'), 'U_UNREAD_POSTS' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'search_id=unreadposts'), 'U_UM_BOOKMARKS' => $this->config['allow_bookmarks'] ? append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", 'i=main&mode=bookmarks') : '', 'U_UM_MAIN_SUBSCRIBED' => append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", 'i=main&mode=subscribed'), 'U_UM_MCP' => $this->auth->acl_get('m_') || $this->auth->acl_getf_global('m_') ? append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=main&mode=front', true, $this->user->session_id) : '', 'S_DISPLAY_SUBSCRIPTIONS' => $this->config['allow_topic_notify'] || $this->config['allow_forum_notify'] ? true : false));
return 'user_menu_side.html';
} else {
/*
* Assign specific vars
* Need to remove web root path as ucp.php will do the
* redirect
*/
$this->template->assign_vars(array('U_PORTAL_REDIRECT' => $this->path_helper->remove_web_root_path($this->controller_helper->route('board3_portal_controller')), 'S_DISPLAY_FULL_LOGIN' => true, 'S_AUTOLOGIN_ENABLED' => $this->config['allow_autologin'] ? true : false, 'S_LOGIN_ACTION' => append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", 'mode=login'), 'S_SHOW_REGISTER' => $this->config['board3_user_menu_register_' . $module_id] ? true : false));
return 'login_box_side.html';
}
}
示例12: _get_words_sql
/**
* @param string $exclude_words
* @return array
*/
private function _get_words_sql($exclude_words)
{
$sql_where = $this->_exclude_words_sql($exclude_words);
return array('SELECT' => 'l.word_text, l.word_count', 'FROM' => array(SEARCH_WORDLIST_TABLE => 'l', SEARCH_WORDMATCH_TABLE => 'm', TOPICS_TABLE => 't', POSTS_TABLE => 'p'), 'WHERE' => 'l.word_common <> 1
AND l.word_count > 0
AND m.word_id = l.word_id
AND m.post_id = p.post_id
AND t.topic_id = p.topic_id
AND t.topic_time <= ' . time() . '
AND ' . $this->content_visibility->get_global_visibility_sql('topic', array_keys($this->auth->acl_getf('!f_read', true)), 't.') . $sql_where, 'GROUP_BY' => 'l.word_text, l.word_count', 'ORDER_BY' => 'l.word_count DESC');
}
示例13: get_readable_forums
/**
* Gets the forum ids that the user is allowed to read.
*
* @return array forum ids that the user is allowed to read
*/
private function get_readable_forums()
{
$forum_ary = array();
$forum_read_ary = $this->auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed) {
if ($allowed['f_read']) {
$forum_ary[] = (int) $forum_id;
}
}
// Remove double entries
$forum_ary = array_unique($forum_ary);
return $forum_ary;
}
示例14: memberlist_viewprofile
public function memberlist_viewprofile($event)
{
$member = $event['member'];
$user_id = (int) $member['user_id'];
$ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true));
$ex_fid_ary = sizeof($ex_fid_ary) ? $ex_fid_ary : false;
// $this->user->add_lang_ext('gfksx/ThanksForPosts', 'thanks_mod');
if (isset($_REQUEST['list_thanks'])) {
$this->helper->clear_list_thanks($user_id, $this->request->variable('list_thanks', ''));
}
if (isset($this->config['thanks_for_posts_version'])) {
$this->helper->output_thanks_memberlist($user_id, $ex_fid_ary);
}
}
示例15: download_file_send_to_browser_before
public function download_file_send_to_browser_before($event)
{
$topic_id = (int) $event['attachment']['topic_id'];
$display_cat = $event['display_cat'];
$points_values = $this->cache->get('points_values');
$sql_array = array('SELECT' => 'f.forum_cost', 'FROM' => array(FORUMS_TABLE => 'f'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 't.forum_id = f.forum_id')), 'WHERE' => 't.topic_id = ' . $topic_id);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
$forum_cost = $this->db->sql_fetchfield('forum_cost');
$this->db->sql_freeresult($result);
if ($forum_cost > 0 && $display_cat != 1 && $this->auth->acl_getf('f_pay_attachment')) {
if ($this->config['allow_attachments'] && $this->config['points_enable'] && $this->user->data['user_points'] < $forum_cost) {
$message = sprintf($this->user->lang['POINTS_ATTACHMENT_MINI_POSTS'], $this->config['points_name']) . '<br /><br /><a href="' . append_sid("{$this->phpbb_root_path}index.{$this->phpEx}") . '">« ' . $this->user->lang['POINTS_RETURN_INDEX'] . '</a>';
trigger_error($message);
}
if ($this->config['points_enable']) {
$this->functions_points->substract_points($this->user->data['user_id'], $forum_cost);
}
}
}