vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to stop a forum from showing up in TopXStats (https://vborg.vbsupport.ru/showthread.php?t=109105)

RDX1 02-28-2006 06:32 AM

How to stop a forum from showing up in TopXStats
 
How do I disallow a forum from showing up in the latest threads for TopXStats?

Or, what I would really like, is it not to show up unless they have permission to view the forum. But either will work.

Code:

<?php
/*======================================================================*\
|| #################################################################### ||
|| # Top 'X' Stats by InfiniteWebby for 3.5.0 RC1                    # ||
|| # ---------------------------------------------------------------- # ||
|| # All PHP code in this file is ?2000-2005 InfiniteWebby            # ||
|| # Email: infinitewebby@hotmail.com                                # ||
|| #################################################################### ||
\*======================================================================*/

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'topXstats.php');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
        'TOPXSTATS',
        'topXstats_stats_bit',
        'topXstats_member_bit',
        'topXstats_poster_bit',
        'topXstats_thread_bit'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// ### TOP X STATS BY INFINITEWEBBY ###########################################
global $vbulletin;

$displayrecords = $vbulletin->input->clean_gpc('r', 'displayrecords', TYPE_UINT);

if ($displayrecords <= 0) {
        $displayrecords = $vbulletin->options['topXstats_displayrecords'];
} else if ($displayrecords >= $vbulletin->options['topXstats_maxdisplayrecords']) {
        $displayrecords = $vbulletin->options['topXstats_maxdisplayrecords'];
} else {
        $displayrecords = $displayrecords;
}

if ($vbulletin->options['topXstats_excludedforums'] !== '') {
        $excludedforums = ',' . $vbulletin->options['topXstats_excludedforums'];
}

$forumpermissions = array();
foreach($vbulletin->forumcache AS $forum) {

        $forumpermissions[$forum["forumid"]] = fetch_permissions($forum['forumid']);

        // ## HIDE FORUMS WITHOUT THE CANVIEW, CANVIEWOTHERS OR CANSEEDELNOTICE PERMISSION ##
        if (!($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums'])  {
                $excludedforums = $excludedforums . ',' . $forum['forumid'];
        }
        // filter out deletion notices if can't be seen
        if ($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canseedelnotice'] OR can_moderate($forum['forumid'])){
                $deljoin = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')";
        } else {
                $deljoin = '';
        }
}


unset($forum);

// get rid of initial comma
$excludedforums = substr($excludedforums, 1);

if ($excludedforums != "") {
        $excludedforums = "AND thread.forumid NOT IN ($excludedforums)";
}

$threadchars = $vbulletin->options['topXstats_threadchars'];
if ($threadchars <= 0) {
        $threadchars = $vbulletin->options['lastthreadchars'];
}

$userchars = $vbulletin->options['topXstats_userchars'];
$newpostprefix = $vbulletin->options['topXstats_newpostprefix'];
$oldpostprefix = $vbulletin->options['topXstats_oldpostprefix'];

if ($threadchars <= 0) {
        $threadchars = $vbulletin->options['lastthreadchars'];
}

$getstats_posters = $db->query_read("SELECT userid, usergroupid, IF(displaygroupid=0, usergroupid, displaygroupid) AS displaygroupid, username, posts FROM " . TABLE_PREFIX . "user ORDER BY posts DESC LIMIT 0, $displayrecords");
while ($getstats_poster = $db->fetch_array($getstats_posters))
{
        if ($userchars > 0) {

                if (strlen($getstats_poster[username]) > $userchars)
                {               
                        $getstats_poster[username] = substr($getstats_poster[username], 0, $userchars) . '...';
                }
                else
                {
                        $getstats_poster[username] = $getstats_poster[username];
                }
        }
        $getstats_poster[musername] = fetch_musername($getstats_poster);
        eval('$topXstats_posters_bits .= "' . fetch_template('topXstats_poster_bit') . '";');
}

$getstats_members = $db->query_read("SELECT userid, usergroupid, IF(displaygroupid=0, usergroupid, displaygroupid) AS displaygroupid, username, posts, joindate FROM " . TABLE_PREFIX . "user ORDER BY joindate DESC LIMIT 0, $displayrecords");
while ($getstats_member = $db->fetch_array($getstats_members))
{
        if ($userchars > 0) {
                if (strlen($getstats_member[username]) > $userchars)
                {               
                        $getstats_member[username] = substr($getstats_member[username], 0, $userchars) . '...';
                }
                else
                {
                        $getstats_member[username] = $getstats_member[username];
                }
        }
        $getstats_member[musername] = fetch_musername($getstats_member);
        eval('$topXstats_members_bits .= "' . fetch_template('topXstats_member_bit') . '";');
}

$getstats_threads = $db->query_read("
        SELECT
                thread.threadid, thread.title, thread.lastpost, thread.forumid, thread.replycount, thread.lastposter, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, thread.visible, user.username, user.userid, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
                " . iif($deljoin, ", NOT ISNULL(deletionlog.primaryid) AS isdeleted, deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason") . "
        FROM " . TABLE_PREFIX . "thread AS thread
                LEFT JOIN  " . TABLE_PREFIX . "user AS user ON (user.username = thread.lastposter)
                $deljoin
                WHERE NOT ISNULL(thread.threadid)
                $excludedforums
                " . iif(!$deljoin, "AND thread.visible <> 2") . "
        ORDER BY lastpost DESC LIMIT 0, $displayrecords");

while ($getstats_thread = $db->fetch_array($getstats_threads))
{
        $getstats_thread[title] = unhtmlspecialchars($getstats_thread[title]);
        if ($threadchars > 0) {
                if (strlen($getstats_thread[title]) > $threadchars)
                {               
                        $getstats_thread[titletrimmed] = substr($getstats_thread[title], 0, strrpos(substr($getstats_thread[title], 0, $threadchars), ' ')) . '...';
                }
                else
                {
                        $getstats_thread[titletrimmed] = $getstats_thread[title];
                }
        }
        if ($getstats_thread[lastpost] > $vbulletin->userinfo['lastvisit'])
        {
                $getstats_thread[newpost] = true;
        }
        if ($getstats_thread[isdeleted])
        {
                $getstats_thread[isdeleted] = true;
        }
        if ($userchars > 0) {
                if (strlen($getstats_thread[username]) > $userchars)
                {               
                        $getstats_thread[username] = substr($getstats_thread[username], 0, $userchars) . '...';
                }
                else
                {
                        $getstats_thread[username] = $getstats_thread[username];
                }
        }
        $getstats_member[musername] = fetch_musername($getstats_thread);
        eval('$topXstats_threads_bits .= "' . fetch_template('topXstats_thread_bit') . '";');
}

eval('$topXstats .= "' . fetch_template('topXstats_stats_bit') . '";');

$navbits = construct_navbits(array('' => $vbphrase[statistics]));
eval('$navbar = "' . fetch_template('navbar') . '";');

construct_forum_jump();

eval('print_output("' . fetch_template('TOPXSTATS') . '");');

/*======================================================================*\
|| #################################################################### ||
|| #          This is the greatest footer ever! Hoorah!              # ||
|| #################################################################### ||
\*======================================================================*/
?>


Damien2005 03-07-2006 08:49 PM

You can disallow a forum from showing up in the latest threads in your admincp ;)

Cheerzz


All times are GMT. The time now is 07:01 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01071 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete