<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBHosting Version 2                                              # ||
|| # ---------------------------------------------------------------- # ||
|| # All PHP code in this file is ©2004 GameCrash.org.                # ||
|| # http://www.gamecrash.org (soon) | http://www.letzplay.de         # ||
|| # ---------------------------------------------------------------- # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/

// identify where we are
define('VB_AREA', 'HostingCP');

if (!isset($phrasegroups))
{
	$phrasegroups = array();
}
$phrasegroups[] = 'vbhosting_hostingcp';
$phrasegroups[] = 'cpglobal';

// ###################### Start functions #######################
chdir('./../');

require_once('./includes/init.php');
require_once('./includes/functions.php');
require_once('./includes/adminfunctions.php');
require_once('./includes/functions_vbhosting.php');

// ###################### Start headers #######################
exec_nocache_headers();

require_once('./includes/sessions.php');

$vboptions['cpstylefolder'] = $vboptions['vbhosting_admin_style'];

// ###################### Get date / time info #######################
// override date/time settings if specified
fetch_options_overrides($bbuserinfo);
fetch_time_data();

// ############################################ LANGUAGE STUFF ####################################
// initialize $vbphrase and set language constants
$vbphrase = init_language();
$stylevar = fetch_stylevars($_tmp, $bbuserinfo);

// ############################################ PERMISSIONS STUFF ####################################
// This are the possible permissions for administrators
$_VBHOSTINGPERMISSIONS = array(
	'managesettings'		=> 1,
	'manageforums'     	 	=> 2,
	'managestyles' 			=> 4,
	'manageadministrators'	=> 8
);

// ############################################ LOGIN ####################################
// Okay, now let's check the user is logged in and can moderate a forum
if ($bbuserinfo['userid'] == 0)
{
	print_cp_login();
}

$hostedid = intval($_REQUEST['hostedid']);
$vbhostingperms = false;

if (!$vboptions['vbhosting_admin_enabled'] || $hostedid < 1 || !$vbhostingperms = $DB_site->query_first("SELECT permissions FROM " . TABLE_PREFIX . "vbhosting_administrator a WHERE hostedid=$hostedid AND userid=$bbuserinfo[userid]"))
{
	vbhosting_print_forumchooser();
}

define ('VBHOSTING_PERMISSIONS', $vbhostingperms['permissions']);

?>