Merge pull request #41 from gnieark/dev

users bot's description
This commit is contained in:
Gnieark 2015-12-26 22:11:48 +01:00
commit 05b919cca8
3 changed files with 46 additions and 5 deletions

View File

@ -43,14 +43,13 @@ if(isset($_GET['arena'])){
} }
$hist=get_battles_history($currentArena); $hist=get_battles_history($currentArena);
$siteTitle=$currentArenaArr['title']; $siteTitle=$currentArenaArr['title'];
$siteDescription=$currentArenaArr['metaDescription']; $siteDescription=$currentArenaArr['metaDescription'];
$mainSectionScript="../src/arenas/".$currentArena."/public.php"; $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> $asideSectionContent='<h2>infos:</h2><p>'.$lang['DEV-YOUR-OWN-BOT'].'<br/> <a href="/'.$currentArena.'/doc">'.$lang['DOC_SPECS_LINKS'].'</a></p>
<h2>Scores</h2>'; <h2>Scores</h2>';
foreach($hist as $sc){ foreach($hist as $sc){
$asideSectionContent.='<h3>'.$sc['bot1'].' VS '.$sc['bot2'].'</h3> $asideSectionContent.='<h3><a href="/p/aboutBot/'.htmlentities($sc['bot1']).'">'.$sc['bot1'].'</a> VS <a href="/p/aboutBot/'.htmlentities($sc['bot2']).'">'.$sc['bot2'].'</a></h3>
<ul> <ul>
<li>'.$sc['bot1']." ".$lang['VICTORIES'].":".$sc['player1Wins'].'</li> <li>'.$sc['bot1']." ".$lang['VICTORIES'].":".$sc['player1Wins'].'</li>
<li>'.$sc['bot2']." ".$lang['VICTORIES'].":".$sc['player2Wins'].'</li> <li>'.$sc['bot2']." ".$lang['VICTORIES'].":".$sc['player2Wins'].'</li>
@ -123,7 +122,45 @@ if(isset($_GET['arena'])){
$cssAdditionalScript=""; $cssAdditionalScript="";
$jsAdditionalScript=""; $jsAdditionalScript="";
break; break;
case "aboutBot":
if(!isset($_GET['params'])){
error(404,"Page does not exists");
die;
}
$rs=mysqli_query($lnMysql,
"SELECT id,game,url,description,date_inscription
FROM bots
WHERE name='".mysqli_real_escape_string($lnMysql,$_GET['params'])."'
AND active='1'");
if(!$r=mysqli_fetch_row($rs)){
error(404,"Page doesn't exist");
die;
}
$theBot=array(
'id' => $r[0],
'game' => $r[1],
'url' => $r[2],
'description' => $r[3],
'date_inscription' => $r[4]
);
$siteTitle=htmlentities($_GET['params']);
$siteDescription=htmlentities($_GET['params'])." bot details";
$mainSectionScript="../src/aboutBot.php";
$hist=get_battles_history($r[1]);
$asideSectionContent='<h2>Scores</h2>';
foreach($hist as $sc){
$asideSectionContent.='<h3>'.$sc['bot1'].' VS '.$sc['bot2'].'</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>';
}
$cssAdditionalScript="";
$jsAdditionalScript="";
break;
default: default:
error(404,"Not found"); error(404,"Not found");
break; break;

5
src/aboutBot.php Normal file
View File

@ -0,0 +1,5 @@
<article>
<?php
echo '<h2>A props de '.htmlentities($_GET['params']).'</h2><p>Inscrit le '.$theBot['date_inscription'].'</p><p>'.$theBot['description'].'</p>';
?>
</article>

View File

@ -18,4 +18,3 @@
<p><label for="sub"></label><input id="sub" type="submit" value="<?php echo $lang['SAVE_BOT']; ?>"/></p> <p><label for="sub"></label><input id="sub" type="submit" value="<?php echo $lang['SAVE_BOT']; ?>"/></p>
</form> </form>
</article> </article>