<?php
/*======================================================================*\
|| #################################################################### ||
|| # EoT-Clan BF3 Leaderboard                                         # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernet werden                     # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # -----------------BF3 Leaderboard is a free Software--------------# ||
|| #                   http://eot-clan.net                            # ||
|| #################################################################### ||
\*======================================================================*/
if(!defined('DIRECTACCESS')){
echo 'You cannot access this file directly!';
die;
}

$aStars = array(
             "arAK74" => $data['arAK74_needed']-$data['arAK74_curr'],
             "wahUGL" => $data['wahUGL_needed']-$data['wahUGL_curr'],
             "arM416" => $data['arM416_needed']-$data['arM416_curr'],
             "wahUSG" => $data['wahUSG_needed']-$data['wahUSG_curr'],
             "arAEK" => $data['arAEK_needed']-$data['arAEK_curr'],
             "arM16" => $data['arM16_needed']-$data['arM16_curr'],
             "arAN94" => $data['arAN94_needed']-$data['arAN94_curr'],
             "arF2" => $data['arF2_needed']-$data['arF2_curr'],
             "arG3" => $data['arG3_needed']-$data['arG3_curr'],
             "arKH" => $data['arKH_needed']-$data['arKH_curr'],
             "srM40" => $data['srM40_needed']-$data['srM40_curr'],
             "srM98" => $data['srM98_needed']-$data['srM98_curr'],
             "srMK11" => $data['srMK11_needed']-$data['srMK11_curr'],
             "srSKS" => $data['srSKS_needed']-$data['srSKS_curr'],
             "srSV98" => $data['srSV98_needed']-$data['srSV98_curr'],
             "srSVD"  => $data['srSVD_needed']-$data['srSVD_curr'],
             "mgM240" => $data['mgM240_needed']-$data['mgM240_curr'],
             "mgM249" => $data['mgM249_needed']-$data['mgM249_curr'],
             "mgM27" => $data['mgM27_needed']-$data['mgM27_curr'],
             "mgM60" => $data['mgM60_needed']-$data['mgM60_curr'],
             "mgPech" => $data['mgPech_needed']-$data['mgPech_curr'],
             "mgRPK" => $data['mgRPK_needed']-$data['mgRPK_curr'],
             "mgT88"  => $data['mgT88_needed']-$data['mgT88_curr'],
             "caA91" => $data['caA91_needed']-$data['caA91_curr'],
             "caAKS" => $data['caAKS_needed']-$data['caAKS_curr'],
             "caG36" => $data['caG36_needed']-$data['caG36_curr'],
             "caM4" => $data['caM4_needed']-$data['caM4_curr'],
             "caSCAR" => $data['caSCAR_needed']-$data['caSCAR_curr'],
             "caSG553" => $data['caSG553_needed']-$data['caSG553_curr'],
             "srM39" => $data['srM39_needed']-$data['srM39_curr'],
             "wLAAFIM" => $data['wLAAFIM_needed']-$data['wLAAFIM_curr'],
             "wLAAIGL" => $data['wLAAIGL_needed']-$data['wLAAIGL_curr'],
             "wLATJAV" => $data['wLATJAV_needed']-$data['wLATJAV_curr'],
             "wLATRPG" => $data['wLATRPG_needed']-$data['wLATRPG_curr'],
             "wLATSMAW" => $data['wLATSMAW_needed']-$data['wLATSMAW_curr'],
             "pG17S" => $data['pG17S_needed']-$data['pG17S_curr'],
             "pG17" => $data['pG17_needed']-$data['pG17_curr'],
             "pg18S" => $data['pg18S_needed']-$data['pg18S_curr'],
             "pg18" => $data['pg18_needed']-$data['pg18_curr'],
             "pM1911L" => $data['pM1911L_needed']-$data['pM1911L_curr'],
             "pM1911" => $data['pM1911_needed']-$data['pM1911_curr'],
             "pM1911S" => $data['pM1911S_needed']-$data['pM1911S_curr'],
             "pM1911T" => $data['pM1911T_needed']-$data['pM1911T_curr'],
             "pM412" => $data['pM412_needed']-$data['pM412_curr'],
             "pM9F" => $data['pM9F_needed']-$data['pM9F_curr'],
             "pM9S" => $data['pM9S_needed']-$data['pM9S_curr'],
             "pM9" => $data['pM9_needed']-$data['pM9_curr'],
             "pM93R" => $data['pM93R_needed']-$data['pM93R_curr'],
             "pMP443L" => $data['pMP443L_needed']-$data['pMP443L_curr'],
             "pMP443S" => $data['pMP443S_needed']-$data['pMP443S_curr'],
             "pMP443" => $data['pMP443_needed']-$data['pMP443_curr'],
             "pTaurS" => $data['pTaurS_needed']-$data['pTaurS_curr'],
             "pTaur" => $data['pTaur_needed']-$data['pTaur_curr'],
             "sg870" => $data['sg870_needed']-$data['sg870_curr'],
             "sgDAO" => $data['sgDAO_needed']-$data['sgDAO_curr'],
             "sgM1014" => $data['sgM1014_needed']-$data['sgM1014_curr'],
             "sgSaiga" => $data['sgSaiga_needed']-$data['sgSaiga_curr'],
             "sgUSAS" => $data['sgUSAS_needed']-$data['sgUSAS_curr'],
             "smMP7" => $data['smMP7_needed']-$data['smMP7_curr'],
             "smP90" => $data['smP90_needed']-$data['smP90_curr'],
             "smPDR" => $data['smPDR_needed']-$data['smPDR_curr'],
             "smPP2000" => $data['smPP2000_needed']-$data['smPP2000_curr'],
             "smUMP" => $data['smUMP_needed']-$data['smUMP_curr'],
             "smVAL" => $data['smVAL_needed']-$data['smVAL_curr'],
             "wasK" => $data['wasK_needed']-$data['wasK_curr'],             
             "arFAMAS" => $data['arFAMAS_needed']-$data['arFAMAS_curr'],
             "arL85A2" => $data['arL85A2_needed']-$data['arL85A2_curr'],
             "caHK53" => $data['caHK53_needed']-$data['caHK53_curr'],
             "caQBZ95B" => $data['caQBZ95B_needed']-$data['caQBZ95B_curr'],
             "mgQBB95" => $data['mgQBB95_needed']-$data['mgQBB95_curr'],
             "mgMG36" => $data['mgMG36_needed']-$data['mgMG36_curr'],
             "srQBU88" => $data['srQBU88_needed']-$data['srQBU88_curr'],
             "srL96" => $data['srL96_needed']-$data['srL96_curr'],
             "smPP19" => $data['smPP19_needed']-$data['smPP19_curr'],
             "sgJackH" => $data['sgJackH_needed']-$data['sgJackH_curr'],   
             "arAUG" => $data['arAUG_needed']-$data['arAUG_curr'],
             "arSCARL" => $data['arSCARL_needed']-$data['arSCARL_curr'],
             "mgL86A1" => $data['mgL86A1_needed']-$data['mgL86A1_curr'],
             "mgLSAT" => $data['mgLSAT_needed']-$data['mgLSAT_curr'],
             "caACR" => $data['caACR_needed']-$data['caACR_curr'],
             "caMTAR21" => $data['caMTAR21_needed']-$data['caMTAR21_curr'],
             "srHK417" => $data['srHK417_needed']-$data['srHK417_curr'],
             "srJNG90" => $data['srJNG90_needed']-$data['srJNG90_curr'],
             "sgSPAS12" => $data['sgSPAS12_needed']-$data['sgSPAS12_curr'],
             "smM5K" => $data['smM5K_needed']-$data['smM5K_curr']
             
             );
            asort($aStars);
?>
<div style="float:left;">
<table class="default" style="float:left;width:400px;margin-left:10px;height:225px;" cellspacing="0" cellpadding="5">
  <td class="head" colspan="10" cellspacing="0" width="100px"><?php echo LANG_NEXT_TITLE; ?></td>
	  <tr> 
		 <?php 
		 $i = 0;
		 foreach ($aStars as $key => $needed){
		 	if ($needed > 0 ){
		 	$i++;
		 	$WeaponNameC = 'LANG_WEAPONS_'.$key;
		 	$WeaponTEXT = 'LANG_WEAPONS_TEXT_'.$key;
		 	$WeaponName = constant($WeaponNameC);
		 	
		 	if(strlen($WeaponName) <= 8) {
        $WeaponName = $WeaponName;
      } else {
        $WeaponName = substr($WeaponName,0,8) . ''; 
      }   
       
		 	?>
		 	   <td class="result"><a class="tooltip"><?php echo $WeaponName; ?>
		 		  <span style="margin-top:20px;margin-left:-10px;width:250px;">
	  			    		<div style="text-align:center;width:120px;"><b><?php echo constant($WeaponNameC); ?></b></div><br />
	  			        <div style="float:left;"><img src="img/weapons/<?php echo $key; ?>.png" width="120px"/></div><div style="text-align:left;"><?php echo constant($WeaponTEXT); ?></div>
	  			      </span></a>
		 		  <br />
		 		  <div>
	  			    	<img src="img/stars/stars_back_big.png" />
	  			    <div style="margin-left:<?php echo marginNext($data[$key.'_count']+1); ?>px;position:absolute;font-size:11px;font-weight:bold;margin-top:-19px;"><?php echo $data[$key.'_count']+1; ?>
	  			   </div>
	  			</div>
		 		  <div class="DIVtext"><?php echo $needed; ?> Kills </div>
		 		</td>
		 	<?php
		 	 if ($i % 4 == 0) echo'<tr />';
	    if ($i == 12) break;
		}
	}
		?>			 
 	</table>
 </div>

      
      
      
      <div style="float:left;">
<table class="default" style="float:left;width:400px;margin-left:10px;height:225px;" cellspacing="0" cellpadding="5">
  <td class="head" colspan="10" cellspacing="0"> <?php echo LANG_NEXT_SIG; ?></td>
	  <tr>
	  	<td class="result"><a class="tooltip">
	  	<img src="http://g.bf3stats.com/<?php echo $row['platform'].'/'.$row['sigID'].'/'.rawurlencode($data['soldiername']); ?>.png" width="390px" height="117px" />
	  	<span style="margin-top:-55px;margin-left:130px;">
	  		<img src="http://g.bf3stats.com/<?php echo $row['platform'].'/'.$row['sigID'].'/'.rawurlencode($data['soldiername']); ?>.png" />
	  	</span></a>
	  	<br />
       <span style="float:left;margin-left:8px;margin-top:3px;">URL:</span><span style="float:right;margin-right:1px;"><input class="inputfield" style="width:300px;background:transparent;border:1px solid <?php echo $style['table_border_color']; ?>;color:<?php echo $style['body_font_color']; ?>;" type="text" name="Link" value="http://g.bf3stats.com/<?php echo $row['platform'].'/'.$row['sigID'].'/'.rawurlencode($data['soldiername']); ?>.png" readonly /></span>
    <br /><div style=padding-top:10px></div>
       <span style="float:left;margin-left:8px;margin-top:3px;">BBCode:</span><span style="float:right;margin-right:1px;"><input class="inputfield" style="width:300px;background:transparent;border:1px solid <?php echo $style['table_border_color']; ?>;color:<?php echo $style['body_font_color']; ?>;" type="text" name="BBCODE" value="[URL=http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>][IMG]http://g.bf3stats.com/<?php echo $row['platform'].'/'.$row['sigID'].'/'.rawurlencode($data['soldiername']); ?>.png[/IMG][/URL]" readonly /></span>
    <br /><div style=padding-top:10px></div>
      <span style="float:left;margin-left:8px;margin-top:3px;">HTML Code:</span><span style="float:right;margin-right:1px;"><input class="inputfield" style="width:300px;background:transparent;border:1px solid <?php echo $style['table_border_color']; ?>;color:<?php echo $style['body_font_color']; ?>;" type="text" name="HTML Code" value="<?php echo htmlspecialchars('<a href="http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'"><img src="http://g.bf3stats.com/'.$row['platform'].'/'.$row['sigID'].'/'.rawurlencode($data['soldiername']).'.png" alt="'.rawurlencode($data['soldiername']).'" border="0" /></a>')?>" readonly /></span>

	   </td>	
	  	</table>
 </div> 
 
<?php 
 function marginNext($count){
	if ($count >= 10 && $count <= 99){
		$return = 45;
	}else if ($count >= 100){
		$return = 44;
	}else{
		$return = 47;
	}
	
	return $return;
}