<?php
/**
* Dragonbyte-Tech.com Thread Ratings Mod
*
* @author Dylan Wheeler
* @copyright 2011
*
* You may not copy/reproduce any part of this file in whole or significant part.
*
* All rights reserved.
*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE & ~8192);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'trating');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
'dbtech_trating'
);
// get templates used by all actions
$globaltemplates = array(
'dbtech_trating',
'dbtech_trating.css'
);
// pre-cache templates used by specific actions
$actiontemplates = array(
'main' => array(
'dbtech_trating_main',
),
'top' => array(
'dbtech_trating_home',
'dbtech_trating_top_stats',
'dbtech_trating_top_stats_bits',
),
);
// get special data templates from the datastore
$specialtemplates = array(
);
// ############################### default do value ######################
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = $_GET['do'] = 'main';
}
// ######################### REQUIRE BACK-END ############################
/**
* If you want to run the ratings in another directory besides the forum
* directory you need to uncomment the $forum_directory variable and enter
* the absolute path the forums directory.
*/
//$forum_directory = 'C:/doc_root/www/domain/forums/';
if ($forum_directory)
{
chdir($forum_directory);
}
require_once('./global.php');
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
if (!empty($_POST['do']))
{
// $_POST requests take priority
$action = $_POST['do'];
}
else if (!empty($_GET['do']))
{
// We had a GET request instead
$action = $_GET['do'];
}
else
{
// No request
$action = 'main';
}
// Strip non-valid characters
$action = preg_replace('/[^\w-]/i', '', $action);
if (!class_exists(DBTECH_TRATING))
{
// Fetch required classes
require_once(DIR . '/dbtech/thread_ratings/includes/class_core.php');
// Initialise
DBTECH_TRATING::init($vbulletin);
}
if ($_REQUEST['do'] == 'devinfo' AND $_REQUEST['devkey'] == 'dbtech')
{
$_info = array(
'version' => DBTECH_TRATING::$version,
'versionnumber' => DBTECH_TRATING::$versionnumber,
'pro' => DBTECH_TRATING::$isPro,
'vbversion' => $vbulletin->versionnumber
);
$_content = array();
foreach ($_info as $key => $val)
{
$_content[] = '"' . $key . '":"' . $val . '"';
}
echo '{' . implode(',', $_content) . '}';
die();
}
if (!class_exists('vB_Template'))
{
require_once(DIR . '/dbtech/thread_ratings/includes/class_template.php');
}
// Strip non-valid characters
$action = preg_replace("/[^a-zA-Z0-9-_]/", "", $action);
if (!file_exists(DIR . '/dbtech/thread_ratings_pro/actions/' . $action . '.php'))
{
if (!file_exists(DIR . '/dbtech/thread_ratings/actions/' . $action . '.php'))
{
eval(standard_error(fetch_error('dbtech_trating_error_x', $vbphrase['dbtech_trating_action_missing_file'])));
} else {
include_once(DIR . '/dbtech/thread_ratings/actions/' . $action . '.php');
}
} else {
include_once(DIR . '/dbtech/thread_ratings_pro/actions/' . $action . '.php');
}
$navbar = render_navbar_template(construct_navbits($navbits));
// Finish the main template
$templater = vB_Template::create('dbtech_trating');
$templater->register_page_templates();
$templater->register('HTML', $HTML);
$templater->register('navbar', $navbar);
$templater->register('template_hook', $template_hook);
$templater->register('includecss', $includecss);
$templater->register('headinclude_bottom', $headinclude_bottom);
print_output($templater->render());
?>