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.
44 righe
1.9 KiB
44 righe
1.9 KiB
<?php |
|
$_cdir = __DIR__; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
|
|
if (! empty($_GET) && ! empty($_SESSION["utente"]) && $_SESSION["utente"]->isSupportoOrRoot() && $_SESSION["utente"]->permission($radice, $_GET["codice"])) { |
|
?> |
|
<form id="import-form" enctype="multipart/form-data" method="POST" action="<?=url("/backend/guue/import-json.php")?>"> |
|
<div class="row"> |
|
<h2 class="col-12"><?=__guue('Importa contenuto form esistente')?></h2> |
|
<?php |
|
$codice = sanitize_string($_GET['codice']); |
|
?> |
|
<input type="hidden" id="codice" name="codice" value="<?= $codice ?>"> |
|
<input class="col-12 py-3" type="file" id="json" name="json" accept="application/json"/> |
|
</div> |
|
</form> |
|
<script type="text/javascript"> |
|
$("#json").on('change', function(e){ |
|
const file = document.getElementById("json").files[0]; |
|
if (file) { |
|
var reader = new FileReader(); |
|
reader.readAsText(file, "UTF-8"); |
|
reader.onload = function(event) { |
|
data = new FormData(); |
|
data.append("codice", $("#codice").val()); |
|
data.append("json", event.target.result); |
|
$.ajax({ |
|
url: '/backend/guue/import-json.php', |
|
type: "POST", |
|
data: data, |
|
processData: false, |
|
contentType: false, |
|
success: function(response){ |
|
eval(response); |
|
} |
|
}) |
|
} |
|
} |
|
}) |
|
</script> |
|
<? |
|
} |
|
?>
|