<?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();
?>
<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8" />
	<!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script><![endif]-->
	<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/css2?family=Philosopher:wght@400;700&amp;display=swap" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&amp;display=swap" 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__; ?>swiper.min.css" rel="stylesheet">
	<link href="<?php echo __PATH_TEMPLATE_CSS__; ?>slick.css" rel="stylesheet">
	<link href="<?php echo __PATH_TEMPLATE_CSS__; ?>slick-theme.css" rel="stylesheet">
	<link href="<?php echo __PATH_TEMPLATE_CSS__; ?>webengine.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">
	<link href="<?php echo __PATH_TEMPLATE_CSS__; ?>rankings-class-filter.css" rel="stylesheet">
	<link href="<?php echo __PATH_TEMPLATE_CSS__; ?>explorahost.css" rel="stylesheet">
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>jquery-1.8.3.min.js" type="text/javascript"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>jquery-ui.min.js" type="text/javascript"></script>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" integrity="sha512-HK5fgLBL+xu6dm/Ii3z4xhlSUyZgTT9tuc/hSrtw6uzJOvgRr2a9jyxxT1ely+B+xFAmJKVSTbpM/CuL7qxO8w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
	<script>
		var baseUrl = '<?php echo __BASE_URL__; ?>';
	</script>
</head>

<body>
	<div class="wrapper">
		<header class="header">

			<div class="topPanel">
				<div class="topPanel-wrapper flex-c">
					<div class="topPanel-left flex-c">
						<div class="logoMini bright"><a href="<?php echo __BASE_URL__; ?>"><img src="<?php echo __PATH_TEMPLATE_IMG__; ?>logo-mini-s20.png" alt="Logo" width="170px"></a></div>
						<?php templateBuildNavbar(); ?>
					</div>
					<div class="topPanel-right">
						<?php if (isLoggedIn()) { ?>
							<a href="<?php echo __BASE_URL__; ?>usercp/myaccount" class="sign-up"><?php echo lang('module_titles_txt_4'); ?></a>
							<a href="<?php echo __BASE_URL__; ?>logout" class="sign-in login"><?php echo lang('menu_txt_6'); ?></a>
						<?php } else { ?>
							<a href="<?php echo __BASE_URL__; ?>register" class="sign-up"><?php echo lang('menu_txt_3'); ?></a>
							<a href="#login-login" class="sign-in login open_modal"><?php echo lang('menu_txt_4'); ?></a>
						<?php } ?>
					</div>
				</div>
			</div>



			<div class="sparks">
				<div class="spark_1"></div>
				<div class="spark_2"></div>
				<div class="spark_3"></div>
				<div class="spark_4 spark-big"></div>
			</div>



			<div class="logo">
				<div class="col-md-8 hidden-xs hidden-sm" style="padding-left: 10px;margin-top: -80px;">
					<a href="<?php echo __BASE_URL__; ?>"><img src="<?php echo __PATH_TEMPLATE_IMG__; ?>logo.png" class="bright"></a>
				</div>

				<div class="col-lg-2 col-md-2 col-sm-6 tableBlock-server">
					<div class="online only">
						<table style="width: 280px;" class="simple">
							<tbody>
								<tr>
									<td style="padding: 0px; text-align: center;">
										<h1 style="font-family: open sans, sans-serif; text-shadow: 1px 1px black; font-size: 40px!important; margin-bottom: -7px; color: #ffd250; font-weight: bold; text-shadow: 0 0 30px #ffd250;">
											<?php echo number_format($srvInfo[3]); ?></h1>

										Players Online <br><br>
										<div onclick="window.location.href = '<?php echo __BASE_URL__; ?>register'" style="border-radius: 10px; cursor: pointer; border: 3px solid #6d6d6d; padding: 5px 45px; height: 45px; background: rgba(0, 0, 0, 0.3); box-shadow: 0px 0px 10px #111; margin: 0px; font-size: 22px; font-weight: bold; font-style: italic; color: #fbac3f;"><?php echo lang('menu_txt_3'); ?></div>

										<br>
										<div onclick="window.location.href = '<?php echo $config_tpl['link_discord']; ?>'" style="border-radius: 10px; cursor: pointer; border: 3px solid #6d6d6d; padding: 5px 45px; height: 45px; background: rgba(0, 0, 0, 0.3); box-shadow: 0px 0px 10px #111; margin: 0px; font-size: 22px; font-weight: bold; font-style: italic; color: #fbac3f;">Discord</div>

									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>

			</div>


		</header><!-- .header-->

		<main class="content">
			<span class="borderTop" style="margin-top: -70px; margin-bottom: -15px;"></span>


			<div class="top-content flex-s">
				<div class="slider">
					<div class="next arrows"> </div>
					<div class="prev arrows"> </div>
					<div class="slides">
						<?php
						foreach ($sliders_custom as $slideritem) {
							echo '<a href="' . $slideritem['1'] . '" class="slide"><div class="slide" style="background-image: url(' . __PATH_TEMPLATE_IMG__ . 'slider/' . $slideritem['0'] . ');"></div></a>';
						}
						?>
					</div>
					<div class="navigation"></div>
				</div>
				<br>
				<?php include(__PATH_TEMPLATE_ROOT__ . 'inc/modules/news.php'); ?>
			</div>

			<span class="borderTop" style=""></span>

			<div class="flex-s">
				<div class="row" style="width: 100%;">

					<div class="col-xl-4 col-md-4 col-sm-6">
						<a href="<?php echo $config_tpl['link_rewards']; ?>" class="socButton socYoutube" style="margin-left: calc(50% - 183px);">
							Recompensas <span>Consulta y reclama todas<br>tus recompensas gratuitas ahora!</span>
							<div class="reward-light"></div>
							<div class="reward-light-icon"></div>
						</a>
					</div>

					<div class="col-xl-4 col-md-4 col-sm-6">
						<a href="<?php echo $config_tpl['link_guias']; ?>" class="socButton socDiscord" style="margin-left: calc(50% - 183px);">
							Guias <span>Guias para iniciantes,<br>droplist y tutoriales</span>
						</a>
					</div>

					<div class="col-xl-4 col-md-4 col-sm-6">
						<a href="<?php echo $config_tpl['link_discord']; ?>" target="_blank" class="socButton socFacebook" style="margin-left: calc(50% - 183px);">
							Discord <span>WCoin grátis, regalos,<br>mercado y mucho más!!</span>
						</a>
					</div>
				</div>
			</div>

			<span class="borderTop" style="margin-top: -35px; margin-bottom: -15px;"></span>

			<div class="mainHomeBlockPlugin flex-s">
				<!--Open block 1-->
				<?php
				$infocs = getInfoCS();
				?>
				<div class="blockHomePlugin">
					<div class="h2-title h2-title-table flex-s-c">
						<span>Castle Siege</span>
					</div>
					<div class="table tabTable-block-cs active" id="castle-owner">
						<div class="tableBlock">
							<table>
								<tbody>
									<tr>
										<td>
											<table>
												<tbody>
													<tr>
														<td style="width: 20%!important;"></td>
														<td style="width: 30%!important;">
															<?php echo returnGuildLogo($infocs["logo"], 70); ?>
														</td>
														<td>
															<br>
															<span>Status:</span> <?php echo $infocs["status"]; ?><br>
															<span>Guild:</span> <?php echo $infocs["owner"]; ?><br>
															<span>Master:</span> <?php echo $infocs["master"]; ?>
														</td>
													</tr>
												</tbody>
											</table>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<div class="blockHomePlugin">
					<div class="h2-title h2-title-table flex-s-c">
						<span>Rey del MU</span>
					</div>
					<div class="table tabTable-block-arka active" id="arka-dominant">
						<div class="tableBlock">
							<table>
								<tbody>
									<tr>
										<td>
											<table>
												<tbody>
													<?php
													$ranking_data = LoadCacheData('arnold_rankings_king_player.cache');
													$i = 0;
													foreach ($ranking_data as $rdata) {
														if ($i >= 1 && $i <= 1) {
													?>
															<tr>
																<td style="width: 20%!important;"></td>
																<td style="width: 30%!important;">
																	<img src="<?php echo __PATH_TEMPLATE__; ?>img/logo-king-of-mu.png" style="width: 70px;">
																</td>
																<td>
																	<br>
																	<span>Guild:</span> <?php echo playerProfile($rdata[0]); ?><br>
																	<span>Wins:</span> <?php echo number_format($rdata[1]); ?><br>
																	<span> </span>
																</td>
															</tr>

													<?php
														}
														$i++;
													}
													?>
												</tbody>
											</table>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<div class="blockHomePlugin hidden-sm hidden-xs">
					<div class="h2-title h2-title-table flex-s-c">
						<span>Blood Castle</span>
					</div>
					<div class="table tabTable-block-throne active" id="throne-owner">
						<div class="tableBlock">
							<table>
								<tbody>
									<tr>
										<td>
											<table>
												<tbody>
													<?php
													$ranking_data = LoadCacheData('arnold_rankings_blood_castle.cache');
													$i = 0;
													foreach ($ranking_data as $rdata) {
														if ($i >= 1 && $i <= 1) {
															$characterIMG = getPlayerClassAvatar($rdata[3], false, true, 'rounded-3 border-1 border-dark-grey-opacity-2');
													?>
															<tr>
																<td style="width: 20%!important;"></td>
																<td style="width: 30%!important;">
																	<img src="<?php echo $characterIMG; ?>" style="width: 70px;">
																</td>
																<td>
																	<br>
																	<span>Top:</span> <?php echo playerProfile($rdata[0]); ?><br>
																	<span>Score:</span> <?php echo number_format($rdata[1]); ?><br>
																	<span> </span>
																</td>
															</tr>

													<?php
														}
														$i++;
													}
													?>
												</tbody>
											</table>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>

			<span class="borderTop" style="margin-top: -35px; margin-bottom: -15px;"></span>







			<div class="mainHomeBlock flex-s">
				<?php include(__PATH_TEMPLATE_ROOT__ . 'inc/modules/top.players.php'); ?>
				<?php include(__PATH_TEMPLATE_ROOT__ . 'inc/modules/top.guilds.php'); ?>
				<?php include(__PATH_TEMPLATE_ROOT__ . 'inc/modules/top.gens.php'); ?>
			</div>

			<span class="borderTop" style="margin-top: -35px; margin-bottom: -15px;"></span>

		</main><!-- .content -->



	</div><!-- .wrapper -->

	<?php include(__PATH_TEMPLATE_ROOT__ . 'inc/modules/footer.php'); ?>
					</td>

				</tr>
			</tbody>
		</table>
	</div>

	<!-- Login Modal -->
	<?php if (!isLoggedIn()) { ?>
		<div id="login-login" class="modal_div">
			<span class="modal_close"></span>
			<div class="modal-content">
				<h2><span><?php echo lang('module_titles_txt_2'); ?></span></h2>
				<form action="<?php echo __BASE_URL__ . 'login'; ?>" method="post">
					<div class="form-group">
						<span>Username</span>
						<input type="text" class="form-control" name="webengineLogin_user" id="login_input">
					</div>
					<div class="form-group">
						<span>Password</span>
						<input type="password" class="form-control" name="webengineLogin_pwd" id="password_input">
					</div>
					<div class="formButton">
						<button class="button buttonsub" name="webengineLogin_submit" type="submit" value="submit"><?php echo lang('login_txt_3'); ?></button>
					</div>
				</form>
			</div>
		</div>
		<div id="overlay"></div>
	<?php } ?>

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>webengine.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>global.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>swiper.min.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>main.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>events.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>slick.min.js"></script>
	<script src="<?php echo __PATH_TEMPLATE_JS__; ?>rankings-class-filter.js"></script>
	<script>
		$('.center').slick({
			infinite: true,
			centerMode: true,
			centerPadding: '50px 30px',
			slidesToShow: 3,
			slidesToScroll: 3
		});
	</script>
	<script>
		// Slider

		$(document).ready(function() {

			var slides = $(".slider .slides").children(".slide");
			var width = $(".slider .slides").width();
			var i = slides.length;
			var offset = i * width;
			var cheki = i - 1;

			$(".slider .slides").css('width', offset);

			for (j = 0; j < slides.length; j++) {
				if (j == 0) {
					$(".slider .navigation").append("<div class='dot active'></div>");
				} else {
					$(".slider .navigation").append("<div class='dot'></div>");
				}
			}

			var dots = $(".slider .navigation").children(".dot");
			offset = 0;
			i = 0;

			$('.slider .navigation .dot').click(function() {
				$(".slider .navigation .active").removeClass("active");
				$(this).addClass("active");
				i = $(this).index();
				offset = i * width;

				$('.slide').removeClass('active');
				var index = offset / width + 1;
				$('.slider .slide:nth-child(' + (index) + ')').addClass('active');

				$(".slider .slides").css("transform", "translate3d(-" + offset + "px, 0px, 0px)");
			});



			$("body .slider .next").click(function() {
				if (offset < width * cheki) {
					offset += width;

					$('.slide').removeClass('active');
					var index = offset / width + 1;
					$('.slider .slide:nth-child(' + (index) + ')').addClass('active');

					$(".slider .slides").css("transform", "translate3d(-" + offset + "px, 0px, 0px)");
					$(".slider .navigation .active").removeClass("active");
					$(dots[++i]).addClass("active");
				}
			});


			$("body .slider .prev").click(function() {
				if (offset > 0) {
					offset -= width;

					$('.slide').removeClass('active');
					var index = offset / width + 1;
					$('.slider .slide:nth-child(' + (index) + ')').addClass('active');

					$(".slider .slides").css("transform", "translate3d(-" + offset + "px, 0px, 0px)");
					$(".slider .navigation .active").removeClass("active");
					$(dots[--i]).addClass("active");
				}
			});

			function autoSlide() {
				if ($(".slider .navigation .active").index() < $(".slider .slides").children(".slide").length - 1) {
					$("body .slider .next").click();
				} else {
					$('.slider .navigation .dot:first-child').click();
				}
			}
			setInterval(function() {
				autoSlide();
			}, 8000);
		});
	</script>
	
</body>
</html>