Not Solved Integrate "Side Box" Plugin with "The Cure"
#1
Not Solved Question 
I've been searching this forum but can't seem to find a thread that help with integrating the "Side Box" plugin with the theme "The Cure". I tried editing the CSS with Chrome but can't seem to achieve much.

Would appreciate some help or a point in the right direction.

Thanks
TDB
Reply
#2
Not Solved
which sidebox plugin - give its link and your forum url.
in general, plugins are coded such that they match with the style of forum theme.
Reply
#3
Not Solved
Thanks for the speedy reply .M. and sorry about the delay.

The name of the plugin is actually Sidbox

Forum - EX Creators. I'm just get started over there. Sidebox works good with the default theme but it just overruns the index page and appears outside of the "main body wrapper"

There are no restriction attached to this plugin about resposting here so I'll save you the trouble by posting the script here:

<?php
/*
// Author: Nayar([email protected])
// Plugin site: http://nayarweb.co.cc/forum/showthread.php?tid=20
// Please read the license before using this plugin.
// License: http://nayarweb.co.cc/forum/showthread.php?tid=21
*/

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("index_start", "sidebox_start");
$plugins->add_hook("forumdisplay_start", "sidebox_start");
$plugins->add_hook("showthread_start", "sidebox_start");
$plugins->add_hook("portal_start", "sidebox_start");

function sidebox_info()
{
	return array(
		"name"			=> "Sidebox",
		"description"	=> "Display portal boxes on your forum",
		"website"		=> "http://nayarweb.co.cc/forum/showthread.php?tid=20",
		"author"		=> "Nayar",
		"authorsite"	=> "http://www.nayarweb.co.cc",
		"version"		=> "1.2.0",
		"compatibility" => "1*",
		"guid" 			=> "566f7b52c9a68601b41782c94d06beb8",
	);
}
function sidebox_activate()
{
	global $db;
	$sidebox_group = array(
		"gid" => "NULL",
		"name" => "sidebox",
		"title" => "Sidebox",
		"description" => "Sidexox By Nayar",
		"disporder" => "15",
		"isdefault" => "no",
	);
	$db->insert_query("settinggroups", $sidebox_group);
	$gid = $db->insert_id();
	$sidebox_setting_1 = array(
		"sid"			=> "NULL",
		"name"			=> "sidebox1",
		"title"			=> "Show on Index",
		"description"	=> "",
		"optionscode"	=> "yesno",
		"value"			=> '1',
		"disporder"		=> '2',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_2 = array(
		"sid"			=> "NULL",
		"name"			=> "sidebox2",
		"title"			=> "Show on Forum display",
		"description"	=> "",
		"optionscode"	=> "yesno",
		"value"			=> '1',
		"disporder"		=> '2',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_3 = array(
		"sid"			=> "NULL",
		"name"			=> "sidebox3",
		"title"			=> "Show on Thread display",
		"description"	=> "",
		"optionscode"	=> "yesno",
		"value"			=> '1',
		"disporder"		=> '3',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_4 = array(
		"sid"			=> "NULL",
		"name"			=> "sidebox4",
		"title"			=> "Show on Left or righty",
		"description"	=> "",
		"optionscode"	=> 'radio
1 = Left
2 = Right',
		"value"			=> '1',
		"disporder"		=> '4',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_5 = array(
		"sid"			=> "NULL",
		"name"			=> "sb1",
		"title"			=> "Box 1",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '5',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_6 = array(
		"sid"			=> "NULL",
		"name"			=> "sb2",
		"title"			=> "Box 2",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '6',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_7 = array(
		"sid"			=> "NULL",
		"name"			=> "sb3",
		"title"			=> "Box 3",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '7',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_8 = array(
		"sid"			=> "NULL",
		"name"			=> "sb4",
		"title"			=> "Box 4",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '8',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_9 = array(
		"sid"			=> "NULL",
		"name"			=> "sb5",
		"title"			=> "Box 5",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '9',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_10 = array(
		"sid"			=> "NULL",
		"name"			=> "sb6",
		"title"			=> "Box 6",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '10',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_11 = array(
		"sid"			=> "NULL",
		"name"			=> "sb7",
		"title"			=> "Box 7",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '11',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_12 = array(
		"sid"			=> "NULL",
		"name"			=> "sb8",
		"title"			=> "Box 8",
		"description"	=> "",
		"optionscode"	=> 'select
 = None
{$sbwelcome} = Welcome Box
{$sbpms} = PM box
{$sbsearch} = Search box
{$sbstats} = Stat
{$sbwhosonline} = Online
{$sblatestthreads} = latest threads
{$sbaddbox1} = additional box 1
{$sbaddbox2} = additional box 2',
		"value"			=> '',
		"disporder"		=> '12',
		"gid"			=> intval($gid),
	);

	$sidebox_setting_13 = array(
	"sid"			=> "NULL",
	"name"			=> "sbadd1",
	"title"			=> "Additional custom box 1",
	"description"	=> "",
	"optionscode"	=> "textarea",
	"value"			=> $db->escape_string('<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="thead"><strong>Box 1</strong></td></tr><tr><td class="trow1">First box</td></tr></table><br />'),
	"disporder"		=> '13',
	"gid"			=> intval($gid),
	);
	$sidebox_setting_14 = array(
	"sid"			=> "NULL",
	"name"			=> "sbadd2",
	"title"			=> "Additional custom box 2",
	"description"	=> "",
	"optionscode"	=> "textarea",
	"value"			=> $db->escape_string('<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="thead"><strong>Box 2</strong></td></tr><tr><td class="trow1">Second box</td></tr></table><br />'),
	"disporder"		=> '14',
	"gid"			=> intval($gid),
	);
	
	$sidebox_setting_15 = array(
		"sid"			=> "NULL",
		"name"			=> "sidebox5",
		"title"			=> "Replace portal boxes by custom ones",
		"description"	=> "",
		"optionscode"	=> "yesno",
		"value"			=> '1',
		"disporder"		=> '15',
		"gid"			=> intval($gid),
	);
	$sidebox_setting_16 = array(
		"sid"			=> "NULL",
		"name"			=> "sidebox6",
		"title"			=> "Width",
		"description"	=> "Width of sideboxes",
		"optionscode"	=> "text",
		"value"			=> '160px',
		"disporder"		=> '16',
		"gid"			=> intval($gid),
	);
	/*$sidebox_setting_X = array(
		"sid"			=> "NULL",
		"name"			=> "sideboxX",
		"title"			=> "Show on Index",
		"description"	=> "",
		"optionscode"	=> "yesno",
		"value"			=> '1',
		"disporder"		=> 'X',
		"gid"			=> intval($gid),
	);*/
	$db->insert_query("settings", $sidebox_setting_1);
	$db->insert_query("settings", $sidebox_setting_2);
	$db->insert_query("settings", $sidebox_setting_3);
	$db->insert_query("settings", $sidebox_setting_4);
	$db->insert_query("settings", $sidebox_setting_5);
	$db->insert_query("settings", $sidebox_setting_6);
	$db->insert_query("settings", $sidebox_setting_7);
	$db->insert_query("settings", $sidebox_setting_8);
	$db->insert_query("settings", $sidebox_setting_9);
	$db->insert_query("settings", $sidebox_setting_10);
	$db->insert_query("settings", $sidebox_setting_11);
	$db->insert_query("settings", $sidebox_setting_12);
	$db->insert_query("settings", $sidebox_setting_13);
	$db->insert_query("settings", $sidebox_setting_14);
	$db->insert_query("settings", $sidebox_setting_15);
	$db->insert_query("settings", $sidebox_setting_16);
	//$db->insert_query("settings", $sidebox_setting_X);
}
function sidebox_deactivate()
{
	global $db;
	$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='sidebox'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sidebox1'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sidebox2'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sidebox3'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sidebox4'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sidebox5'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sidebox6'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb1'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb2'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb3'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb4'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb5'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb6'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb7'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb8'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sbadd1'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sbadd2'");
	//$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sbX'");
}
function sidebox_start()
{
	global $mybb,$db,$lang,$templates,$cache;
	global $sbwelcome,$sbpms,$sbsearch,$sbstats,$sbwhosonline,$sblatestthreads,$gobutton,$lastvisit,$sbaddbox1,$sbaddbox2;
	$portal_url='member.php';

	require_once MYBB_ROOT."inc/class_parser.php";
	$parser = new postParser;

	// Load global language phrases
	$lang->load("portal");
	
	//Variables to use
	
	$lol1 = $mybb->settings['sb1'];
	$lol2 = $mybb->settings['sb2'];
	$lol3 = $mybb->settings['sb3'];
	$lol4 = $mybb->settings['sb4'];
	$lol5 = $mybb->settings['sb5'];
	$lol6 = $mybb->settings['sb6'];
	$lol7 = $mybb->settings['sb7'];
	$lol8 = $mybb->settings['sb8'];
	//$lol9 = '<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="thead"><a href="http://nayarweb.co.cc/forum/showthread.php?tid=20">Sideboxes</a> By <a href="http://nayarweb.co.cc">Nayar</a></td></tr></table>';
	$lol9 = '';
	
	$lmao1= $mybb->settings['sidebox6'];
	
	//Display boxes on index
	if($mybb->settings['sidebox1'] == 1)
	{
		if ($mybb->settings['sidebox4'] == 2)
		{
			//$templates->cache['index'] = str_replace('{$forums}', '<table width="100%"  border="0"><tr><td width="auto" valign="top">{$forums}',$templates->cache['index']);
			$templates->cache['index'] = str_replace('{$header}', '{$header}<table width="100%"  border="0"><tr><td width="auto" valign="top">',$templates->cache['index']);
			$templates->cache['index'] = str_replace('{$footer}','{$footer}</td><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td></tr></table>',$templates->cache['index']);
		}
		else 
		{
			//$templates->cache['index'] = str_replace('{$forums}', '<table width="100%"  border="0"><tr><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td><td width="auto" valign="top">{$forums}',$templates->cache['index']);
			$templates->cache['index'] = str_replace('{$header}', '{$header}<table width="100%"  border="0"><tr><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td><td width="auto" valign="top">',$templates->cache['index']);
			$templates->cache['index'] = str_replace('{$footer}','{$footer}</td></tr></table>',$templates->cache['index']);
		}
	}
	
	//Display boxes on forumdisplay
	if($mybb->settings['sidebox2'] == 1)
	{
		if ($mybb->settings['sidebox4'] == 2)
		{
			//$templates->cache['forumdisplay'] = str_replace('{$subforums}','',$templates->cache['forumdisplay']);
			//$templates->cache['forumdisplay'] = str_replace('{$threadslist}','<table width="100%"  border="0"><tr><td width="auto" valign="top">{$subforums}{$threadslist}',$templates->cache['forumdisplay']);
			$templates->cache['forumdisplay'] = str_replace('{$header}','{$header}<table width="100%"  border="0"><tr><td width="auto" valign="top">',$templates->cache['forumdisplay']);
			$templates->cache['forumdisplay'] = str_replace('{$footer}','{$footer}</td><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td></tr></table>',$templates->cache['forumdisplay']);
		}
		else
		{
			//$templates->cache['forumdisplay'] = str_replace('{$moderatedby}','<table width="100%"  border="0"><tr><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td><td width="auto" valign="top">{$moderatedby}',$templates->cache['forumdisplay']);
			$templates->cache['forumdisplay'] = str_replace('{$header}','{$header}<table width="100%"  border="0"><tr><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td><td width="auto" valign="top">',$templates->cache['forumdisplay']);
			$templates->cache['forumdisplay'] = str_replace('{$footer}','{$footer}</td></tr></table>',$templates->cache['forumdisplay']);
		}
	}
	//Display boxes on showthread
	if($mybb->settings['sidebox3'] == 1)
	{
		if ($mybb->settings['sidebox4'] == 2)
		{
			$templates->cache['showthread'] = str_replace('{$header}','	{$header}<table width="100%"  border="0"><tr><td width="auto" valign="top">',$templates->cache['showthread']);
			$templates->cache['showthread'] = str_replace('{$footer}','{$footer}</td><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td></tr></table>',$templates->cache['showthread']);
		}
		else
		{
			$templates->cache['showthread'] = str_replace('{$header}','	{$header}<table width="100%"  border="0"><tr><td width="'.$lmao1.'" valign="top">'.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'</td></td><td width="auto" valign="top">',$templates->cache['showthread']);
			$templates->cache['showthread'] = str_replace('{$footer}','{$footer}</td></tr></table>',$templates->cache['showthread']);
		}
	}
	//Display additional boxes on portal
	if($mybb->settings['sidebox5'] == 1)
	{
		$templates->cache['portal'] = str_replace('{$welcome}','',$templates->cache['portal']);
		$templates->cache['portal'] = str_replace('{$search}','',$templates->cache['portal']);
		$templates->cache['portal'] = str_replace('{$pms}','',$templates->cache['portal']);
		$templates->cache['portal'] = str_replace('{$stats}','',$templates->cache['portal']);
		$templates->cache['portal'] = str_replace('{$whosonline}','',$templates->cache['portal']);
		$templates->cache['portal'] = str_replace('{$latestthreads}',''.$lol1."".$lol2."".$lol3."".$lol4."".$lol5."".$lol6."".$lol7."".$lol8."".$lol9.'',$templates->cache['portal']);
	}
	//Generate additional boxes
	eval("\$sbaddbox1 = \"".$db->escape_string($mybb->settings['sbadd1'])."\";");
	eval("\$sbaddbox2 = \"".$db->escape_string($mybb->settings['sbadd2'])."\";");	
	
//Below are codes from portal.php(modified) from MyBB version: 1.6 Beta
// get forums user cannot view

$unviewable = get_unviewable_forums(true);
if($unviewable)
{
	$unviewwhere = " AND fid NOT IN ($unviewable)";
}
// If user is known, welcome them
if($mybb->settings['portal_showwelcome'] != 0)
{
	if($mybb->user['uid'] != 0)
	{
		// Get number of new posts, threads, announcements
		$query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
		$newposts = $db->fetch_field($query, "newposts");
		if($newposts)
		{ // if there aren't any new posts, there is no point in wasting two more queries
			$query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
			$newthreads = $db->fetch_field($query, "newthreads");
			$query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$mybb->settings['portal_announcementsfid'].") $unviewwhere");
			$newann = $db->fetch_field($query, "newann");
			if(!$newthreads)
			{
				$newthreads = 0;
			}
			if(!$newann)
			{
				$newann = 0;
			}
		}
		else
		{
			$newposts = 0;
			$newthreads = 0;
			$newann = 0;
		}

		// Make the text
		if($newann == 1)
		{
			$lang->new_announcements = $lang->new_announcement;
		}
		else
		{
			$lang->new_announcements = $lang->sprintf($lang->new_announcements, $newann);
		}
		if($newthreads == 1)
		{
			$lang->new_threads = $lang->new_thread;
		}
		else
		{
			$lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
		}
		if($newposts == 1)
		{
			$lang->new_posts = $lang->new_post;
		}
		else
		{
			$lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
		}
		eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");

	}
	else
	{
		$lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');
		$mybb->user['username'] = $lang->guest;
		eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";");
	}
	$lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
	eval("\$sbwelcome = \"".$templates->get("portal_welcome")."\";");
	if($mybb->user['uid'] == 0)
	{
		$mybb->user['username'] = "";
	}
}
// Private messages box
if($mybb->settings['portal_showpms'] != 0)
{
	if($mybb->user['uid'] != 0 && $mybb->user['receivepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->settings['enablepms'] != 0)
	{
		switch($db->type)
		{
			case "sqlite2":
			case "sqlite3":
			case "pgsql":
				$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total", "uid='".$mybb->user['uid']."'");
				$messages['pms_total'] = $db->fetch_field($query, "pms_total");
				
				$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='".$mybb->user['uid']."' AND CASE WHEN status = '0' AND folder = '0' THEN TRUE ELSE FALSE END");
				$messages['pms_unread'] = $db->fetch_field($query, "pms_unread");
				break;
			default:
				$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='".$mybb->user['uid']."'");
				$messages = $db->fetch_array($query);
		}
		
		// the SUM() thing returns "" instead of 0
		if($messages['pms_unread'] == "")
		{
			$messages['pms_unread'] = 0;
		}
		$lang->pms_received_new = $lang->sprintf($lang->pms_received_new, $mybb->user['username'], $messages['pms_unread']);
		eval("\$sbpms = \"".$templates->get("portal_pms")."\";");
	}
}
// Get Forum Statistics
if($mybb->settings['portal_showstats'] != 0)
{
	$stats = $cache->read("stats");
	$stats['numthreads'] = my_number_format($stats['numthreads']);
	$stats['numposts'] = my_number_format($stats['numposts']);
	$stats['numusers'] = my_number_format($stats['numusers']);
	if(!$stats['lastusername'])
	{
		$newestmember = "<strong>" . $lang->no_one . "</strong>";
	}
	else
	{
		$newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
	}
	eval("\$sbstats = \"".$templates->get("portal_stats")."\";");
}

// Search box
if($mybb->settings['portal_showsearch'] != 0)
{
	eval("\$sbsearch = \"".$templates->get("portal_search")."\";");
}

// Get the online users
if($mybb->settings['portal_showwol'] != 0)
{
	$timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
	$comma = '';
	$guestcount = 0;
	$membercount = 0;
	$onlinemembers = '';
	$query = $db->query("
		SELECT s.sid, s.ip, s.uid, s.time, s.location, u.username, u.invisible, u.usergroup, u.displaygroup
		FROM ".TABLE_PREFIX."sessions s
		LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
		WHERE s.time>'$timesearch'
		ORDER BY u.username ASC, s.time DESC
	");
	while($user = $db->fetch_array($query))
	{
	
		// Create a key to test if this user is a search bot.
		$botkey = my_strtolower(str_replace("bot=", '', $user['sid']));
		
		if($user['uid'] == "0")
		{
			++$guestcount;
		}
		elseif(my_strpos($user['sid'], "bot=") !== false && $session->bots[$botkey])
		{
			// The user is a search bot.
			$onlinemembers .= $comma.format_name($session->bots[$botkey], $session->botgroup);
			$comma = $lang->comma;
			++$botcount;
		}
		else
		{
			if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
			{
				++$membercount;
				
				$doneusers[$user['uid']] = $user['time'];
				
				// If the user is logged in anonymously, update the count for that.
				if($user['invisible'] == 1)
				{
					++$anoncount;
				}
				
				if($user['invisible'] == 1)
				{
					$invisiblemark = "*";
				}
				else
				{
					$invisiblemark = '';
				}
				
				if(($user['invisible'] == 1 && ($mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])) || $user['invisible'] != 1)
				{
					$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
					$user['profilelink'] = get_profile_link($user['uid']);
					eval("\$onlinemembers .= \"".$templates->get("portal_whosonline_memberbit", 1, 0)."\";");
					$comma = $lang->comma;
				}
			}
		}
	}
	
	$onlinecount = $membercount + $guestcount + $botcount;
	
	// If we can see invisible users add them to the count
	if($mybb->usergroup['canviewwolinvis'] == 1)
	{
		$onlinecount += $anoncount;
	}
	
	// If we can't see invisible users but the user is an invisible user incriment the count by one
	if($mybb->usergroup['canviewwolinvis'] != 1 && $mybb->user['invisible'] == 1)
	{
		++$onlinecount;
	}

	// Most users online
	$mostonline = $cache->read("mostonline");
	if($onlinecount > $mostonline['numusers'])
	{
		$time = TIME_NOW;
		$mostonline['numusers'] = $onlinecount;
		$mostonline['time'] = $time;
		$cache->update("mostonline", $mostonline);
	}
	$recordcount = $mostonline['numusers'];
	$recorddate = my_date($mybb->settings['dateformat'], $mostonline['time']);
	$recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);

	if($onlinecount == 1)
	{
	  $lang->online_users = $lang->online_user;
	}
	else
	{
	  $lang->online_users = $lang->sprintf($lang->online_users, $onlinecount);
	}
	$lang->online_counts = $lang->sprintf($lang->online_counts, $membercount, $guestcount);
	eval("\$sbwhosonline = \"".$templates->get("portal_whosonline")."\";");
}

// Latest forum discussions
if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'])
{
	$altbg = alt_trow();
	$threadlist = '';
	$query = $db->query("
		SELECT t.*, u.username
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
		ORDER BY t.lastpost DESC 
		LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
	);
	while($thread = $db->fetch_array($query))
	{
		$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
		$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
		// Don't link to guest's profiles (they have no profile).
		if($thread['lastposteruid'] == 0)
		{
			$lastposterlink = $thread['lastposter'];
		}
		else
		{
			$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
		}
		if(my_strlen($thread['subject']) > 25)
		{
			$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
		}
		$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
		$thread['threadlink'] = get_thread_link($thread['tid']);
		eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
		$altbg = alt_trow();
	}
	if($threadlist)
	{ 
		// Show the table only if there are threads
		eval("\$sblatestthreads = \"".$templates->get("portal_latestthreads")."\";");
	}
	
}

//End of codes taken from portal.php

}

?>

Thanks for the help.

TDB

How's it going .M.?
I found an alternative (Advanced Sidebox) that was recently updated...works great with The Cure.
Thanks for offering to help.

________________________
TDB
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)