diff --git a/html/index.php b/html/index.php index f0a1db2..ca5df84 100644 --- a/html/index.php +++ b/html/index.php @@ -102,26 +102,48 @@ if($currentArena == ""){

Scores

'; - foreach($hist as $sc){ - echo '

'.$sc['bot1'].' VS '.$sc['bot2'].'

- '; + if(isset($_GET['doc'])){ + //on affiche une page de doc. + $pageExists=false; + foreach($arenas as $arena){ + if($arena['id'] == $_GET['doc']){ + if(file_exists("../src/arenas/".$arena['id']."/doc-".$lang['lang'].".html")){ + $pageExists=true; + echo file_get_contents("../src/arenas/".$arena['id']."/doc-".$lang['lang'].".html"); + break; + } } - echo ''; - include ("../src/arenas/".$currentArena."/public.php"); - break; + } + if(!$pageExists){ + error(404,"doc is missing"); + die; + } + + }else{ + //on affiche une arene ou page d'accueil + switch($currentArena){ + case "": + include ("../src/home.php"); + break; + default: + //battle history for this arena + $hist=get_battles_history($currentArena); + echo ''; + include ("../src/arenas/".$currentArena."/public.php"); + break; + } } + + ?>