30 |
30 |
<input type="submit" value="<?=$button?>" />
|
31 |
31 |
</form>
|
32 |
32 |
<?php }
|
|
33 |
|
33 |
34 |
/*
|
34 |
35 |
echo "<pre>\n";
|
35 |
36 |
print_r($_POST);
|
... | ... | |
66 |
67 |
$message = "";
|
67 |
68 |
|
68 |
69 |
if ($_POST['saison'] && $_POST['div1']) {
|
69 |
|
$champPath = $_POST['saison']."/".$_POST['div1'];
|
70 |
|
if ($_POST['div2']) $champPath .= $SEP_DIV.$_POST['div2'];
|
71 |
|
if ($_POST['poule'] || $_POST['phase']) $champPath .= "/";
|
72 |
|
if ($_POST['poule']) $champPath .= $_POST['poule'];
|
73 |
|
if ($_POST['phase']) $champPath .= $SEP_DIV.$_POST['phase'];
|
74 |
|
$path = ((IamAdmin()) ? "../datas" : "datas")."/$champPath";
|
75 |
|
} else {
|
76 |
|
$message = "Données manquantes !";
|
|
70 |
$path = (IamAdmin()) ? "../datas" : "datas";
|
|
71 |
$path .= "/".$_POST['saison']."/".$_POST['div1'];
|
|
72 |
if ($_POST['div2']) $path .= $SEP_DIV.$_POST['div2'];
|
|
73 |
if ($_POST['poule'] || $_POST['phase']) $path .= "/";
|
|
74 |
if ($_POST['poule']) $path .= $_POST['poule'];
|
|
75 |
if ($_POST['phase']) $path .= $SEP_DIV.$_POST['phase'];
|
77 |
76 |
}
|
78 |
77 |
|
79 |
|
if ($_POST['exporter-tout'] == "tout exporter") {
|
|
78 |
if ($_POST['exporter'] == "exporter") {
|
80 |
79 |
$zip = new zipfile();
|
81 |
80 |
backup($zip, "../datas", "datas");
|
82 |
81 |
$archive = $zip->file();
|
... | ... | |
84 |
83 |
header("Content-Disposition: inline; filename=datas-".date("Y-m-d").".zip");
|
85 |
84 |
echo $archive;
|
86 |
85 |
exit;
|
87 |
|
} elseif ($_POST['validation-importer'] == "importer") {
|
|
86 |
} elseif ($_POST['validation_importer'] == "importer") {
|
88 |
87 |
if ($_FILES['zipfile']['error'] == 0) {
|
89 |
|
$dest = "/tmp";
|
|
88 |
$dest = "..";
|
90 |
89 |
$zip = new SimpleUnzip($_FILES['zipfile']['tmp_name']);
|
91 |
90 |
if ($zip) {
|
|
91 |
$needToImport = array();
|
|
92 |
$alreadyExist = array();
|
92 |
93 |
foreach ($zip->Entries as $extr) {
|
93 |
94 |
if (!file_exists($dest."/".$extr->Path)) {
|
94 |
95 |
mkdirRecursive($dest."/".$extr->Path);
|
|
96 |
$needToImport[] = $extr->Path;
|
|
97 |
} else {
|
|
98 |
if (!in_array($extr->Path, $needToImport)) {
|
|
99 |
if (!in_array($extr->Path, $alreadyExist)) {
|
|
100 |
$message .= "<p>Le championnat ".$extr->Path." n'a pas été importé car il existe déjà !</p>";
|
|
101 |
$alreadyExist[] = $extr->Path;
|
|
102 |
}
|
|
103 |
}
|
|
104 |
}
|
|
105 |
if (in_array($extr->Path, $needToImport)) {
|
95 |
106 |
$fh = fopen($dest."/".$extr->Path."/".$extr->Name, 'w');
|
96 |
107 |
fwrite($fh, $extr->Data);
|
97 |
108 |
fclose($fh);
|
98 |
|
} else {
|
99 |
|
$message .= "<p>Le championnat ".$extr->Path." existe déjà !</p>";
|
100 |
109 |
}
|
101 |
110 |
}
|
102 |
111 |
$message .= "Données importées";
|
... | ... | |
146 |
155 |
}
|
147 |
156 |
$message = "Le championnat a été supprimé.";
|
148 |
157 |
break;
|
149 |
|
case "exporter":
|
150 |
|
$filename = $_POST['saison']."-".$_POST['div1'];
|
151 |
|
if ($_POST['div2']) $filename .= $_POST['div2'];
|
152 |
|
if ($_POST['poule'] || $_POST['phase']) $filename .= "-";
|
153 |
|
if ($_POST['poule']) $filename .= $_POST['poule'];
|
154 |
|
if ($_POST['phase']) $filename .= $_POST['phase'];
|
155 |
|
$zip = new zipfile();
|
156 |
|
backup($zip, $path, "datas/$champPath");
|
157 |
|
$archive = $zip->file();
|
158 |
|
header("Content-Type: application/x-zip");
|
159 |
|
header("Content-Disposition: inline; filename=datas-$filename.zip");
|
160 |
|
echo $archive;
|
161 |
|
exit;
|
162 |
|
break;
|
163 |
158 |
}
|
164 |
159 |
switch ($rencontre) {
|
165 |
160 |
case "ajouter":
|
... | ... | |
301 |
296 |
</form>
|
302 |
297 |
<?php retour("annuler"); ?>
|
303 |
298 |
<?php } else if ($rencontre == "ajouter" || $rencontre == "modifier") { ?>
|
304 |
|
<form name="admin" method="post" action="<?=$_SERVER['PHP_SELF']?>">
|
|
299 |
<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
|
305 |
300 |
<table border="0">
|
306 |
301 |
<tr>
|
307 |
302 |
<td colspan="3">
|
... | ... | |
371 |
366 |
<form method="post" enctype="multipart/form-data">
|
372 |
367 |
<?php hiddenVars() ?>
|
373 |
368 |
<input type="file" name="zipfile" value="" />
|
374 |
|
<input type="submit" name="selection-importer" value="importer" />
|
|
369 |
<input type="submit" name="validation_importer" value="importer" />
|
375 |
370 |
</form>
|
376 |
371 |
<?php retour("annuler"); ?>
|
377 |
372 |
<?php
|