Merge pull request #7 from gnieark/dev

Dev
This commit is contained in:
Gnieark 2015-11-28 19:05:49 +01:00
commit ac30b1a1f2
5 changed files with 19 additions and 8 deletions

View File

@ -86,7 +86,8 @@ if($currentArena == ""){
<body> <body>
<header> <header>
<h1><?php echo $siteTitle; ?></h1> <h1><?php echo $siteTitle; ?></h1>
<nav id="languages"><a href="-fr">fr</a>&nbsp;<a href="-en">en</a></nav>
<nav id="languages"><a href="<?php echo $currentArena; ?>-fr">fr</a>&nbsp;<a href="<?php echo $currentArena; ?>-en">en</a></nav>
<nav id="menus"><a href="/"<?php if($currentArena == "") echo ' class="selected"'; ?>><?php echo $lang['HOME']; ?></a> <nav id="menus"><a href="/"<?php if($currentArena == "") echo ' class="selected"'; ?>><?php echo $lang['HOME']; ?></a>
<?php <?php
foreach($arenas as $arena){ foreach($arenas as $arena){
@ -103,7 +104,7 @@ if($currentArena == ""){
<?php <?php
switch($currentArena){ switch($currentArena){
case "": case "":
echo "<h2>Accueil</h2>"; include ("../src/home.php");
break; break;
default: default:
include ("../src/arenas/".$currentArena."/public.php"); include ("../src/arenas/".$currentArena."/public.php");

View File

@ -1,6 +1,9 @@
<?php <?php
$lang=array( $lang=array(
'SITE_NAME' => 'Arène à bots', 'SITE_NAME' => 'Arène à bots',
'SITE_DESCRIPTION' => 'blah blah blah mais en francais', 'SITE_DESCRIPTION' =>
'<p>Bienvenue sur cette arène à bots.<br/>
Plusieurs jeux sont proposés ici. Vous ne devez pas y jouer, mais dévolopper le "bot" qui jouera en votre nom.
Ce site permet de faire s\'affronter les bots des différents développeurs.</p>',
'HOME' => 'accueil' 'HOME' => 'accueil'
); );

7
src/config.php Normal file
View File

@ -0,0 +1,7 @@
<?php
$mysqlParams=array(
'host' => 'localhost',
'user' => '',
'pass' => '',
'database'=>''
);

View File

@ -56,15 +56,13 @@ function get_language_array(){
$langsAvailable=array('fr','en'); $langsAvailable=array('fr','en');
$language=""; $language="";
if( isset($_GET['lang']) ){ if( isset($_GET['lang']) ){
$lang = $_GET['lang']; $language = $_GET['lang'];
setcookie( 'lang', $language, time() + 60*60*24*30 ); setcookie( 'lang', $language, time() + 60*60*24*30 );
}elseif( isset($_COOKIE['lang']) ){ }elseif( isset($_COOKIE['lang']) ){
$language=$_COOKIE['lang']; $language=$_COOKIE['lang'];
}else{ }else{
if(in_array(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2),$langsAvailable)){ if(in_array(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2),$langsAvailable)){

2
src/home.php Normal file
View File

@ -0,0 +1,2 @@
<?php
echo $lang['SITE_DESCRIPTION'];