85 lines
3.3 KiB
PHP
Executable file
85 lines
3.3 KiB
PHP
Executable file
<?php
|
|
|
|
$lang = false;
|
|
|
|
if (isset($_GET['lang'])) {
|
|
if (is_file('lang/'.$_GET['lang'].'.lang')) {
|
|
$lang = $_GET['lang'];
|
|
setcookie('lang', $lang, time()+32140800);
|
|
}
|
|
}
|
|
if (!$lang AND isset($_COOKIE['lang'])) {
|
|
if (is_file('lang/'.$_COOKIE['lang'].'.lang')) {
|
|
$lang = $_COOKIE['lang'];
|
|
}
|
|
}
|
|
if (!$lang) {
|
|
$lang = 'fr_FR'; #TODO Function wich detct the language
|
|
setcookie('lang', $lang, time()+32140800);
|
|
}
|
|
$langCacheLink = 'cache/index/'.$lang.'.html';
|
|
|
|
if (is_file($langCacheLink)) { // If there is a cache file
|
|
echo file_get_contents($langCacheLink); // Send it
|
|
end;
|
|
} else { // Else, construct it
|
|
$langData = fopen('lang/'.$lang.'.lang', 'r');
|
|
$langParsed = array();
|
|
while($langDataLine = fgets($langData)) {
|
|
$langDataLineUncommented = explode("#", $langDataLine);
|
|
$langDataLineUncommentedExploded = explode('=', $langDataLineUncommented[0]);
|
|
if (count($langDataLineUncommentedExploded) == 2) {
|
|
$langParsed[ltrim(rtrim($langDataLineUncommentedExploded[0]))] = ltrim(rtrim($langDataLineUncommentedExploded[1]));
|
|
}
|
|
}
|
|
$langIndexText = '<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>'.$langParsed['general.title'].'</title>
|
|
<link rel="stylesheet" media="screen" type="text/css" title="design" href="stye/style.css">
|
|
<script type="text/javascript" src="script/jQuery.js"></script>
|
|
<script type="text/javascript" src="script/releases.js"></script>
|
|
</head>
|
|
<body lang="'.$langParsed['language.codeHTML'].'">
|
|
<h1>'.$langParsed['general.title'];
|
|
if ($langParsed['general.version.state'] != '0') {
|
|
$langIndexText .= ' '.$langParsed['general.version.state'];
|
|
}
|
|
$langIndexText .= '</h1>
|
|
<div id="body">
|
|
<p>'.$langParsed['general.description'].'</p>
|
|
<h2>'.$langParsed['allReleases.title'].' <span id="state">'.$langParsed['allReleases.noConnexion'].'</span></h2>
|
|
<div id="allReleases">
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
<p id="copyright">Copyright © <a href="https://twitter.com/#!/WebFrogeye">WebFrogeye</a> 2012</p>
|
|
<p>'.str_replace('%1', '<a href="https://twitter.com/#!/WebFrogeye">@WebFrogeye</a>', $langParsed['footer.script']).'<br/>
|
|
'.str_replace('%1', '<a href="https://twitter.com/#!/EphysPotato">@EphysPotato</a>', $langParsed['footer.help']).'<br/>
|
|
'.str_replace('%1', '<a href="http://dlp.host56.com/">DLProduction</a>', $langParsed['footer.design']).'<br/>';
|
|
if ($langParsed['footer.translation.author'] != '0') {
|
|
$langIndexText .= str_replace('%1', '<a href="'.$langParsed['footer.translation.author.link'].'">'.$langParsed['footer.translation.author'].'</a>', $langParsed['footer.translation']).'<br/>';
|
|
}
|
|
$langIndexText .='<p id="version">'.$langParsed['footer.version'].' '.$langParsed['general.version'];
|
|
if ($langParsed['general.version.state'] != '0') {
|
|
$langIndexText .= ' '.$langParsed['general.version.state'];
|
|
}
|
|
$langIndexText .= '.</p>
|
|
</footer>
|
|
</body>
|
|
</html>';
|
|
echo $langIndexText;
|
|
if (!is_dir('cache')) {
|
|
mkdir('cache');
|
|
}
|
|
if (!is_dir('cache/index')) {
|
|
mkdir('cache/index');
|
|
}
|
|
if ($langCacheData = fopen($langCacheLink, 'w')) {
|
|
fwrite($langCacheData, $langIndexText);
|
|
}
|
|
|
|
}
|
|
|
|
?>
|