Exemplo n.º 1
0
/**
* 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)));
}
Exemplo n.º 2
0
 /**
  * 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'];
 }
/**
* 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'])) {
            $google_forum_mod_rewrite = (bool) get_gym_option('google', 'forum', 'modrewrite', $override_google_mod_rewrite, $gym_config);
            $google_auth_guest = array_diff_assoc($auth_guest_list['read_post'], set_exclude_list($gym_config['google_forum_exclude']), $auth_guest_list['thresholded']);
            $google_forum_exclude = set_exclude_list($gym_config['google_forum_exclude']) + $auth_guest_list['skip_all'];
            $links['setup']['google'] = array_merge($links['setup']['google'], array('forum_google' => true, 'forum_cat_google' => $google_url . ($google_forum_mod_rewrite && $_phpbb_seo ? "%1\$s.xml{$google_gzip_ext}" : "sitemap.{$phpEx}?forum=%2\$s"), 'auth_guest' => $google_auth_guest, 'forum_exclude' => $google_forum_exclude));
        }
        $links['main'] = array_merge($links['main'], array('GYM_GOOGLE_TITLE' => $user->lang['GOOGLE_SITEMAPINDEX'], 'GYM_GOOGLE_URL' => $sitemap_url, 'GYM_GOOGLE_LINK' => $display_google_main_links ? sprintf($gym_link_tpl, $sitemap_url, 'sitemap-icon.gif', $user->lang['GOOGLE_SITEMAPINDEX']) : '', 'GYM_GOOGLE_THRESOLD' => (int) $links['setup']['google']['threshold']));
        $do_display_main = $display_google_main_links ? true : $do_display_main;
        $do_display_index = $display_google_index_links ? true : $do_display_index;
        $do_display_cat = $display_google_cat_links ? true : $do_display_cat;
    }
    // RSS
    if ($rss_active) {
        $display_rss_main_links = (bool) get_gym_option('rss', 'gym', 'link_main', OVERRIDE_MODULE, $gym_config);
        $display_rss_index_links = (bool) get_gym_option('rss', 'gym', 'link_index', OVERRIDE_MODULE, $gym_config);
        $display_rss_cat_links = (bool) get_gym_option('rss', 'gym', 'link_cat', OVERRIDE_MODULE, $gym_config);
        $override_rss_mod_rewrite = get_override('rss', 'modrewrite', $gym_config);
        $rss_mod_rewrite = (bool) get_gym_option('rss', 'gym', 'modrewrite', $override_rss_mod_rewrite, $gym_config);
        $rss_modrtype = max(0, (int) get_gym_option('rss', 'gym', 'modrtype', $override_rss_mod_rewrite, $gym_config));
        $override_rss_gzip = get_override('rss', 'gzip', $gym_config);
        $rss_gzip = (bool) get_gym_option('rss', 'forum', 'gzip', $override_rss_gzip, $gym_config);
        $rss_gzip_ext = $rss_gzip || $config['gzip_compress'] ? get_gym_option('rss', 'forum', 'gzip_ext', $override_rss_gzip, $gym_config) ? '.gz' : '' : '';
        // Take car of linking type
        $link_type_sep = $rss_mod_rewrite ? '/' : '&amp;';
        $link_type_to_options = array('n' => 'news', 'nd' => 'news' . $link_type_sep . 'digest', 'r' => '', 'rd' => 'digest');
        $link_type_bit = isset($link_type_to_options[$gym_config['rss_linking_type']]) ? $link_type_to_options[$gym_config['rss_linking_type']] : '';
        $rss_url = $_phpbb_seo ? $phpbb_seo->sslify($gym_config['rss_url'], $phpbb_seo->ssl['use'], false) : $gym_config['rss_url'];
        $rss_main_url = $rss_url . ($rss_mod_rewrite ? 'rss/' . ($link_type_bit ? $link_type_bit . '/' : '') . 'rss.xml' . $rss_gzip_ext : "gymrss.{$phpEx}" . ($link_type_bit ? '?' . $link_type_bit : ''));
        $rss_chan_url = $rss_url . ($rss_mod_rewrite ? 'rss/' . ($link_type_bit ? $link_type_bit . '/' : '') : "gymrss.{$phpEx}?channels" . ($link_type_bit ? '&amp;' . $link_type_bit : ''));
        $links['setup']['rss'] = array('display_alternate' => (int) $gym_config['rss_alternate'], 'link_main' => $display_rss_main_links, 'link_index' => $display_rss_index_links, 'link_cat' => $display_rss_cat_links, 'override_mod_rewrite' => $override_rss_mod_rewrite, 'mod_rewrite' => $rss_mod_rewrite, 'override_gzip' => $override_rss_gzip, 'gzip' => $rss_gzip, 'gzip_ext' => $rss_gzip_ext, 'rss_url' => $rss_url, 'l_rss_feed' => $user->lang['RSS_FEED'], 'l_rss_feed_of' => $user->lang['RSS_FEED_OF']);
        if (!empty($gym_config['rss_forum_installed'])) {
            $rss_forum_allow_auth = (bool) get_gym_option('rss', 'forum', 'allow_auth', $gym_config['rss_override'], $gym_config);
            // only readable forums can be listed
            $rss_auth_guest = array_diff_assoc($auth_guest_list['read_post'], set_exclude_list($gym_config['rss_forum_exclude']), $auth_guest_list['empty']);
            $rss_forum_exclude = set_exclude_list($gym_config['rss_forum_exclude']) + $auth_guest_list['skip_all'] + $auth_guest_list['empty'];
            $rss_forum_mod_rewrite = (bool) get_gym_option('rss', 'forum', 'modrewrite', $override_rss_mod_rewrite, $gym_config);
            $rss_forum_modrtype = max(0, (int) get_gym_option('rss', 'forum', 'modrtype', $override_rss_mod_rewrite, $gym_config));
            $links['setup']['rss'] = array_merge($links['setup']['rss'], array('display_forum_alternate' => (int) $gym_config['rss_forum_alternate'], 'forum_rss' => !empty($gym_config['rss_forum_installed']), 'forum_cat_rss' => $rss_url . ($rss_forum_mod_rewrite && $_phpbb_seo ? $rss_forum_modrtype > 1 ? "%1\$s/" . ($link_type_bit ? $link_type_bit . '/' : '') . "forum.xml{$rss_gzip_ext}" : "forum" . $phpbb_seo->seo_delim['forum'] . "%2\$s/" . ($link_type_bit ? $link_type_bit . '/' : '') . "forum.xml{$rss_gzip_ext}" : "gymrss.{$phpEx}?forum=%2\$s" . ($link_type_bit ? '&amp;' . $link_type_bit : '')), 'auth_guest' => $rss_auth_guest, 'forum_exclude' => $rss_forum_exclude, 'forum_allow_auth' => $rss_forum_allow_auth));
        }
        $links['main'] = array_merge($links['main'], array('GYM_RSS_TITLE' => $user->lang['RSS_FEED'], 'GYM_RSS_URL' => $rss_main_url, 'GYM_RSS_LINK' => $display_rss_main_links ? sprintf($gym_link_tpl, $rss_main_url, 'feed-icon.png', $user->lang['RSS_FEED']) : '', 'GYM_RSS_CHAN_TITLE' => $user->lang['RSS_CHAN_LIST_TITLE'], 'GYM_RSS_CHAN_URL' => $rss_chan_url, 'GYM_RSS_CHAN_LINK' => $display_rss_main_links ? sprintf($gym_link_tpl, $rss_chan_url, 'feed-icon.png', $user->lang['RSS_CHAN_LIST_TITLE']) : ''));
        $do_display_main = $display_rss_main_links ? true : $do_display_main;
        $do_display_index = $display_rss_index_links ? true : $do_display_index;
        $do_display_cat = $display_rss_cat_links ? true : $do_display_cat;
    }
    // HTML
    if ($html_active) {
        $display_html_main_links = (bool) get_gym_option('html', 'gym', 'link_main', OVERRIDE_MODULE, $gym_config);
        $display_html_index_links = (bool) get_gym_option('html', 'gym', 'link_index', OVERRIDE_MODULE, $gym_config);
        $display_html_cat_links = (bool) get_gym_option('html', 'gym', 'link_cat', OVERRIDE_MODULE, $gym_config);
        $override_html_mod_rewrite = get_override('html', 'modrewrite', $gym_config);
        $html_mod_rewrite = (bool) get_gym_option('html', 'gym', 'modrewrite', $override_html_mod_rewrite, $gym_config);
        $html_allow_map = (bool) $gym_config['html_allow_map'];
        $html_allow_cat_map = (bool) $gym_config['html_allow_cat_map'];
        $html_allow_news = (bool) $gym_config['html_allow_news'];
        $html_allow_cat_news = (bool) $gym_config['html_allow_cat_news'];
        $html_url = $_phpbb_seo ? $phpbb_seo->sslify($gym_config['html_url'], $phpbb_seo->ssl['use'], false) : $gym_config['html_url'];
        $html_map_url = $gym_config['html_allow_map'] ? $html_url . ($html_mod_rewrite ? 'maps/' : "map.{$phpEx}") : '';
        $html_news_url = $gym_config['html_allow_news'] ? $html_url . ($html_mod_rewrite ? 'news/' : "map.{$phpEx}?news") : '';
        $links['setup']['html'] = array('link_main' => $display_html_main_links, 'link_index' => $display_html_index_links, 'link_cat' => $display_html_cat_links, 'override_mod_rewrite' => $override_html_mod_rewrite, 'mod_rewrite' => $html_mod_rewrite, 'html_url' => $html_url, 'allow_map' => $html_allow_map, 'allow_news' => $html_allow_news, 'allow_cat_map' => $html_allow_cat_map, 'allow_cat_news' => $html_allow_cat_news, 'l_html_news' => $user->lang['HTML_NEWS'], 'l_html_map' => $user->lang['HTML_MAP'], 'l_html_news_of' => $user->lang['HTML_NEWS_OF'], 'l_html_map_of' => $user->lang['HTML_MAP_OF']);
        if (!empty($gym_config['html_forum_installed'])) {
            $html_forum_mod_rewrite = (bool) get_gym_option('html', 'forum', 'modrewrite', $override_html_mod_rewrite, $gym_config);
            $html_forum_allow_map = (bool) get_gym_option('html', 'forum', 'allow_map', $gym_config['html_override'], $gym_config);
            $html_forum_allow_cat_map = (bool) get_gym_option('html', 'forum', 'allow_cat_map', $gym_config['html_override'], $gym_config);
            $html_forum_allow_news = (bool) get_gym_option('html', 'forum', 'allow_news', $gym_config['html_override'], $gym_config);
            $html_forum_allow_cat_news = (bool) get_gym_option('html', 'forum', 'allow_cat_news', $gym_config['html_override'], $gym_config);
            $html_auth_guest = array_diff_assoc($auth_guest_list['list'], set_exclude_list($gym_config['html_forum_exclude']), $auth_guest_list['empty']);
            $html_forum_allow_auth = (bool) get_gym_option('html', 'forum', 'allow_auth', $gym_config['html_override'], $gym_config);
            $html_forum_exclude = set_exclude_list($gym_config['html_forum_exclude']) + $auth_guest_list['skip_link'] + $auth_guest_list['empty'];
            $links['setup']['html'] = array_merge($links['setup']['html'], array('forum_allow_map' => $html_forum_allow_map, 'forum_map_url' => $html_allow_map ? $html_url . ($html_forum_mod_rewrite ? 'maps/forum/' : "map.{$phpEx}?forum") : '', 'forum_allow_news' => $html_forum_allow_news, 'forum_news_url' => $html_allow_news ? $html_url . ($html_forum_mod_rewrite ? 'news/forum/' : "map.{$phpEx}?forum=news") : '', 'forum_allow_cat_map' => $html_forum_allow_cat_map, 'forum_cat_map' => $html_url . ($html_forum_mod_rewrite && $_phpbb_seo ? 'maps/forum/%1$s/' : "map.{$phpEx}?forum=%2\$s"), 'forum_allow_cat_news' => $html_forum_allow_cat_news, 'forum_cat_news' => $html_url . ($html_forum_mod_rewrite && $_phpbb_seo ? 'news/forum/%1$s/' : "map.{$phpEx}?forum=%2\$s&amp;news"), 'auth_guest' => $html_auth_guest, 'forum_exclude' => $html_forum_exclude, 'forum_allow_auth' => $html_forum_allow_auth));
        }
        $links['main'] = array_merge($links['main'], array('GYM_HTML_NEWS_TITLE' => $user->lang['HTML_NEWS'], 'GYM_HTML_NEWS_URL' => $html_news_url, 'GYM_HTML_NEWS_LINK' => $display_html_main_links ? sprintf($gym_link_tpl, $html_news_url, 'html_news.gif', $user->lang['HTML_NEWS']) : '', 'GYM_HTML_MAP_TITLE' => $user->lang['HTML_MAP'], 'GYM_HTML_MAP_URL' => $html_map_url, 'GYM_HTML_MAP_LINK' => $display_html_main_links ? sprintf($gym_link_tpl, $html_map_url, 'maps-icon.gif', $user->lang['HTML_MAP']) : '', 'GYM_HTML_THEFORUM_NEWS_TITLE' => $user->lang['HTML_FORUM_NEWS'], 'GYM_HTML_THEFORUM_NEWS_URL' => $links['setup']['html']['forum_news_url'], 'GYM_HTML_THEFORUM_NEWS_LINK' => sprintf($gym_link_tpl, $links['setup']['html']['forum_news_url'], 'html_news.gif', $user->lang['HTML_FORUM_NEWS']), 'GYM_HTML_THEFORUM_MAP_TITLE' => $user->lang['HTML_FORUM_MAP'], 'GYM_HTML_THEFORUM_MAP_URL' => $links['setup']['html']['forum_map_url'], 'GYM_HTML_THEFORUM_MAP_LINK' => sprintf($gym_link_tpl, $links['setup']['html']['forum_map_url'], 'maps-icon.gif', $user->lang['HTML_FORUM_MAP'])));
        $do_display_main = $display_html_main_links ? true : $do_display_main;
        $do_display_index = $display_html_index_links ? true : $do_display_index;
        $do_display_cat = $display_html_cat_links ? true : $do_display_cat;
    }
    $links['setup']['main'] = array('link_main' => $gym_config['gym_link_main'] && $do_display_main ? 1 : 0, 'link_index' => $gym_config['gym_link_index'] && $do_display_index ? 1 : 0, 'link_cat' => $gym_config['gym_link_cat'] && $do_display_cat ? 1 : 0, 'f_public_read' => array_diff_assoc($auth_guest_list['read'], $auth_guest_list['skip_pass']) + array_intersect_assoc($auth_guest_list['skip_cat'], $auth_guest_list['list']));
    $links['main'] = array_merge($links['main'], array('GYM_LINKS' => $links['setup']['main']['link_main'], 'GYM_LINKS_CAT' => $links['setup']['main']['link_cat']));
    $links['alternate'] = array();
    if (!empty($links['setup']['rss']['display_alternate'])) {
        $links['alternate'] = array(array('TITLE' => $user->lang['RSS_FEED'], 'URL' => $rss_main_url), array('TITLE' => $user->lang['RSS_CHAN_LIST_TITLE'], 'URL' => $rss_chan_url));
    }
    return $links;
}
Exemplo n.º 4
0
            $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']);