<?php
$template = '
<!DOCTYPE html>
<html lang="ru"><head>
<title>'.$PRETITLE.' - '.$lang['titlerankings'].'</title>
<meta name="description" content="Battlefield 2 statistics - T~Gamer" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="origin-when-cross-origin">

<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

<!-- bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>


<link rel="stylesheet" type="text/css" media="screen" href="css/two-tiers.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/inner.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/footer.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/nt.css">
<link rel="stylesheet" type="text/css" media="print" href="css/print.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/default.css">

<script>/* no frames */ if(top.location != self.location) top.location.replace(self.location);</script>
<script src="js/nt2.js"></script>

</head>
<body class="inner">

<div id="page-1">
	<div id="page-2">
	
	<h1 id="page-title">'.$lang['titlerankings'].' <small>"'.$lang['titlerankingsnote'].'"</small></h1>

	<div id="page-3">
	
	<div id="content"><div id="content-id"><!-- template header end == begin content below -->
		
        <ul id="navitems">
			<li>|<a href="'.$ROOT.'">'.$lang['Home'].'</a>|</li>
            <li><a href="'.$ROOT.'forum.php">'.$lang['forum'].'</a>|</li>
            <li><a href="'.$ROOT.'?go=stats">'.$lang['top'].'</a>|</li>
            <li><a href="'.$ROOT.'?go=currentranking">'.$lang['currentranking'].'</a>|</li>
            <li><a href="'.$ROOT.'?go=lastrounds">'.$lang['lastrounds'].'</a>|</li>
            <li><a href="'.$ROOT.'?go=banlist">'.$lang['banlist'].'</a>|</li>
            <li><a href="'.$ROOT.'monitor.php">'.$lang['monitor'].'</a>|</li>
			<li><a href="'.$ROOT.'?go=faq">'.$lang['FAQ'].'</a>|</li>
            <li><a href="'.$ROOT.'?go=ubar">'.$lang['UBAR'].'</a>|</li>
			<li><a href="http://wiki.bf2s.com/">'.$lang['Wiki'].'</a>|</li>
		</ul>
		
		<form action="'.$ROOT.'?go=search" method="post" id="getstats">
			<label for="pid">'.$lang['search'].':</label>
			<input type="text" name="searchvalue" id="pid" value="" />
			<input type="submit" class="btn" value="Go" />
		</form>
        
<!--<center><h4>В &laquo;Зал славы&raquo; попадают бойцы, проведшие на поле боя более <font color=yellow>100</font> часов</h4></center>
<center>		<form  method="GET">
			<label>Для сравнения введите свой ID:
            <input type="hidden" name="go" value="currentranking">
			<input class=input name="id" maxlength="10" size="10"  value="';
			if ($id)
				$template .= $id;
			$template .= '" type="text"></label>
			<input class=button name="search" value="Сравнить" type="submit">
		</form></center>-->
';
$template .= '	  <center><table id="rankslist-home" class="stat" border="0" cellpadding="0" cellspacing="0" width="400">


	<tbody><tr>
		<th>'.$lang['TopStat'].'</th>
		<th>#1</th>
		<th>#2</th>
		<th>#3</th>
		<th>#4</th>
		<th>#5</th>';
if ($compare)
{
foreach ($rankings as $key => $value)
    {
if ($value['data2'][0]['name'] != '' AND !$done) {$template .= '        <th><a href="'.$ROOT.'?pid='.$value['data2'][0]['id'].'">'.$value['data2'][0]['name'].'</a></th>'; $done=1;}
    }
}
$template .= '	</tr>';

	
	foreach ($rankings as $key => $value)
	{
		#$template .= '#'.$key.'#'.$value.'+<br>';
		#$template .= $value['name'];

		$template .= '<tr><td>'.$value['name'].'</td>';
		
		for ($i=0; $i<5; $i++)
		{
$value['data'][$i]['name'] = preg_replace("/>/","&gt;",$value['data'][$i]['name']);
$value['data'][$i]['name'] = preg_replace("/</","&lt;",$value['data'][$i]['name']);
			$template .= '<td>
			<table width="150" border="0" cellspacing="0">
              <tr>
                <td width=10 rowspan="2"><img src="'.$ROOT.'images/game-images/ranks/icon/rank_'.$value['data'][$i]['rank'].'.gif" alt="'.getRankByID($value['data'][$i]['rank']).'"></td>
                <td><a href="'.$ROOT.'?pid='.$value['data'][$i]['id'].'">'.$value['data'][$i]['name'].'</a></td>
              </tr>
              <tr>
                <td>'.cutzero(sprintf("%2.2f",$value['data'][$i]['value'])).'</td>
              </tr>
            </table>
			</td>
			';
		}
if ($compare){
$value['data2'][0]['name'] = preg_replace("/>/","&gt;",$value['data2'][0]['name']);
$value['data2'][0]['name'] = preg_replace("/</","&lt;",$value['data2'][0]['name']);
			$template .= '<td>
			<table width="120" border="0" cellspacing="0">
              <tr>
                <td width=22 align=center rowspan="2">'.$value['data2'][0]['num'].'</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>'.cutzero(sprintf("%2.2f",$value['data2'][0]['value'])).'</td>
              </tr>
            </table>
			</td>
			';
}
		$template .= '</tr>
		<tr class="separator"><td colspan="';
        if ($compare){$template .= '7';}
        else {$template .= '6';}
        $template .= '">&nbsp;</td></tr>';

	}
	
	$template .= '	
	</tbody></table></center>

        <!-- end content == footer below -->
<!--
      <hr class="clear"><center><em><font color=yellow>*</font> KD - убийства/смерти; KPM - убийств в минуту</em><br><em><font color=yellow>**</font> убийства*убийства/кол-во применений</em><br><em><font color=yellow>***</font> снайперская винтовка: убийства/смерти + убийств в минуту + процент попаданий</em><br><em><font color=yellow>****</font> AT/AA: убийства/смерти + убийств в минуту + процент попаданий</em></center>
-->
	</div></div> <!-- content-id --><!-- content -->
	  </div><!-- page 3 -->


	</div><!-- page 2 -->
    
<div id="footer"><!-- footer -->
<div class="footer_mod">
    <div class="footer_mod_left"><!-- Language -->
        <form method="post" id="content">
            '.$lang['select'].'
            <select name="lang">
            <option value="ru">'.$lang['Russian'].'</option>
            <option value="en">'.$lang['English'].'</option>
            <option value="jp">Japanese</option>
            </select>
            <input type="submit" value="'.$lang['selectsave'].'" />
        </form>
    </div><!-- / Language -->
    <div class="footer_mod_right">
    <a href="#top">'.$UpPage.'</a><br/>
    <!--&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<br/>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp-->
    </div>
    <div class="footer_mod_center">'.$lang['footerLASTUPDATE'].'. '.$lang['footerNEXTUPDATE'].'.<br>
	'.$lang['footerPROCESSED'].'.<br><br/>
    '.$lang['copyrightProject'].'<br/>
    <!-- Уважайте мою работу - не трогайте нижнюю строчку... (^ω^)/ -->
    '.$lang['copyrightBF2REW'].'<br/>
    '.$lang['copyrightShark'].'<br/></div>
</div>
</div><!-- footer -->

</div>';
$template .= '</body></html>';
?>