Ver a proveniência

Mise en place du systeme de MAJ

master
heuzef há 9 anos
ascendente
cometimento
9719f80555
17 ficheiros alterados com 165 adições e 59 eliminações
  1. +65
    -0
      export_data.php
  2. +1
    -0
      header.php
  3. +71
    -39
      index.php
  4. BIN
      medias/c0f08ae603e364cb554fe71c9fc94ffd.zip
  5. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/dark.mp3
  6. +0
    -9
      medias/c0f08ae603e364cb554fe71c9fc94ffd/enemy/enemy.xml
  7. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/hard.mp3
  8. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/index.php
  9. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/light.mp3
  10. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/map.jpg
  11. +1
    -1
      medias/c0f08ae603e364cb554fe71c9fc94ffd/player.xml
  12. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/soft.mp3
  13. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/tonic.mp3
  14. +0
    -9
      medias/default/enemy.xml
  15. +0
    -1
      register.php
  16. +26
    -0
      update.php
  17. +1
    -0
      version.txt

+ 65
- 0
export_data.php Ver ficheiro

@@ -0,0 +1,65 @@
<?php
include "header.php";
connecte("ecomonde");
$hash=md5($email);
$path="./medias/".$hash;

class HZip
{
/**
* Add files and sub-directories in a folder to zip file.
* @param string $folder
* @param ZipArchive $zipFile
* @param int $exclusiveLength Number of text to be exclusived from the file path.
*/
private static function folderToZip($folder, &$zipFile, $exclusiveLength) {
$handle = opendir($folder);
while (false !== $f = readdir($handle)) {
if ($f != '.' && $f != '..') {
$filePath = "$folder/$f";
// Remove prefix from file path before add to zip.
$localPath = substr($filePath, $exclusiveLength);
if (is_file($filePath)) {
$zipFile->addFile($filePath, $localPath);
} elseif (is_dir($filePath)) {
// Add sub-directory.
$zipFile->addEmptyDir($localPath);
self::folderToZip($filePath, $zipFile, $exclusiveLength);
}
}
}
closedir($handle);
}

/**
* Zip a folder (include itself).
* Usage:
* HZip::zipDir('/path/to/sourceDir', '/path/to/out.zip');
*
* @param string $sourcePath Path of directory to be zip.
* @param string $outZipPath Path of output zip file.
*/
public static function zipDir($sourcePath, $outZipPath)
{
$pathInfo = pathInfo($sourcePath);
$parentPath = $pathInfo['dirname'];
$dirName = $pathInfo['basename'];

$z = new ZipArchive();
$z->open($outZipPath, ZIPARCHIVE::CREATE);
$z->addEmptyDir($dirName);
self::folderToZip($sourcePath, $z, strlen("$parentPath/"));
$z->close();
}
}


if ($email) {
exec("rm -rf {$path}.zip");
HZip::zipDir($path, './medias/'.$hash.'.zip');
header("location:./medias/c0f08ae603e364cb554fe71c9fc94ffd.zip");
}
else {
header("location:index.php?msg=0");
}
?>

+ 1
- 0
header.php Ver ficheiro

@@ -27,5 +27,6 @@ $res=mysql_query($sql) or die("Erreur de requete $sql");
while ($ligne=mysql_fetch_array($res)) {
extract($ligne);
$hash=md5($email);
$latest_commit = file_get_contents('./version.txt');
}
?>

+ 71
- 39
index.php Ver ficheiro

@@ -54,6 +54,12 @@ $message[10]='
<button type="button" class="close" data-dismiss="alert">X</button>
<h4>ERREUR !</h4>
<p>Echec à l\'importation de la musique. Seul les fichiers <strong>.mp3</strong> (100 M max) sont autorisés.</p>';
$message[11]='
<div class="col-lg-6 alert alert-dismissable alert-success">
<button type="button" class="close" data-dismiss="alert">X</button>
<h4>OK !</h4>
<p>Mise à jour réussie !</p>
<p><strong>Version : '.$version.'</strong></p>';
?>
<!DOCTYPE html>
<html lang="fr">
@@ -90,6 +96,9 @@ $message[10]='
</ul>
<ul class="nav navbar-nav navbar-right">
<?php if($status != 0): ?>
<?php if ($version != $latest_commit) {
echo('<a data-toggle="modal" data-target="#modal_update" class="btn btn-success btn-sm"><i class="ionicons ion-loop"></i>&nbsp;Mise à jour disponible !</a>&nbsp;&nbsp;');
} ?>
<?php echo '<img class="img-circle" src="http://gravatar.com/avatar/'.$hash.'?s=50" alt="gravatar" />'; ?>&nbsp;&nbsp;<strong><?php echo strtoupper($pseudo); ?></strong>
&nbsp;&nbsp;
<a data-toggle="modal" data-target="#modal_settings" class="btn btn-default btn-xs"><i class="ionicons ion-gear-b"></i>&nbsp;Paramètres</a>&nbsp;&nbsp;
@@ -122,43 +131,44 @@ $message[10]='
<div class="panel panel-default">
<div class="panel-heading"><i class="ionicons ion-gear-a"></i>&nbsp;&nbsp;<strong>Configurer votre partie</strong></div>
<div class="panel-body">
<p>
<a href="play" class="btn btn-info btn-lg" target="_blank"><i class="ionicons ion-play"></i>&nbsp;&nbsp;Lancer votre partie</a>
<p>
<hr />
<p>
<a data-toggle="modal" data-target="#modal_new_player" class="btn btn-default btn-lg"><i class="ionicons ion-person-add"></i>&nbsp;&nbsp;Créer un joueur</a>
</p>
<hr />
<p>
<a data-toggle="modal" data-target="#modal_import_player" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-import"></i>&nbsp;&nbsp;Importer un joueur (.XML)</a>
</p>
<hr />
<p>
<div class="btn-group">
<a href="#" class="btn btn-default btn-lg dropdown-toggle" data-toggle="dropdown">
<i class="ionicons ion-music-note"></i>&nbsp;&nbsp;Changer les musiques
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a data-toggle="modal" data-target="#modal_change_music_soft" style="color:#CCC;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;SOFT</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_tonic" style="color:#AAA;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;TONIC</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_hard" style="color:#000;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;HARD</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_light" style="color:#ADDFFF;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;LIGHT</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_dark" style="color:#8128B5;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;DARK</a></li>
</ul>
</div>
</p>
<hr />
<p>
<a data-toggle="modal" data-target="#modal_change_map" class="btn btn-default btn-lg"><i class="ionicons ion-map"></i>&nbsp;&nbsp;Changer la carte</a>
</p>
<hr />
<h1><i class="glyphicon glyphicon-phone"></i>Affichage téléphone</h1>
<img class="img-responsive" src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.ecomonde.land%2Fmedias/<?php echo $hash; ?>&choe=UTF-8" />
<a href="https://play.google.com/store/apps/details?id=com.google.zxing.client.android&hl=fr_FR" target="_blank">
<img alt="Barcode Scanner" src="https://lh6.ggpht.com/os72icmFlDtbxpYbZCP-v6kOereSLGDmlKsBl1ISTPdgbcpoc4rSIuXDuoDECvgcvoFJ=w300-rw" height="60px" /><img alt="Android app on Google Play" src="https://developer.android.com/images/brand/fr_app_rgb_wo_45.png" />
</a>
<p>
<a href="play" class="btn btn-info btn-lg" target="_blank"><i class="ionicons ion-play"></i>&nbsp;&nbsp;Lancer votre partie</a>
<p>
<hr />
<p>
<a data-toggle="modal" data-target="#modal_new_player" class="btn btn-default btn-lg"><i class="ionicons ion-person-add"></i>&nbsp;&nbsp;Créer un joueur</a>
</p>
<hr />
<p>
<a data-toggle="modal" data-target="#modal_import_player" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-import"></i>&nbsp;&nbsp;Importer un joueur (.XML)</a>
</p>
<hr />
<p>
<div class="btn-group">
<a href="#" class="btn btn-default btn-lg dropdown-toggle" data-toggle="dropdown">
<i class="ionicons ion-music-note"></i>&nbsp;&nbsp;Changer les musiques
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a data-toggle="modal" data-target="#modal_change_music_soft" style="color:#CCC;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;SOFT</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_tonic" style="color:#AAA;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;TONIC</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_hard" style="color:#000;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;HARD</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_light" style="color:#ADDFFF;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;LIGHT</a></li>
<li><a data-toggle="modal" data-target="#modal_change_music_dark" style="color:#8128B5;" class="btn btn-default"><i class="ionicons ion-music-note"></i>&nbsp;&nbsp;DARK</a></li>
</ul>
</div>
</p>
<hr />
<p>
<a data-toggle="modal" data-target="#modal_change_map" class="btn btn-default btn-lg"><i class="ionicons ion-map"></i>&nbsp;&nbsp;Changer la carte</a>
</p>
<hr />
<p>
<a href="./export_data.php" class="btn btn-info btn-lg"><i class="glyphicon glyphicon-download"></i>&nbsp;&nbsp;Exporter vos médias</a>
</p>
<hr />
<h1><i class="glyphicon glyphicon-phone"></i>Affichage téléphone</h1>
<img class="img-responsive" src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.ecomonde.land%2Fmedias/<?php echo $hash; ?>&choe=UTF-8" />
</div>
</div>
</div>
@@ -304,18 +314,40 @@ $message[10]='
<input type="hidden" name="id" value="<?php echo $id; ?>">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-info">Mise à jour du compte</button>
<button type="submit" class="btn btn-info">Modifier le compte</button>
</div>
</form>
<hr />
<p align="center">
<strong>Attention, en cliquant sur ce bouton, vous entraînez la suppression complète de votre compte ainsi que de tous vos médias, pensez à exporter vos fiches personnages avant d'appliquer cette sentence irrévocable de la mort qui tue !</strong><br />
<strong>Attention, en cliquant sur ce bouton, vous entraînez la suppression complète de votre compte, pensez à <a href="export_data.php">exporter vos médias</a> avant d'appliquer cette sentence irrévocable de la mort qui tue !</strong><br />
<a href="delete_account.php" class="btn btn-danger btn-xs"><i class="ionicons ion-alert-circled"></i>&nbsp;SUPPRIMER VOTRE COMPTE&nbsp;<i class="ionicons ion-alert-circled"></i></a>
</p>
</div>
</div>
</div>

<div class="modal fade" id="modal_update">
<div class="modal-dialog">
<div class="modal-content">
<form class="form-horizontal well" role="form" method="post" action="update.php" enctype="multipart/form-data">
<div class="modal-header">
<a type="button" class="close" data-dismiss="modal" aria-hidden="true" style="color:black;">X</a>
<h4 class="modal-title"><i class="ionicons ion-loop"></i>&nbsp;&nbsp;MISE A JOUR DU COMPTE</h4>
</div>
<div class="modal-body">
<h3>De nouvelles mises à jour sont disponibles !</h3>
<p>Attention, la mise à jour de votre compte provoque sa réinitialisation, pensez à <a href="export_data.php">exporter vos médias</a> avant d'appliquer cette sentence irrévocable de la mort qui tue !</p>
<p align="center"><a href="update.php" class="btn btn-success"><i class="ionicons ion-loop"></i>&nbsp;MISE A JOUR DU COMPTE&nbsp;<i class="ionicons ion-loop"></i></a></p>
<hr />
<p><strong>Version actuel :</strong> <?php echo $version; ?></p>
<p><strong>Dernière version :</strong> <?php echo $latest_commit; ?></p>
<p><a href="https://github.com/heuzef/ecomonde/commits/master" target="_blank"><i class="ionicons ion-social-github"></i>&nbsp;Détails des dernières mises à jours<a></p>
</div>
</form>
</div>
</div>
</div>

<div class="modal fade" id="modal_change_map">
<div class="modal-dialog">
<div class="modal-content">


BIN
medias/c0f08ae603e364cb554fe71c9fc94ffd.zip Ver ficheiro


+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/dark.mp3 Ver ficheiro


+ 0
- 9
medias/c0f08ae603e364cb554fe71c9fc94ffd/enemy/enemy.xml Ver ficheiro

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<response>
<entry>
<nom>enemy</nom>
<hp>2</hp>
<img>http://wiki.ecomonde.land/lib/exe/fetch.php?media=wiki:loup_garou.jpg</img>
<url>http://wiki.ecomonde.land/doku.php?id=wiki:ennemies</url>
</entry>
</response>

+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/hard.mp3 Ver ficheiro


+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/index.php Ver ficheiro


+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/light.mp3 Ver ficheiro


+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/map.jpg Ver ficheiro

Antes Depois
Largura: 2000  |  Altura: 1400  |  Tamanho: 1.0 MiB Largura: 2000  |  Altura: 1400  |  Tamanho: 1.0 MiB

+ 1
- 1
medias/c0f08ae603e364cb554fe71c9fc94ffd/player.xml Ver ficheiro

@@ -3,7 +3,7 @@
<entry>
<nom>player</nom>
<level>0</level>
<hp>7</hp>
<hp>10</hp>
<xp>0</xp>
<money>0</money>
<ecos>


+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/soft.mp3 Ver ficheiro


+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/tonic.mp3 Ver ficheiro


+ 0
- 9
medias/default/enemy.xml Ver ficheiro

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<response>
<entry>
<nom>enemy</nom>
<hp>3</hp>
<img>http://wiki.ecomonde.land/lib/exe/fetch.php?media=wiki:loup_garou.jpg</img>
<url>http://wiki.ecomonde.land/doku.php?id=wiki:ennemies</url>
</entry>
</response>

+ 0
- 1
register.php Ver ficheiro

@@ -17,7 +17,6 @@ else {
mkdir("medias/".$hash."/enemy/");
copy("medias/default/index.php", "medias/".$hash."/index.php");
copy("medias/default/player.xml", "medias/".$hash."/player.xml");
copy("medias/default/enemy.xml", "medias/".$hash."/enemy/enemy.xml");
copy("medias/default/map.jpg", "medias/".$hash."/map.jpg");
copy("medias/default/soft.mp3", "medias/".$hash."/soft.mp3");
copy("medias/default/tonic.mp3", "medias/".$hash."/tonic.mp3");


+ 26
- 0
update.php Ver ficheiro

@@ -0,0 +1,26 @@
<?php
include "header.php";
connecte("ecomonde");
$hash=md5($email);
$path="./medias/".$hash;

if ($email) {
$sql="UPDATE membres SET version='$latest_commit'";
mysql_query($sql) or die(include("index.php?msg=0"));
exec("rm -rf {$path}");
mkdir("medias/".$hash."/");
mkdir("medias/".$hash."/enemy/");
copy("medias/default/index.php", "medias/".$hash."/index.php");
copy("medias/default/player.xml", "medias/".$hash."/player.xml");
copy("medias/default/map.jpg", "medias/".$hash."/map.jpg");
copy("medias/default/soft.mp3", "medias/".$hash."/soft.mp3");
copy("medias/default/tonic.mp3", "medias/".$hash."/tonic.mp3");
copy("medias/default/hard.mp3", "medias/".$hash."/hard.mp3");
copy("medias/default/light.mp3", "medias/".$hash."/light.mp3");
copy("medias/default/dark.mp3", "medias/".$hash."/dark.mp3");
header("location:index.php?msg=11");
}
else {
header("location:index.php?msg=0");
}
?>

+ 1
- 0
version.txt Ver ficheiro

@@ -0,0 +1 @@
c202d7deda9023ab6888bdba3da44e97ea2d1d6d

Carregando…
Cancelar
Guardar