Location: PHPKode > scripts > ezStats for Medal of Honor > index.php
<?php
	include 'config.php';
	include 'classes.php';
	include 'functions.php';
	include 'settings.php';
	
	/* Laden der Localization */
	$ezLoc->get_data("overview");
	
	
	/* Templates für Modus "Standalone" */
	if ($ezstats['cms'] == '011_standalone') {
		if ($ezstats['supportlink']) {
			$title = $ezLoc->data['ezstats']." v".$ezstats['version'];
		} else {
			$title = $ezLoc->data['leaderboard'];
		}
		
		eval ("\$template = \"".$ezLoc->get_template("standalone_header")."\";");
		echo $template;
		eval ("\$template = \"".$ezLoc->get_template("standalone_body")."\";");
		echo $template;
	}
	
	
	/* Erstellen des Overview-Heads -> Javascripts und Stylesheets laden */
	$ezSet = Array();
	$ezSet['easing'] = $ezstats['relpath']."jscripts/jquery.easing.js";
	$ezSet['tablesort'] = $ezstats['relpath']."jscripts/jquery.tablesorter.js";
	$ezSet['tooltip'] = $ezstats['relpath']."jscripts/jquery.tooltip.js";
	$ezSet['fancybox'] = $ezstats['relpath']."jscripts/jquery.fancybox.js";
	$ezSet['common'] = $ezstats['relpath']."jscripts/common.js";
	$ezSet['overview'] = $ezstats['relpath']."jscripts/overview.js";
	$ezSet['style'] = '
		@import url('.$ezstats['relpath'].'stylesheets/overview.css);
		@import url('.$ezstats['relpath'].'stylesheets/themes/'.$ezstats['theme'].'/overview.css);
		@import url('.$ezstats['relpath'].'stylesheets/fancybox.css);
		@import url('.$ezstats['relpath'].'stylesheets/detail.css);
		@import url('.$ezstats['relpath'].'stylesheets/themes/'.$ezstats['theme'].'/detail.css);
		@import url('.$ezstats['relpath'].'stylesheets/userdefined.css);
	';
	
	
	/* Erstellen des Overview-Heads -> Spalten ein- und ausblenden */
	$display = Array();
	$query = 'SELECT * FROM '.$ezstats['prefix'].'overview WHERE ID = 1';
	$result = mysql_fetch_assoc($ezSQL->safe_query($query));
	$overview = $ezData->show_columns_of_table($ezstats['prefix']."overview");
	foreach ($overview as $col) {
			if ($result[$col]) {
			$display[$col] = "block";
		} else  {
			$display[$col] = "hidden";
		}
	}
	
	eval ("\$template = \"".$ezLoc->get_template("overview_head_head")."\";");
	echo $template;
	$ezLoc->get_data("overview");
	
	
	/* Erstellen der Gesamt- und Durchschittswerte */
	$show_foot = "hidden";
	$data = $ezLoc->data;
	$sum = $ezLoc->data;
	
	if ($ezstats['overview_average'] OR $ezstats['overview_summary']) {
		/* Ermitteln der Gesamtzahlen */
		$players = $ezData->get_all_players("act", "ID");
		foreach ($players as $player) {
			$stats = $ezData->get_stats($player, "default");
			
			$sum['score'] += $stats['score'];
			$sum['time'] += $stats['time'];
			$sum['score_per_minute'] += $stats['score_per_minute'];
			$sum['kills'] += $stats['kills'];
			$sum['deaths'] += $stats['deaths'];
			$sum['dogt'] += $stats['dogt'];
			$sum['accuracy'] += $stats['accuracy'];
			$sum['wins'] += $stats['wins'];
			$sum['losses'] += $stats['losses'];
			$sum['bestIARScore'] += $stats['bestIARScore'];
			$sum['highestScoreStreak'] += $stats['highestScoreStreak'];
			
			$sum['count']++;
		}
		for ($i = 0; $i < 2; $i++) {
			if ($i) {
				if ($ezstats['overview_average']) $show_foot = "block"; else $show_foot = "hidden";
				$data['lang_name'] = $ezLoc->data['avg'];
				$data['lang_title'] = $ezLoc->data['title_avg'];
				
				/* Berechnen der Durchschnittswerte im zweiten Durchlauf */
				foreach ($sum as $key => $value) {
					if ($key != "count" AND $sum['count']) $sum[$key] = $value / $sum['count'];
				}
			} else {
				if ($ezstats['overview_summary']) $show_foot = "block"; else $show_foot = "hidden";
				$data['lang_name'] = $ezLoc->data['sum'];
				$data['lang_title'] = $ezLoc->data['title_sum'];
			}
			
			/* Erstellen der Zelleninhalte */
			if ($sum['count']) {
				$data['name'] = 				$data['lang_name'];
				$data['score'] = 				$ezFunc->convert_stats_data(Array($sum['score'], 0, "", $data['lang_title'].$ezLoc->data['title_score']), "number");
				$data['time'] = 				$ezFunc->convert_stats_data(Array($sum['time'], 0, "h", $data['lang_title'].$ezLoc->data['title_time']), "time");
				$data['score_per_minute'] =		$ezFunc->convert_stats_data(Array($sum['score_per_minute'], 0, "", $data['lang_title'].$ezLoc->data['title_spm']), "number");
				$data['kills'] = 				$ezFunc->convert_stats_data(Array($sum['kills'], 0, "", $data['lang_title'].$ezLoc->data['title_kills']), "number");
				$data['deaths'] = 				$ezFunc->convert_stats_data(Array($sum['deaths'], 0, "", $data['lang_title'].$ezLoc->data['title_deaths']), "number");
				$data['kdr'] = 					$ezFunc->convert_stats_data(Array($sum['kills'], $sum['deaths'], 2, "", $data['lang_title'].$ezLoc->data['title_kdr']), "ratio");
				$data['dogt'] = 				$ezFunc->convert_stats_data(Array($sum['dogt'], 0, "", $data['lang_title'].$ezLoc->data['title_dogtags_sum']), "number");
				$data['accuracy'] = 			$ezFunc->convert_stats_data(Array($sum['accuracy'], 0, "%", $data['lang_title'].$ezLoc->data['title_accuracy']), "number");
				$data['wins'] = 				$ezFunc->convert_stats_data(Array($sum['wins'], 0, "", $data['lang_title'].$ezLoc->data['title_wins']), "number");
				$data['losses'] = 				$ezFunc->convert_stats_data(Array($sum['losses'], 0, "", $data['lang_title'].$ezLoc->data['title_losses']), "number");
				$data['wlr'] = 					$ezFunc->convert_stats_data(Array($sum['wins'], $sum['losses'], 2, "", $data['lang_title'].$ezLoc->data['title_wlr']), "ratio");
				$data['bestIARScore'] = 		$ezFunc->convert_stats_data(Array($sum['bestIARScore'], 0, "", $data['lang_title'].$ezLoc->data['title_bestIARScore']), "number");
				$data['highestScoreStreak'] = 	$ezFunc->convert_stats_data(Array($sum['highestScoreStreak'], 0, "", $data['lang_title'].$ezLoc->data['title_highestScoreStreak']), "number");
			}
			
			eval ("\$template = \"".$ezLoc->get_template("overview_head_body")."\";");
			echo $template;
		}
	
	}
	
	
	eval ("\$template = \"".$ezLoc->get_template("overview_head_foot")."\";");
	echo $template;
	
	
	/* Erstellen des Overview-Bodys */
	$players = $ezData->get_all_players("act", "ID");
	foreach ($players as $player) {
		$data = Array();
		$stats = $ezData->get_stats($player, "default");
		
		$data['country'] = 				$ezFunc->convert_stats_data(Array($stats['country'], $display['country']), "country");
		$data['name'] = 				$ezFunc->convert_stats_data(Array($stats['name'], $player, $ezstats, $ezLoc->data['view_details'], $ezstats['system']), "namelink");
		$data['score'] = 				$ezFunc->convert_stats_data(Array($stats['score'], 0, "", $ezLoc->data['title_score']), "number");
		$data['time'] = 				$ezFunc->convert_stats_data(Array($stats['time'], 0, "h", $ezLoc->data['title_time']), "time");
		$data['score_per_minute'] = 	$ezFunc->convert_stats_data(Array($stats['score_per_minute'], 0, "", $ezLoc->data['title_spm']), "number");
		$data['kills'] = 				$ezFunc->convert_stats_data(Array($stats['kills'], 0, "", $ezLoc->data['title_kills']), "number");
		$data['deaths'] = 				$ezFunc->convert_stats_data(Array($stats['deaths'], 0, "", $ezLoc->data['title_deaths']), "number");
		$data['kdr'] = 					$ezFunc->convert_stats_data(Array($stats['kills'], $stats['deaths'], 2, "", $ezLoc->data['title_kdr']), "ratio");
		$data['dogt'] = 				$ezFunc->convert_stats_data(Array($stats['dogt'], 0, "", $ezLoc->data['title_dogtags']), "number");
		$data['accuracy'] =			 	$ezFunc->convert_stats_data(Array($stats['accuracy'], 0, "%", $ezLoc->data['title_accuracy']), "number");
		$data['wins'] = 				$ezFunc->convert_stats_data(Array($stats['wins'], 0, "", $ezLoc->data['title_wins']), "number");
		$data['losses'] = 				$ezFunc->convert_stats_data(Array($stats['losses'], 0, "", $ezLoc->data['title_losses']), "number");
		$data['wlr'] = 					$ezFunc->convert_stats_data(Array($stats['wins'], $stats['losses'], 2, "", $ezLoc->data['title_wlr']), "ratio");
		$data['bestIARScore'] = 		$ezFunc->convert_stats_data(Array($stats['bestIARScore'], 0, "", $ezLoc->data['title_bestIARScore']), "number");
		$data['highestScoreStreak'] = 	$ezFunc->convert_stats_data(Array($stats['highestScoreStreak'], 0, "", $ezLoc->data['title_highestScoreStreak']), "number");
		
		$data['updt'] =			'<span class="update fright" title="'.$ezLoc->data['title_updt'].'" rel="'.$player.'"></span>';
		
		eval ("\$template = \"".$ezLoc->get_template("overview_body")."\";");
		echo $template;
	}
	
	
	/* Erstellen des Overview-Foots */
	if ($ezstats['adminlink']) $adminlink = '<a href="'.$ezstats['relpath'].'admin/" target="_blank" title="'.$ezLoc->data['adminpanel_title'].'">'.$ezLoc->data['adminpanel'].'</a>&nbsp;'; else $adminlink = "";
	if ($ezstats['supportlink'] OR $ezFunc->check_version($ezstats['version'])) {
		if ($ezFunc->check_version($ezstats['version'])) {
			$supportlink = '<a href="http://ezstats.sixbitunder.com/support/" target="_blank" title="'.$ezLoc->data['supportlink_title'].'">'.$ezLoc->data['newversion'].'</a>';
		} else {
			$supportlink = '<a href="http://ezstats.sixbitunder.com/support/" target="_blank" title="'.$ezLoc->data['supportlink_title'].'">'.$ezLoc->data['ezstats'].' v'.$ezstats['version'].'</a>';
		}
	} else $supportlink = "";
	if ($ezstats['showupdate']) {
		if (function_exists('ini_get') && ini_get('date.timezone') == '') ini_set('date.timezone', 'Europe/Berlin');
		$lastupdate = $ezLoc->data['lastupdate'].": ".date('d.m.Y - H:i', $ezstats['lastupdate']);
	} else $lastupdate = "";
	
	
	eval ("\$template = \"".$ezLoc->get_template("overview_foot")."\";");
	echo $template;
	
	
	/* Templates für Modus "Standalone" */
	if ($ezstats['cms'] == '011_standalone') {
		eval ("\$template = \"".$ezLoc->get_template("standalone_footer")."\";");
		echo $template;
	}
	
	/* Setzt die SQL-Verbinding auf die Datenbank des CMS zurück */
	$ezSQL->reset_connection();
?>
Return current item: ezStats for Medal of Honor