<?php
/*======================================================================*\
|| #################################################################### ||
|| # EoT-Clan BF3 Leaderboard                                         # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernt werden                      # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # -----------------BF3 Leaderboard is a free Software--------------# ||
|| #                   http://eot-clan.net                            # ||
|| #################################################################### ||
\*======================================================================*/
 $versionNr = "1.3.1";



define('DIRECTACCESS','1'); 


define('DS', DIRECTORY_SEPARATOR);
define('SYS_DIR', dirname(dirname(__FILE__)) . DS);
define('LOG_DIR', SYS_DIR . 'logs' . DS);

/* Database connect */
$link = mysql_connect($host, $dbuser, $dbpw)
or die ("Can not connect to Database: " .mysql_error());
mysql_select_db($db);



$sSql = "SELECT * FROM ".DBPrefix."admin"; 
           
 $result = @mysql_query($sSql);
 $entrys = @mysql_num_rows($result);
			    if ($entrys > 0){
	
		 
 $row = mysql_fetch_assoc($result);
 
 
 if ($row['error_report'] == 1){ 
   error_reporting(-1);
 }
 
 
 $styleSql = "SELECT * FROM ".DBPrefix."style"; 
  $style = @mysql_query($styleSql);
  $style = @mysql_fetch_assoc($style);
  
  
 if ($row['stylesettings'] == "acp"){ 
   $styleSettings = '<link rel="stylesheet" type="text/css" href="'.$domain.'/css/style.php" media="screen,projection" />';
 }else{
 	 $styleSettings = '<link rel="stylesheet" type="text/css" href="'.$domain.'/css/style.css">';
 }
} 

 if (!$row['banner']) {
 	$Banner = "";
}else{
  $Banner = '<br /><a title="Leaderboard Home" href="'.$domain.'/index.php"><img src="'.$row['banner'].'" border="0" alt="banner" style="width:'.$style['IndexBanner'].'px" /></a>';
}

//Berechnung der größe für die Index

   $Width=round($style['IndexTableWidth']*100/814);
     
     if ($Width < 100){
       $textwidth = (120/100*$Width);
      }else{
	     $textwidth = 120;
	   }
	   
	    if ($Width < 100){
       $tabs = $style['IndexTableWidth']-5;
      }else{
	     $tabs = 690;
	   }
	   
	   if ($Width < 100){
       $imgW = (100/100*$Width)-10;
      }else{
	     $imgW = 100;
	   }

      if ($Width < 100){
       $imgMap = (780/100*$Width);
      }else{
	     $imgMap = 780;
	   }
 
   $clantag = explode(',', $row['clantag']);



/* Load Classes */

/**
 * Module added by Eichi (E-Mail: eichi@blubbbel.eu)
 */
function __autoload($sClass){
	$sDir = dirname(__FILE__);
	if ($sClass == 'xajax'){
		$sFile = dirname($sDir) . DS . 'js' . DS . 'xajax' . DS . 'xajax_core' . DS . 'xajax.inc.php';
		if (file_exists($sFile)){
			require_once $sFile;
		} else {
			exit('Fatal error in ' . __FILE__ . ' on line ' . __LINE__ . ': Could not find xajax library files. (' . $sFile . ')');
		}
	} else {
		$sFile = $sDir . DS . $sClass . '.php';
		if (file_exists($sFile)){
			require_once $sFile;
		} else {
			$sFile = $sDir . DS . $sClass . '.class.php';
			if (file_exists($sFile)){
				require_once $sFile;
			} else {
				exit('Fatal error in ' . __FILE__ . ' on line ' . __LINE__ . ': Could not load instantiated class ' . $sClass . ' in: ' . $sFile);
			}
		}
	}
}

 
	   
	   