Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
63 righe
2.3 KiB
63 righe
2.3 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->gerarchia === 1) { |
|
$pending = getPendingTranslations(); |
|
if (!empty($pending)) { |
|
$notFound = 0; |
|
$new = 0; |
|
$over = 0; |
|
$chunkPath = $config["chunk_folder"]."/".$_SESSION["utente"]->codice."/".$_POST["filechunk"]; |
|
if (file_exists($chunkPath)) { |
|
$newTranslations = jsonToArray($chunkPath); |
|
if (!empty($newTranslations)) { |
|
$error = false; |
|
$vocabolario = jsonToArray($config["path_vocabolario"]."/vocabolario.json"); |
|
if (!file_exists($config["path_vocabolario"]."/backup/")) { mkdir($config["path_vocabolario"]."/backup/"); } |
|
if (file_put_contents($config["path_vocabolario"]."/backup/".time().".json",file_get_contents($config["path_vocabolario"]."/vocabolario.json"))) { |
|
foreach($newTranslations AS $key => $value) { |
|
unset($value["_verify"]); |
|
if (isset($vocabolario[$key])) { |
|
if (!empty($vocabolario[$key]["_verify"])) { |
|
$over++; |
|
} else { |
|
$new++; |
|
} |
|
$vocabolario[$key] = $value; |
|
} else { |
|
$notFound++; |
|
} |
|
} |
|
if (file_put_contents($config["path_vocabolario"]."/vocabolario.json",json_encode($vocabolario,JSON_PRETTY_PRINT))) { |
|
?> |
|
swal({ |
|
title: "Risultati importazione", |
|
html: "<?= __("Non trovati") ?>: <?= $notFound; ?><br><?= __("Nuove") ?>: <?= $new; ?><br><?= __("Aggiornate") ?>: <?= $over; ?>", |
|
type: "info", |
|
confirmButtonText: "Ok", |
|
confirmButtonClass: 'btn btn-primary' |
|
}).then(function() { window.location.reload(); }); |
|
<? |
|
} else { |
|
$error = true; |
|
} |
|
} else { |
|
?> |
|
swal({ |
|
title: "Errore Backup!", |
|
type: "warning", |
|
confirmButtonText: "Riprova", |
|
confirmButtonClass: 'btn btn-warning' |
|
}); |
|
<? |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|