View Single Post
  #2048  
Old 12-02-2004, 06:29 PM
TheEnd's Avatar
TheEnd TheEnd is offline
 
Join Date: Mar 2003
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Alright, well I edited out some of the news strings in the index.php and called it roster.php, and same with vbioptions.php, which i copied and made it vbioptions2.php. The settings are still set on both, which one = the other. Is there a way I can change the database where vbioptions2 is saved? Heres what I got (not much).
Roster.php
HTML Code:
<?php

// +--------------------------------------------------------------------+
// | vBindex Version 3.0.0 Release Candidate 5 (UK English)
// | Copyright (C) MMII - MMIV Winter Systems
// | This file may not be redistributed in whole or significant part.
// +--------------------------------------------------------------------+
// | vBindex, File v3.0.21
// |--------------------------------------------------------------------+
// | Support will only be given at Core Forums (http://www.coreforums.net)
// | to those who have confirmed they are licenced, or at vBulletin.org
// | via the vBindex 3.x thread listed bellow.
// +--------------------------------------------------------------------+
// | v1.x Release(s) by el3m3nt:
// |	(https://vborg.vbsupport.ru/showthread.php?threadid=37021)
// | v2.x Release(s) by NTLDR (aka Eldorado):
// | 	(https://vborg.vbsupport.ru/showthread.php?threadid=41916)
// | v3.x Release(s) by NTLDR (aka Eldorado):
// |    (http://www.coreforums.net/forums/showthread.core?threadid=93)
// |	(https://vborg.vbsupport.ru/showthread.php?threadid=59524)
// +--------------------------------------------------------------------+

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vbindex');
define('AVATAR_ON_NAVBAR', 1);

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

// get special data templates from the datastore
$specialtemplates = array(
	'smiliecache',
	'bbcodecache',
	'iconcache',
	'userstats',
	'birthdaycache',
	'vbindex_setting',
	'vbindex_version',
	'vbindex_config'
);

// pre-cache templates used by all actions
$globaltemplates = array(
	// global templates
	'VBINDEX',
	'VBINDEX_SHELL',
	'vbindex_side',
	'vbindex_header',
	'vbindex_footer',
	'vbindex_onlineuser',
	'vbindex_onlineusers',
	'vbindex_pm_popup_script',
	'vbindex_navbar',
	'vbindex_headinclude',
	// roster
	'vbindex_roster',
	// latest threads
	'vbindex_latestthreads',
	'vbindex_latestthreadbit',
	'vbindex_centerthreadbit',
	// shoutbox
	'vbindex_shoutbox',
	'vbindex_shoutboxbit',
	// today's events
	'vbindex_event',
	'vbindex_eventbit',
	// bbocode
	'bbcode_code',
	'bbcode_html',
	'bbcode_php',
	'bbcode_quote',
	// bithdays
	'vbindex_birthdays',
	// calendar
	'vbindex_calendar',
	'calendar_smallmonth_day',
	'calendar_smallmonth_day_other',
	'calendar_smallmonth_header',
	'calendar_smallmonth_week',
	// poll
	'vbindex_poll',
	'vbindex_poll_option',
	'vbindex_poll_result',
	// custom boxes
	'vbindex_customblock_php',
	// default to 6 to prevent extra queries
	'vbindex_customblock_1',
	'vbindex_customblock_2',
	'vbindex_customblock_3',
	'vbindex_customblock_4',
	'vbindex_customblock_5',
	'vbindex_customblock_6',
);

// pre 4.1.0 don't have superglobals, so lets create the
// two indexs we're interested in before vB does
if (PHP_VERSION < '4.1.0') {
	$_REQUEST['page'] = &$HTTP_GET_VARS['page'];
	$_REQUEST['section'] = &$HTTP_GET_VARS['section'];
}

// pre-cache templates used by specific actions
// link the page we're requesting to the do var so that vB3 will
// pre-cache the template and save 1 query
if (!empty($_REQUEST['page'])) {
	$_REQUEST['do'] = &$_REQUEST['page'];
	define('EXTRA_PAGE', true);
}
// pre cache the phpinc template per extra page.
if (!empty($_REQUEST['section'])) {
	$_REQUEST['do'] = &$_REQUEST['section'];
	define('EXTRA_PAGE', true);
}
$actiontemplates = array(
	$_REQUEST['page'] => array(
		'vbindex_extra_'.$_REQUEST['page']
	),
	$_REQUEST['section'] => array(
		'vbindex_extra_'.$_REQUEST['section'],
		'vbindex_extra_php_'.$_REQUEST['section']
	)
);

if (!defined('EXTRA_PAGE')) {
	define('EXTRA_PAGE', false);
}

// ######################### REQUIRE BACK-END ############################
// this contains a few config vars for vBindex to make upgrades easier
require_once('./vbiconfig2.php');

if (!defined('SCRIPT_EXTENSION')) {
	// should the script extension not be defined assume .php
	define('SCRIPT_EXTENSION', '.php');
}

chdir(CHDIR_PATH);
require_once('./global'.SCRIPT_EXTENSION);
require_once('./includes/functions_bbcodeparse'.SCRIPT_EXTENSION);
require_once('./includes/functions_bigthree'.SCRIPT_EXTENSION);
require_once('./includes/functions_user'.SCRIPT_EXTENSION);

// ######################### vBindex OPTIONS #############################
$vbindex = unserialize($datastore['vbindex_setting']);
$vbindex['version'] = $datastore['vbindex_version'];
$ext = SCRIPT_EXTENSION;

// options bitfields
$_VBINDEX['options'] = array(
	'vbi_left_col'          => 1,
	'vbi_right_col'         => 2,
	'vbi_shownews'          => 4,
	'vbi_shownewsavatar'    => 8,
	'vbi_showthreads'       => 16,
	'vbi_showshoutbox'      => 32,
	'vbi_both_cols'         => 64,
	'vbi_wol'				=> 128,
	'vbi_subnews'			=> 256,
	'vbi_subthreads'		=> 512,
	'vbi_subnewposts'		=> 1024,
	'vbi_welcomeav'			=> 2048,
	'vbi_scrollshoutbox'	=> 4096,
	'vbi_allowshoutdelete'	=> 8192,
	'vbi_showcalendar'		=> 16384,
	'vbi_showbirthdays'		=> 32768,
	'vbi_showpoll'			=> 65536,
	'vbi_randompoll'		=> 131072,
	'vbi_disabledshout'		=> 262144,
	'vbi_shownewposts'		=> 524288,
	'vbi_stickynews'		=> 1048576,
	'vbi_24wol'				=> 2097152,
	'vbi_24woluser'			=> 4194304,
	'vbi_ascshout'			=> 8388608,
	'vbi_vbwar'				=> 16777216,
	'vbi_showweekends'		=> 33554432,
	//'vbi_newscharlimit'		=> 67108864, // needs to be added to vbioptions.php, as does $vbindex['newscharlimit'] for the number of chars
	'vbi_showcenterthreads'	=> 134217728,
);

// define all the options for on the spot checks
foreach($_VBINDEX['options'] AS $option => $bitfield) {
	define(strtoupper($option), $bitfield);
}
unset($option, $bitfield);

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

// ############################ INIT VARS ###############################

// user configured forumids to exclude
if (!empty($vbindex['limitfids'])) {
	$limitfids = array();
	$limitfids = explode(',', $vbindex['limitfids']);
	foreach($limitfids AS $key => $value) {
		$limitfids["$key"] = intval($value);
	}
} else {
	$limitfids = array(0);
}

$globalignore = ''; // global ignore list
$globalshoutignore = ''; // global ignore list as used in the shoutbox
$shoutignore = ''; // users ignore list as used in the shoutbox
$ignorelist = ''; // users ignore list
$onlineusers = '';
$previewfield = '';
$previewjoin = '';
$pollbits = '';
$home['subscribedthreads'] = 0;
$home['newposts'] = 0;
$home['newthreads'] = 0;
$avatarcache = array(); // avatar cache, saves 1 query if a avatar is returned from the cache
$threadids = array();
$iconcache = unserialize($datastore['iconcache']); // thread icon cache

// #################### PROCESS FORUM PERMISSIONS #######################

// fetch the permissions for each forum
$forumperms = array();
foreach($forumcache AS $forum) {

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

	// ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
	if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
		// forum pass? || !verify_forum_password($forum['forumid'], $foruminfo['password'], false);) {
		$limitfids[] = $forum['forumid'];
	}
}
unset($forum);

// ####################### PROCESS IGNORE LISTS #########################
// ## GLOBAL IGNORE ##
if ($Coventry = fetch_coventry('string')) {
	$globalignore = "AND thread.postuserid NOT IN ($Coventry) ";
	$globalshoutignore = "AND shoutbox.userid NOT IN ($Coventry)";
}
// ## USERS IGNORE ##
if (trim($bbuserinfo['ignorelist'])) {
	$ignorelist = 'AND thread.postuserid NOT IN ('.str_replace(' ', ',', $bbuserinfo['ignorelist']).')';
	$shoutignore = 'AND shoutbox.userid NOT IN ('.str_replace(' ', ',', $bbuserinfo['ignorelist']).')';
}

// ################ PROCESS SPECIFIC GET/POST ACTIONS ###################
// ## START INSERT NEW SHOUT ##
if (($vbindex['options'] & VBI_SHOWSHOUTBOX) && trim(!empty($_POST['shout'])) && $bbuserinfo['userid']) {

	// needed for convert_url_to_bbcode();
	require_once('./includes/functions_newpost'.SCRIPT_EXTENSION);

	// check length of shout
	if (!empty($vbindex['max_shout_length']) && vbstrlen($_POST['shout']) > $vbindex['max_shout_length']) {
		eval(print_standard_error('error_vbi_shout_too_long'));
	}

	$DB_site->query("	## INSERT NEW SHOUT ##
						INSERT INTO ".TABLE_PREFIX."vbindex_shoutbox
						(shoutid, userid, shout, dateline)
						VALUES
						(NULL, '$bbuserinfo[userid]', '".addslashes(convert_url_to_bbcode($_POST['shout']))."',
                     	'".TIMENOW."')");

			$url = "$_SERVER[PHP_SELF]?$session[sessionurl]";
			eval(print_standard_redirect('redirect_vbi_shoutadded'));
}
// ## START DELETE SHOUT ##
if ($_REQUEST['action'] == 'deleteshout') {

	$shoutid = intval($_REQUEST['shoutid']);

    if (in_array($bbuserinfo['usergroupid'], $vbindex['global_shout_delete'])) {
		// global shout delete group so delete it
		$deleteshout = true;
	} else {
		$deleteshout = false;
	}

	if (($vbindex['options'] & VBI_ALLOWSHOUTDELETE) && !$deleteshout) {

		// check user is the shouter
		$shout = $DB_site->query_first("## DELETE SHOUT ##
										SELECT userid, shoutid
										FROM ".TABLE_PREFIX."vbindex_shoutbox
										WHERE shoutid = '$shoutid'");

		if ($shout['userid'] == $bbuserinfo['userid']) {
			// delete shout as user is shouter
			$deleteshout = true;
		} else {
			$deleteshout = false;
			// error user isn't shouter
			eval(print_standard_error('error_vbi_cant_delete_others_shouts'));
		}
	}

	if ($deleteshout === true) {
		$DB_site->query("DELETE FROM ".TABLE_PREFIX."vbindex_shoutbox WHERE shoutid = '$shoutid'");
		$url = "$_SERVER[PHP_SELF]?$session[sessionurl]";
		eval(print_standard_redirect('redirect_vbi_shoutdeleted'));
	}
}

// #################### GET NEW POSTS/THREAD INFO #######################
if ($bbuserinfo['userid'] > 0 && ($vbindex['options'] & VBI_SHOWNEWPOSTS)) {
	if (!empty($bbuserinfo['lastvisit'])) {
		$datecut = $bbuserinfo['lastvisit'];
	} else {
		$datecut = TIMENOW - (24 * 60 * 60 * 1);
	}

	$getnew = $DB_site->query("
			## GET NEW POSTS / THREADS ##
			SELECT post.postid, post.threadid
			".iif(($vbindex['options'] & VBI_SUBNEWPOSTS) AND $bbuserinfo['userid'], ', NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed')."
			FROM ".TABLE_PREFIX."post AS post
			".iif(($vbindex['options'] & VBI_SUBNEWPOSTS) AND $bbuserinfo['userid'], "
			LEFT JOIN ".TABLE_PREFIX."subscribethread AS subscribethread ON(subscribethread.threadid = post.threadid AND subscribethread.userid = $bbuserinfo[userid])"
			)."
			WHERE dateline >= $datecut
			AND visible = '1'");

	while($new = $DB_site->fetch_array($getnew)) {
		$home['newposts']++;
		if (!in_array($new['threadid'], $threadids)) {
			$home['newthreads']++;
			$threadids[] = $new['threadid'];
			if ($new['issubscribed']) {
				$home['subscribedthreads']++;
			}
		}
	}
	$home['newposts'] = vb_number_format($home['newposts']);
	$home['newthreads'] = vb_number_format($home['newthreads']);
	// memory saving
	unset($new, $datecut, $threadids);
	$DB_site->free_result($getnew);
}

// user statistics
$userstats = unserialize($datastore['userstats']);
$home['numbermembers'] = vb_number_format($userstats['numbermembers']);
$home['newusername'] = $userstats['newusername'];
$home['newuserid'] = $userstats['newuserid'];
unset($userstats);

// ####################### PROCESS vBindex WOL ##########################
if ($vbindex['options'] & VBI_WOL) {
	$online['datecut'] = TIMENOW - $vboptions['cookietimeout'];
	$buddies = explode(' ', $bbuserinfo['buddylist']);

	$onlineusers = $DB_site->query("
						## GET ONLINE USERS ##
						SELECT user.username, (user.options & $_USEROPTIONS[invisible]) AS invisible,
						user.usergroupid, session.userid, session.lastactivity,
						IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
						FROM ".TABLE_PREFIX."session AS session
						LEFT JOIN ".TABLE_PREFIX."user AS user ON (user.userid = session.userid)
						WHERE session.lastactivity > $online[datecut]
						ORDER BY ".iif($permissions['genericpermissions'] & CANSEEHIDDEN, 'invisible ASC, ')."username ASC");

	$home['onlinetotal'] = 0;
	$home['onlineguesttotal'] = 0;
	$home['onlinemembertotal'] = 0;
	$done = array();
	while($onlineuser = $DB_site->fetch_array($onlineusers)) {

		if ($onlineuser['userid'] && !$done["$onlineuser[userid]"]) {

			$done["$onlineuser[userid]"] = true;

			$home['onlinetotal']++;
			$home['onlinemembertotal']++;

			// do invisible users
			if (($permissions['genericpermissions'] & CANSEEHIDDEN) && $onlineuser['invisible']) {
				$onlineuser['invisiblemark'] = '*';
			} elseif ($onlineuser['invisible']) {
				$home['onlineguesttotal']++;
				$home['onlinemembertotal']--;
				break 1;
			}

			// do buddies
			if (in_array($onlineuser['userid'], $buddies)) {
				$onlineuser['buddymark'] = '+';
			}

			$onlineuser['musername'] = fetch_musername($onlineuser);
			eval("\$home[onlineusers] .= \", ".fetch_template('vbindex_onlineuser')."\";");

		} elseif ($onlineuser['userid'] == 0) {
			$home['onlineguesttotal']++;
			$home['onlinetotal']++;
		}
	}

	if ($vbindex['options'] & VBI_24WOL) {
		// show users from the last 24 hours
		$show['last24'] = true;
		unset($onlineuser);
		$starttime = mktime(0, 0, 0, date('m'), date('d'), date('Y'));


		if ($vbindex['options'] & VBI_24WOLUSER) {

			// show user names and count
			$show['last24user'] = true;

			$fetchusers = $DB_site->query("
						## USERS IN PAST 24HRS ##
						SELECT username, userid, usergroupid,
						(user.options & $_USEROPTIONS[invisible]) AS invisible,
						IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
						FROM ".TABLE_PREFIX."user AS user
						WHERE lastactivity >= $starttime
						ORDER BY username ASC
			");

			while($onlineuser = $DB_site->fetch_array($fetchusers)) {

				$home['last24count']++;
				$onlineuser['musername'] = fetch_musername($onlineuser);

				if (($permissions['genericpermissions'] & CANSEEHIDDEN) && $onlineuser['invisible']) {
					$onlineuser['invisiblemark'] = '*';
				} elseif ($onlineuser['invisible']) {
					$onlineuser['musername'] = '';
					$home['last24count']--;
				}

				eval("\$home[last24] .= \", ".fetch_template('vbindex_onlineuser')."\";");
			}
			// removed inital comma in online list
			$home['last24'] = substr($home['last24'], 2);
			// memory saving
			unset($user);
			$DB_site->free_result($fetchusers);

		} else {

			// show count only
			$show['last24user'] = false;
			$onlinetoday = $DB_site->query_first("  ## USERS IN LAST 24HRS COUNT ##
													SELECT COUNT(*) AS count
													FROM ".TABLE_PREFIX."user
													WHERE lastactivity >= $starttime
									");
			$home['last24count'] = $onlinetoday['count'];
		}
	}

	// removed inital comma in online list
	$home['onlineusers'] = substr($home['onlineusers'], 2);
	eval("\$side[onlineusers] .= \"".fetch_template('vbindex_onlineusers')."\";");
	// memory saving
	unset($onlineuser, $done, $online, $buddies);
	$DB_site->free_result($onlineusers);
}

// ######################### PROCESS NEWS ############################
// standard news block
if (($vbindex['options'] & VBI_SHOWNEWS) && !($vbindex['options'] & VBI_VBWAR) && !EXTRA_PAGE && $_REQUEST['action'] != 'shoutbox') {

	$getnews = $DB_site->query("
		## GET NEWS ##
		SELECT thread.*,thread.iconid AS threadiconid, threadpost.pagetext AS pagetext,
		threadpost.attach AS attachcount,
		".iif($vbindex['options'] & VBI_SHOWNEWSAVATAR, 'avatarpath, NOT ISNULL(avatardata) AS customavatar, user.avatarrevision, customavatar.dateline AS customdateline,')."
		".iif(($vbindex['options'] & VBI_SUBNEWS) AND $bbuserinfo['userid'], 'NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed,')."
		IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid
		FROM ".TABLE_PREFIX."thread AS thread
		LEFT JOIN ".TABLE_PREFIX."user AS user ON (thread.postuserid = user.userid)
		LEFT JOIN ".TABLE_PREFIX."post AS threadpost ON (thread.firstpostid = threadpost.postid)
		LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
		".iif($vbindex['options'] & VBI_SHOWNEWSAVATAR, '
		LEFT JOIN '.TABLE_PREFIX.'customavatar AS customavatar ON (customavatar.userid = user.userid)
		LEFT JOIN '.TABLE_PREFIX.'avatar AS avatar ON (avatar.avatarid = user.avatarid)'
		)."
		".iif(($vbindex['options'] & VBI_SUBNEWS) AND $bbuserinfo['userid'], "
		LEFT JOIN ".TABLE_PREFIX."subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = $bbuserinfo[userid])"
		)."
		WHERE forumid IN ($vbindex[newsfid])
		AND deletionlog.primaryid IS NULL
		AND forumid NOT IN (".implode(',', $limitfids).")
		AND thread.open <> 10
		AND thread.visible = '1'
		$globalignore
		$ignorelist
		ORDER BY ".iif($vbindex['options'] & VBI_STICKYNEWS, 'thread.sticky DESC,', '')." thread.dateline DESC
		LIMIT $vbindex[newsposts]");

	while($news = $DB_site->fetch_array($getnews)) {

  		$news['title'] = fetch_censored_text($news['title']);
  		$news['time'] = vbdate($vboptions['timeformat'], $news['dateline']);
  		$news['date'] = vbdate($vboptions['dateformat'], $news['dateline'], 1);
  		$news['musername'] = fetch_musername($news, 'displaygroupid', 'postusername');
  		$news['attachcount'] = vb_number_format($news['attachcount']);
  		$news['replycount'] = vb_number_format($news['replycount']);

  		if ($news['iconid']) {
			$news['showicon'] = true;
			$news['threadiconpath'] = &$iconcache["$news[threadiconid]"]['iconpath'];
			$news['threadicontitle'] = &$iconcache["$news[threadiconid]"]['title'];
		} elseif (!empty($vboptions['showdeficon'])) {
			$news['showicon'] = true;
			$news['threadiconpath'] = $vboptions['showdeficon'];
			$news['threadicontitle'] = $vbphrase['default'];
		}

  		// ## CENSOR NEWS AND PARSE vB CODE ##
  		if (!empty($vbindex['newscharlimit']) && (vbstrlen(strip_bbcode($news['pagetext'])) > $vbindex['newscharlimit'])) {
  		  	$news['pagetext'] = fetch_censored_text(strip_bbcode(parse_bbcode(fetch_trimmed_title($news['pagetext'], $vbindex['newscharlimit']), true, true), $news['forumid'], 1));
  		  	$show['readmore'] = true;
		} else {
			$news['pagetext'] = fetch_censored_text(parse_bbcode($news['pagetext'], $news['forumid'], 1));
			$show['readmore'] = false;
		}

		// ## GET POSTERS AVATAR ##
		$news['avatar'] = false;
		if ($vbindex['options'] & VBI_SHOWNEWSAVATAR) {

			if (!isset($avatarcache["$news[postuserid]"])) {

				if (!empty($news['customavatar'])) {

					if ($vboptions['usefileavatar']) {
						$news['avatarurl'] = "$vboptions[avatarurl]/avatar$news[postuserid]_$news[avatarrevision].gif";
					} else {
						$news['avatarurl'] = "$vboptions[bburl]/image".SCRIPT_EXTENSION."?userid=$news[postuserid]&amp;dateline=$news[customdateline]";
					}

					$news['avatar'] = true;
					$avatarcache["$news[postuserid]"] = $news['avatarurl'];
					DEVDEBUG("cached avatar for userid $news[postuserid]");
				} elseif (!empty($news['avatarpath'])) {
					$news['avatarurl'] = $vboptions['bburl'].'/'.$news['avatarpath'];
					$news['avatar'] = true;
					$avatarcache["$news[postuserid]"] = $news['avatarurl'];
					DEVDEBUG("cached avatar for userid $news[postuserid]");
				} elseif (!empty($vbindex['useravatar'])) { // we have a default av specified
					$news['avatarurl'] = $vbindex['useravatar'];
					$avatarcache["$bbuserinfo[userid]"] = $news['avatarurl'];
					$news['avatar'] = true;
				}

  			} else {
				$news['avatar'] = true;
				$news['avatarurl'] = $avatarcache["$news[postuserid]"];
			}
		}

  		eval("\$home[roster] .= \"".fetch_template('vbindex_roster')."\";");
	}
  	// memory saving
	unset($news);
	$DB_site->free_result($getnews);
}

// if vBwar is enabled then show that instead
if ((($vbindex['options'] & VBI_VBWAR) && !($vbindex['options'] & VBI_SHOWNEWS)) && !EXTRA_PAGE && $_REQUEST['action'] != 'shoutbox') {

	require_once('./vnews.php');

}

// ######################## CREATE WELCOME BOX ###########################
// moved bellow news as it creates the posibility of one less query
// if the users avatar has been cached from a news post
$showavatar = false;

// if we are a member
if ($bbuserinfo['userid']) {

	// show members welcome
	$showmemberwelcome = true;

	// ## GET & CACHE AV ##
	if ($vbindex['options'] & VBI_WELCOMEAV) {

		if (!isset($avatarcache["$bbuserinfo[userid]"])) {

			if (trim($vboptions['templateversion']) == '3.0.0 Gamma') {
				$avatarurl = $vboptions['bburl'].'/'.fetch_avatar_url($bbuserinfo['userid']);
			} else {
				if ($vboptions['usefileavatar']) {
					$avatarurl = "$vboptions[avatarurl]/avatar$bbuserinfo[userid]_$bbuserinfo[avatarrevision].gif";
				} else {
					$avatarurl = $vboptions['bburl']."/image".SCRIPT_EXTENSION."?userid=$bbuserinfo[userid]&amp;dateline=$bbuserinfo[customdateline]";
				}
			}
			$avatarcache["$bbuserinfo[userid]"] = $avatarurl;
			DEVDEBUG("cached avatar for userid $bbuserinfo[userid]");
		} else {
			$avatarurl = $avatarcache["$bbuserinfo[userid]"];
		}

		if ($avatarurl != $vboptions['bburl'].'/') {
			$showavatar = true;
		} elseif (!empty($vbindex['useravatar'])) { // we have a default av specified
			$avatarurl = $vbindex['useravatar'];
			$avatarcache["$bbuserinfo[userid]"] = $avatarurl;
			$showavatar = true;
		}
	}

} else {
	// a guest is viewing
	if (!empty($vbindex['guestavatar'])) {
		$avatarurl = $vbindex['guestavatar'];
		$showavatar = true;
		$home['welcomemessage'] = construct_phrase($vbphrase['vbi_welcome_guest_message'], $vboptions['bbtitle'], $vboptions['bburl'], SCRIPT_EXTENSION.'?'.$session['sessionurl']);
	}
  	$showmemberwelcome = false;
}

// #################### PROCESS LATEST THREADS #######################
if ($vbindex['options'] & VBI_SHOWTHREADS) {

	if ($vboptions['threadpreview'] > 0) {
		$previewfield = ', post.pagetext AS preview';
		$previewjoin = 'LEFT JOIN '.TABLE_PREFIX.'post AS post ON(post.postid = thread.firstpostid)';
	}

	$getthreads = $DB_site->query("
		## GET LATEST THREADS ##
		SELECT thread.*,thread.iconid AS threadiconid $previewfield
		".iif(($vbindex['options'] & VBI_SUBTHREADS) AND $bbuserinfo['userid'], ', NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed')."
		".iif($vbindex['options'] & VBI_SHOWCENTERTHREADS, ',forum.title AS forumtitle')."
		FROM ".TABLE_PREFIX."thread AS thread
		LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
		".iif(($vbindex['options'] & VBI_SUBTHREADS) AND $bbuserinfo['userid'], "
		LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = $bbuserinfo[userid])"
		)."
		".iif($vbindex['options'] & VBI_SHOWCENTERTHREADS, "LEFT JOIN ".TABLE_PREFIX."forum AS forum ON(forum.forumid = thread.forumid)")."
		$previewjoin
		WHERE open = '1'
		AND thread.open <> 10
		AND thread.forumid NOT IN (".iif(is_numeric($vbindex['newsfid']), "$vbindex[newsfid],").implode(',', $limitfids).")
		AND thread.visible = '1'
		AND deletionlog.primaryid IS NULL
		$globalignore
		$ignorelist
		ORDER BY lastpost
		DESC LIMIT $vbindex[maxlthreads]");

	while($thread = $DB_site->fetch_array($getthreads)) {

		$threads = true;
	    $thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspecialchars($thread['title']), 22));
	    $thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
	    $thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
	    $thread['preview'] = preg_replace('#\[quote(=(&quot;|"|\'|).*\\2)?\](.*)\[/quote\]#siU', '', $thread['preview']);
		$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode(fetch_censored_text($thread['preview']), false, true), $vboptions['threadpreview']));
		$thread['replycount'] = vb_number_format($thread['replycount']);
		$thread['views'] = vb_number_format($thread['views']);

	    // thread icon
	    $show['icon'] = false;
	    if ($thread['iconid']) {
			$show['icon'] = true;
			$thread['threadiconpath'] = &$iconcache["$thread[threadiconid]"]['iconpath'];
			$thread['threadicontitle'] = &$iconcache["$thread[threadiconid]"]['title'];
		} elseif (!empty($vboptions['showdeficon'])) {
			$show['icon'] = true;
			$thread['threadiconpath'] = $vboptions['showdeficon'];
			$thread['threadicontitle'] = $vbphrase['default'];
		}

		// show goto new post
		$show['firstnew'] = false;
		$bbforumview = fetch_bbarray_cookie('forum_view', $thread['forumid']);

		if ($bbforumview > $bbuserinfo['lastvisit']) {
			$lastread = $bbforumview;
		} else {
			$lastread = $bbuserinfo['lastvisit'];
		}

		if ($thread['lastpost'] > $lastread) {

			$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);

			if ($thread['lastpost'] > $threadview) {
				$show['firstnew'] = true;
				$show['icon'] = false;
			}
		}

	    exec_switch_bg();

	    eval("\$threadbits .= \"".fetch_template('vbindex_latestthreadbit')."\";");
	    if ($vbindex['options'] & VBI_SHOWCENTERTHREADS) {
	    	// prepare center threads block
	    	eval("\$centerthreadbits .= \"".fetch_template('vbindex_centerthreadbit')."\";");
		}
	}
	if ($threads) {
		eval("\$side[latestthreads] = \"".fetch_template('vbindex_latestthreads')."\";");
	}
	// memory saving
	unset($thread, $threads);
	$DB_site->free_result($getthreads);
}

// ######################### PROCESS POLL ###############################
if ($vbindex['options'] & VBI_SHOWPOLL) {

	// the $pollinfo query here is experimental, to save one query later on I have joined
	// the pollvote table if the bbuser is registed, this seems to work fine from my testing

	$pollinfo = $DB_site->query_first("
			## GET POLL ##
			SELECT thread.pollid, thread.forumid, open, threadid, replycount, question, poll.dateline,
			options, votes, active, numberoptions, timeout, multiple, voters,
			pollvote.voteoption, pollvote.userid AS voteuserid
			FROM ".TABLE_PREFIX."thread AS thread
			LEFT JOIN ".TABLE_PREFIX."poll AS poll ON (thread.pollid = poll.pollid)
			LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
			LEFT JOIN ".TABLE_PREFIX."pollvote AS pollvote ON(thread.pollid = pollvote.pollid AND pollvote.userid = $bbuserinfo[userid])
			WHERE forumid NOT IN (".implode(',', $limitfids).")
			AND deletionlog.primaryid IS NULL
			AND thread.pollid <> 0
			AND thread.open <> 10
			AND thread.visible = '1'
			".iif(strtoupper($vbindex['pollsforumid']) != 'ALL', "AND thread.forumid IN ($vbindex[pollsforumid])")."
			$globalignore
			$ignorelist
			ORDER BY ".iif($vbindex['options'] & VBI_RANDOMPOLL, 'RAND()', 'thread.threadid')." DESC
			LIMIT 1");

	if ($pollinfo['pollid']) {

		$pollinfo['question'] = fetch_censored_text($pollinfo['question']);

		$splitoptions = explode('|||', $pollinfo['options']);
		$splitvotes = explode('|||', $pollinfo['votes']);

		$showresults = '';
		$uservoted = '';

		if (!$pollinfo['active'] || !$pollinfo['open'] || ($pollinfo['dateline'] + ($pollinfo['timeout'] * 86400) < TIMENOW && $pollinfo['timeout'])) {
			// poll closed
			$showresults = true;
		} elseif (!($forumperms["$pollinfo[forumid]"] & CANVOTE)) {
			// user cannot vote on this poll
			$nopermission = true;
		} elseif (fetch_bbarray_cookie('poll_voted', $pollinfo['pollid'])) {
			// cookie shows user has voted
			$uservoted = true;
		} elseif ($bbuserinfo['userid'] == $pollinfo['voteuserid'] && !empty($pollinfo['voteoption'])) {
			// pollinfo query shows user has voted
			$uservoted = true;
		}

		$i = 0;

		while($i++ < $pollinfo['numberoptions']) {
			$pollinfo['numbervotes'] += $splitvotes[$i - 1];
		}

		$i = 0;
		$option = array();

		while($i++ < $pollinfo['numberoptions']) {

			exec_switch_bg();

			$option['question'] = fetch_censored_text(parse_bbcode($splitoptions[$i - 1], $pollinfo['forumid'], $pollinfo['allowsmilies']));
			$option['votes'] = $splitvotes[$i - 1];
			$option['number'] = $i;

			if ($showresults || $uservoted || $nopermission) {
				if ($showresults) {
					$status = $vbphrase['this_poll_is_closed'];
				} elseif ($uservoted) {
					$status = $vbphrase['you_have_already_voted_on_this_poll'];
				} elseif ($nopermission) {
					$status = $vbphrase['you_may_not_vote_on_this_poll'];
				}

				$percent = 0;
				if ($option['votes']) {
					$percent = vb_number_format($option['votes'] / $pollinfo['numbervotes'] * 100, 2);
				}

				$option['graphicnumber'] = $option['number'] % 6 + 1;
				$option['barnumber'] = round($percent) * 1.3;

				$showform = false;
				eval("\$home[pollbits] .= \"".fetch_template('vbindex_poll_result')."\";");
			} elseif ($pollinfo['multiple']) {
				// mutiple choice poll
				$multiple = true;
				$showform = true;
				eval("\$home[pollbits] .= \"".fetch_template('vbindex_poll_option')."\";");
			} else {
				// single choice poll
				$multiple = false;
				$showform = true;
				eval("\$home[pollbits] .= \"".fetch_template('vbindex_poll_option')."\";");
			}
		}
		eval("\$side[poll] = \"".fetch_template('vbindex_poll')."\";");
	}
}

// ####################### PROCESS CAlENDAR & EVENTS ##########################
if ($vbindex['options'] & VBI_SHOWCALENDAR) {

	// lets prevent hacking and do our own calendar permissions checking
	$cpermscache = array();
	$calendarcache = array();

    // fetch the membergroupids
    $membergroupids = fetch_membergroupids_array($bbuserinfo);

    $calendarpermissions = $DB_site->query("
        ## CALENDAR PERMS & OPTIONS QUERY (userid: $bbuserinfo[userid], membergroupids: $bbuserinfo[membergroupids]) ##
        SELECT calendarpermission.usergroupid, calendarpermission.calendarpermissions,
        calendar.calendarid,calendar.title, calendar.options, calendar.startofweek, displayorder
        FROM ".TABLE_PREFIX."calendar AS calendar
        LEFT JOIN ".TABLE_PREFIX."calendarpermission AS calendarpermission ON (calendarpermission.calendarid=calendar.calendarid AND usergroupid IN(".implode(',', $membergroupids)."))
        ORDER BY displayorder ASC");

	while($calendarpermission = $DB_site->fetch_array($calendarpermissions)) {
		if (!empty($calendarpermission['displayorder'])) {
			// leave permissions at 0 for calendars that aren't being displayed
			$cpermscache["$calendarpermission[calendarid]"]["$calendarpermission[usergroupid]"] = intval($calendarpermission['calendarpermissions']);
			$calendarcache["$calendarpermission[calendarid]"]['title'] = $calendarpermission['title'];
			$calendarcache["$calendarpermission[calendarid]"]['options'] = $calendarpermission['options'];
			$calendarcache["$calendarpermission[calendarid]"]['startofweek'] = $calendarpermission['startofweek'];
		}
	}
	// memory saving
	unset($calendarpermission);
	$DB_site->free_result($calendarpermissions);

	// Combine the calendar permissions for all member groups
	foreach($cpermscache AS $calendarid => $cpermissions) {
		$user['calendarpermissions']["$calendarid"] = 0;
		foreach($membergroupids AS $usergroupid) {
			if (isset($cpermissions["$usergroupid"])) {
				$bbuserinfo['calendarpermissions']["$calendarid"] |= $cpermissions["$usergroupid"];
			} else {
				$bbuserinfo['calendarpermissions']["$calendarid"] |= $usergroupcache["$usergroupid"]['calendarpermissions'];
			}
		}
	}

	// require the calendar functions
	require_once('./includes/functions_calendar'.SCRIPT_EXTENSION);

	// get the first viewable calendarid
	$showcalendar = false;
	foreach ($calendarcache AS $id => $value) {
		if ($bbuserinfo['calendarpermissions']["$id"] & CANVIEWCALENDAR) {

			$calendarinfo = array(
				'options' 		=> $value['options'],
				'title'			=> $value['title'],
				'startofweek'	=> $value['startofweek'],
				'calendarid'	=> $id
			);

			$startofweek = $value['startofweek'];
			$calendarid = $id;
			$showcalendar = true;
			break;
		}
	}

	if ($showcalendar) {

		// bbuser has access to a calendar, so lets process it
		if ($bbuserinfo['startofweek'] > 7 || $bbuserinfo['startofweek'] < 1) {
			$bbuserinfo['startofweek'] = $calendarinfo['startofweek'];
		}

		$today = getdate(TIMENOW - $vboptions['hourdiff']);
		$today['month'] = $vbphrase[strtolower($today['month'])];

		$usertoday = array(
			'firstday' => gmdate('w', gmmktime(0, 0, 0, $today['mon'], 1, $today['year'])),
			'month' => $today['mon'], 'year' => $today['year']
		);

		$getoptions = convert_bits_to_array($calendarinfo['options'], $_CALENDAROPTIONS);
		$calendarinfo = array_merge($calendarinfo, $getoptions);
		$calendarinfo['showweekends'] = iif($vbindex['options'] & VBI_SHOWWEEKENDS, 1, 0);

		// events
		//$eventarray = unserialize($datastore['vbi_eventcache']);
		//$eventcache = $eventarray["$calendarinfo[calendarid]"];
		//unset($eventarray);echo '<pre>';print_r($eventcache);exit;
		$erange = array(
			'frommonth' => $today['mon'],
			'fromyear'  => $today['year'],
			'nextmonth' => $today['mon'],
			'nextyear'  => $today['year']
		);
		$eventcache = cache_events($erange);

		if (is_array($eventcache)) {
			// only process events if we have an array of them
			$i = 0;
			foreach($eventcache AS $event) {
				if (!($bbuserinfo['calendarpermissions']["$calendarinfo[calendarid]"] & CANVIEWOTHERSEVENT) && $bbuserinfo['userid'] != $event['userid']) {
					unset($eventcache["$i"]);
				}
				$i++;
			}
		}

		$calendarbits = str_replace('calendar'.SCRIPT_EXTENSION, "$vboptions[bburl]/calendar".SCRIPT_EXTENSION, construct_calendar_output($today, $usertoday, $calendarinfo, 0));
		eval("\$side[calendar] = \"".fetch_template('vbindex_calendar')."\";");
	} else {
		$side['calendar'] = '';
	}
}

// #################### PROCESS TODAYS BIRTHDAYS #######################
if ($vbindex['options'] & VBI_SHOWBIRTHDAYS) {

	// birthdays
	$birthdays = unserialize($datastore['birthdaycache']);
	$birthdaydate = vbdate('Y-m-d', TIMENOW);

	if (!is_array($birthdays) || ($birthdaydate != $birthdays['day1'] && $birthdaydate != $birthdays['day2'])) {
		// update the cache
		require_once('./includes/functions_databuild'.SCRIPT_EXTENSION);
		$birthdays = build_birthdays();
		DEVDEBUG('Updated Birthday Cache');
	}

	if ($birthdays['day1'] == $birthdaydate && !empty($birthdays['users1'])) {
		// process day1
		$home['birthdaybit'] = str_replace('member'.SCRIPT_EXTENSION.'?u', "$vboptions[bburl]/member".SCRIPT_EXTENSION.'?userid', $birthdays['users1']);
		eval("\$side[birthdays] = \"".fetch_template('vbindex_birthdays')."\";");
	} elseif ($birthdays['day2'] == $birthdaydate && !empty($birthdays['users2'])) {
		// process day2
		$home['birthdaybit'] = str_replace('member'.SCRIPT_EXTENSION.'?u', "$vboptions[bburl]/member".SCRIPT_EXTENSION.'?userid', $birthdays['users2']);
		eval("\$side[birthdays] = \"".fetch_template('vbindex_birthdays')."\";");
	} else {
		$side['birthdays'] = '';
	}
	unset($birthdays, $birthdaydate);
}

// ######################## PROCESS SHOUTBOX ############################
if ($vbindex['options'] & VBI_SHOWSHOUTBOX) {

	if ($_REQUEST['action'] == 'shoutbox') {
		$pagenumber = intval($_REQUEST['pagenumber']);
		$perpage = intval($_REQUEST['perpage']);
		$mainpage = true;

		$total = $DB_site->query_first("## COUNT SHOUTS ##
										SELECT COUNT(*) AS shouts
										FROM ".TABLE_PREFIX."vbindex_shoutbox
										WHERE 1 = 1
										$globalshoutignore
	  									$shoutignore");

		// set defaults
		sanitize_pageresults($total['shouts'], $pagenumber, $perpage, 100, 25);

		$limitlower = ($pagenumber - 1) * $perpage+1;
		$limitupper = ($pagenumber) * $perpage;
		$counter = 0;

		if ($limitupper > $total['shouts']) {
			$limitupper = $total['shouts'];
			if ($limitlower > $total['shouts']) {
				$limitlower = $total['shouts']-$perpage;
			}
		}
		if ($limitlower <= 0) {
			$limitlower = 1;
		}

		// limit for mysql query when full page is selected
		$limit = ($limitlower - 1).", $perpage";


		$navarray = array(
			'' => 'Shoutbox'
		);
		$navbits = construct_navbits($navarray);
		$pagenav = str_replace('&amp;page=', '&amp;pagenumber=', construct_page_nav($total['shouts'], "$_SERVER[PHP_SELF]?$session[sessionurl]action=shoutbox&amp;perpage=$perpage"));
	} else {
		// limit for mysql query when only side box is show
		$limit = $vbindex['maxshouts'];
		$pagenav = '';
	}

	$getshouts = $DB_site->query("	## GET SHOUTS ##
	  								SELECT user.username, user.userid,
	  								shoutbox.shoutid, shoutbox.shout, shoutbox.dateline,
	  								IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid
	  								FROM ".TABLE_PREFIX."vbindex_shoutbox AS shoutbox
	  								LEFT JOIN ".TABLE_PREFIX."user AS user USING (userid)
	  								WHERE 1 = 1
	  								$globalshoutignore
	  								$shoutignore
	  								ORDER BY shoutbox.dateline DESC
	  								LIMIT $limit");

	$i = 0;
	while ($shout = $DB_site->fetch_array($getshouts)) {
		$i++;
		$shouts = true;
		$shout['shout'] = fetch_censored_text(parse_bbcode($shout['shout']));
		// lets word wrap the shouts to prevent an expanded column
		if (!empty($vbindex['shout_wrap_length'])) {
			$shout['shout'] = preg_replace("#([^\n\r ?&./<>\"\\-\[\]]{".$vbindex['shout_wrap_length'].'})#i', "\\1  ", $shout['shout']);
		}
		$shout['musername'] = fetch_musername($shout);
		$shout['date'] = vbdate($vboptions['dateformat'], $shout['dateline'], 1);
	    $shout['time'] = vbdate($vboptions['timeformat'], $shout['dateline']);
		exec_switch_bg();

		if (in_array($bbuserinfo['usergroupid'], $vbindex['global_shout_delete']) || (($vbindex['options'] & VBI_ALLOWSHOUTDELETE) && $shout['userid'] == $bbuserinfo['userid'])) {
			$shoutdelete = true;
		} else {
			$shoutdelete = false;
		}

		// prevent the side box showing more than the defined number of shouts
		// if we are viewing the full page one
		if ($i <= $vbindex['maxshouts']) {

			if ($vbindex['options'] & VBI_ASCSHOUT) {
				// asc order
				eval("\$sbox[$shout[timestamp]] .= \"".fetch_template('vbindex_shoutboxbit')."\";");
			} else {
				// default desc order
				eval("\$shoutbox[shoutbits] .= \"".fetch_template('vbindex_shoutboxbit')."\";");
			}
		}

		if ($_REQUEST['action'] == 'shoutbox') {
			eval("\$shoutbox[main_shoutbits] .= \"".fetch_template('vbindex_shoutboxbit')."\";");
		}
	}

	if (($vbindex['options'] & VBI_ASCSHOUT) && is_array($sbox)) {
		// asc sort
		krsort($sbox);
		foreach($sbox AS $sarea) {
			$shoutbox['shoutbits'] .= $sarea;
		}
	}

	if ($bbuserinfo['userid'] || ($vbindex['options'] & VBI_DISABLEDSHOUT)) {
		exec_switch_bg();
		if (!$bbuserinfo['userid']) {
			$shoutbox['postdisabled'] = true;
		} else {
			$shoutbox['postdisabled'] = false;
		}
		$shoutbox['postshout'] = true;
	} else {
		$shoutbox['postshout'] = false;
	}

	if ($shouts || $shoutbox['postshout']) {
		if ($_REQUEST['action'] == 'shoutbox') {
			$main = true;
			eval("\$home[news] .= \"".fetch_template('vbindex_shoutbox')."\";");
			$pagenav = '';
			$main = false;
			eval("\$side[shoutbox] .= \"".fetch_template('vbindex_shoutbox')."\";");
		} else {
			$main = false;
			eval("\$side[shoutbox] .= \"".fetch_template('vbindex_shoutbox')."\";");
		}
	}
	// memory saving
	unset($shout, $sbox, $sarea);
	$DB_site->free_result($getshouts);
}

// #############################################################################
// unset vB's default template vars, do this at the end so any standard error
// or redirect calls still have the vars for use in the templates.
unset($header, $footer, $navbar, $headinclude);

// ####################### GENERATE SIDE BAR ##########################
// ## CUSTOM BLOCKS
if (!empty($vbindex['customboxes'])) {
	for($box = 1; $box <= $vbindex['customboxes']; $box++) {
		$collapseobj_vbindex_customblock = $vbcollapse['collapseobj_vbindex_customblock'.$box];
		$collapseimg_vbindex_customblock = $vbcollapse['collapseimg_vbindex_customblock'.$box];

		if (!is_demo_mode()) {
			@ob_start();
			eval(fetch_template('vbindex_customblock_php', -1, 0));
			// this is the var to use in the template for the dynamic content
			$contvar = 'box'.$box.'_php';
			$$contvar = @ob_get_contents();
			@ob_end_clean();
		}

		eval("\$side[customblock_".$box."] .= \"".fetch_template("vbindex_customblock_{$box}")."\";");
	}
}

// ## LEFT
if (($vbindex['options'] & VBI_BOTH_COLS) || ($vbindex['options'] & VBI_LEFT_COL)) {
	for($box = 1; $box < ($vbindex['totalboxes'] + 1 + $vbindex['customboxes']); $box++) {
		$leftright = $vbindex["left_{$box}"];
		$home['left']["$box"] = $side["$leftright"];
	}
	foreach($home['left'] AS $box => $content) {
		$home['leftblocks'] .= $content;
	}
}

// ## RIGHT
if (($vbindex['options'] & VBI_BOTH_COLS) || ($vbindex['options'] & VBI_RIGHT_COL)) {
	for($box = 1; $box < ($vbindex['totalboxes'] + 1 + $vbindex['customboxes']); $box++) {
		$leftright = $vbindex["right_{$box}"];
		$home['right']["$box"] = $side["$leftright"];
	}
	foreach($home['right'] AS $box => $content) {
		$home['rightblocks'] .= $content;
	}
}

if ($vbindex['options'] & VBI_BOTH_COLS) {
	$currentside = 'left';
	eval("\$home[leftside] = \"".fetch_template('vbindex_side')."\";");
	$currentside = 'right';
	eval("\$home[rightside] = \"".fetch_template('vbindex_side')."\";");
} elseif ($vbindex['options'] & VBI_LEFT_COL) {
	$currentside = 'left';
	eval("\$home[leftside] = \"".fetch_template('vbindex_side')."\";");
} elseif ($vbindex['options'] & VBI_RIGHT_COL) {
	$currentside = 'right';
	eval("\$home[rightside] = \"".fetch_template('vbindex_side')."\";");
}

// #################### EVAL GLOBAL TEMPLATES #######################
$vbphrase['copyright'] = construct_phrase($vbphrase['vbi_copyright'], $vboptions['templateversion'], $vbindex['version']);
eval("\$home[footer] = \"".fetch_template('vbindex_footer')."\";");
$footer = &$home['footer'];
eval("\$home[header] = \"".fetch_template('vbindex_header')."\";");
$header = &$home['header'];
eval("\$headinclude = \"".fetch_template('vbindex_headinclude')."\";");
$home['headinclude'] = &$headinclude;

$home['footer'] = str_replace('cron'.SCRIPT_EXTENSION, "$vboptions[bburl]/cron".SCRIPT_EXTENSION, $home['footer']);
// ## PM POPUP
if ($shownewpm) {
	eval("\$home[footer] = \"".fetch_template('vbindex_pm_popup_script')."\";");
}

$navbits = array('', $vboptions['hometitle']);
$navbits = construct_navbits($navbits);
eval("\$home[navbar] = \"".fetch_template('vbindex_navbar')."\";");

eval($datastore['vbindex_config']);

if (trim($vboptions['templateversion']) != '3.0.0 Gamma') {
	$headinclude = str_replace('link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css', 'link rel="stylesheet" type="text/css" href="'.$vboptions['bburl'].'/clientscript/vbulletin_css', $headinclude);
}

// #################### SELECT OUTPUT TEMPLATE #######################
if (!EXTRA_PAGE) {
	eval("print_output(\"".fetch_template('VBINDEX')."\");");
} elseif (!empty($_REQUEST['page'])) {
	eval("\$home[content] = \"".fetch_template("vbindex_extra_{$_REQUEST[page]}")."\";");
	eval("print_output(\"".fetch_template('VBINDEX_SHELL')."\");");
} elseif (!empty($_REQUEST['section'])) {
	// we're using a PHP special extra page, so lets parse the PHP Include
	if (!is_demo_mode()) {
		@ob_start();
		eval(fetch_template("vbindex_extra_php_{$_REQUEST[section]}", -1, 0));
		// this is the var to use in the template for the dynamic content
		$php_output = @ob_get_contents();
		@ob_end_clean();

	}
	eval("\$home[content] = \"".fetch_template("vbindex_extra_{$_REQUEST[section]}")."\";");
	eval("print_output(\"".fetch_template('VBINDEX_SHELL')."\");");
}

?>
(Continued Below)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01565 seconds
  • Memory Usage 2,072KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete