<?php
	@ob_start();
	include 'include/functions/header.php';
?>
<!DOCTYPE html>
<html lang="<?php print $language_code; ?>">

<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title><?php print $site_title.' - '.$title; if($offline) print ' - '.$lang['server-offline']; ?></title>

    <link href="<?php print $site_url; ?>css/bootstrap.min.css" rel="stylesheet">
    <link href="<?php print $site_url; ?>css/fonts.css" rel="stylesheet">
    <link href="<?php print $site_url; ?>css/animate.css" rel="stylesheet">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
    <link href="<?php print $site_url; ?>css/font-awesome.min.css" rel="stylesheet">
    <link href="<?php print $site_url; ?>css/owl.carousel.min.css" rel="stylesheet">
    <link href="<?php print $site_url; ?>css/flag-icon.min.css" rel="stylesheet">
    <link href="<?php print $site_url; ?>plugins/sweet-alert/sweetalert.css" rel="stylesheet">
    <link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
    <link href="<?php print $site_url; ?>css/stylesab1e.css?v=1548078013" rel="stylesheet">
	<?php if($page=="admin" && $a_page=="player_edit") { ?>
    <link rel='stylesheet' href='<?php print $site_url; ?>css/bootstrap-select.css'/>
	<?php } ?>
	<link rel="shortcut icon" href="<?php print $site_url; ?>images/favicon.ico?v=" />
	
</head>

<body>
    <div class="transparent-overlay" id="page-loader">
		<?php
			if($item_shop!="")
				$shop_url = $item_shop;
			else if(is_dir('shop')) 
				$shop_url = $site_url.'shop'; 
			else print $shop_url = ''; 
		?>
        <div class="overlay-content">
            <div class="spinner">
                <div class="bounce1"></div>
                <div class="bounce2"></div>
                <div class="bounce3"></div>
            </div>
            <p>Loading...</p>
        </div>
    </div>
    <nav class="navbar">
        <div class="container" style="min-width: 1170px;">
            <ul>
                <li><a href="<?php print $site_url; ?>news"><?php print $lang['news']; ?></a></li>
                <li><a href="<?php print $site_url; ?>ranking/players"><?php print $lang['ranking']; ?></a></li>

                <li class="logo"><a href="<?php print $shop_url; ?>"><img src="<?php print $site_url; ?>img/logo-rubinum.png"></a></li>

				<?php if(!$database->is_loggedin()) { ?>
					<li><a href="<?php print $site_url; ?>users/register"><?php print $lang['register']; ?></a></li>
				<?php } else { ?>
					<li><a href="<?php print $shop_url; ?>" target="_blank"><?php print $lang['item-shop']; ?></a></li>
				<?php } ?>
                <li><a href="<?php print $forum; ?>" target="_blank">Forum</a></li>
            </ul>
        </div>
    </nav>
    <section id="content">
        <div class="container" style="min-width:1170px;">
            <div id="wrapper">
                <div class="row">
                    <div class="col-xs-9">
                        <div class="content-area">
                            <div class="row">
                                <div class="col-xs-4">
                                    <div class="btn-area">
                                        <div class="big-button-area">
                                            <a href="<?php print $site_url; ?>download" class="client-dl text-uppercase"><span><?php print $lang['download']; ?></span></a>
                                        </div>
                                        <div class="small-button-area">
											<?php if(!$database->is_loggedin()) { ?>
                                            <a href="<?php print $site_url; ?>users/login" class="wiki text-uppercase"><span><?php print $lang['login']; ?></span></a>
											<?php } else { ?>
                                            <a href="<?php print $site_url; ?>user/administration" class="wiki text-uppercase"><span><?php print $lang['account-data']; ?></span></a>
											<?php } ?>
                                            <a href="<?php print $site_url; ?>user/vote4coins" class="vote-4-coins text-uppercase"><span>Vote4Coins</span></a>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-8">
                                    <div class="slider-topper-wrapper">
                                        <div id="slider-topper" class="owl-carousel">
                                            <div class="item">
                                                <div class="boss-kills bg-dark-brown" style="background: transparent url('<?php print $site_url; ?>img/slider2.jpg') no-repeat center;background-size: 570px 280px">
                                                    <h3 class="orange text-uppercase"> <?php print $lang['statistics']; ?> </h3>
                                                    <div class="bar-chart-wrapper">


                                                        <div class="chart-element">
                                                            <div class="bar bar-first">
                                                                <span><?php print $lang['players-online']; ?></span>
                                                            </div>
                                                            <span><?php print number_format(getStatistics('players-online'), 0, '', '.'); ?></span>
                                                        </div>
                                                        <div class="chart-element">
                                                            <div class="bar bar-second">
                                                                <span><?php print $lang['accounts-created']; ?></span>
                                                            </div>
                                                            <span><?php print number_format(getStatistics('accounts-created'), 0, '', '.'); ?></span>
                                                        </div>
                                                        <div class="chart-element">
                                                            <div class="bar bar-third">
                                                                <span><?php print $lang['created-characters']; ?></span>
                                                            </div>
                                                            <span><?php print number_format(getStatistics('created-characters'), 0, '', '.'); ?></span>
                                                        </div>
                                                        <div class="chart-element">
                                                            <div class="bar bar-fourth">
                                                                <span><?php print $lang['guilds-created']; ?></span>
                                                            </div>
                                                            <span><?php print number_format(getStatistics('guilds-created'), 0, '', '.'); ?></span>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="item">
                                                <div class="boss-kills bg-dark-brown" style="background: transparent url('<?php print $site_url; ?>img/slider3.jpg') no-repeat center;background-size: 570px 280px">
                                                    <h3 class="orange text-uppercase"> Offlineshop
                                                        <!--<small class="white">Ø per day</small>--></h3>
                                                    <div class="bar-chart-wrapper">


                                                        <div class="chart-element">
                                                            <div class="bar bar-fourth">
                                                                <span><?php print $lang['offline-shops']; ?></span>
                                                            </div>
                                                            <span><?php
																if(!check_table_in_player('offline_shop_npc'))
																	print 0;
																else print number_format(getStatistics('offline-shops'), 0, '', '.');
															?></span>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="item">
                                                <div class="boss-kills bg-dark-brown" style="background: transparent url('<?php print $site_url; ?>img/slider_dungeoninfo.jpg') no-repeat center;background-size: 570px 280px">
                                                    <h3 class="orange text-uppercase"> Be the King of Pvm!
                                                        <!--<small class="white">Ø per day</small>--></h3>
                                                    <h5 class="white text-uppercase" style="margin: 0 0 0 30px;font-size: 16px;font-weight: 700;"> The new Dungeon Ranking System! </h5>
                                                    <div class="bar-chart-wrapper">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <style>
                                        #slider-topper .owl-dots {
                                            opacity: 0.4;
                                        }
                                    </style>
                                </div>
                            </div>
                            <div class="news-area">
								<?php
									include 'pages/'.$page.'.php';
								?>
                            </div>


                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div class="sidebar">
							<?php if($offline || !$database->is_loggedin()) { ?>
                            <div class="login-area">
                                <form role="form" method="post" action="<?php print $site_url; ?>users/login" accept-charset="UTF-8">
                                    <div class="form-group">
										<input type="text" name="username" pattern=".{5,64}" maxlength="64" class="form-control" placeholder="<?php print $lang['user-name-or-email']; ?>" autocomplete="off" <?php if($offline) print 'disabled'; else print 'required'; ?>>
                                    </div>
                                    <div class="form-group">
										<input type="password" name="password" pattern=".{5,16}" maxlength="16" class="form-control" placeholder="<?php print $lang['password']; ?>" <?php if($offline) print 'disabled'; else print 'required'; ?>>
                                    </div>
									<?php if(!$offline) { ?>
                                    <p><a href="<?php print $site_url; ?>users/lost"><?php print $lang['forget-password']; ?></a></p>
                                    <p><a href="<?php print $site_url; ?>users/register"><?php print $lang['register']; ?></a></p>
									<?php } ?>
									<input type="submit" class="btn btn-block btn-login" value="<?php print $lang['login']; ?>"<?php if($offline) print ' disabled'; ?>>
                                </form>
                            </div>
							<?php } else { ?>
							<div class="login-area user-nav">
								<span>Welcome <a href=""><?php print getAccountName($_SESSION['id']); ?></a>!</span>
								<ul>
									<?php if($web_admin) { ?>
									<li><a href="<?php print $site_url; ?>admin"><?php print $lang['administration']; ?></a></li>
									<?php 
										if($web_admin>=$jsondataPrivileges['donate']) {
											$count_donations = count(get_donations());
											if($count_donations)
											{
									?>	
									<li><a href="<?php print $site_url; ?>admin/donatelist"><?php print $lang['donatelist']; ?> <span class="tag tag-info tag-pill float-xs-right"><?php print $count_donations.' '.$lang['new-donations']; ?> </span></a></li>
									<?php
											}
										}
									}
									?>
									<li><a href="<?php print $site_url; ?>user/administration"><?php print $lang['account-data']; ?></a></li>
									<li><a href="<?php print $site_url; ?>user/characters"><?php print $lang['chars-list']; ?></a></li>
									<li><a href="<?php print $site_url; ?>user/redeem"><?php print $lang['redeem-codes']; ?></a></li>
									<?php if($jsondataFunctions['active-referrals']) { ?>
									<li><a href="<?php print $site_url; ?>user/referrals"><?php print $lang['referrals']; ?></a></li>
									<?php } if($item_shop!="") { ?>
									<li><a target='_blank' href="<?php print $item_shop; ?>"><?php print $lang['item-shop']; ?></a></li>
									<?php }
										$vote4coins = file_get_contents('include/db/vote4coins.json');
										$vote4coins = json_decode($vote4coins, true);
										
										if(count($vote4coins))
											print '<a href="'.$site_url.'user/vote4coins">Vote4Coins</a></li>';
										
										$donate = file_get_contents('include/db/donate.json');
										$donate = json_decode($donate, true);
										
										if(count($donate))
											print '<li><a href="'.$site_url.'user/donate">'.$lang['donate'].'</a></li>';
									?>
									<li><a href="<?php print $site_url; ?>users/logout"><?php print $lang['logout']; ?></a></li>
								</ul>
							</div>
							<?php } ?>
                            <div class="online-stats">
                                <p class="number" id="player-online-counter"><?php print number_format(getStatistics('players-online'), 0, '', '.'); ?></p>
                                <p><?php print $lang['players-online']; ?></p>

                                <p class="number" id="player-online-24h-counter"><?php print number_format(getStatistics('players-online-last-24h'), 0, '', '.'); ?></p>
                                <p><?php print $lang['players-online-last-24h']; ?></p>
                            </div>
                            <div class="todays-events">
                                <a href="<?php print $site_url; ?>user/donate"><?php print $lang['donate']; ?></a>
                            </div>
                            <div class="upcoming-events">
                                <div class="hero-overlay">
                                    <img src="<?php print $site_url; ?>img/upcoming-events-hero.png" alt="" class="" />
                                </div>
                            </div>


                            <div class="top-player-points">
                                <a href="<?php print $site_url; ?>ranking/players"><?php print $lang['players']; ?></a>
                            </div>

                            <div class="top-lists-wrapper">
                                <div class="top-list metins">
                                    <div class="header">
                                        <div class="row">
                                            <div class="col-xs-6">
                                                <span class="text-left">Top</span>
                                            </div>
                                            <div class="col-xs-6">
                                                <span class="text-right">Players</span>
                                            </div>
                                            <div class="top-lists-icon">
                                                <img src="<?php print $site_url; ?>img/top-lists-guilds.png" class="" />
                                            </div>
                                        </div>
                                    </div>
									<div id="section_ranking">
										<table style="overflow: hidden; width: 285px" height="100%" cellspacing="30">
											<tbody>
											<?php
												if(!$offline) {
												$top = array();
												$top = top10players();
												$i=0;
												foreach($top as $player)
												{
													$i++;
											?>
												<tr class="pos_<?php if($i==1) print 'one'; else if($i==2) print 'two'; else if($i==3) print 'three'; else if($i==4) print 'four'; else print 'five'; ?>">
													<td><img src="<?php print $site_url.'img/ranking/rank'.$i; ?>.gif"></td>
													<td class="r_name">
														<a><?php print $player['name']; ?></a><br>
														<span><?php print $lang['level']; ?> <b><?php print $player['level']; ?></b></span>
													</td>
													<td class="r_stats">
														<img src="<?php print $site_url; ?>images/empire/<?php print $empire=get_player_empire($player['account_id']); ?>.jpg" alt="<?php print emire_name($empire); ?>" title="<?php print emire_name($empire); ?>"></td>
												</tr>
											<?php }
												}
											?>
											</tbody>
										</table>
									</div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div id="body-bg" style="position: absolute">
	<img src="https://i.imgur.com/6kOzBTu.jpg">
        </div>
    </div>
    <div id="mini-icons">
        <div class="languagewrapper">
            <a class="current-language flag-icon flag-icon-<?php print $language_code; ?>" type="button" btattached="true"></a>
            <div class="languages">
				<?php
					foreach($json_languages['languages'] as $key => $value)
						if($key!=$language_code)
							print '<a href="'.$site_url.'?lang='.$key.'" class="flag-icon flag-icon-'.$key.'"></a></li>';
				?>
            </div>
        </div>
        <div class="youtube"><a target="_blank" href="<?php print $social_links['youtube']; ?>"><i class="fab fa-youtube"></i></a></div>
        <div class="facebook"><a target="_blank" href="<?php print $social_links['facebook']; ?>"><i class="fab fa-facebook"></i></a></div>
        <div class="discord"><a target="_blank" href="<?php print $social_links['discord']; ?>"><i class="fab fa-discord"></i></a></div>
        <div class="teamspeak"><a target="_blank" href="<?php print $support; ?>"><i class="fab fa-teamspeak"></i></a></div>
    </div>
    <div id="twitch-sidebar">
        <a class="close">&times;</a>


    </div>
    <div id="youtube-sidebar" style="padding:20px">
        <a class="close">&times;</a>

    </div>


    <style>
        .wiki {
            position: relative;
        }
        
        .wiki i {
            z-index: 2;
        }
        
        .wiki-bubble {
          width: 270px;
          background: #492a21;
          padding: 15px;
          text-align: left;
          font-weight: normal;
          color: #eddccd;;
          position:absolute;
          top: 0;
          left: -350px;
          line-height: 2;
        
             transition-property: left;
           transition-duration: 2s;
           -webkit-transition-property: left; /* Safari */
           -webkit-transition-duration: 2s; /* Safari */
        }
        
        .wiki-bubble.active {
        left: 80px;
        }
        
        
        .wiki-bubble:before {
          content: "";
          width: 0px;
          height: 0px;
          position: absolute;
          border-left: 10px solid transparent;
          border-right: 10px solid #492a21;
          border-top: 10px solid #492a21;
          border-bottom: 10px solid transparent;
          left: -19px;
          top: 6px;
        }
        
        
        .pulse {
          animation: pulse 2s infinite;
        }
        
        
        @-webkit-keyframes pulse {
          0% {
            transform: scale(1);
          }
          50% {
             transform: scale(0.9);
          }
          100% {
              transform: scale(1);
          }
        }
        @keyframes  pulse {
          0% {
            transform: scale(1);
          }
          50% {
              transform: scale(0.9);
          }
          100% {
             transform: scale(1);
          }
        }
    </style>

    <script src="<?php print $site_url; ?>js/jquery-2.1.0.min.js"></script>
	<?php include 'include/functions/footer.php'; ?>
    <script src="<?php print $site_url; ?>js/bootstrap.min.js"></script>

    <script src="<?php print $site_url; ?>js/owl.carousel.min.js"></script>
    <script src="<?php print $site_url; ?>plugins/jquery-countdown/jquery.countdown.min.js"></script>
    <script src="<?php print $site_url; ?>js/jquery.vide.min.js"></script>
    <script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>

    <script src="<?php print $site_url; ?>js/application4108.js?v=1545555024"></script>

    <script src="<?php print $site_url; ?>plugins/sweet-alert/sweetalert.min.js"></script>
    <script src="<?php print $site_url; ?>js/countup.js"></script>
</body>

</html>