Révision 1fe6c79e
b/admin/admin.php | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
|
10 | 10 |
require_once 'zip.lib.php'; |
11 |
require_once 'unzip.lib.php'; |
|
11 | 12 |
|
12 | 13 |
if (basename(dirname($_SERVER['PHP_SELF'])) == "admin") |
13 | 14 |
require_once '../functions.php'; |
... | ... | |
83 | 84 |
header("Content-Disposition: inline; filename=datas-".date("Y-m-d").".zip"); |
84 | 85 |
echo $archive; |
85 | 86 |
exit; |
86 |
} elseif ($_POST['importer-tout'] == "tout importer") { |
|
87 |
$message = "pas implémenté."; |
|
87 |
} elseif ($_POST['validation-importer'] == "importer") { |
|
88 |
if ($_FILES['zipfile']['error'] == 0) { |
|
89 |
$dest = "/tmp"; |
|
90 |
$zip = new SimpleUnzip($_FILES['zipfile']['tmp_name']); |
|
91 |
if ($zip) { |
|
92 |
foreach ($zip->Entries as $extr) { |
|
93 |
if (!file_exists($dest."/".$extr->Path)) { |
|
94 |
mkdirRecursive($dest."/".$extr->Path); |
|
95 |
$fh = fopen($dest."/".$extr->Path."/".$extr->Name, 'w'); |
|
96 |
fwrite($fh, $extr->Data); |
|
97 |
fclose($fh); |
|
98 |
} else { |
|
99 |
$message .= "<p>Le championnat ".$extr->Path." existe déjà !</p>"; |
|
100 |
} |
|
101 |
} |
|
102 |
$message .= "Données importées"; |
|
103 |
} else { |
|
104 |
$message = $_POST['zipfile'].": fichier invalide !"; |
|
105 |
} |
|
106 |
} else { |
|
107 |
$message = "Erreur lors du chargement du fichier '".$_FILES['zipfile']['name']."' !"; |
|
108 |
} |
|
88 | 109 |
} elseif ($_POST['supprimer-tout'] == "tout supprimer") { |
89 | 110 |
$message = "pas implémenté."; |
90 | 111 |
} |
... | ... | |
346 | 367 |
<?php } ?> |
347 | 368 |
</form> |
348 | 369 |
<?php retour("annuler"); ?> |
370 |
<?php } else if ($_POST['importer'] == "importer") { ?> |
|
371 |
<form method="post" enctype="multipart/form-data"> |
|
372 |
<?php hiddenVars() ?> |
|
373 |
<input type="file" name="zipfile" value="" /> |
|
374 |
<input type="submit" name="selection-importer" value="importer" /> |
|
375 |
</form> |
|
376 |
<?php retour("annuler"); ?> |
|
349 | 377 |
<?php |
350 | 378 |
} else { |
351 | 379 |
retour("continuer", $message); |
Formats disponibles : Unified diff