Taking a x.php file and embedding it within index.php
I'm trying to find a way to embed the vBISpy modification into my home page. Currently it's on a separate page (vaispy.php), and I want it to somehow replace the forum listings.
Maybe I'm naive, but it doesn't seem like it'd be too hard; just cut, paste, and edit vaispy.php into index.php, but I'm not too sure which lines to place where.
Here's the code to the vaispy.php file:
PHP Code:
<?php //################################################################################// // MOD NAME: VBISpy #// //################################################################################// // DESCRIPTION: This modification for vBulletin adds a "live" scrolling #// // update of new posts to the forum #// //################################################################################// // BY: MPDev #// // DATE: 9.26.06 #// // VERSION: 1.0.12 #// //################################################################################//
// ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS ####################### define('THIS_SCRIPT', 'vaispy');
// ################### 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();
// pre-cache templates used by specific actions $actiontemplates = array();
// ######################### CONFIG VARS ############################ // The number of days to scan the table for .. (86400 represents the number of seconds in 24 hours) $daysprune = 1;
// Do not list these forums even if they have permissions (test categories, etc) $blockforums = "";
// ######################### CONFIG VARS ############################
############################################################################ // Get Threads I've Posted In require_once(DIR . '/includes/functions_forumdisplay.php'); $result = $db->query_read(" SELECT threadid FROM " . TABLE_PREFIX . "thread as thread WHERE thread.forumid NOT IN (0$blockforums) and thread.visible = 1 and thread.open <> 10 and thread.lastpostid > $lastpostid $datecut ");
$dotthreads = fetch_dot_threads_array(implode(',', $idsArray)); ############################################################################ // Get Threads
// Do not set to more than 20 unless you know how to modify the html at the bottom of the page (and at line 291) $limitq = ( isset($_REQUEST['do']) ? "20" : "5,20" );
if ( $subscribe == 1 ) { $getthreads = $db->query_read(" SELECT subscribethread.subscribethreadid, thread.forumid, thread.firstpostid, thread.lastpost, thread.lastposter, thread.lastpostid, thread.replycount, thread.threadid, thread.title, thread.open, thread.views, post.pagetext AS preview, post.userid AS lastpuserid FROM " . TABLE_PREFIX . "subscribethread AS subscribethread INNER JOIN " . TABLE_PREFIX . "thread AS thread ON (subscribethread.threadid = thread.threadid) LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread') LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.lastpostid) WHERE subscribethread.userid = " . $vbulletin->userinfo['userid'] . " AND thread.forumid NOT IN (0$blockforums) AND thread.visible = 1 AND subscribethread.canview = 1 AND thread.lastpostid > $lastpostid AND deletionlog.primaryid IS NULL $datecut ORDER BY thread.lastpost DESC LIMIT $limitq "); } else { $getthreads = $db->query_read(" SELECT thread.forumid, thread.firstpostid, thread.lastpost, thread.lastposter, thread.lastpostid, thread.replycount, thread.threadid, thread.title, thread.open, thread.views, post.pagetext AS preview, post.userid AS lastpuserid FROM " . TABLE_PREFIX . "thread AS thread LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread') LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.lastpostid) WHERE open <> 10 $datecut AND thread.forumid NOT IN (0$blockforums) AND thread.visible = '1' AND thread.lastpostid > $lastpostid AND post.visible = 1 AND deletionlog.primaryid IS NULL ORDER BY thread.lastpost DESC LIMIT $limitq "); }
// Get rid of html and bbcode first $thread['preview'] = strip_tags(strip_bbcode($thread['preview'], true, true)); $thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title($thread['preview'], 200)); $thread['preview'] = fetch_censored_text(fetch_word_wrapped_string($thread['preview'], 20));
if ( $thread['lastpostid'] == $thread['firstpostid'] ) { $etype = "New Thread"; } else { $etype = "New Post"; }
// Statusicon // show dot folder? if ($vbulletin->userinfo['userid'] AND $vbulletin->options['showdots'] AND $dotthreads["$thread[threadid]"]) { $thread['statusicon'] .= '_dot'; $thread['dot_count'] = $dotthreads["$thread[threadid]"]['count']; $thread['dot_lastpost'] = $dotthreads["$thread[threadid]"]['lastpost']; }
// show hot folder? if ($vbulletin->options['usehotthreads'] AND (($thread['replycount'] >= $vbulletin->options['hotnumberposts'] AND $vbulletin->options['hotnumberposts'] > 0) OR ($thread['views'] >= $vbulletin->options['hotnumberviews'] AND $vbulletin->options['hotnumberviews'] > 0))) { $thread['statusicon'] .= '_hot'; }
// show locked folder? if (!$thread['open']) { $thread['statusicon'] .= '_lock'; }