<?php
/**
 * WebEngine CMS
 * https://webenginecms.org/
 * 
 * @version 1.2.0
 * @author Lautaro Angelico <http://lautaroangelico.com/>
 * @copyright (c) 2013-2019 Lautaro Angelico, All Rights Reserved
 * 
 * Licensed under the MIT license
 * http://opensource.org/licenses/MIT
 */

if(!defined('access') or !access) die();
include('inc/template.functions.php');

$disabledSidebar = array(
	'rankings',
);
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title><?php $handler->websiteTitle(); ?></title>
		<meta name="generator" content="WebEngine <?php echo __WEBENGINE_VERSION__; ?>"/>
		<meta name="author" content="Lautaro Angelico"/>
		<meta name="description" content="<?php config('website_meta_keywords'); ?>"/>
		<meta name="keywords" content="<?php config('website_meta_keywords'); ?>"/>
		<link rel="shortcut icon" href="<?php echo __PATH_TEMPLATE__; ?>favicon.ico"/>
	<meta name="viewport" content="width=1240, maximum-scale=1">
	<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Cinzel" rel="stylesheet">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link href="<?php echo __PATH_TEMPLATE_CSS__; ?>style.css" rel="stylesheet">
    <link href="<?php echo __PATH_TEMPLATE_CSS__; ?>main.css" rel="stylesheet">
    <link href="<?php echo __PATH_TEMPLATE_CSS__; ?>profiles.css" rel="stylesheet">
    <link href="<?php echo __PATH_TEMPLATE_CSS__; ?>override.css" rel="stylesheet">
		<script>
			var baseUrl = '<?php echo __BASE_URL__; ?>';
		</script>
</head>

<body>
	<div class="top-panel flex-c-c">
		<ul class="menu flex-c-c"><li><a href="/index">Inicio</a></li><li><a href="/info">Informacion</a></li><li><a href="https://foro.muperu.org/" target="_blank">Foro</a></li><li><a href="/downloads">Descargas</a></li><li><a href="/donation">Donaciones</a></li><li><a href="/rankings/resets">Ranking</a></li><li><a href="/register">Registro</a></li><li><a href="/login">Entrar</a></li></ul>	</div><!-- top-panel -->
	<div class="wrapper">
		<header class="header"><div class="slider-effect"></div>
			<div class="logo">
				<a href="/index"><img src="<?php echo __PATH_TEMPLATE_IMG__; ?>logo-1.png" alt=""></a>
			</div>
			<div class="leaves">
				<div class="leaves-left-1">
				</div>
				<div class="leaves-left-2">
				</div>
				<div class="leaves-left-3">
				</div>
				<div class="leaves-left-4">
				</div>
				<div class="leaves-left-5">
				</div>
				<div class="leaves-right-1">
				</div>
				<div class="leaves-right-2">
				</div>
				<div class="leaves-right-3">
				</div>
				<div class="leaves-right-4">
				</div>
				<div class="leaves-right-5">
				</div>
			</div>
		</header><!-- .header-->
			
			<div class="web-container">
				<aside class="left-sidebar sidebar">
				<div class="download-block">
	<a href="/downloads" class="flex-c-c"><span>DESCARGAR<b><?php config('server_name'); ?></b></span></a>
</div><!-- download-block -->
<div class="widget red-light login-block">

<?php
# Login block
if(!isLoggedIn()) {
	echo '	<div class="widget-title flex-s-c">
		Ingresar	</div>';
		echo '<form action="'.__BASE_URL__.'login" method="post">
		<p class="login l-input"><input type="text" name="webengineLogin_user" required></p>
		<p class="pass l-input"><input type="password" name="webengineLogin_pwd" required></p>
		<div class="flex-s-c buttons">
			<div class="lost"> <a href="'.__BASE_URL__.'forgotpassword">forgot your password?</a>
			  <br> <a href="'.__BASE_URL__.'register">Register a New Account</a>
			</div>
			 <button type="submit" name="webengineLogin_submit" value="submit" class="cont button-border">'.lang('login_txt_3',true).'</button>
		</div>
	</form>';
	
}
	
# Usercp block
if(isLoggedIn()) {
	
echo '<div class="panel panel-sidebar panel-usercp">';
	echo '<div class="panel-heading">';
		echo '<h3 class="panel-title">'.lang('usercp_menu_title',true).' 
		<a href="'.__BASE_URL__.'logout" class="btn btn-primary btn-xs pull-right">logout</a></h3>';
	echo '</div>';
	echo '<div class="panel-body">';
			templateBuildUsercp();
	echo '</div>';
echo '</div>';
}
?>
</div><!-- widget -->

<!-- TOP Reset -->
<div class="widget red-dark">
	<div class="widget-title">
		Top Resets	</div>
	<ul class="top-block"><li class="top-title"><span class="top-number">#</span> <span class="top-flag"></span> <span class="top-name">Nombre</span> <span class="top-lvl">Nivel<sup>Master</sup></span></li>
	
							<?php
						# Top resets
$levelRankingData = LoadCacheData('rankings_resets.cache');
$topLevelLimit = 5;
if(is_array($levelRankingData)) {
    $topLevel = array_slice($levelRankingData, 0, $topLevelLimit+1);
 
               
                foreach($topLevel as $key => $row) {
                    if($key == 0) continue;
					
                    echo '<li class="top-list"><span class="top-number">'.$key.'.</span> 
<span class="top-flag"><img src="'.getPlayerClassAvatar($row[1], false).'" alt="" style="width:20px;height:auto;"></span> 
<span class="top-name">'.playerProfile($row[0]).'</span> 
<span class="top-lvl">'.number_format($row[2]).'<sup>'.number_format($row[3]).'</sup></span></li>';

}}
?>
	</ul></div><!-- widget -->


<div class="widget red-light" style="display:none;">
	block contents
</div><!-- widget -->				</aside><!-- left-sidebar -->
				<main class="content">
				<div class="slider">
	<div class="next arrows"> </div>
	<div class="prev arrows"> </div>
	<div class="slides">
		<div class="slide active" style="background-image: url(<?php echo __PATH_TEMPLATE_IMG__; ?>slider-img.jpg);">
			<div class="slide-info">
				<h2>Nuevos Mapas-Eventos-Items</h2>
				<div class="slide-text"><p>MuOnline ahora es version Season 13, con unos files premium para el disfrute de los jugadores.</p></div>
				<div class="slide-i flex-s-c">
					<div class="slide-date"><span>18</span>/05/2019</div>
				</div>
			</div>
		</div>
				<div class="slide" style="background-image: url(<?php echo __PATH_TEMPLATE_IMG__; ?>slider-img.jpg); ">
			<div class="slide-info">
				<h2>Nuestra Comunidad</h2>
				<div class="slide-text"><p>Problemas, dudas o cualquier otra consulta Via Foro.</p></div>
				<div class="slide-i flex-s-c">
					<div class="slide-date"><span>07</span>/09/2018</div> <a href="http://foro.muperu.org/" class="button button-border">Entrar al Foro</a>
				</div>
			</div>
		</div>
						<div class="slide" style="background-image: url(<?php echo __PATH_TEMPLATE_IMG__; ?>slider-img.jpg); ">
			<div class="slide-info">
				<h2>Resets Personalizados</h2>
				<div class="slide-text"><p>MuOnline es el unico servidor en el cual tus resets son recompensados con items y puntos especificos cada reset y es totalmente gratis.</p></div>
				<div class="slide-i flex-s-c">
					<div class="slide-date"><span>07</span>/09/2018</div> <a href="http://foro.muperu.org/" class="button button-border">Entrar al Foro</a>
				</div>
			</div>
		</div>
	</div>
	<div class="navigation">
	</div>
</div><!-- slider -->					
					<div class="content-title flex-s-c">
						<h2></h2>
					</div>
					<div class="col-xs-12">
						<?php $handler->loadModule($_REQUEST['page'],$_REQUEST['subpage']); ?>
					</div>
					<div class="toTop-fon">
						<div class="toTop" id="toTop"></div>
					</div>
				</main><!-- .content -->
				<aside class="right-sidebar sidebar">
				<!-- SERVER STATUS -->
<div class="status-block flex-c-c">
	<div class="server">
		<div class="flex-s-c">
			<span class="server-name"><?php config('server_name'); ?></span> <span class="status-online" style="color: green;">Online</span>
		</div>
<?php echo '<div class="forest-progress-bar"><span style="width: '.number_format($srvInfo[3]/2).'%;"></span></div>' ;?>
		<a href="/info" class="desc">Usuarios</a> <span class="status-online">
		<?php
			# Server online
$srvInfoCache = LoadCacheData('server_info.cache');
if(is_array($srvInfoCache)) {
	$srvInfo = explode("|", $srvInfoCache[1][0]);
	echo '<span id="sOnline" style="color: #00ff00;">'.number_format($srvInfo[3]).'</span>';}?> </span><br><br>
		<a href="#" class="desc"></a> <span class="status-online"><span id="ServerTime" style="color: #dcc326;font-size:10px;">Hora Servidor: <time id="tServerTime"><?php echo lang('server_time'); ?></time> <span id="tServerDate"></span></span></span><br />
		<a href="#" class="desc"></a> <span class="status-online"><span id="ServerTime" style="color: #dcc326;font-size:10px;">Tu hora: <time id="tLocalTime"><?php echo lang('user_time'); ?></time> <span id="tLocalDate"></span></span></span>
	</div>
</div><!-- status-block -->

<!-- TOP GUILDS -->
<div class="widget red-dark">
	<div class="widget-title">
		Top Guilds	</div>
	<ul class="top-block guild"><li class="top-title"><span class="top-number">#</span> <span class="top-name">Nombre</span> <span class="score">Puntuacion</span></li>
	<?php
//Rankings top guilds//
try {
	echo '';
	
	$Rankings = new Rankings();
	loadModuleConfigs('rankings');
	
	if(!mconfig('rankings_enable_guilds')) throw new Exception(lang('error_44',true));
	if(!mconfig('active')) throw new Exception(lang('error_44',true));
	
	$ranking_data = LoadCacheData('rankings_guilds.cache');
	if(!is_array($ranking_data)) throw new Exception(lang('error_58',true));
	
	if(mconfig('')) $onlineCharacters = loadCache('online_characters.cache');
	if(!is_array($onlineCharacters)) $onlineCharacters = array();
	$i = 0;
	foreach($ranking_data as $rdata) {
		if($i>=1) {
			echo '<tr>';
			if(mconfig('rankings_show_place_number')) {

				echo '';
			}
			echo '<li class="top-list"><span class="top-number">'.$i.'. 
'.returnGuildLogo($rdata[3], 20).'
</span> <span class="top-name">'.guildProfile($rdata[0]).'</span> 
<span class="score">'.number_format($rdata[2]).'</span></li>';
		}
		$i++;
	}
	echo '';
} catch(Exception $ex) {
	message('error', $ex->getMessage());
}?>
	</ul></div><!-- widget -->

<!-- CASTLE SIEGE -->
<div class="widget red-light">
	<div class="widget-title">
		Castle Siege
	</div>
	<div class="panel-castle-siege">
<?
///CS//											  
$castleData = loadCache('castle_siege.cache');
						echo'
<div class="row"><div class="col-xs-6 text-center">
<img width="80" height="80" '.returnGuildLogo($castleData['castle'][_CLMN_GUILD_LOGO_], 180).'</img>
</div><div class="col-xs-6"><span class="title-castle-owner">Dueño del Castillo</span><br />'.guildProfile($castleData['castle'][_CLMN_MCD_GUILD_OWNER_]).'<br /><br />
<span class="title-guild-master">Guild Master</span><br />'.$castleData['castle'][_CLMN_GUILD_MASTER_].'</div></div>
'; 
								
if(is_array($castleData['guilds'])) {
		echo ''.lang('castlesiege_txt_7',true).'';
			foreach($castleData['guilds'] as $guild) {
				echo ''.guildProfile($guild).'';
			}}
						?>
		<div class="row castle-siege-countdown"><div class="col-xs-12 text-center"><span class="title-castle-battle">La batalla comienza en</span><br /><span class="castle-countdown" id="cscountdown">
			<?$battleTime = mconfig('cs_battle_time');
					echo $battleTime;?></div></div>	</div>
</div><!-- widget -->

<!-- EVENTS -->
<div class="widget red-dark">
	<div class="widget-title">
		Eventos <span>Eventos proximos a iniciar</span>
	</div>
	<ul class="events">
		<li>
			<a href="#" id="bloodcastle_name"></a>
			<span id="bloodcastle">--</span>
			<span id="bloodcastle_next" style="display:none;"></span>
		</li>
		<li>
			<a href="#" id="devilsquare_name"></a>
			<span id="devilsquare">--</span>
			<span id="devilsquare_next" style="display:none;"></span>
		</li>
		<li>
			<a href="#" id="chaoscastle_name"></a>
			<span id="chaoscastle">--</span>
			<span id="chaoscastle_next" style="display:none;"></span>
		</li>
		<li>
			<a href="#" id="goldeninvasion_name"></a>
			<span id="goldeninvasion">--</span>
			<span id="goldeninvasion_next" style="display:none;"></span>
		</li>
		<li>
			<a href="#" id="castlesiege_name"></a>
			<span id="castlesiege">--</span>
			<span id="castlesiege_next" style="display:none;"></span>
		</li>
	</ul>
</div><!-- widget -->				</aside><!-- right-sidebar -->
			</div><!-- .container-->

		<footer class="footer">
			<?php include(__PATH_TEMPLATE_ROOT__ . 'inc/modules/footer.php'); ?>
				</footer><!-- .footer -->
	</div><!-- .wrapper -->

	<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>main.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>global.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>events.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>