Version alpha

This commit is contained in:
Geoffrey Frogeye 2017-04-05 08:55:56 +02:00
parent 54c24457e9
commit c4b001c253
40 changed files with 9954 additions and 1317 deletions

0
.htaccess Executable file
View file

3
TODO Executable file
View file

@ -0,0 +1,3 @@
- Client support for lang
- Client support for Extended Data
- Server support for XHR Requests

View file

@ -1,192 +0,0 @@
<?php
set_time_limit('240');
function addRelease($input) {
$debug = false;
// D<>finition des variables de travail
$lastVersions_e = explode('|', file_get_contents('lastVersions.txt'));
$lastVersions_e_backup = $lastVersions_e;
if ($input == 'r') {
$lastVersions_e[1] = 'UP';
} else {
$lastVersions_e[3] = 'UP';
}
// Enregistrement des donn<6E>es d'ajout
$lastVersions_e[0] = time();
$lastVersions_txt = fopen('lastVersions.txt', 'w');
fwrite($lastVersions_txt, implode('|', $lastVersions_e));
fclose($lastVersions_txt);
if ($input == 'r') {
$type = 'r';
$url = 'http://s3.amazonaws.com/MinecraftDownload/minecraft.jar';
} else {
$type = 'apr';
$url = 'http://assets.minecraft.net/'.$input.'/minecraft.zip';
}
// Chargement du XML
$data = new DomDocument();
$data->load('data.xml');
$dataNode = $data->getElementsByTagName('data')->item(0);
$mcupdatesNode = $dataNode->getElementsByTagName('mcupdates')->item(0);
$id = $mcupdatesNode->getAttribute('total')+1;
$releaseS = $mcupdatesNode->getElementsByTagName('release');
$release = $releaseS->item($releaseS->length-1);
// Creation du noeud XML
$releaseNode = $data->createElement('release');
$mcupdatesNode->appendChild($releaseNode);
$infosNode = $data->createElement('infos');
$releaseNode->appendChild($infosNode);
$files = $data->createElement('files');
$releaseNode->appendChild($files);
// Extraction et copie de minecraft.jar
$directory = $id.' - '.$lastVersions_e[0].' ('.rand(1, 1000).')';
if (!mkdir($directory) OR !copy($url, $directory.'/minecraft.jar')) { return 'ERREUR Impossible de copier le fichier ou de cr<63>er un nouveau dossier.';}
if ($type == 'r') {
$zip = new ZipArchive;
if ($zip->open($directory.'/minecraft.jar') AND mkdir($directory.'/content')) {
$zip->extractTo($directory.'/content');
$zip->close();
}
} else {
$zip = new ZipArchive;
if ($zip->open($directory.'/minecraft.jar') AND mkdir($directory.'/extract')) {
$zip->extractTo($directory.'/extract');
$zip->close();
$zip2 = new ZipArchive;
if ($zip2->open($directory.'/extract/bin/minecraft.jar') AND mkdir($directory.'/content')) {
$zip2->extractTo($directory.'/content');
$zip2->close();
} else {
return 'ERREUR Impossible d\'extraire le fichier ou de cr<63>er un nouveau dossier².';
}
} else {
return 'ERREUR Impossible d\'extraire le fichier ou de cr<63>er un nouveau dossier.';
}
}
$md5 = md5_file($directory.'/minecraft.jar');
directoryConstruct($directory.'/content', $files, $data, directoryOld($release));
// Detection de $givenName
// Code par @EphysPatato
$minecraft_class = file_get_contents($directory.'/content/net/minecraft/client/Minecraft.class');
$givenName = 'false';
if (preg_match('/Minecraft Minecraft (.+)Minecraft main/', $minecraft_class, $matches)) {
$givenName = '';
$givenName_w = $matches[count($matches)-1];
for( $i = 0 ; $i < strlen($givenName_w) ; $i++ )
{
$givenName_cw = substr($givenName_w, $i, 1);
if(($givenName_cw >= 'a' && $givenName_cw <= 'z') || ($givenName_cw >= 'A' && $givenName_cw <= 'Z') || ($givenName_cw >= '0' && $givenName_cw <= '9') || $givenName_cw == '|' || $givenName_cw == '.' || $givenName_cw == '_' || $givenName_cw == '-')
$givenName .= $givenName_cw;
}
}
// Sp<53>cifications selon le type de release
if ($type == 'r') {
$name = $givenName;
$lastVersions_e[1] = $name;
$lastVersions_e[2] = $md5;
$infosNode->setAttribute('wiki', 'http://www.minecraftwiki.net/wiki/Version_history#'.$name);
} else {
$name = $input;
$lastVersions_e[3] = $name;
$lastVersions_e[4] = $md5;
$infosNode->setAttribute('wiki', 'http://www.minecraftwiki.net/wiki/Version_history/Development_versions#'.$name);
}
// Mise des infos dans le XML
$releaseNode->setAttribute('id', $id);
$releaseNode->setAttribute('name', $name);
$releaseNode->setAttribute('type', $type);
$infosNode->setAttribute('givenName', $givenName);
$infosNode->setAttribute('directory', $directory);
$infosNode->setAttribute('link', $url);
$infosNode->setAttribute('size', filesize($directory.'/minecraft.jar'));
$infosNode->setAttribute('md5', $md5);
$infosNode->setAttribute('sha1', sha1_file($directory.'/minecraft.jar'));
$infosNode->setAttribute('date', $lastVersions_e[0]);
$infosNode->setAttribute('shortDescription', 'false');
$mcupdatesNode->setAttribute('total', $id);
// Sauvegarde finale
$lastVersions_e[0] = time();
$lastVersions_e[5] = $id;
$lastVersions_e[6] = $name;
$lastVersions_e[7] = $type;
$id = $mcupdatesNode->setAttribute('total', $id);
$lastVersions_f = fopen('lastVersions.txt', 'w');
$lastError = error_get_last();
if ($debug) { echo substr($lastError['file'], -14); }
if ($lastError /*AND $lastError['type']!= 2 */AND substr($lastError['file'], -14) == 'addrelease.php') {
fwrite($lastVersions_f, implode('|', $lastVersions_e_backup));
rrmdir($directory);
return 'ERREUR "'.$lastError['message'].'" (type : '.$lastError['type'].') dans '.$lastError['file'].' ligne '.$lastError['line'].'.';
} else {
$data->save('data.xml');
fwrite($lastVersions_f, implode('|', $lastVersions_e));
fclose($lastVersions_f);
return implode('|', $lastVersions_e);
}
}
function directoryConstruct($directoryName, $XML, $data, $array) {
$directory = opendir($directoryName);
while($file = readdir($directory)) {
if ($file != '.' AND $file != '..') {
if (is_dir($directoryName.'/'.$file)) {
$newDirectory = $data->createElement('dir');
$XML->appendChild($newDirectory);
$newDirectory->setAttribute('name', $file);
if (isset($array[$file])) {
$newDirectory->setAttribute('comparaison', 'same');
directoryConstruct($directoryName.'/'.$file, $newDirectory, $data, $array[$file]);
} else {
$newDirectory->setAttribute('comparaison', 'added');
directoryConstruct($directoryName.'/'.$file, $newDirectory, $data, array());
}
} else {
$fileXML = $data->createElement('file');
$XML->appendChild($fileXML);
$fileXML->setAttribute('name', $file);
$fileXML->setAttribute('md5', md5_file($directoryName.'/'.$file));
if (isset($array[$file])) {
if ($array[$file] == md5_file($directoryName.'/'.$file)) {
$fileXML->setAttribute('comparaison', 'same');
} else {
$fileXML->setAttribute('comparaison', 'change');
}
} else {
$fileXML->setAttribute('comparaison', 'added');
}
// TODO Verifier si un fichier a <20>t<EFBFBD> supprim<69>
}
}
}
}
function directoryOld($XML) {
$array = array();
$dirS = $XML->getElementsByTagName('dir');
for ($c = $dirS->length, $i = 0; $i < $c; $i++) {
$dir = $dirS->item($i);
$array[$dir->getAttribute('name')]= directoryOld($dir);
}
$fileS = $XML->getElementsByTagName('file');
for ($c = $fileS->length, $i = 0; $i < $c; $i++) {
$file = $fileS->item($i);
$array[$file->getAttribute('name')] = $file->getAttribute('md5');
}
return $array;
}
function rrmdir($dir) { // Par holger1@NOSPAMzentralplan.de
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
?>

3
admin.php Executable file
View file

@ -0,0 +1,3 @@
<?php
?>

2
cache/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

File diff suppressed because one or more lines are too long

3
engine/check.php Executable file
View file

@ -0,0 +1,3 @@
<?php
?>

3
engine/releases.php Executable file
View file

@ -0,0 +1,3 @@
<?php
?>

3
feed.php Executable file
View file

@ -0,0 +1,3 @@
<?php
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

291
index.php
View file

@ -1,236 +1,85 @@
<?php <?php
$data = new DomDocument();
$data->load('data.xml'); $lang = false;
$dataNode = $data->getElementsByTagName('data')->item(0);
$mcupdatesNode = $dataNode->getElementsByTagName('mcupdates')->item(0); if (isset($_GET['lang'])) {
$releaseS = $mcupdatesNode->getElementsByTagName('release'); if (is_file('lang/'.$_GET['lang'].'.lang')) {
$text = ''; $lang = $_GET['lang'];
for ($i = $releaseS->length; $i > 1; $i--) { setcookie('lang', $lang, time()+32140800);
$release = $releaseS->item($i-1);
$releaseInfos = $release->getElementsByTagName('infos')->item(0);
$text .= '<h3>Minecraft '.$release->getAttribute('name').' ';
if (isset($prevRelease)) {
if ($release->getAttribute('name') == $prevRelease->getAttribute('name')) {
$text .= '(version enterrée) ';
} }
} }
$shortDescription = $releaseInfos->getAttribute('shortDescription'); if (!$lang AND isset($_COOKIE['lang'])) {
if ($shortDescription == 'false') { if (is_file('lang/'.$_COOKIE['lang'].'.lang')) {
$shortDescription = 'Pas de description.'; $lang = $_COOKIE['lang'];
} }
$text .= '</h3><div class="release" id="R'.$release->getAttribute('id').'"><div class="shortDescription">'.$shortDescription.' <input type="button" value="+" class="more" /></div><div class="content"></div></div>';
$prevRelease = $release;
} }
?> if (!$lang) {
<!DOCTYPE html> $lang = 'fr_FR'; #TODO Function wich detct the language
<html lang="fr"> 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> <head>
<title>Minecraft Checker</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" media="screen" type="text/css" title="design" href="design.css"> <title>'.$langParsed['general.title'].'</title>
<script type="text/javascript"> <link rel="stylesheet" media="screen" type="text/css" title="design" href="stye/style.css">
var checkIntervalForm; <script type="text/javascript" src="script/jQuery.js"></script>
var checkState; <script type="text/javascript" src="script/releases.js"></script>
var checkTimeout;
var addXhr;
var allReleases;
var checkXhr;
var lastId = <?php echo $mcupdatesNode->getAttribute('total'); ?>;
window.onload = function () {
checkIntervalForm = document.getElementById('checkActivate');
checkState = document.getElementById('checkState');
checkIntervalForm.addEventListener('change', function(e) {
if (e.target.checked) {
checkState.innerHTML = 'activé';
checkTimeout = true;
check();
console.log('Checking activated');
} else {
checkState.innerHTML = 'désactivé';
clearTimeout(checkTimeout); // TODO Annulation de checkXhr
checkTimeout = false;
checkXhr.abort();
console.log('Checking stopped');
}
}, false);
allReleases = document.getElementById('allreleases');
allReleaseS = allReleases.getElementsByClassName('more');
for (var allReleaseI = 0; allReleaseI < allReleaseS.length; allReleaseI++) {
allReleaseS[allReleaseI].addEventListener('click', releaseOpen, false);
}
console.log('System initialised');
}
function releaseOpen(e) {
e.target.value = '...';
var releaseXhr = new XMLHttpRequest();
releaseXhr.onreadystatechange = function() {
if (releaseXhr.readyState == 4 && (releaseXhr.status == 200 || releaseXhr.status == 0)) {
e.target.removeEventListener('click', releaseOpen, false);
console.log(' Infos recevied');
var content = e.target.parentNode.parentNode.getElementsByClassName('content')[0];
content.innerHTML = releaseXhr.responseText;
if (content.getElementsByClassName('releaseFiles')[0]) {
content.getElementsByClassName('releaseFilesButton')[0].addEventListener('click', releaseFilesOpen, false);
filesDirExpandS = content.getElementsByClassName('dir');
for (var filesDirExpandI = 0; filesDirExpandI < filesDirExpandS.length; filesDirExpandI++) {
filesDirExpandS[filesDirExpandI].addEventListener('click', releaseFilesDirOpen, false);
}
var releaseFilesSelectionS = content.getElementsByClassName('releaseFiles')[0].getElementsByTagName('input');
for (var releaseFilesSelectionI = 0; releaseFilesSelectionI < releaseFilesSelectionS.length; releaseFilesSelectionI++) {
if (releaseFilesSelectionS[releaseFilesSelectionI].name == 'filesSelectionChangement' || releaseFilesSelectionS[releaseFilesSelectionI].name == 'filesSelectionClass') {
releaseFilesSelectionS[releaseFilesSelectionI].addEventListener('click', releaseFilesOrderEvent, false);
}
}
}
e.target.value = '-';
e.target.addEventListener('click', releaseClose, false);
}
};
var releaseId = e.target.parentNode.parentNode.id.split('R')[1];
console.log('Searching details for release ID = '+releaseId+'.');
releaseXhr.open('GET', 'moreinfos.php?i='+releaseId, true);
releaseXhr.send(null);
}
function releaseFilesDirOpen(e) {
e.target.parentNode.getElementsByClassName('dirUl')[0].style.display = '';
e.target.className = 'dir opened';
e.target.removeEventListener('click', releaseFilesDirOpen, false);
e.target.addEventListener('click', releaseFilesDirClose, false);
}
function releaseFilesDirClose(e) {
e.target.parentNode.getElementsByClassName('dirUl')[0].style.display = 'none';
e.target.className = 'dir closed';
e.target.removeEventListener('click', releaseFilesDirClose, false);
e.target.addEventListener('click', releaseFilesDirOpen, false);
}
function releaseClose(e) {
e.target.value = '...';
e.target.parentNode.parentNode.getElementsByClassName('content')[0].innerHTML = '';
e.target.removeEventListener('click', releaseClose, false);
e.target.addEventListener('click', releaseOpen, false);
e.target.value = '+';
}
function releaseFilesOpen(e) {
e.target.value = '...';
var releaseFiles = e.target.parentNode.parentNode.getElementsByClassName('releaseFiles')[0];
releaseFiles.style.display = '';
releaseFilesOrder(releaseFiles);
e.target.removeEventListener('click', releaseFilesOpen, false);
e.target.addEventListener('click', releaseFilesClose, false);
e.target.value = '-';
}
function releaseFilesOrder(releaseFiles) {
var releaseFilesFileS = releaseFiles.getElementsByClassName('file');
var releaseFilesSelectionClassAll = releaseFiles.getElementsByClassName('fileSelectionClassAll')[0].checked;
var releaseFilesSelectionClassNonTechnic = releaseFiles.getElementsByClassName('fileSelectionClassNontechnic')[0].checked;
var releaseFilesSelectionClassNone = releaseFiles.getElementsByClassName('fileSelectionClassNone')[0].checked;
var releaseFilesSelectionChangementAll = releaseFiles.getElementsByClassName('fileSelectionChangementAll')[0].checked;
var releaseFilesSelectionChangementChanged = releaseFiles.getElementsByClassName('fileSelectionChangementChanged')[0].checked;
var releaseFilesSelectionChangementAdded = releaseFiles.getElementsByClassName('fileSelectionChangementAdded')[0].checked;
for (var releaseFilesFileI = 0; releaseFilesFileI < releaseFilesFileS.length; releaseFilesFileI++) {
var releaseFilesFileClassE = releaseFilesFileS[releaseFilesFileI].className.split(' ');
var releaseFilesFileTechnic = in_array('technic', releaseFilesFileClassE);
var releaseFilesFileClass = in_array('class', releaseFilesFileClassE);
var releaseFilesFileChanged = in_array('change', releaseFilesFileClassE);
var releaseFilesFileAdded = in_array('added', releaseFilesFileClassE);
if ((releaseFilesSelectionClassAll || (releaseFilesSelectionClassNonTechnic && (!releaseFilesFileTechnic)) || (releaseFilesSelectionClassNone && (!releaseFilesFileClass))) && (releaseFilesSelectionChangementAll || (releaseFilesSelectionChangementChanged && (releaseFilesFileChanged || releaseFilesFileAdded)) || (releaseFilesSelectionChangementAdded && releaseFilesFileAdded))) {
releaseFilesFileS[releaseFilesFileI].parentNode.style.display = '';
} else {
releaseFilesFileS[releaseFilesFileI].parentNode.style.display = 'none';
}
}
}
function releaseFilesOrderEvent(e) {
releaseFilesOrder(e.target.parentNode.parentNode);
}
function releaseFilesClose(e) {
e.target.value = '+';
e.target.parentNode.parentNode.getElementsByClassName('releaseFiles')[0].style.display = 'none';
e.target.removeEventListener('click', releaseFilesClose, false);
e.target.addEventListener('click', releaseFilesOpen, false);
}
function check() {
checkXhr = new XMLHttpRequest();
checkXhr.onreadystatechange = function() {
if (checkXhr.readyState == 4 && (checkXhr.status == 200 || checkXhr.status == 0)) {
console.log('Check finished, with information : '+checkXhr.responseText);
var newReleaseE = checkXhr.responseText.split('|');
if (newReleaseE.length == 8 && checkTimeout) {
if (newReleaseE[5] == lastId) {
console.log(' Information analysed : no new release (date: '+newReleaseE[0]+').');
checkState.innerHTML = 'attente';
} else if (newReleaseE[5] > lastId) {
console.log(' Information analysed : new release.');
checkState.innerHTML = 'nouvelle version';
// TODO Vérifier si (newReleaseE[5] == lastId+1)
lastRelease = newReleaseE[6];
if (newReleaseE[7] == 'r' && newReleaseE[5] == lastId+1) {
var newReleaseAlertType = 'La release complète';
} else if (newReleaseE[7] == 'apr' && newReleaseE[5] == lastId+1) {
var newReleaseAlertType = 'La pre-release automatique';
} else if (newReleaseE[7] == 'pr' && newReleaseE[5] == lastId+1) {
var newReleaseAlertType = 'La pre-release';
} else {
console.error(' Bad informations on the new release. Reloading page.');
checkState.innerHTML = 'erreur';
location.reload();
return false;
}
lastId = newReleaseE[5];
console.info('New release: name: '+lastRelease+' id:'+newReleaseE[5]+' type: '+newReleaseE[7]+'.');
checkState.innerHTML = 'nouvelle version';
document.title='Version '+lastRelease+' sortie !';
alert(newReleaseAlertType+' '+lastRelease+' est sortie !');
location.reload();
} else {
console.error('Database upset. Reloading page.');
checkState.innerHTML = 'erreur';
location.reload();
}
checkTimeout = setTimeout('check()', 5000);
} else if (!checkTimeout) {
return false;
} else {
console.error('Error comited server-side.');
checkState.innerHTML = 'erreur';
}
}
};
checkXhr.open('GET', 'test.php', true);
checkState.innerHTML = 'recherche';
checkXhr.send(null);
}
function in_array(needle, haystack) {
for (key in haystack) {
if (haystack[key] == needle) {
return true;
}
}
return false;
}
</script>
</head> </head>
<body> <body lang="'.$langParsed['language.codeHTML'].'">
<h1>Minecraft Checker</h1> <h1>'.$langParsed['general.title'];
if ($langParsed['general.version.state'] != '0') {
$langIndexText .= ' '.$langParsed['general.version.state'];
}
$langIndexText .= '</h1>
<div id="body"> <div id="body">
<h2>Rechercher des versions</h2> <p>'.$langParsed['general.description'].'</p>
<p class="RL_search"><input type="checkbox" id="checkActivate" name="checkActivate"/><label for="checkActivate"> Rechercher les nouvelles releases (<span id="checkState">désactivé</span>)</label></p> <h2>'.$langParsed['allReleases.title'].' <span id="state">'.$langParsed['allReleases.noConnexion'].'</span></h2>
<div id="allReleases">
<h2>Versions référencées</h2>
<div id="allreleases">
<?php echo $text; ?>
</div> </div>
</div> </div>
<footer> <footer>
<p id="copyright">Copyright &copy; <a href="https://twitter.com/#!/WebFrogeye">WebFrogeye</a> 2012</p> <p id="copyright">Copyright &copy; <a href="https://twitter.com/#!/WebFrogeye">WebFrogeye</a> 2012</p>
<p>Créé par <a href="https://twitter.com/#!/WebFrogeye">@WebFrogeye</a>.<br/> <p>'.str_replace('%1', '<a href="https://twitter.com/#!/WebFrogeye">@WebFrogeye</a>', $langParsed['footer.script']).'<br/>
Avec l'aide d'<a href="https://twitter.com/#!/EphysPotato">@EphysPotato</a>.<br/> '.str_replace('%1', '<a href="https://twitter.com/#!/EphysPotato">@EphysPotato</a>', $langParsed['footer.help']).'<br/>
Sur un design de <a href="http://dlp.host56.com/">DLProduction</a>.<br/> '.str_replace('%1', '<a href="http://dlp.host56.com/">DLProduction</a>', $langParsed['footer.design']).'<br/>';
D'après un script de <a href="https://twitter.com/#!/shellgratuit">@shellgratuit</a>.</p> 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> </footer>
<div id="cache" style="display: none;"></div>
</body> </body>
</html> </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);
}
}
?>

View file

@ -1,236 +0,0 @@
<?php
$data = new DomDocument();
$data->load('data.xml');
$dataNode = $data->getElementsByTagName('data')->item(0);
$mcupdatesNode = $dataNode->getElementsByTagName('mcupdates')->item(0);
$releaseS = $mcupdatesNode->getElementsByTagName('release');
$text = '';
for ($i = $releaseS->length; $i > 1; $i--) {
$release = $releaseS->item($i-1);
$releaseInfos = $release->getElementsByTagName('infos')->item(0);
$text .= '<h3>Minecraft '.$release->getAttribute('name').' ';
if (isset($prevRelease)) {
if ($release->getAttribute('name') == $prevRelease->getAttribute('name')) {
$text .= '(version enterrée) ';
}
}
$shortDescription = $releaseInfos->getAttribute('shortDescription');
if ($shortDescription == 'false') {
$shortDescription = 'Pas de description.';
}
$text .= '</h3><div class="release" id="R'.$release->getAttribute('id').'"><div class="shortDescription">'.$shortDescription.' <input type="button" value="+" class="more" /></div><div class="content"></div></div>';
$prevRelease = $release;
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Minecraft Checker</title>
<meta charset="utf-8">
<link rel="stylesheet" media="screen" type="text/css" title="design" href="design.css">
<script type="text/javascript">
var checkIntervalForm;
var checkState;
var checkTimeout;
var addXhr;
var allReleases;
var checkXhr;
var lastId = <?php echo $mcupdatesNode->getAttribute('total'); ?>;
window.onload = function () {
checkIntervalForm = document.getElementById('checkActivate');
checkState = document.getElementById('checkState');
checkIntervalForm.addEventListener('change', function(e) {
if (e.target.checked) {
checkState.innerHTML = 'activé';
checkTimeout = true;
check();
console.log('Checking activated');
} else {
checkState.innerHTML = 'désactivé';
clearTimeout(checkTimeout); // TODO Annulation de checkXhr
checkTimeout = false;
checkXhr.abort();
console.log('Checking stopped');
}
}, false);
allReleases = document.getElementById('allreleases');
allReleaseS = allReleases.getElementsByClassName('more');
for (var allReleaseI = 0; allReleaseI < allReleaseS.length; allReleaseI++) {
allReleaseS[allReleaseI].addEventListener('click', releaseOpen, false);
}
console.log('System initialised');
}
function releaseOpen(e) {
e.target.value = '...';
var releaseXhr = new XMLHttpRequest();
releaseXhr.onreadystatechange = function() {
if (releaseXhr.readyState == 4 && (releaseXhr.status == 200 || releaseXhr.status == 0)) {
e.target.removeEventListener('click', releaseOpen, false);
console.log(' Infos recevied');
var content = e.target.parentNode.parentNode.getElementsByClassName('content')[0];
content.innerHTML = releaseXhr.responseText;
if (content.getElementsByClassName('releaseFiles')[0]) {
content.getElementsByClassName('releaseFilesButton')[0].addEventListener('click', releaseFilesOpen, false);
filesDirExpandS = content.getElementsByClassName('dir');
for (var filesDirExpandI = 0; filesDirExpandI < filesDirExpandS.length; filesDirExpandI++) {
filesDirExpandS[filesDirExpandI].addEventListener('click', releaseFilesDirOpen, false);
}
var releaseFilesSelectionS = content.getElementsByClassName('releaseFiles')[0].getElementsByTagName('input');
for (var releaseFilesSelectionI = 0; releaseFilesSelectionI < releaseFilesSelectionS.length; releaseFilesSelectionI++) {
if (releaseFilesSelectionS[releaseFilesSelectionI].name == 'filesSelectionChangement' || releaseFilesSelectionS[releaseFilesSelectionI].name == 'filesSelectionClass') {
releaseFilesSelectionS[releaseFilesSelectionI].addEventListener('click', releaseFilesOrderEvent, false);
}
}
}
e.target.value = '-';
e.target.addEventListener('click', releaseClose, false);
}
};
var releaseId = e.target.parentNode.parentNode.id.split('R')[1];
console.log('Searching details for release ID = '+releaseId+'.');
releaseXhr.open('GET', 'moreinfos.php?i='+releaseId, true);
releaseXhr.send(null);
}
function releaseFilesDirOpen(e) {
e.target.parentNode.getElementsByClassName('dirUl')[0].style.display = '';
e.target.className = 'dir opened';
e.target.removeEventListener('click', releaseFilesDirOpen, false);
e.target.addEventListener('click', releaseFilesDirClose, false);
}
function releaseFilesDirClose(e) {
e.target.parentNode.getElementsByClassName('dirUl')[0].style.display = 'none';
e.target.className = 'dir closed';
e.target.removeEventListener('click', releaseFilesDirClose, false);
e.target.addEventListener('click', releaseFilesDirOpen, false);
}
function releaseClose(e) {
e.target.value = '...';
e.target.parentNode.parentNode.getElementsByClassName('content')[0].innerHTML = '';
e.target.removeEventListener('click', releaseClose, false);
e.target.addEventListener('click', releaseOpen, false);
e.target.value = '+';
}
function releaseFilesOpen(e) {
e.target.value = '...';
var releaseFiles = e.target.parentNode.parentNode.getElementsByClassName('releaseFiles')[0];
releaseFiles.style.display = '';
releaseFilesOrder(releaseFiles);
e.target.removeEventListener('click', releaseFilesOpen, false);
e.target.addEventListener('click', releaseFilesClose, false);
e.target.value = '-';
}
function releaseFilesOrder(releaseFiles) {
var releaseFilesFileS = releaseFiles.getElementsByClassName('file');
var releaseFilesSelectionClassAll = releaseFiles.getElementsByClassName('fileSelectionClassAll')[0].checked;
var releaseFilesSelectionClassNonTechnic = releaseFiles.getElementsByClassName('fileSelectionClassNontechnic')[0].checked;
var releaseFilesSelectionClassNone = releaseFiles.getElementsByClassName('fileSelectionClassNone')[0].checked;
var releaseFilesSelectionChangementAll = releaseFiles.getElementsByClassName('fileSelectionChangementAll')[0].checked;
var releaseFilesSelectionChangementChanged = releaseFiles.getElementsByClassName('fileSelectionChangementChanged')[0].checked;
var releaseFilesSelectionChangementAdded = releaseFiles.getElementsByClassName('fileSelectionChangementAdded')[0].checked;
for (var releaseFilesFileI = 0; releaseFilesFileI < releaseFilesFileS.length; releaseFilesFileI++) {
var releaseFilesFileClassE = releaseFilesFileS[releaseFilesFileI].className.split(' ');
var releaseFilesFileTechnic = in_array('technic', releaseFilesFileClassE);
var releaseFilesFileClass = in_array('class', releaseFilesFileClassE);
var releaseFilesFileChanged = in_array('change', releaseFilesFileClassE);
var releaseFilesFileAdded = in_array('added', releaseFilesFileClassE);
if ((releaseFilesSelectionClassAll || (releaseFilesSelectionClassNonTechnic && (!releaseFilesFileTechnic)) || (releaseFilesSelectionClassNone && (!releaseFilesFileClass))) && (releaseFilesSelectionChangementAll || (releaseFilesSelectionChangementChanged && (releaseFilesFileChanged || releaseFilesFileAdded)) || (releaseFilesSelectionChangementAdded && releaseFilesFileAdded))) {
releaseFilesFileS[releaseFilesFileI].parentNode.style.display = '';
} else {
releaseFilesFileS[releaseFilesFileI].parentNode.style.display = 'none';
}
}
}
function releaseFilesOrderEvent(e) {
releaseFilesOrder(e.target.parentNode.parentNode);
}
function releaseFilesClose(e) {
e.target.value = '+';
e.target.parentNode.parentNode.getElementsByClassName('releaseFiles')[0].style.display = 'none';
e.target.removeEventListener('click', releaseFilesClose, false);
e.target.addEventListener('click', releaseFilesOpen, false);
}
function check() {
checkXhr = new XMLHttpRequest();
checkXhr.onreadystatechange = function() {
if (checkXhr.readyState == 4 && (checkXhr.status == 200 || checkXhr.status == 0)) {
console.log('Check finished, with information : '+checkXhr.responseText);
var newReleaseE = checkXhr.responseText.split('|');
if (newReleaseE.length == 8 && checkTimeout) {
if (newReleaseE[5] == lastId) {
console.log(' Information analysed : no new release (date: '+newReleaseE[0]+').');
checkState.innerHTML = 'attente';
} else if (newReleaseE[5] > lastId) {
console.log(' Information analysed : new release.');
checkState.innerHTML = 'nouvelle version';
// TODO Vérifier si (newReleaseE[5] == lastId+1)
lastRelease = newReleaseE[6];
if (newReleaseE[7] == 'r' && newReleaseE[5] == lastId+1) {
var newReleaseAlertType = 'La release complète';
} else if (newReleaseE[7] == 'apr' && newReleaseE[5] == lastId+1) {
var newReleaseAlertType = 'La pre-release automatique';
} else if (newReleaseE[7] == 'pr' && newReleaseE[5] == lastId+1) {
var newReleaseAlertType = 'La pre-release';
} else {
console.error(' Bad informations on the new release. Reloading page.');
checkState.innerHTML = 'erreur';
location.reload();
return false;
}
lastId = newReleaseE[5];
console.info('New release: name: '+lastRelease+' id:'+newReleaseE[5]+' type: '+newReleaseE[7]+'.');
checkState.innerHTML = 'nouvelle version';
document.title='Version '+lastRelease+' sortie !';
alert(newReleaseAlertType+' '+lastRelease+' est sortie !');
location.reload();
} else {
console.error('Database upset. Reloading page.');
checkState.innerHTML = 'erreur';
location.reload();
}
checkTimeout = setTimeout('check()', 5000);
} else if (!checkTimeout) {
return false;
} else {
console.error('Error comited server-side.');
checkState.innerHTML = 'erreur';
}
}
};
checkXhr.open('GET', 'test.php', true);
checkState.innerHTML = 'recherche';
checkXhr.send(null);
}
function in_array(needle, haystack) {
for (key in haystack) {
if (haystack[key] == needle) {
return true;
}
}
return false;
}
</script>
</head>
<body>
<h1>Minecraft Checker</h1>
<div id="body">
<h2>Rechercher des versions</h2>
<p class="RL_search"><input type="checkbox" id="checkActivate" name="checkActivate"/><label for="checkActivate"> Rechercher les nouvelles releases (<span id="checkState">désactivé</span>)</label></p>
<h2>Versions référencées</h2>
<div id="allreleases">
<?php echo $text; ?>
</div>
</div>
<footer>
<p id="copyright">Copyright &copy; <a href="https://twitter.com/#!/WebFrogeye">WebFrogeye</a> 2012</p>
<p>Créé par <a href="https://twitter.com/#!/WebFrogeye">@WebFrogeye</a>.<br/>
Avec l'aide d'<a href="https://twitter.com/#!/EphysPotato">@EphysPotato</a>.<br/>
Sur un design de <a href="http://dlp.host56.com/">DLProduction</a>.<br/>
D'après un script de <a href="https://twitter.com/#!/shellgratuit">@shellgratuit</a>.</p>
</footer>
<div id="cache" style="display: none;"></div>
</body>
</html>

2
jars/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

47
lang/de_DE.lang Executable file
View file

@ -0,0 +1,47 @@
language.name=Deutsch
language.region=Deutschland
language.code=de_DE
language.codeHTML=de
general.title=Minecraft Checker
general.version=1.1
general.version.state=α
general.description=Minecraft Checker kontrollieren Minecraft neue Versionen und warnen Sie. Es erlaubt Sie Informationen über Versionen einfach zu bekommen.
allReleases.title=Referenzierten Versionen
allReleases.noConnexion=(kein connexion)
allReleases.connexionEtablished=(connexion établie)
allReleases.error=(erreur de connexion)
allReleases.suspended=(connexion au serveur suspendue)
allReleases.updating.waiting=(mise à jour des données)
allReleases.updating.done=(données mises à jour)
allReleases.newRelease.waiting=(nouvelle version détéctée)
allReleases.newRelease.added(nouvelle version ajoutée)
#release.title.minecraft=Minecraft
#release.title.classic=Classic
#release.title.indev=Indev
#release.title.infdev=Infdev
#release.title.alpha=Alpha
#release.title.beta=Beta
#release.title.official=(version officielle)
release.title.state.developpement=(version de développement)
release.title.state.willUpdate=(informations pas à jour)
release.title.state.updating=(mise à jour des informations)
release.title.state.updated=(informations mises à jour)
release.title.state.error=(impossible de récupérer les informations sur la mise à jour)
release.title.state.newRelease=(version récente)
release.expandButton.more.value=+
release.expandButton.more.tip=Ouvrir les informations détaillées
release.expandButton.less.value=-
release.expandButton.less.tip=Fermer les informations détaillées
release.expandButton.loading.value=...
release.expandButton.loading.tip=Chargement des informations détaillées
footer.script=Skript von %1.
footer.help=Mit helfen von %1.
footer.design=Bei ein design von %1.
footer.translation=Übersetzung von %1 (bei weitem nicht perfekt).
footer.translation.author=WebFrogeye
footer.translation.author.link=http://twitter.com/WebFrogeye TODO Does not allow any # in
footer.version=Versionen

47
lang/en_US.lang Executable file
View file

@ -0,0 +1,47 @@
language.name=English
language.region=United-States
language.code=en_US
language.codeHTML=en
general.title=Minecraft Checker
general.version=1.1
general.version.state=α
general.description=Minecraft Checker check Minecraft's new versions and alert you. It allow you to get informations about releases simply.
allReleases.title=Referenced versions
allReleases.noConnexion=(no connexion to server)
allReleases.connexionEtablished=(connexion établie)
allReleases.error=(erreur de connexion)
allReleases.suspended=(connexion au serveur suspendue)
allReleases.updating.waiting=(mise à jour des données)
allReleases.updating.done=(données mises à jour)
allReleases.newRelease.waiting=(nouvelle version détéctée)
allReleases.newRelease.added(nouvelle version ajoutée)
#release.title.minecraft=Minecraft
#release.title.classic=Classic
#release.title.indev=Indev
#release.title.infdev=Infdev
#release.title.alpha=Alpha
#release.title.beta=Beta
#release.title.official=(version officielle)
release.title.state.developpement=(version de développement)
release.title.state.willUpdate=(informations pas à jour)
release.title.state.updating=(mise à jour des informations)
release.title.state.updated=(informations mises à jour)
release.title.state.error=(impossible de récupérer les informations sur la mise à jour)
release.title.state.newRelease=(version récente)
release.expandButton.more.value=+
release.expandButton.more.tip=Ouvrir les informations détaillées
release.expandButton.less.value=-
release.expandButton.less.tip=Fermer les informations détaillées
release.expandButton.loading.value=...
release.expandButton.loading.tip=Chargement des informations détaillées
footer.script=Script by %1.
footer.help=With help of %1.
footer.design=On a design by %1.
footer.translation=Translation by %1 (far from perfect).
footer.translation.author=WebFrogeye
footer.translation.author.link=http://twitter.com/WebFrogeye TODO Does not allow any # in
footer.version=Version

46
lang/fr_FR.lang Executable file
View file

@ -0,0 +1,46 @@
language.name=Français
language.region=France
language.code=fr_FR
general.title=Minecraft Checker
general.version=1.1
general.version.state=α
general.description=Minecraft Checker vérifie les nouvelles versions de Minecraft et vous en alerte. Il permet aussi d'avoir des informations sur les versions simplement.
allReleases.title=Versions référencées
allReleases.noConnexion=(pas de connexion au serveur)
allReleases.connexionEtablished=(connexion établie)
allReleases.error=(erreur de connexion)
allReleases.suspended=(connexion au serveur suspendue)
allReleases.updating.waiting=(mise à jour des données)
allReleases.updating.done=(données mises à jour)
allReleases.newRelease.waiting=(nouvelle version détéctée)
allReleases.newRelease.added(nouvelle version ajoutée)
#release.title.minecraft=Minecraft
#release.title.classic=Classic
#release.title.indev=Indev
#release.title.infdev=Infdev
#release.title.alpha=Alpha
#release.title.beta=Beta
#release.title.official=(version officielle)
release.title.state.developpement=(version de développement)
release.title.state.willUpdate=(informations pas à jour)
release.title.state.updating=(mise à jour des informations)
release.title.state.updated=(informations mises à jour)
release.title.state.error=(impossible de récupérer les informations sur la mise à jour)
release.title.state.newRelease=(version récente)
release.expandButton.more.value=+
release.expandButton.more.tip=Ouvrir les informations détaillées
release.expandButton.less.value=-
release.expandButton.less.tip=Fermer les informations détaillées
release.expandButton.loading.value=...
release.expandButton.loading.tip=Chargement des informations détaillées
footer.script=Script par %1.
footer.help=Avec l'aide d'%1.
footer.design=Sur un design de %1.
footer.translation=Traduction de %1.
footer.translation.author=0
footer.translation.author.link=# TODO Does not allow any # in
footer.version=Version

View file

@ -1 +0,0 @@
1336223378|1.2.5|8e8778078a175a33603a585257f28563|12w18a|37d778548796dd95c4d0ea49a015be06|27|12w18a|apr

17
maintenance.php Executable file
View file

@ -0,0 +1,17 @@
<?php
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Minecraft Checker - Maintenance</title>
</head>
<body>
<h1>Minecraft Checker - Maintenance</h1>
<div>
<p>Minecraft Checker is currently in maintenance. It will be back soon.</p>
<p>Minecraft Checker est en mantenance. Il reviendra sous peu. Pour plus d'informations, consultez le compte twitter de @WebFrogeye.</p>
</div>
</body>
</html>

View file

@ -1,143 +0,0 @@
<?php
date_default_timezone_set('Europe/Paris');
if (isset($_GET['i']))
{
$data = new DomDocument();
$data->load('data.xml');
$dataNode = $data->getElementsByTagName('data')->item(0);
$mcupdatesNode = $dataNode->getElementsByTagName('mcupdates')->item(0);
$releaseS = $mcupdatesNode->getElementsByTagName('release');
// $lastVersions_e = explode('|', file_get_contents('lastVersions.txt'));
$prevRelease = false;
for ($c = $releaseS->length, $i = 0; $i < $c; $i++) {
$release = $releaseS->item($i);
if ($_GET['i'] == $release->getAttribute('id')) {
$releaseInfos = $release->getElementsByTagName('infos')->item(0);
$releaseDateE = explode('/', $releaseInfos->getAttribute('date'));
$date = $releaseInfos->getAttribute('date');
echo 'Sortie le '.date('d', $date).'/'.date('m', $date).'/'.date('Y', $date);
/*if (date('G', $date) != 0 OR date('i', $date) != 0) {
echo ' à '.date('G', $date).':'.date('i', $date).' (environ)';
}*/
echo '.<br/>';
if ($release->getAttribute('name') != $releaseInfos->getAttribute('givenName')) {
echo 'Le nom de la version donné dans le jeu est '.$releaseInfos->getAttribute('givenName').' mais le nom réel est '.$release->getAttribute('name').'.<br/>';
}
// Téléchargement
echo '<div class="download"><h4>Téléchargement</h4>
Nom : <strong>minecraft.jar</strong>
Taille : <strong>'.$releaseInfos->getAttribute('size').' octets</strong><br/>
MD5 : <strong>'.$releaseInfos->getAttribute('md5').'</strong><br/>
SHA-1 : <strong>'.$releaseInfos->getAttribute('sha1').'</strong><br/>';
if (is_dir($releaseInfos->getAttribute('directory'))) {
$downloadLocal = $releaseInfos->getAttribute('directory').'/minecraft.jar'; }
if (@fopen($releaseInfos->getAttribute('link'), 'r') AND ($release->getAttribute('type') != 'r' OR $i+1 == $c)) {
$downloadServer = $releaseInfos->getAttribute('link');
} else {
// TODO AR? Prévoir ça (variable $changes par exemple)
}
// TODO AR $downloadWiki
if (isset($downloadLocal) OR isset($downloadServer) OR isset($downloadWiki)) {
if (isset($downloadLocal)) {
echo '<a href="'.$downloadLocal.'">Depuis ce serveur</a><br/>'; }
if (isset($downloadServer)) {
echo '<a href="'.$downloadServer.'">Depuis minecraft.net</a><br/> '; }
if (isset($downloadWiki)) {
echo '<a href="'.$downloadWiki.'">Depuis Minecaft Wiki</a><br/> '; }
} else {
echo 'Aucun lien de téléchargement n\'est disponible.';
}
echo '</div>';
echo '<div class="changelog">
<h4>Changelog</h4>
Langue : Français<br/>
<a class="wikiLink" href="'.$releaseInfos->getAttribute('wiki').'">Lien vers le wiki</a><br/>
</div>';
$text = '<ul>';
if ($release->getElementsByTagName('files')->item(0)) {
echo '<div class="files">
<h4>Fichiers du .jar</h4>';
$directory = $releaseInfos->getAttribute('directory');
$haveLink = (is_dir($directory) AND is_dir($directory.'/content'));
$elementS = $release->getElementsByTagName('files')->item(0)->childNodes;
$filesModificationsStat = array(0, 0, 0, 0);
$directoryXML = directoryXML($elementS, $releaseInfos->getAttribute('directory').'/content');
if ($prevRelease)
echo 'Comparaison par rapport à la version : '.$prevRelease->getAttribute('name').'.<br/>';
echo '<span class="changeStats">'.$filesModificationsStat[3].' fichiers au total, '.$filesModificationsStat[2].' inchangés, '.$filesModificationsStat[1].' ajoutés et '.$filesModificationsStat[0].' modifiés (dont fichiers obstrués). <input class="releaseFilesButton" type="button" value="+" /></span><br/>';
// TODO Supprimer (s) (conditions)
echo '<div class="releaseFiles" style="display: none;"><p>Tri selon les fichiers modifiés : <input type="radio" name="filesSelectionChangement" class="fileSelectionChangementAll" title="Pas de filtre pour les modifications de fichier" checked /><input type="radio" name="filesSelectionChangement" class="fileSelectionChangementChanged" title="Filtrer les fichiers restés inchangés" /><input type="radio" name="filesSelectionChangement" class="fileSelectionChangementAdded" title="Filtrer les fichiers uniquement modifiés (ne garder que les fichiers ajoutés)"/></p><p>
Tri selon le type de fichier : <input type="radio" name="filesSelectionClass" class="fileSelectionClassAll" title="Pas de filtre pour les types de fichiers"/><input type="radio" name="filesSelectionClass" checked class="fileSelectionClassNontechnic" title="Filtrer les fichiers obstrués"/><input type="radio" name="filesSelectionClass" class="fileSelectionClassNone" title="Filtrer les fichiers .class"/></p><div class="releaseFilesContainer">
<strong class="minecraftDotJar">Minecraft.jar</strong><br/><ul>'.$directoryXML.'</ul></div></div>';
echo '</div>';
}
exit();
}
else {
$prevRelease = $release;
}
}
echo 'ERREUR L\'information demmandée n\'a pas été trouvée.<br/>
Si il s\'agit d\'une sortie récente, attendez un peu et réésayez.';
} else {
echo 'ERREUR Les informations demmandées ne sont pas correctes.';
}
function directoryXML($XML, $path) {
global $filesModificationsStat;
global $haveLink;
$text = '';
for ($c = $XML->length, $i = 0; $i < $c; $i++) {
$element = $XML->item($i);
if ($element->tagName == 'dir') {
if ($directoryXML = directoryXML($element->childNodes, $path.'/'.$element->getAttribute('name'))) {
$text .= '<li><span class="dir closed">'.$element->getAttribute('name').'</span><ul class="dirUl" style="display: none;">'.$directoryXML.'</ul></li>';
}
} elseif ($element->tagName == 'file') {
/*
if ((isset($_GET['allowClass']) OR strlen(@$exploded[0]) > 3 OR @$exploded[1] != 'class' OR $element->getAttribute('comparaison')== 'addded') AND (isset($_GET['allowSame']) OR $element->getAttribute('comparaison')!= 'same')) { */
$className = 'file';
switch ($element->getAttribute('comparaison')) {
case 'change':
$comparaison = '≠';
$className .= ' change';
$filesModificationsStat[0]++;
break;
case 'added':
$comparaison = '+';
$className .= ' added';
$filesModificationsStat[1]++;
break;
case 'same';
$comparaison = '=';
$className .= ' same';
$filesModificationsStat[2]++;
break;
default:
$comparaison = '?';
break;
}
$exploded = explode('.', $element->getAttribute('name'));
if (@$exploded[1] == 'class') {
$className .= ' class';
}
if (strlen($exploded[0]) < 4 AND @$exploded[1] == 'class') {
$className .= ' technic';
}
if (@$exploded[1] == 'png') {
$className .= ' image';
}
if (@$exploded[1] == 'txt') {
$className .= ' txt';
}
$filesModificationsStat[3]++;
$text .= '<li><span class="'.$className.'">';
if ($haveLink) { $text.= '<a href="'.$path.'/'.$element->getAttribute('name').'">'; }
$text .= $element->getAttribute('name');
if ($haveLink) { $text .= '</a>'; }
$text .= '</span>('.$comparaison.')</li>';
}
}
return $text;
}
?>

View file

@ -1,178 +0,0 @@
<?php
set_time_limit('240');
addRelease('1_2_5');
function addRelease($input) {
$debug = false;
// Définition des variables de travail
$lastVersions_e = explode('|', file_get_contents('lastVersions.txt'));
$lastVersions_e_backup = $lastVersions_e;
if ($input == 'r') {
$lastVersions_e[1] = 'UP';
} else {
$lastVersions_e[3] = 'UP';
}
// Enregistrement des données d'ajout
$lastVersions_e[0] = time();
$lastVersions_txt = fopen('lastVersions.txt', 'w');
fwrite($lastVersions_txt, implode('|', $lastVersions_e));
fclose($lastVersions_txt);
if ($input == 'r') {
$type = 'r';
$url = 'http://s3.amazonaws.com/MinecraftDownload/minecraft.jar';
} else {
$type = 'pr';
$url = 'http://assets.minecraft.net/'.$input.'/minecraft.jar';
}
// Chargement du XML
$data = new DomDocument();
$data->load('data.xml');
$dataNode = $data->getElementsByTagName('data')->item(0);
$mcupdatesNode = $dataNode->getElementsByTagName('mcupdates')->item(0);
$id = $mcupdatesNode->getAttribute('total')+1;
$releaseS = $mcupdatesNode->getElementsByTagName('release');
$release = $releaseS->item($releaseS->length-1);
// Creation du noeud XML
$releaseNode = $data->createElement('release');
$mcupdatesNode->appendChild($releaseNode);
$infosNode = $data->createElement('infos');
$releaseNode->appendChild($infosNode);
$files = $data->createElement('files');
$releaseNode->appendChild($files);
// Extraction et copie de minecraft.jar
$directory = $id.' - '.$lastVersions_e[0].' ('.rand(1, 1000).')';
if (!mkdir($directory) OR !copy($url, $directory.'/minecraft.jar')) { return 'ERREUR Impossible de copier le fichier ou de créer un nouveau dossier.';}
$zip = new ZipArchive;
if ($zip->open($directory.'/minecraft.jar') AND mkdir($directory.'/content')) {
$zip->extractTo($directory.'/content');
$zip->close();
} else {
return 'ERREUR Impossible d\'extraire le fichier ou de créer un nouveau dossier.';
}
$md5 = md5_file($directory.'/minecraft.jar');
directoryConstruct($directory.'/content', $files, $data, directoryOld($release));
// Detection de $givenName
// Code par @EphysPatato
$minecraft_class = file_get_contents($directory.'/content/net/minecraft/client/Minecraft.class');
$givenName = 'false';
if (preg_match('/Minecraft Minecraft (.+)Minecraft main/', $minecraft_class, $matches)) {
$givenName = '';
$givenName_w = $matches[count($matches)-1];
for( $i = 0 ; $i < strlen($givenName_w) ; $i++ )
{
$givenName_cw = substr($givenName_w, $i, 1);
if(($givenName_cw >= 'a' && $givenName_cw <= 'z') || ($givenName_cw >= 'A' && $givenName_cw <= 'Z') || ($givenName_cw >= '0' && $givenName_cw <= '9') || $givenName_cw == '|' || $givenName_cw == '.' || $givenName_cw == '_' || $givenName_cw == '-')
$givenName .= $givenName_cw;
}
}
// Spécifications selon le type de release
if ($type == 'r') {
$name = $givenName;
$lastVersions_e[1] = $name;
$lastVersions_e[2] = $md5;
$infosNode->setAttribute('wiki', 'http://www.minecraftwiki.net/wiki/Version_history#'.$name);
} else {
$name = $input;
$lastVersions_e[3] = $name;
$lastVersions_e[4] = $md5;
$infosNode->setAttribute('wiki', 'http://www.minecraftwiki.net/wiki/Version_history/Development_versions#'.$name);
}
// Mise des infos dans le XML
$releaseNode->setAttribute('id', $id);
$releaseNode->setAttribute('name', $name);
$releaseNode->setAttribute('type', $type);
$infosNode->setAttribute('givenName', $givenName);
$infosNode->setAttribute('directory', $directory);
$infosNode->setAttribute('link', $url);
$infosNode->setAttribute('size', filesize($directory.'/minecraft.jar'));
$infosNode->setAttribute('md5', $md5);
$infosNode->setAttribute('sha1', sha1_file($directory.'/minecraft.jar'));
$infosNode->setAttribute('date', $lastVersions_e[0]);
$infosNode->setAttribute('shortDescription', 'false');
$mcupdatesNode->setAttribute('total', $id);
// Sauvegarde finale
$lastVersions_e[0] = time();
$lastVersions_e[5] = $id;
$lastVersions_e[6] = $name;
$lastVersions_e[7] = $type;
$id = $mcupdatesNode->setAttribute('total', $id);
$lastVersions_f = fopen('lastVersions.txt', 'w');
$lastError = error_get_last();
if ($debug) { echo substr($lastError['file'], -14); }
if ($lastError /*AND $lastError['type']!= 2 */AND substr($lastError['file'], -14) == 'addrelease.php') {
fwrite($lastVersions_f, implode('|', $lastVersions_e_backup));
rrmdir($directory);
return 'ERREUR "'.$lastError['message'].'" (type : '.$lastError['type'].') dans '.$lastError['file'].' ligne '.$lastError['line'].'.';
} else {
$data->save('data.xml');
fwrite($lastVersions_f, implode('|', $lastVersions_e));
fclose($lastVersions_f);
return implode('|', $lastVersions_e);
}
}
function directoryConstruct($directoryName, $XML, $data, $array) {
$directory = opendir($directoryName);
while($file = readdir($directory)) {
if ($file != '.' AND $file != '..') {
if (is_dir($directoryName.'/'.$file)) {
$newDirectory = $data->createElement('dir');
$XML->appendChild($newDirectory);
$newDirectory->setAttribute('name', $file);
if (isset($array[$file])) {
$newDirectory->setAttribute('comparaison', 'same');
directoryConstruct($directoryName.'/'.$file, $newDirectory, $data, $array[$file]);
} else {
$newDirectory->setAttribute('comparaison', 'added');
directoryConstruct($directoryName.'/'.$file, $newDirectory, $data, array());
}
} else {
$fileXML = $data->createElement('file');
$XML->appendChild($fileXML);
$fileXML->setAttribute('name', $file);
$fileXML->setAttribute('md5', md5_file($directoryName.'/'.$file));
if (isset($array[$file])) {
if ($array[$file] == md5_file($directoryName.'/'.$file)) {
$fileXML->setAttribute('comparaison', 'same');
} else {
$fileXML->setAttribute('comparaison', 'change');
}
} else {
$fileXML->setAttribute('comparaison', 'added');
}
// TODO Verifier si un fichier a été supprimé
}
}
}
}
function directoryOld($XML) {
$array = array();
$dirS = $XML->getElementsByTagName('dir');
for ($c = $dirS->length, $i = 0; $i < $c; $i++) {
$dir = $dirS->item($i);
$array[$dir->getAttribute('name')]= directoryOld($dir);
}
$fileS = $XML->getElementsByTagName('file');
for ($c = $fileS->length, $i = 0; $i < $c; $i++) {
$file = $fileS->item($i);
$array[$file->getAttribute('name')] = $file->getAttribute('md5');
}
return $array;
}
function rrmdir($dir) { // Par holger1@NOSPAMzentralplan.de
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
?>

12
script/blur.js Executable file
View file

@ -0,0 +1,12 @@
// Stackblur, courtesy of Mario Klingemann: http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
(function(l){l.fn.blurjs=function(e){function O(){this.a=this.b=this.g=this.r=0;this.next=null}var y=document.createElement("canvas"),P=!1,H=l(this).selector.replace(/[^a-zA-Z0-9]/g,"");if(y.getContext){var e=l.extend({source:"body",radius:5,overlay:"",offset:{x:0,y:0},optClass:"",cache:!1,cacheKeyPrefix:"blurjs-",draggable:!1,debug:!1},e),R=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,
328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,
305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],S=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];return this.each(function(){var A=l(this),I=l(e.source),B=I.css("backgroundImage").replace(/"/g,"").replace(/url\(|\)$/ig,"");ctx=y.getContext("2d");tempImg=new Image;tempImg.onload=function(){if(P)j=tempImg.src;else{y.style.display="none";y.width=tempImg.width;y.height=tempImg.height;ctx.drawImage(tempImg,0,0);var j=y.width,q=y.height,k=e.radius;if(!(isNaN(k)||1>k)){var k=
k|0,M=y.getContext("2d"),l;try{try{l=M.getImageData(0,0,j,q)}catch(L){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),l=M.getImageData(0,0,j,q)}catch(T){throw alert("Cannot access local image"),Error("unable to access local image data: "+T);}}}catch(U){throw alert("Cannot access image"),Error("unable to access image data: "+U);}var c=l.data,u,z,a,d,f,J,g,h,i,v,w,x,m,n,o,r,s,t,C;u=k+k+1;var K=j-1,N=q-1,p=k+1,D=p*(p+1)/2,E=new O,b=E;for(a=1;a<u;a++)if(b=b.next=new O,a==
p)var Q=b;b.next=E;b=a=null;J=f=0;var F=R[k],G=S[k];for(z=0;z<q;z++){m=n=o=g=h=i=0;v=p*(r=c[f]);w=p*(s=c[f+1]);x=p*(t=c[f+2]);g+=D*r;h+=D*s;i+=D*t;b=E;for(a=0;a<p;a++)b.r=r,b.g=s,b.b=t,b=b.next;for(a=1;a<p;a++)d=f+((K<a?K:a)<<2),g+=(b.r=r=c[d])*(C=p-a),h+=(b.g=s=c[d+1])*C,i+=(b.b=t=c[d+2])*C,m+=r,n+=s,o+=t,b=b.next;a=E;b=Q;for(u=0;u<j;u++)c[f]=g*F>>G,c[f+1]=h*F>>G,c[f+2]=i*F>>G,g-=v,h-=w,i-=x,v-=a.r,w-=a.g,x-=a.b,d=J+((d=u+k+1)<K?d:K)<<2,m+=a.r=c[d],n+=a.g=c[d+1],o+=a.b=c[d+2],g+=m,h+=n,i+=o,a=a.next,
v+=r=b.r,w+=s=b.g,x+=t=b.b,m-=r,n-=s,o-=t,b=b.next,f+=4;J+=j}for(u=0;u<j;u++){n=o=m=h=i=g=0;f=u<<2;v=p*(r=c[f]);w=p*(s=c[f+1]);x=p*(t=c[f+2]);g+=D*r;h+=D*s;i+=D*t;b=E;for(a=0;a<p;a++)b.r=r,b.g=s,b.b=t,b=b.next;d=j;for(a=1;a<=k;a++)f=d+u<<2,g+=(b.r=r=c[f])*(C=p-a),h+=(b.g=s=c[f+1])*C,i+=(b.b=t=c[f+2])*C,m+=r,n+=s,o+=t,b=b.next,a<N&&(d+=j);f=u;a=E;b=Q;for(z=0;z<q;z++)d=f<<2,c[d]=g*F>>G,c[d+1]=h*F>>G,c[d+2]=i*F>>G,g-=v,h-=w,i-=x,v-=a.r,w-=a.g,x-=a.b,d=u+((d=z+p)<N?d:N)*j<<2,g+=m+=a.r=c[d],h+=n+=a.g=
c[d+1],i+=o+=a.b=c[d+2],a=a.next,v+=r=b.r,w+=s=b.g,x+=t=b.b,m-=r,n-=s,o-=t,b=b.next,f+=j}M.putImageData(l,0,0)}if(!1!=e.overlay)ctx.beginPath(),ctx.rect(0,0,tempImg.width,tempImg.width),ctx.fillStyle=e.overlay,ctx.fill();var j=y.toDataURL();if(e.cache)try{e.debug&&console.log("Cache Set"),localStorage.setItem(e.cacheKeyPrefix+H+"-"+B+"-data-image",j)}catch(V){console.log(V)}}q=I.css("backgroundAttachment");k="fixed"==q?"":"-"+(A.offset().left-I.offset().left-e.offset.x)+"px -"+(A.offset().top-I.offset().top-
e.offset.y)+"px";A.css({"background-image":'url("'+j+'")',"background-repeat":I.css("backgroundRepeat"),"background-position":k,"background-attachment":q});!1!=e.optClass&&A.addClass(e.optClass);e.draggable&&(A.css({"background-attachment":"fixed","background-position":"0 0"}),A.draggable())};Storage.prototype.cacheChecksum=function(j){var q="",k;for(k in j)var l=j[k],q="[object Object]"==l.toString()?q+(l.x.toString()+l.y.toString()+",").replace(/[^a-zA-Z0-9]/g,""):q+(l+",").replace(/[^a-zA-Z0-9]/g,
"");this.getItem(e.cacheKeyPrefix+H+"-"+B+"-options-cache")!=q&&(this.removeItem(e.cacheKeyPrefix+H+"-"+B+"-options-cache"),this.setItem(e.cacheKeyPrefix+H+"-"+B+"-options-cache",q),e.debug&&console.log("Settings Changed, Cache Emptied"))};var L=null;e.cache&&(localStorage.cacheChecksum(e),L=localStorage.getItem(e.cacheKeyPrefix+H+"-"+B+"-data-image"));null!=L?(e.debug&&console.log("Cache Used"),P=!0,tempImg.src=L):(e.debug&&console.log("Source Used"),tempImg.src=B)})}}})(jQuery);

9404
script/jQuery.js Executable file

File diff suppressed because it is too large Load diff

86
script/releases.js Executable file
View file

@ -0,0 +1,86 @@
// JavaScript Document
function release(generalDataRaw) {
// Functions
this.parseGeneralDataRaw = function(generalDataRaw) {
var generalDataRawExploded = generalDataRaw.split('|');
this.id = generalDataRawExploded[0];
this.nameUsed = generalDataRawExploded[1];
this.type = generalDataRawExploded[2];
this.description = generalDataRawExploded[3];
return true;
};
this.updateGeneralData = function() {
this.HTMLtitle.text('Minecraft ' + this.nameUsed);
this.HTMLdescription.text(this.description);
};
this.expandButton = function() {
if (that.detailedDataExpanded) {
that.HTMLexpandButton.attr('value', '...');
// Load the content
if (this.detailedDataBuilded) {
// Creating HTML Elements
}
else {
}
that.HTMLdetailedData.hide('slow');
that.detailedDataExpanded = false;
that.HTMLexpandButton.attr('value', '+');
}
else {
that.HTMLexpandButton.attr('value', '...');
that.HTMLdetailedData.show('slow');
that.detailedDataExpanded = true;
that.HTMLexpandButton.attr('value', '-');
}
};
/*this.parseExtendedDataRaw = function(generalDataRaw) {
var generalDataRawExploded = generalDataRaw.split('|');
this.id = generalDataRawExploded[0];
return true;
};
this.updateExtendedData = function() {
this.HTMLtitle.text('Minecraft ' + this.nameUsed);
};*/
this.parseGeneralDataRaw(generalDataRaw);
// Creating HTML Elements
this.HTMLtitle = $('<h3>', {
css: {
display: 'none'
}
}).appendTo('#allReleases');
this.HTMLelement = $('<div>', {
className: 'release',
css: {
display: 'none'
}
}).appendTo('#allReleases');
this.HTMLgeneralData = $('<p>').appendTo(this.HTMLelement);
this.HTMLdescription = $('<span>', {
className: 'description'
}).appendTo(this.HTMLgeneralData);
this.HTMLexpandButton = $('<input>', {
className: 'expandButton',
type: 'button',
value: '+'
}).appendTo(this.HTMLgeneralData);
this.HTMLdetailedData = $('<div>', {
className: 'detailedData',
css: {
display: 'none'
}
}).appendTo(this.HTMLelement);
this.detailedDataExpanded = false;
this.detailedDataBuilded = false;
var that = this; // Cheated trick
this.HTMLexpandButton.bind('click', that.expandButton);
this.updateGeneralData();
this.HTMLtitle.show('fast');
this.HTMLelement.show('fast');
console.log('Added Minecraft ' + this.nameUsed + ' (' + this.id + ')', this);
}

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,12 +1,16 @@
@charset "utf-8";
/* CSS Document */
* { * {
margin: 0px; margin: 0;
padding: 0px; padding: 0;
} }
body { body {
font-family: "Trebuchet MS"; font-family: "Trebuchet MS";
background-image: url('images/background_pattern.png'); background-image: url('images/background_pattern.png');
text-shadow : 0px 2px 23px white; text-shadow : 0 2px 23px white;
} }
h1 { h1 {
@ -16,15 +20,15 @@ h1 {
} }
h3 { h3 {
margin: 18px 18px 0px 18px; margin: 18px 18px 0 18px;
} }
.more, .releaseFilesButton { .more, .releaseFilesButton {
padding: 0px 5px; padding: 0 5px;
} }
p { p {
margin: 0px 0px 10px 0px; margin: 0 0 10px 0;
} }
li { li {
@ -32,6 +36,12 @@ li {
line-height: 25px; line-height: 25px;
} }
.expandButton {
padding: 1px 6px;
width: 30px;
margin-left: 5px;
}
#body { #body {
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
@ -39,9 +49,9 @@ li {
background-color: white; background-color: white;
margin: 25px; margin: 25px;
padding: 10px; padding: 10px;
box-shadow: 0px 3px 10px #222323; box-shadow: 0 3px 10px #222323;
-webkit-box-shadow : 0px 3px 10px #222323; -webkit-box-shadow : 0 3px 10px #222323;
-moz-box-shadow : 0px 3px 10px #222323; -moz-box-shadow : 0 3px 10px #222323;
background-image: url('images/body_pattern.png'); background-image: url('images/body_pattern.png');
} }
@ -60,9 +70,9 @@ footer {
background-color: white; background-color: white;
margin: 25px; margin: 25px;
padding: 10px; padding: 10px;
box-shadow: 0px 3px 10px #222323; box-shadow: 0 3px 10px #222323;
-webkit-box-shadow : 0px 3px 10px #222323; -webkit-box-shadow : 0 3px 10px #222323;
-moz-box-shadow : 0px 3px 10px #222323; -moz-box-shadow : 0 3px 10px #222323;
background-image: url('images/body_pattern.png'); background-image: url('images/body_pattern.png');
overflow: hidden; overflow: hidden;
} }
@ -71,7 +81,7 @@ a {
color: #0f7eff; color: #0f7eff;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
text-shadow : 0px 2px 15px white; text-shadow : 0 2px 15px white;
} }
.release { .release {
border: #3d3d3d 2px solid; border: #3d3d3d 2px solid;
@ -79,7 +89,7 @@ a {
background-color: white; background-color: white;
color: black; color: black;
background-image: url('images/release_pattern.png'); background-image: url('images/release_pattern.png');
margin: 0px 15px 15px 15px; margin: 0 15px 15px 15px;
-webkit-border-radius: 6px; -webkit-border-radius: 6px;
-moz-border-radius: 6px; -moz-border-radius: 6px;
border-radius: 6px; border-radius: 6px;
@ -101,12 +111,12 @@ a {
-webkit-border-radius: 6px; -webkit-border-radius: 6px;
-moz-border-radius: 6px; -moz-border-radius: 6px;
border-radius: 6px; border-radius: 6px;
box-shadow: 0px 1px 10px #222323; box-shadow: 0 1px 10px #222323;
-webkit-box-shadow : 0px 1px 10px #222323; -webkit-box-shadow : 0 1px 10px #222323;
-moz-box-shadow : 0px 1px 10px #222323; -moz-box-shadow : 0 1px 10px #222323;
} }
.shortDescription { .description {
font-style: italic; font-style: italic;
} }

View file

@ -1,84 +0,0 @@
<?php
date_default_timezone_set('Europe/Paris');
$lastVersions_e = explode('|', file_get_contents('lastVersions.txt'));
// set_time_limit('240');
function debug($a){return 0;}
// V<>rification d'une update en cours
debug('test.php started');
if ($lastVersions_e[1] == 'UP') {
debug('R Up');
for ($i = 0; $i <= 200; $i++) {
sleep(1);
$lastVersions_e = explode('|', file_get_contents('lastVersions.txt'));
if ($lastVersions_e[1] != 'UP') {
echo implode('|', $lastVersions_e);
exit();
}
}
echo 'ERREUR La release n\'a pas <20>t<EFBFBD> correctement trait<69>e. Le syst<73>me d\'ajout de release est suspendu pour le moment.';
exit();
}
if ($lastVersions_e[3] == 'UP') {
debug('APR Up');
for ($i = 0; $i <= 200; $i++) {
sleep(1);
$lastVersions_e = explode('|', file_get_contents('lastVersions.txt'));
if ($lastVersions_e[3] != 'UP') {
echo implode('|', $lastVersions_e);
exit();
}
}
echo 'ERREUR La release n\'a pas <20>t<EFBFBD> correctement trait<69>e. Le syst<73>me d\'ajout de release est suspendu pour le moment.';
exit();
}
if (time()-$lastVersions_e[0] < 5) {
echo implode('|', $lastVersions_e);
exit();
}
// TODO Commande serveur
// D<>finition de la prochaine APR
if (substr($lastVersions_e[3], 0, 2) == substr(date('Y'), 2, 2) AND substr($lastVersions_e[3], 3, 2) == date('W')) {
$alphabet = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
$nextAPR = substr(date('Y'), 2, 2).'w'.date('W').$alphabet[array_search(substr($lastVersions_e[3], 2), $alphabet)+1];
$nextAPR_firstOfWeek = false;
} else {
$nextAPR = substr(date('Y'), 2, 2).'w'.date('W').'a';
$nextAPR_firstOfWeek = true;
}
debug('$nextAPR='.$nextAPR);
// Check de l'APR
if (true) {
// if (((date('D') == 'Thu') AND $nextAPR_firstOfWeek AND time()-$lastVersions_e[0] >= 5) OR time()-$lastVersions_e[0] >= 10) {
debug('nextAPR check 1');
if (@fopen('http://assets.minecraft.net/'.$nextAPR.'/minecraft.zip', 'r')) {
include_once('addrelease.php');
echo addRelease($nextAPR);
exit();
}
}
// Check de la R
if (true) {
// if (time()-$lastVersions_e[0] >= 30){
if (@md5_file('http://s3.amazonaws.com/MinecraftDownload/minecraft.jar') != $lastVersions_e[2]) {
debug('nextR check');
include_once('addrelease.php');
echo addRelease('r');
exit();
}
}
// Re-check de la derni<6E>re APR
if (true) {
//if ((time()-$lastVersions_e[0] <= 20 AND !$nextAPR_firstOfWeek) OR (time()-$lastVersions_e[0] >= 60)) {
debug('lastAPR re-check');
if (@md5_file('http://assets.minecraft.net/'.$lastVersions_e[3].'/minecraft.zip') != $lastVersions_e[4]) {
include_once('addrelease.php');
echo addRelease($lastVersions_e[3]);
exit();
}
}
$lastVersions_e[0] = time();
$lastVersions_f = fopen('lastVersions.txt', 'w');
fwrite($lastVersions_f, implode('|', $lastVersions_e));
fclose($lastVersions_f);
echo implode('|', $lastVersions_e);
?>

View file

@ -1,48 +0,0 @@
TODO
Before release
- Correction de bugs
Before or after
- Autoriser le chargement depuis Minecraft.net pour les R quand dernière R
- Bot (minimaliste, avec gestion de processus à incrémentation)
- Ajouter quelques icônes
- Faire en sorte que les dossiers vides n'apparaissent pas (get Childs)
- nextVersions.txt
After release
- Checker les tweets de @jeb_
- Tweeter les infos sur la release
- Recodage entier en Programmation Orientée Objet (serveur et client) avec jQuery & SQL
Corrections à faire lors de ce recodage :
- Nom du fichier
- Administration
- Analyser les fichiers / dossiers quand on ouvre Miecraft.jar, pas à l'arrivée de la release
- Pouvoir actualiser le nom et la description de chaque release
- data.xml
- Descriptions multi-langage
- Pas de lien Wiki
- Suggestions de description
- Widget
/*var wikiXhr = new XMLHttpRequest();
wikiXhr.onreadystatechange = function() {
if (wikiXhr.readyState == 4 && (wikiXhr.status == 200 || wikiXhr.status == 0)) {
console.debug(wikiXhr.responseHTML);
// content.getElementsByClassName('wiki')[0].innerHTML = wikiXhr.responseHTML.innerHTML;
}
}
wikiXhr.open('GET', 'wikiAccess.php?u='+content.getElementsByClassName('wikiLink')[0].href, true);
wikiXhr.send(null);
$("#cache").load('wikiAccess.php?u='+content.getElementsByClassName('wikiLink')[0].href, function() {
console.debug('LOOOOOOOOOOOOOOOOOOL');
data = $(".wikitable tbody tr td").children("span");
for(i = 0; i<data.length; i++)
{
if($(data[i]).attr("id") == MCVersion)
{
$("#cache").html('');
content.getElementsByClassName('wiki')[0].innerHTML = $(data[i]).parent();
}
}
content.getElementsByClassName('wiki')[0].innerHTML = 'Pas d\'informations sur le Wiki';
});
*/

9
xhr.php Executable file
View file

@ -0,0 +1,9 @@
<?php
if (isset($_GET['getExtendedDataRaw']) AND is_numeric($_GET['getExtendedDataRaw'])) {
} else {
echo 'Wrong header.';
}
?>