2015-11-23 21:54:25 +01:00
|
|
|
<?php
|
|
|
|
#- BEGIN LICENSE BLOCK ---------------------------------------
|
|
|
|
#
|
2015-11-25 22:32:58 +01:00
|
|
|
# This file is part of botsArena.
|
2015-11-23 21:54:25 +01:00
|
|
|
#
|
|
|
|
# Copyright (C) Gnieark et contributeurs
|
|
|
|
# Licensed under the GPL version 3.0 license.
|
|
|
|
# See LICENSE file or
|
|
|
|
# http://www.gnu.org/licenses/gpl-3.0-standalone.html
|
|
|
|
#
|
|
|
|
# -- END LICENSE BLOCK -----------------------------------------
|
2015-11-28 15:17:00 +01:00
|
|
|
|
2015-11-23 21:54:25 +01:00
|
|
|
@session_start();
|
|
|
|
|
2015-11-25 22:13:36 +01:00
|
|
|
require_once("../src/functions.php");
|
2015-11-23 21:54:25 +01:00
|
|
|
|
2015-11-26 19:38:09 +01:00
|
|
|
$arenas=get_arenas_list();
|
2015-11-26 21:18:11 +01:00
|
|
|
$lang=get_language_array();
|
2015-11-27 18:59:04 +01:00
|
|
|
|
|
|
|
if(isset($_GET['arena'])){
|
|
|
|
//check if arena is list
|
|
|
|
$currentArena = false;
|
|
|
|
foreach($arenas as $arena){
|
2015-11-27 22:25:57 +01:00
|
|
|
if($arena['id'] == $_GET['arena']){
|
|
|
|
$currentArena = $_GET['arena'];
|
2015-11-27 22:29:37 +01:00
|
|
|
$currentArenaArr=$arena;
|
2015-11-27 18:59:04 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!$currentArena){
|
2015-11-27 22:25:57 +01:00
|
|
|
error(404,"Wrong parameter");
|
2015-11-27 18:59:04 +01:00
|
|
|
die;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$currentArena = "";
|
|
|
|
}
|
|
|
|
|
2015-11-23 21:54:25 +01:00
|
|
|
//form submitting
|
2015-11-27 18:59:04 +01:00
|
|
|
if (isset($_POST['xd_check'])){
|
2015-11-23 21:54:25 +01:00
|
|
|
//vérifier le numero de formulaire
|
|
|
|
if (($_SESSION['xd_check']!=$_POST['xd_check']) AND ($_POST['xd_check'] !="")){
|
2015-11-28 15:21:37 +01:00
|
|
|
error (400, 'Something wrong has appen');
|
2015-11-23 21:54:25 +01:00
|
|
|
die;
|
|
|
|
}
|
|
|
|
//call the good act.php
|
2015-11-27 22:10:43 +01:00
|
|
|
if(($currentArena <> "") && (file_exists("../src/arenas/".$currentArena."/act.php"))){
|
2015-11-28 15:44:16 +01:00
|
|
|
require_once("../src/arenas/".$currentArena."/act.php");
|
2015-11-23 21:54:25 +01:00
|
|
|
}
|
|
|
|
}
|
2015-11-28 11:18:21 +01:00
|
|
|
//title
|
|
|
|
if($currentArena == ""){
|
|
|
|
$siteTitle = $lang['SITE_NAME'];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
$siteTitle=$currentArenaArr['title'];
|
|
|
|
}
|
|
|
|
|
2015-11-23 21:54:25 +01:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2015-11-28 11:18:21 +01:00
|
|
|
<meta name="ROBOTS" content="INDEX, FOLLOW" />
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="author" content="Gnieark" />
|
|
|
|
<title><?php echo $siteTitle; ?></title>
|
|
|
|
<style type="text/css">
|
|
|
|
@import url(/style.css);
|
|
|
|
</style>
|
2015-11-28 14:41:29 +01:00
|
|
|
<?php
|
2015-11-28 18:02:49 +01:00
|
|
|
//arena specific css script (if needed)
|
|
|
|
if(isset($currentArenaArr['cssFile'])){
|
|
|
|
echo '<style type="text/css"><!--'."\n";
|
|
|
|
echo file_get_contents("../src/arenas/".$currentArena."/".$currentArenaArr['cssFile']);
|
|
|
|
echo "\n--></style>";
|
|
|
|
}
|
2015-11-28 15:17:00 +01:00
|
|
|
//arena specific script js (if needed)
|
2015-11-28 14:41:29 +01:00
|
|
|
if(isset($currentArenaArr['jsFile'])){
|
2015-11-28 15:17:00 +01:00
|
|
|
echo '<script type="text/javascript"><!--'."\n";
|
2015-11-28 14:41:29 +01:00
|
|
|
echo file_get_contents("../src/arenas/".$currentArena."/".$currentArenaArr['jsFile']);
|
2015-11-28 15:21:37 +01:00
|
|
|
echo "\n--></script>";
|
2015-11-28 14:41:29 +01:00
|
|
|
}
|
|
|
|
?>
|
2015-11-23 21:54:25 +01:00
|
|
|
</head>
|
2015-11-28 15:17:00 +01:00
|
|
|
<body>
|
2015-11-23 21:54:25 +01:00
|
|
|
<header>
|
2015-11-28 11:18:21 +01:00
|
|
|
<h1><?php echo $siteTitle; ?></h1>
|
2015-11-28 18:24:49 +01:00
|
|
|
|
|
|
|
<nav id="languages"><a href="<?php echo $currentArena; ?>-fr">fr</a> <a href="<?php echo $currentArena; ?>-en">en</a></nav>
|
2015-11-28 14:43:23 +01:00
|
|
|
<nav id="menus"><a href="/"<?php if($currentArena == "") echo ' class="selected"'; ?>><?php echo $lang['HOME']; ?></a>
|
2015-11-27 18:59:04 +01:00
|
|
|
<?php
|
|
|
|
foreach($arenas as $arena){
|
|
|
|
if( $arena['id'] == $currentArena){
|
|
|
|
$class="selected";
|
|
|
|
}else{
|
|
|
|
$class="";
|
|
|
|
}
|
|
|
|
echo '<a href="'.$arena['url'].'" class="'.$class.'">'.$arena['title'].'</a>';
|
|
|
|
}
|
2015-11-28 11:35:36 +01:00
|
|
|
?></nav>
|
2015-11-23 21:54:25 +01:00
|
|
|
</header>
|
|
|
|
<section>
|
2015-11-27 20:29:00 +01:00
|
|
|
<?php
|
2015-11-27 22:13:37 +01:00
|
|
|
switch($currentArena){
|
2015-11-27 20:29:00 +01:00
|
|
|
case "":
|
2015-11-28 18:19:27 +01:00
|
|
|
include ("../src/home.php");
|
2015-11-27 20:29:00 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
include ("../src/arenas/".$currentArena."/public.php");
|
2015-11-29 09:42:34 +01:00
|
|
|
|
|
|
|
//battle history for this arena
|
|
|
|
$hist=get_battles_history($currentArena);
|
2015-11-29 11:12:47 +01:00
|
|
|
echo '<aside id="history"><h2>Scores</h2>';
|
2015-11-29 09:42:34 +01:00
|
|
|
foreach($hist as $sc){
|
2015-11-29 11:12:47 +01:00
|
|
|
echo '<h3>'.$sc['bot1'].' VS '.$sc['bot2'].'</h3>
|
2015-11-29 09:42:34 +01:00
|
|
|
<ul>
|
|
|
|
<li>'.$sc['bot1']." ".$lang['VICTORIES'].":".$sc['player1Wins'].'</li>
|
|
|
|
<li>'.$sc['bot2']." ".$lang['VICTORIES'].":".$sc['player2Wins'].'</li>
|
2015-11-29 09:44:54 +01:00
|
|
|
<li>'.$lang['DRAW'].":".$sc['draws'].'</li>
|
2015-11-29 09:42:34 +01:00
|
|
|
</ul>';
|
|
|
|
}
|
2015-11-29 09:45:32 +01:00
|
|
|
echo '</aside>';
|
2015-11-27 20:29:00 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
?>
|
2015-11-23 21:54:25 +01:00
|
|
|
</section>
|
|
|
|
<footer>
|
|
|
|
</footer>
|
|
|
|
</body>
|
2015-11-28 15:44:16 +01:00
|
|
|
</html>
|