<?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 # ||
|| #################################################################### ||
\*======================================================================*/

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

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

// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array('cphome');
$specialtemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// ############################# LOG ACTION ###############################
if (empty($_REQUEST['do']))
{
	vbhosting_log();
}

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

if (!empty($_REQUEST['redirect']))
{
	define('CP_REDIRECT', $redirect);
	print_stop_message('redirecting_please_wait');
}

if (empty($_REQUEST['do']))
{
	$_REQUEST['do'] = 'frames';
}

if ($_REQUEST['do'] == 'frames')
{
	globalize($_REQUEST, array('loc'));

	$navframe = "<frame src=\"index.php?$session[sessionurl]hostedid=$hostedid&do=nav" . iif($cpnavjs, '&amp;cpnavjs=1') . "\" name=\"nav\" scrolling=\"yes\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" border=\"no\" />\n";
	$headframe = "<frame src=\"index.php?$session[sessionurl]hostedid=$hostedid&do=head\" name=\"head\" scrolling=\"no\" noresize=\"noresize\" frameborder=\"0\" marginwidth=\"10\" marginheight=\"0\" border=\"no\" />\n";
	$mainframe = "<frame src=\"" . iif(!empty($loc), $loc, "index.php?$session[sessionurl]hostedid=$hostedid&do=home") . "\" name=\"main\" scrolling=\"yes\" frameborder=\"0\" marginwidth=\"10\" marginheight=\"10\" border=\"no\" />\n";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html dir="<?php echo $stylevar['textdirection']; ?>" lang="<?php echo $stylevar['languagecode']; ?>">
<head>
<script type="text/javascript">
<!-- // get out of any containing frameset
if (self.parent.frames.length != 0)
{
	document.write('<span style="font: bold 10pt verdana,sans-serif">Get me out of this frame set!</span>');
	self.parent.location.replace(document.location.href);
}
// -->
</script>
<title><?php echo $vboptions['bbtitle']; ?> <?php echo $vbphrase['vbhosting_hosting_control_panel']; ?></title>
</head>

<?php

if ($stylevar['textdirection'] == 'ltr')
{
// left-to-right frameset
?>
<frameset cols="195,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
	<?php echo $navframe; ?>
	<frameset rows="20,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
		<?php echo $headframe; ?>
		<?php echo $mainframe; ?>
	</frameset>
</frameset>
<?php
}
else
{
// right-to-left frameset
?>
<frameset cols="*,195"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
	<frameset rows="20,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
		<?php echo $headframe; ?>
		<?php echo $mainframe; ?>
	</frameset>
	<?php echo $navframe; ?>
</frameset>
<?php
}

?>

<noframes>
	<body>
		<p><?php echo $vbphrase['no_frames_support']; ?></p>
	</body>
</noframes>

</html>
<?php
}

if ($_REQUEST['do'] == 'head')
{
	define('IS_NAV_PANEL', true);
	print_cp_header();
	
	$hostedforuminfo = $DB_site->query_first("SELECT f.title, f.forumid FROM " . TABLE_PREFIX . "forum f, " . TABLE_PREFIX . "vbhosting_hosted h WHERE h.hostedid=$hostedid AND h.forumid=f.forumid");
?>
<table border="0" width="100%" height="100%">
<tr valign="middle">
	<td><b><?php echo $vbphrase['vbhosting_hosting_control_panel']; ?></b> (<a href="http://www.vbulletin.com/" target="_blank">vBulletin <?php echo $versionnumber; ?></a> with <a href="http://www.gamecrash.org/" target="_blank">vBHosting <?php echo $vboptions['vbhosting_version']; ?></a>)</td>
	<td align="<?php echo $stylevar['right']; ?>"><b><a href="../forumdisplay.php?<?php echo $session['sessionurl']; ?>forumid=<?php echo $hostedforuminfo['forumid']; ?>" target="_blank"><?php echo $hostedforuminfo['title'] ?></b></td>
</tr>
</table>
<?php
	print_cp_footer();
}

if ($_REQUEST['do'] == 'home')
{
	print_cp_header($vbphrase['vbhosting_welcome_to_your_vbhosting_control_panel']);

	print_form_header('', '');
	print_table_header($vbphrase['vbhosting_welcome_to_your_vbhosting_control_panel']);
	print_table_footer();

	echo '<p>' . $vbphrase['vbhosting_here_you_can_maintain_your_forum'] . '</p>';

	print_cp_footer();
}

if ($_REQUEST['do'] == 'nav')
{
	require_once('./includes/adminfunctions_navpanel.php');
	print_cp_header();
	?>
	<script type="text/javascript">
	<!--
	function nobub()
	{
		window.event.cancelBubble = true;
	}

	function nav_goto(targeturl)
	{
		parent.frames.main.location = targeturl;
	}
	-->
	</script>
<div>
<img src="../cpstyles/<?php echo $vboptions['cpstylefolder']; ?>/cp_logo.gif" alt="" border="0" hspace="4" vspace="4" /><?php
	echo "</div>\n\n<div style=\"width:168px; padding: 4px\">\n";

	construct_nav_spacer();

	$hasanypermissions = false;
	// *************************************************
	$dosettings = false;
	if (vbhosting_haspermission('managesettings'))
	{
		$dosettings = true;
		construct_nav_option($vbphrase['vbhosting_edit_settings'], "setting.php?hostedid=$hostedid&do=modify");
	}
	if (vbhosting_haspermission('manageadministrators'))
	{
		$dosettings = true;
		construct_nav_option($vbphrase['vbhosting_manage_administrators'], "administrator.php?hostedid=$hostedid&do=modify");
	}
	if ($dosettings)
	{
		$hasanypermissions = true;
		construct_nav_group($vbphrase['vbhosting_settings']);
		construct_nav_spacer();
	}
	// *************************************************
	if (vbhosting_haspermission('manageforums'))
	{
		$hasanypermissions = true;
		construct_nav_option($vbphrase['vbhosting_manage_forums'], "forum.php?hostedid=$hostedid&do=modify");
		construct_nav_option($vbphrase['vbhosting_create_new_forum'], "forum.php?hostedid=$hostedid&do=createforum");
		construct_nav_option($vbphrase['vbhosting_create_new_category'], "forum.php?hostedid=$hostedid&do=createcategory");
		construct_nav_group($vbphrase['vbhosting_forums_and_moderators']);
		construct_nav_spacer();
	}
	// *************************************************
	if (vbhosting_haspermission('managestyles'))
	{
		$hasanypermissions = true;
		construct_nav_option($vbphrase['vbhosting_edit_colors'], "color.php?hostedid=$hostedid&do=modify");
		construct_nav_option($vbphrase['vbhosting_edit_images'], "image.php?hostedid=$hostedid&do=modify");
		if ($vboptions['vbhosting_general_allowheaderfooter'])
		{
			construct_nav_option($vbphrase['vbhosting_header_and_footer'], "headerandfooter.php?hostedid=$hostedid&do=modify");
		}
		construct_nav_group($vbphrase['vbhosting_style']);
		construct_nav_spacer();
	}

	print_nav_panel();

	echo "</div>\n";
	// *************************************************

	if (!$hasanypermissions)
	{
		echo '<div style="text-align:center; padding:4px;"><strong>' . $vbphrase['vbhosting_hostingcp_nopermissions'] . '</strong></div>';
	}
	
	echo '<div style="text-align:center; padding:4px;">' . construct_phrase($vbphrase['vbhosting_vbhosting_x'], $vboptions['vbhosting_version']) . '</div>';
	
	define('NO_CP_COPYRIGHT', true);
	unset($DEVDEBUG);
	print_cp_footer();
}

?>