commit
e0137f7cca
|
@ -6,6 +6,7 @@ RewriteRule ^p/(.*)-([a-z]{2})$ index\.php?page=$1&lang=$2 [L]
|
|||
RewriteRule ^p/(.*)$ index\.php?page=$1 [L]
|
||||
RewriteRule ^([a-zA-Z]{1,})/doc-([a-z]{2})$ index\.php?doc=$1&lang=$2 [L]
|
||||
RewriteRule ^([a-zA-Z]{1,})/doc$ index\.php?doc=$1 [L]
|
||||
RewriteRule ^([a-zA-Z]{1,})/scores$ index\.php?scores=$1 [L]
|
||||
RewriteRule ^([a-zA-Z]{1,})-([a-z]{2})$ index\.php?arena=$1&lang=$2 [L]
|
||||
RewriteRule ^([a-zA-Z]{1,})$ index\.php?arena=$1 [L]
|
||||
RewriteRule ^-([a-z]{2})$ index\.php?lang=$1 [L]
|
||||
|
|
|
@ -41,50 +41,10 @@ if(isset($_GET['arena'])){
|
|||
error(404,"Wrong parameter");
|
||||
die;
|
||||
}
|
||||
$hist=get_battles_history($currentArena);
|
||||
|
||||
$siteTitle=$currentArenaArr['title'];
|
||||
$siteDescription=$currentArenaArr['metaDescription'];
|
||||
$mainSectionScript="../src/arenas/".$currentArena."/public.php";
|
||||
$asideSectionContent='<h2>infos:</h2><p>'.$lang['DEV-YOUR-OWN-BOT'].'<br/> <a href="/'.$currentArena.'/doc">'.$lang['DOC_SPECS_LINKS'].'</a></p>
|
||||
<h2>Scores</h2>';
|
||||
|
||||
$podium=ELO_get_podium($currentArena);
|
||||
$count=0;
|
||||
$asideSectionContent.='<ul class="podium">';
|
||||
foreach($podium as $sc){
|
||||
$count++;
|
||||
|
||||
switch($count){
|
||||
case 1:
|
||||
$img='<img src="/imgs/Gold_Medal.svg" alt="Gold_Medal.svg"/>';
|
||||
break;
|
||||
case 2:
|
||||
$img='<img src="/imgs/Silver_Medal.svg" alt="Silver_Medal.svg"/>';
|
||||
break;
|
||||
case 3:
|
||||
$img='<img src="/imgs/Bronze_Medal.svg" alt="Bronze_Medal.svg"/>';
|
||||
break;
|
||||
default:
|
||||
$img='<img src="/imgs/Emoji_u1f4a9.svg" alt="caca"/>';
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
$asideSectionContent.='<li>'.$img.' <a href="/p/aboutBot/'.urlencode(htmlentities(($sc['name']))).'">'.htmlentities($sc['name']).'</a> ELO rank: '.$sc['ELO'].'</li>';
|
||||
}
|
||||
$asideSectionContent.='</ul><h2>Détail des matchs</h2>';
|
||||
|
||||
foreach($hist as $sc){
|
||||
$asideSectionContent.='<h3><a href="/p/aboutBot/'.urlencode(htmlentities($sc['bot1'])).'">'.$sc['bot1'].'</a> VS <a href="/p/aboutBot/'.urlencode(htmlentities($sc['bot2'])).'">'.$sc['bot2'].'</a></h3>
|
||||
<ul>
|
||||
<li>'.$sc['bot1']." ".$lang['VICTORIES'].":".$sc['player1Wins'].'</li>
|
||||
<li>'.$sc['bot2']." ".$lang['VICTORIES'].":".$sc['player2Wins'].'</li>
|
||||
<li>'.$lang['DRAW'].":".$sc['draws'].'</li>
|
||||
</ul>';
|
||||
}
|
||||
|
||||
$asideSectionContent= get_default_aside_content($currentArena);
|
||||
$cssAdditionalScript="";
|
||||
if(isset($currentArenaArr['cssFile'])){
|
||||
$cssAdditionalScript.='<style type="text/css"><!--'."\n".file_get_contents("../src/arenas/".$currentArena."/".$currentArenaArr['cssFile'])."\n--></style>";
|
||||
|
@ -112,16 +72,41 @@ if(isset($_GET['arena'])){
|
|||
error(404,"Wrong parameter");
|
||||
die;
|
||||
}
|
||||
$siteTitle="Specifications ".$currentArenaArr['title'];
|
||||
$siteDescription="documentation, faites votre propre bot pour ".$currentArenaArr['metaDescription'];
|
||||
$mainSectionScript="../src/arenas/".$currentArenaArr['id']."/doc-".$lang['lang'].".html";
|
||||
$asideSectionContent=''; //to do
|
||||
$cssAdditionalScript="";
|
||||
$siteTitle = "Specifications ".$currentArenaArr['title'];
|
||||
$siteDescription = "documentation, faites votre propre bot pour ".$currentArenaArr['metaDescription'];
|
||||
$mainSectionScript = "../src/arenas/".$currentArenaArr['id']."/doc-".$lang['lang'].".html";
|
||||
$asideSectionContent = get_default_aside_content($currentArena);
|
||||
$cssAdditionalScript = "";
|
||||
if(isset($currentArenaArr['cssFile'])){
|
||||
$cssAdditionalScript.='<style type="text/css"><!--'."\n".file_get_contents("../src/arenas/".$currentArena."/".$currentArenaArr['cssFile'])."\n--></style>";
|
||||
}
|
||||
$jsAdditionalScript="";
|
||||
|
||||
}elseif(isset($_GET['scores'])){
|
||||
//check if arena exists
|
||||
$currentArena = false;
|
||||
foreach($arenas as $arena){
|
||||
if($arena['id'] == $_GET['scores']){
|
||||
$currentArena = $_GET['scores'];
|
||||
$currentArenaArr=$arena;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$currentArena){
|
||||
error(404,"Wrong parameter");
|
||||
die;
|
||||
}
|
||||
|
||||
$siteTitle="détail des combats ".$currentArenaArr['title'];
|
||||
$siteDescription="scores ".$currentArenaArr['metaDescription'];
|
||||
$mainSectionScript="../src/scores.php";
|
||||
$asideSectionContent=get_default_aside_content($currentArena);
|
||||
$cssAdditionalScript="";
|
||||
$jsAdditionalScript="";
|
||||
|
||||
|
||||
//to do !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
}elseif(isset($_GET['page'])){
|
||||
//simple page
|
||||
switch($_GET['page']){
|
||||
|
|
|
@ -107,6 +107,7 @@ pre{
|
|||
.podium{list-style-type:none;padding: 5px 20px 5px 0;}
|
||||
.podium li{padding: 5px 20px 5px 0;}
|
||||
.podium li img {height: 50px; vertical-align:middle;}
|
||||
.hidden{display:none;}
|
||||
@media screen and (max-width: 800px){
|
||||
aside, article{display: block; width: 100%; border-right:none;}
|
||||
|
||||
|
|
|
@ -293,7 +293,37 @@ function get_unique_id(){
|
|||
fclose($fp);
|
||||
return $count;
|
||||
}
|
||||
|
||||
function get_default_aside_content($currentArena){
|
||||
global $lang;
|
||||
$asideSectionContent='<h2>infos:</h2><p>'.$lang['DEV-YOUR-OWN-BOT'].'<br/> <a href="/'.$currentArena.'/doc">'.$lang['DOC_SPECS_LINKS'].'</a></p>
|
||||
<h2>Scores</h2>';
|
||||
|
||||
$podium=ELO_get_podium($currentArena);
|
||||
$count=0;
|
||||
$asideSectionContent.='<ul class="podium">';
|
||||
foreach($podium as $sc){
|
||||
$count++;
|
||||
|
||||
switch($count){
|
||||
case 1:
|
||||
$img='<img src="/imgs/Gold_Medal.svg" alt="Gold_Medal.svg"/>';
|
||||
break;
|
||||
case 2:
|
||||
$img='<img src="/imgs/Silver_Medal.svg" alt="Silver_Medal.svg"/>';
|
||||
break;
|
||||
case 3:
|
||||
$img='<img src="/imgs/Bronze_Medal.svg" alt="Bronze_Medal.svg"/>';
|
||||
break;
|
||||
default:
|
||||
$img='<img src="/imgs/Emoji_u1f4a9.svg" alt="caca"/>';
|
||||
break;
|
||||
}
|
||||
|
||||
$asideSectionContent.='<li>'.$img.' <a href="/p/aboutBot/'.urlencode(htmlentities(($sc['name']))).'">'.htmlentities($sc['name']).'</a> ELO rank: '.$sc['ELO'].'</li>';
|
||||
}
|
||||
$asideSectionContent.='</ul><p><a href="/'.$currentArena.'/scores">Détail des matchs >></a></p>';
|
||||
return $asideSectionContent;
|
||||
}
|
||||
function does_arena_exist($string,$arenasArr){
|
||||
foreach($arenasArr as $arena){
|
||||
if($string == $arena['id']){
|
||||
|
|
12
src/scores.php
Normal file
12
src/scores.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
$hist=get_battles_history($currentArena);
|
||||
|
||||
|
||||
foreach($hist as $sc){
|
||||
echo '<article><h3><a href="/p/aboutBot/'.urlencode(htmlentities($sc['bot1'])).'">'.$sc['bot1'].'</a> VS <a href="/p/aboutBot/'.urlencode(htmlentities($sc['bot2'])).'">'.$sc['bot2'].'</a></h3>
|
||||
<ul>
|
||||
<li>'.$sc['bot1']." ".$lang['VICTORIES'].":".$sc['player1Wins'].'</li>
|
||||
<li>'.$sc['bot2']." ".$lang['VICTORIES'].":".$sc['player2Wins'].'</li>
|
||||
<li>'.$lang['DRAW'].":".$sc['draws'].'</li>
|
||||
</ul></article>';
|
||||
}
|
Loading…
Reference in New Issue
Block a user