Files
PVM/public_html/gest-lib/allegati/include/ajax.php
2024-02-09 13:12:49 +01:00

62 lines
2.5 KiB
PHP

<?php
if (isset($_GET["popup-main"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["popup-main"]);
include "popup-main.php";
} else if (isset($_POST["uploadFromModal"])) {
$Ret = new Ret;
if (count($_FILES) > 0) {
$data = Utility::B64JSON_parse($_POST["uploadFromModal"]);
$Ret = Allegati::uploadFromModal($data, $_FILES);
} else {
$Ret->set_error("File non pervenuto");
}
$Ret->display();
} else if (isset($_GET["getItemList"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["getItemList"]);
Allegati::getSourceFileList($data)->display();
} else if (isset($_GET["get"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["get"]);
Allegati::get($data)->display();
} else if (isset($_GET["download"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["download"]);
Allegati::download($data);
} else if (isset($_GET["get_all"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["get_all"]);
Allegati::download_all($data)->display();
} else if (isset($_POST["remove"])) {
$data = Utility::sanitizeB64JSON_parse($_POST["remove"]);
Allegati::remove($data)->display();
} else if (isset($_POST["updateDescrizione"])) {
$data = Utility::sanitizeB64JSON_parse($_POST["updateDescrizione"]);
Allegati::updateDescrizione($data)->display();
} else if (isset($_GET["render"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["render"]);
Allegati::render($data)->display();
} else if (isset($_GET["cache"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["cache"]);
Allegati::cache($data)->display();
} else if (isset($_POST["upload"])) {
$Ret = new Ret;
if (count($_FILES) > 0) {
$data = Utility::B64JSON_parse($_POST["upload"]);
$Ret = Allegati::upload($data, $_FILES);
} else {
$Ret->set_error("File non pervenuti");
}
$Ret->display();
} else if (isset($_GET["buildTableRow"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["buildTableRow"]);
$item = $data["item"];
ob_start();
include \Controller::current_gestpath_include("main-tr.php");
$html = \Utility\Str::remove_multiple_spaces(@ob_get_clean());
$Ret = new Ret;
$Ret->set_string($html)->display();
} else if (isset($_GET["getAllegatiAttivita"])) {
$data = Utility::sanitizeB64JSON_parse($_GET["getAllegatiAttivita"]);
Allegati\ContattiCommesse::get_filelist($data)->display();
} else if (Controller::is_ajaxRequest()) {
$Ret = new Ret;
$Ret->set_errorCode(ErrorHandler::UNEXPECTED_AJAX_METHOD)->display();
}