<?php
/*=======================================================================
| UberCMS - Advanced Website and Content Management System for uberEmu
| #######################################################################
| Copyright (c) 2010, Roy 'Meth0d'
| http://www.meth0d.org
| #######################################################################
| This program is free software: you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation, either version 3 of the License, or
| (at your option) any later version.
| #######################################################################
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
\======================================================================*/

define('BAN_PAGE', true);

require_once "global.php";

$ban = null;

if (uberUsers::IsIpBanned(USER_IP))
{
	$ban = uberUsers::GetBan('ip', USER_IP, true);
}

if (LOGGED_IN && uberUsers::IsUserBanned(USER_NAME))
{
	$ban = uberUsers::GetBan('user', USER_NAME, true);
}

if ($ban == null)
{
	header("Location: " . WWW . "/");
	exit;
}

$tpl->Init();

$tpl->AddGeneric('head-me');
$tpl->AddIncludeSet('process-template');
$tpl->WriteIncludeFiles();
$tpl->AddGeneric('head-overrides-process');
$tpl->AddGeneric('head-bottom');

$tpl->Write('<script language="JavaScript" type="text/javascript"> 
	document.logoutPage = true;
	</script>');

$tpl->AddGeneric('process-template-top');

$tpl->Write('<div class="action-error flash-message"> 
	<div class="rounded"> ');

	$tpl->Write('<h2>Du wurdest gebannt! ' . (LOGGED_IN ? '<small style="font-weight: normal; font-size: 60%;">(<a href="%www%/logout.html">Log out</a>)</small>' : '') . '</h2>');
$tpl->Write('<p>Du wurdest aus folgendem Grund gebannt:</p>');
$tpl->Write('<p style="margin-top: 5px; margin-bottom: 5px; font-size: 110%;"><b>' . clean($ban['reason'], false, true) . '</b></p>');
$tpl->Write('<p>Dein Bann wurde erstellt am <b>' . $ban['added_date'] . '</b> und endet am <b>' . date('d F, Y', $ban['expire']) . '</b> das ist <b>' . ceil(($ban['expire'] - time()) / 86400) . '</b> Tage ab jetzt.</p>');
$tpl->Write('<p>Deine IP ist <b>' . USER_IP . '</b>. ' . (($ban['bantype'] == 'user') ? 'Der Name im Zusammenhang mit diesem Bann ist <b>' . clean($ban['value']) . '</b>.' : 'Es ist kein Name mit dem Bann verbunden.') . '</p>');


$tpl->Write('	</div> 
</div>');


$tpl->AddGeneric('process-template-bottom');


$tpl->AddGeneric('footer');

$tpl->SetParam('page_title', 'Sign out');
$tpl->SetParam('body_id', 'logout');

$tpl->Output();

?>