当前位置: 首页>>代码示例>>PHP>>正文


PHP auth::acl_getf方法代码示例

本文整理汇总了PHP中auth::acl_getf方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::acl_getf方法的具体用法?PHP auth::acl_getf怎么用?PHP auth::acl_getf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auth的用法示例。


在下文中一共展示了auth::acl_getf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_user_activity

/**
* Display user activity (action forum/topic)
*/
function display_user_activity(&$userdata)
{
    global $auth, $template, $db, $user;
    global $phpbb_root_path, $phpEx;
    // Init new auth class if user is different
    if ($user->data['user_id'] != $userdata['user_id']) {
        $auth2 = new auth();
        $auth2->acl($userdata);
        $post_count_ary = $auth2->acl_getf('!f_postcount');
    } else {
        $post_count_ary = $auth->acl_getf('!f_postcount');
    }
    $forum_read_ary = $auth->acl_getf('!f_read');
    $forum_ary = array();
    // Do not include those forums the user is not having read access to...
    foreach ($forum_read_ary as $forum_id => $not_allowed) {
        if ($not_allowed['f_read']) {
            $forum_ary[] = (int) $forum_id;
        }
    }
    // Now do not include those forums where the posts do not count...
    foreach ($post_count_ary as $forum_id => $not_counted) {
        if ($not_counted['f_postcount']) {
            $forum_ary[] = (int) $forum_id;
        }
    }
    $forum_ary = array_unique($forum_ary);
    $post_count_sql = sizeof($forum_ary) ? 'AND f.forum_id NOT IN (' . implode(', ', $forum_ary) . ')' : '';
    // Firebird does not support ORDER BY on aliased columns
    // MySQL does not support ORDER BY on functions
    switch (SQL_LAYER) {
        case 'firebird':
            $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts
				FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f 
				WHERE p.poster_id = ' . $userdata['user_id'] . " \n\t\t\t\t\tAND f.forum_id = p.forum_id \n\t\t\t\t\t{$post_count_sql}\n\t\t\t\tGROUP BY f.forum_id\n\t\t\t\tORDER BY COUNT(p.post_id) DESC";
            break;
        default:
            $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts
				FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f 
				WHERE p.poster_id = ' . $userdata['user_id'] . " \n\t\t\t\t\tAND f.forum_id = p.forum_id \n\t\t\t\t\t{$post_count_sql}\n\t\t\t\tGROUP BY f.forum_id\n\t\t\t\tORDER BY num_posts DESC";
            break;
    }
    $result = $db->sql_query_limit($sql, 1);
    $active_f_row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
    if (!empty($active_f_row)) {
        $sql = 'SELECT forum_name
			FROM ' . FORUMS_TABLE . '
			WHERE forum_id = ' . $active_f_row['forum_id'];
        $result = $db->sql_query($sql, 3600);
        $active_f_row['forum_name'] = (string) $db->sql_fetchfield('forum_name');
        $db->sql_freeresult($result);
    }
    // Firebird does not support ORDER BY on aliased columns
    // MySQL does not support ORDER BY on functions
    switch (SQL_LAYER) {
        case 'firebird':
            $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts   
				FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f  
				WHERE p.poster_id = ' . $userdata['user_id'] . " \n\t\t\t\t\tAND t.topic_id = p.topic_id  \n\t\t\t\t\tAND f.forum_id = t.forum_id \n\t\t\t\t\t{$post_count_sql}\n\t\t\t\tGROUP BY t.topic_id\n\t\t\t\tORDER BY COUNT(p.post_id) DESC";
            break;
        default:
            $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts   
				FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f  
				WHERE p.poster_id = ' . $userdata['user_id'] . " \n\t\t\t\t\tAND t.topic_id = p.topic_id  \n\t\t\t\t\tAND f.forum_id = t.forum_id \n\t\t\t\t\t{$post_count_sql}\n\t\t\t\tGROUP BY t.topic_id\n\t\t\t\tORDER BY num_posts DESC";
            break;
    }
    $result = $db->sql_query_limit($sql, 1);
    $active_t_row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
    if (!empty($active_t_row)) {
        $sql = 'SELECT topic_title
			FROM ' . TOPICS_TABLE . '
			WHERE topic_id = ' . $active_t_row['topic_id'];
        $result = $db->sql_query($sql);
        $active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title');
        $db->sql_freeresult($result);
    }
    $userdata['active_t_row'] = $active_t_row;
    $userdata['active_f_row'] = $active_f_row;
    $active_f_name = $active_f_id = $active_f_count = $active_f_pct = '';
    if (!empty($active_f_row['num_posts'])) {
        $active_f_name = $active_f_row['forum_name'];
        $active_f_id = $active_f_row['forum_id'];
        $active_f_count = $active_f_row['num_posts'];
        $active_f_pct = $userdata['user_posts'] ? $active_f_count / $userdata['user_posts'] * 100 : 0;
    }
    $active_t_name = $active_t_id = $active_t_count = $active_t_pct = '';
    if (!empty($active_t_row['num_posts'])) {
        $active_t_name = $active_t_row['topic_title'];
        $active_t_id = $active_t_row['topic_id'];
        $active_t_count = $active_t_row['num_posts'];
        $active_t_pct = $userdata['user_posts'] ? $active_t_count / $userdata['user_posts'] * 100 : 0;
    }
    $template->assign_vars(array('ACTIVE_FORUM' => $active_f_name, 'ACTIVE_FORUM_POSTS' => $active_f_count == 1 ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct), 'ACTIVE_TOPIC' => censor_text($active_t_name), 'ACTIVE_TOPIC_POSTS' => $active_t_count == 1 ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct), 'U_ACTIVE_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $active_f_id), 'U_ACTIVE_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 't=' . $active_t_id)));
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:99,代码来源:functions_display.php

示例2: array

 /**
  * check_forum_auth()
  * Returns various forum auth and properties
  */
 function check_forum_auth($guest_auth = true)
 {
     global $auth, $db, $user, $cache;
     $forum_auth_list = array('list' => array(), 'read' => array(), 'list_post' => array(), 'read_post' => array(), 'public_list' => array(), 'public_read' => array(), 'skip_pass' => array(), 'skip_cat' => array(), 'skip_all' => array(), 'skip_link' => array());
     $need_cache = false;
     $cache_file = '_gym_auth_forum_guest';
     // First check the public forum list
     if (($forum_auth_list = $cache->get($cache_file)) === false) {
         $forum_auth_list = array('list' => array(), 'read' => array(), 'list_post' => array(), 'read_post' => array(), 'public_list' => array(), 'public_read' => array(), 'skip_pass' => array(), 'skip_cat' => array(), 'skip_all' => array(), 'skip_link' => array());
         $guest_data = array('user_id' => ANONYMOUS, 'user_type' => USER_IGNORE, 'user_permissions' . (defined('XLANG_AKEY') ? XLANG_AKEY : '') => '');
         $g_auth = new auth();
         $g_auth->acl($guest_data);
         // the forum id array
         $forum_list_ary = $g_auth->acl_getf('f_list', true);
         foreach ($forum_list_ary as $forum_id => $null) {
             $forum_auth_list['list'][$forum_id] = (int) $forum_id;
         }
         $forum_read_ary = $g_auth->acl_getf('f_read', true);
         foreach ($forum_read_ary as $forum_id => $null) {
             $forum_auth_list['read'][$forum_id] = (int) $forum_id;
         }
         ksort($forum_auth_list['list']);
         ksort($forum_auth_list['read']);
         $sql = "SELECT forum_id, forum_type, forum_password\n\t\t\t\tFROM " . FORUMS_TABLE . "\n\t\t\t\tWHERE\tforum_type <> " . FORUM_POST . " OR forum_password <> ''";
         $result = $db->sql_query($sql);
         while ($row = $db->sql_fetchrow($result)) {
             $forum_id = (int) $row['forum_id'];
             if ($row['forum_password']) {
                 $forum_auth_list['skip_pass'][$forum_id] = $forum_id;
             }
             if ($row['forum_type'] == FORUM_CAT) {
                 $forum_auth_list['skip_cat'][$forum_id] = $forum_id;
             } else {
                 if ($row['forum_type'] == FORUM_LINK) {
                     $forum_auth_list['skip_link'][$forum_id] = $forum_id;
                 }
             }
             $forum_auth_list['skip_all'][$forum_id] = $forum_id;
         }
         $db->sql_freeresult($result);
         ksort($forum_auth_list['skip_pass']);
         ksort($forum_auth_list['skip_all']);
         ksort($forum_auth_list['skip_link']);
         ksort($forum_auth_list['skip_cat']);
         // Never mind about fourm links
         $forum_auth_list['read'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_link']);
         $forum_auth_list['list'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_link']);
         ksort($forum_auth_list['read']);
         ksort($forum_auth_list['list']);
         $forum_auth_list['list_post'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_all']);
         $forum_auth_list['read_post'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_all']);
         $forum_auth_list['public_list'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_pass']);
         $forum_auth_list['public_read'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_pass']);
         $cache->put($cache_file, $forum_auth_list);
     }
     $this->module_auth['forum'] =& $forum_auth_list;
     if ($guest_auth) {
         // sometime, we need to only check guest auths, even if user is registered
         $this->actions['auth_param'] = implode('-', $forum_auth_list['read_post']);
         return $forum_auth_list['read_post'];
     }
     // else handle the real auth
     $forum_auth_list['read'] = $forum_auth_list['list'] = array();
     $forum_list_ary = $auth->acl_getf('f_list', true);
     foreach ($forum_list_ary as $forum_id => $null) {
         $forum_auth_list['list'][$forum_id] = (int) $forum_id;
     }
     $forum_read_ary = $auth->acl_getf('f_read', true);
     foreach ($forum_read_ary as $forum_id => $null) {
         $forum_auth_list['read'][$forum_id] = (int) $forum_id;
     }
     ksort($forum_auth_list['list']);
     ksort($forum_auth_list['read']);
     $forum_auth_list['list'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_link']);
     $forum_auth_list['read'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_link']);
     $forum_auth_list['list_post'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_all']);
     $forum_auth_list['read_post'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_all']);
     $this->actions['auth_param'] = implode('-', $forum_auth_list['read_post']);
     return $forum_auth_list['read_post'];
 }
开发者ID:jverkoey,项目名称:Three20-Scope,代码行数:84,代码来源:gym_sitemaps.php

示例3: get_gym_links

/**
* get_gym_links($gym_config).
* retunrs the link array
*/
function get_gym_links($gym_config)
{
    global $phpbb_root_path, $config, $phpEx, $user, $cache, $db, $phpbb_seo;
    $links = array();
    $_phpbb_seo = !empty($phpbb_seo);
    $board_url = $_phpbb_seo ? $phpbb_seo->seo_path['phpbb_url'] : generate_board_url() . '/';
    $gym_link_tpl = '<a href="%1$s" title="%3$s" class="gym"><img src="' . $board_url . 'gym_sitemaps/images/%2$s" alt="%3$s" width="14" height="14"/>&nbsp;%3$s</a>';
    $google_threshold = max(1, (int) $gym_config['google_threshold']);
    //compute guest auth
    $cache_file = '_gym_auth_guests_forum';
    if (($auth_guest_list = $cache->get($cache_file)) === false) {
        $auth_guest_list = array('list' => array(), 'read' => array(), 'list_post' => array(), 'read_post' => array(), 'skip_pass' => array(), 'skip_cat' => array(), 'skip_all' => array(), 'skip_link' => array(), 'thresholded' => array(), 'empty' => array());
        $guest_data = array('user_id' => ANONYMOUS, 'user_type' => USER_IGNORE, 'user_permissions' . (defined('XLANG_AKEY') ? XLANG_AKEY : '') => '');
        $g_auth = new auth();
        $g_auth->acl($guest_data);
        // the forum id array
        $forum_list_ary = $g_auth->acl_getf('f_list', true);
        foreach ($forum_list_ary as $forum_id => $null) {
            $auth_guest_list['list'][$forum_id] = (int) $forum_id;
        }
        $forum_read_ary = $g_auth->acl_getf('f_read', true);
        foreach ($forum_read_ary as $forum_id => $null) {
            $auth_guest_list['read'][$forum_id] = (int) $forum_id;
        }
        ksort($auth_guest_list['list']);
        ksort($auth_guest_list['read']);
        $sql = "SELECT forum_id, forum_type, forum_password\n\t\t\tFROM " . FORUMS_TABLE . "\n\t\t\tWHERE\tforum_type <> " . FORUM_POST . " OR forum_password <> ''";
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $forum_id = (int) $row['forum_id'];
            if ($row['forum_password']) {
                $auth_guest_list['skip_pass'][$forum_id] = $forum_id;
            }
            if ($row['forum_type'] == FORUM_CAT) {
                $auth_guest_list['skip_cat'][$forum_id] = $forum_id;
            } else {
                if ($row['forum_type'] == FORUM_LINK) {
                    $auth_guest_list['skip_link'][$forum_id] = $forum_id;
                }
            }
            $auth_guest_list['skip_all'][$forum_id] = $forum_id;
        }
        $db->sql_freeresult($result);
        // Now let's grabb the list of forum with not enough topics to have a sitemap
        // Only care about postable forum ;-)
        $sql = "SELECT forum_id, forum_topics\n\t\t\tFROM " . FORUMS_TABLE . "\n\t\t\tWHERE\tforum_type = " . FORUM_POST . "\n\t\t\t\tAND forum_topics < {$google_threshold}";
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $forum_id = (int) $row['forum_id'];
            $auth_guest_list['thresholded'][$forum_id] = $forum_id;
            if (empty($row['forum_topics'])) {
                $auth_guest_list['empty'][$forum_id] = $forum_id;
            }
        }
        ksort($auth_guest_list['skip_pass']);
        ksort($auth_guest_list['skip_all']);
        ksort($auth_guest_list['skip_link']);
        ksort($auth_guest_list['skip_cat']);
        // Never mind about forum links
        $auth_guest_list['read'] = array_diff_assoc($auth_guest_list['read'], $auth_guest_list['skip_link']);
        $auth_guest_list['list'] = array_diff_assoc($auth_guest_list['list'], $auth_guest_list['skip_link']);
        ksort($auth_guest_list['read']);
        ksort($auth_guest_list['list']);
        $auth_guest_list['list_post'] = array_diff_assoc($auth_guest_list['list'], $auth_guest_list['skip_all']);
        $auth_guest_list['read_post'] = array_diff_assoc($auth_guest_list['read'], $auth_guest_list['skip_all']);
        $cache->put($cache_file, $auth_guest_list);
    }
    $links = array();
    $links['main'] = $links['setup']['google'] = $links['setup']['rss'] = $links['setup']['html'] = array();
    // Find out about active modes
    $google_active = $rss_active = $html_active = false;
    $gym_modules = array('google' => array('forum', 'xml', 'txt'), 'rss' => array('forum'), 'html' => array('forum'));
    foreach ($gym_modules as $type => $modules) {
        foreach ($modules as $module) {
            if (!empty($gym_config[$type . '_' . $module . '_installed'])) {
                ${$type . '_active'} = true;
                break;
            }
        }
    }
    $do_display_cat = $do_display_main = $do_display_index = false;
    // Google sitemaps
    if ($google_active) {
        $display_google_main_links = (bool) get_gym_option('google', 'gym', 'link_main', OVERRIDE_MODULE, $gym_config);
        $display_google_index_links = (bool) get_gym_option('google', 'gym', 'link_index', OVERRIDE_MODULE, $gym_config);
        $display_google_cat_links = (bool) get_gym_option('google', 'gym', 'link_cat', OVERRIDE_MODULE, $gym_config);
        $override_google_mod_rewrite = get_override('google', 'modrewrite', $gym_config);
        $google_mod_rewrite = (bool) get_gym_option('google', 'gym', 'modrewrite', $override_google_mod_rewrite, $gym_config);
        $override_google_gzip = get_override('google', 'gzip', $gym_config);
        $google_gzip = (bool) get_gym_option('google', 'forum', 'gzip', $override_google_gzip, $gym_config);
        $google_gzip_ext = $google_gzip || $config['gzip_compress'] ? get_gym_option('google', 'forum', 'gzip_ext', $override_google_gzip, $gym_config) ? '.gz' : '' : '';
        $google_url = $_phpbb_seo ? $phpbb_seo->sslify($gym_config['google_url'], $phpbb_seo->ssl['use'], false) : $gym_config['google_url'];
        $sitemap_url = $google_url . ($google_mod_rewrite ? 'sitemapindex.xml' . $google_gzip_ext : "sitemap.{$phpEx}");
        $links['setup']['google'] = array('override_mod_rewrite' => $override_google_mod_rewrite, 'mod_rewrite' => $google_mod_rewrite, 'override_gzip' => $override_google_gzip, 'link_main' => $display_google_main_links, 'link_index' => $display_google_index_links, 'link_cat' => $display_google_cat_links, 'gzip' => $google_gzip, 'gzip_ext' => $google_gzip_ext, 'google_url' => $google_url, 'threshold' => max(1, (int) $gym_config['google_threshold']), 'l_google_sitemap' => $user->lang['GOOGLE_SITEMAP'], 'l_google_sitemap_of' => $user->lang['GOOGLE_MAP_OF']);
        // only publicly readable and not thresholded forums will be listed
        if (!empty($gym_config['google_forum_installed'])) {
//.........这里部分代码省略.........
开发者ID:Ibrahim-Abdelkader,项目名称:phpbb3,代码行数:101,代码来源:gym_rss_functions.php

示例4: sprintf

            $group_options .= '<option value="' . $row['group_id'] . '"' . ($member['user_group'] == $row['group_id'] ? ' selected="selected"' : '') . '>' . (isset($_CLASS['core_user']->lang['G_' . $row['group_name']]) ? $_CLASS['core_user']->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
        }
        $_CLASS['core_db']->free_result($result);
        $page_title = sprintf($_CLASS['core_user']->lang['VIEWING_PROFILE'], $member['username']);
        $template_html = 'memberlist_view.html';
        $sql = 'SELECT MAX(session_time) AS session_time
			FROM ' . SESSIONS_TABLE . "\n\t\t\tWHERE session_user_id = {$user_id}";
        $result = $_CLASS['core_db']->query($sql);
        $row = $_CLASS['core_db']->fetch_row_assoc($result);
        $_CLASS['core_db']->free_result($result);
        $member['session_time'] = isset($row['session_time']) ? $row['session_time'] : 0;
        unset($row);
        // Obtain list of forums where this users post count is incremented
        $auth2 = new auth();
        $auth2->acl($member);
        $f_postcount_ary = $auth2->acl_getf('f_postcount');
        $sql_forums = array();
        foreach ($f_postcount_ary as $forum_id => $allow) {
            if ($allow['f_postcount']) {
                $sql_forums[] = $forum_id;
            }
        }
        $post_count_sql = sizeof($sql_forums) ? 'AND f.forum_id IN (' . implode(', ', $sql_forums) . ')' : '';
        unset($sql_forums, $f_postcount_ary, $auth2);
        // Grab all the relevant data
        $sql = 'SELECT COUNT(p.post_id) AS num_posts
			FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_FORUMS_TABLE . " f\n\t\t\tWHERE p.poster_id = {$user_id}\n\t\t\t\tAND f.forum_id = p.forum_id\n\t\t\t\t{$post_count_sql}";
        $result = $_CLASS['core_db']->query($sql);
        $row = $_CLASS['core_db']->fetch_row_assoc($result);
        $_CLASS['core_db']->free_result($result);
        $num_real_posts = min($_CLASS['core_user']->data['user_posts'], $row['num_posts']);
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:index.php


注:本文中的auth::acl_getf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。