<?php
# Login block
if(!isLoggedIn()) {
echo'<div class="sidebarBlock sidebarBlockLogin">';
echo' <form id="login_form" class="form" method="post" action="/login">';
echo '<h3>Account panel</h3>';
echo '<div class="formGroup login"><input type="text" name="webengineLogin_user" id="loginBox1"></div>';
echo '<div class="formGroup pass"><input type="password" name="webengineLogin_pwd" id="loginBox2"></div>';
echo '<div class="formGroup-button">';
echo '<button type="submit" name="webengineLogin_submit" value="submit" class="button-login">'.lang('login_txt_3',true).'</button>';
echo '</div>';
echo '<div class="formGroup-links flex-c-c">';
echo '<a href="/register">Registrarte</a> | <a href="/forgotpassword">Recuperar Contraseña</a>';
echo'</div>';
echo '</form>';
echo'</div>';
}
# Usercp block
if(isLoggedIn()) {
echo'<div class="sidebarBlock sidebarBlockLogin">';
echo'<div class="widget light-fon login-block">';
echo'<div class="widget-title">';
echo'<div class="form">';
echo '<h3>Account panel</h3>';
echo'</div>';
echo'<form class="lk-form">';
templateBuildUsercp();
echo'</form>';
echo'<p style="display: flex; justify-content: center; align-items: center; margin:5px 0px; ">';
echo'<a href="'.__BASE_URL__.'logout" class="button">Logout</a>';
echo'</p>';
echo '</div>';
echo '</div>';
}
#Top Reset
$resetRankingData = LoadCacheData('rankings_resets.cache');
$charactersCountry = loadCache('character_country.cache');
$topResetLimit = 10;
if(is_array($resetRankingData)) {
$topReset = array_slice($resetRankingData, 0, $topResetLimit+1);
echo '<div class="sidebarBlock">';
echo '<div class="sidebarTitle">';
echo'<h2>Top Resets.</h2>';
echo'</div>';
echo'<ul class="rank-list active top-block">';
echo'<li class="top-title">';
echo'<span class="top-number">#</span>';
echo'<span class="top-flag"></span>';
echo'<span class="top-flag"></span>';
echo'<span class="top-name">Nombre</span>';
echo'<span class="top-lvl">Reset<sup>Lvl</sup></span>';
foreach($topReset as $key => $row) {
if($key == 0) continue;
echo'<li class="top-list" >';
echo'<span class="top-number">'.$key.'.</span>';
echo'<img src="'.getPlayerClassAvatar($row[1], false).'" width="20px" height="auto" style="margin-left:10px; -moz-border-radius: 50%;-webkit-border-radius: 50%;border-radius: 50%;-khtml-border-radius: 50%;"/>';
echo'<img src="'.getCountryFlag($charactersCountry[$row[0]]).'" style="margin:0px 15px;"/>';
echo'<span class="top-name">'.playerProfile($row[0]).'</span>';
echo'<span class="top-lvl">'.number_format($row[2]).'<sup style="color:red;">'.number_format($row[3]).'</sub></span>';
echo'</li>';
}
echo'</li>';
echo'</ul>';
echo'</div>';
}
# Server info block
$srvInfoCache = LoadCacheData('server_info.cache');
if(is_array($srvInfoCache)) {
$srvInfo = explode("|", $srvInfoCache[1][0]);
echo'<div class="widget light-fon login-block">';
echo'<div class="sidebarTitle">';
echo'<h2>Informacion.</h2>';
echo'</div>';
echo '<table class="table">';
if(check_value(config('server_info_season', true))) echo '<tr><td><i class="fas fa-code-branch" aria-hidden="true"></i> '.lang('sidebar_srvinfo_txt_6').'</td><td>'.config('server_info_season', true).'</td></tr>';
if(check_value(config('server_info_exp', true))) echo '<tr><td><i class="fas fa-sort-amount-down" aria-hidden="true"></i> '.lang('sidebar_srvinfo_txt_7').'</td><td>'.config('server_info_exp', true).'</td></tr>';
if(check_value(config('server_info_drop', true))) echo '<tr><td><i class="fas fa-tint" aria-hidden="true"></i> '.lang('sidebar_srvinfo_txt_9').'</td><td>'.config('server_info_drop', true).'</td></tr>';
echo '<tr><td><i class="fas fa-address-book" aria-hidden="true"></i> '.lang('sidebar_srvinfo_txt_2',true).'</td><td style="font-weight:bold;">'.number_format($srvInfo[0]).'</td></tr>';
echo '<tr><td><i class="fas fa-user" aria-hidden="true"></i> '.lang('sidebar_srvinfo_txt_3',true).'</td><td style="font-weight:bold;">'.number_format($srvInfo[1]).'</td></tr>';
echo '<tr><td><i class="fas fa-shield-alt" aria-hidden="true"></i> '.lang('sidebar_srvinfo_txt_4',true).'</td><td style="font-weight:bold;">'.number_format($srvInfo[2]).'</td></tr>';
echo '<tr><td><i class="fas fa-plug"></i> '.lang('sidebar_srvinfo_txt_5',true).'</td><td style="color:#00aa00;font-weight:bold;">'.number_format($srvInfo[3]).'</td></tr>';
echo '</table>';
echo'</div>';
}
echo'<div class="widget light-fon login-block">';
echo'<div class="sidebarTitle">';
echo'<h2>DISCORD</h2>';
echo'<span>Unete a nustro Discord!</span>';
echo'</div>';
echo'<iframe src="
https://discord.com/widget?id=909937779209830440&theme=dark" width="250" height="450" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>';
echo '<table class="table">';
echo '</table>';
echo'</div>';
?>