$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$error = true;
if (isset($_SESSION["utente"]) && !empty($_GET["sezione"]) && !empty($_GET["codice_elemento"]) && $_SESSION["utente"]->permission($_GET["sezione"],$_GET["codice_elemento"],(!empty($_GET["function"]) ? $_GET["function"] : ""))) {
$utenti = ente::getUtentiFromModulo($_GET["sezione"],$_SESSION["ente"]->codice);
$error = false;
?>
= __("Gli utenti di tipologia Amministratore sono automaticamente abilitati") ?>
if (!empty($utenti)) {
$bind = array();
$utenti = $_SESSION["ente"]->getUtentiFromEnte($utenti,(int) $_GET["ente"]);
if (!empty($utenti)) {
$check = $pdo->prepare("SELECT codice FROM r_permessi WHERE sezione = :sezione AND codice_elemento = :codice_elemento AND codice_gestore = :codice_gestore AND codice_utente = :codice_utente AND funzione = :funzione");
$check->bindValue(":sezione",$_GET["sezione"]);
$check->bindValue(":codice_gestore",$_SESSION["ente"]->codice);
$check->bindValue(":codice_elemento",$_GET["codice_elemento"]);
$funzione = $_GET["function"];
$settings = $_SESSION["utente"]->settings[$_GET["sezione"]] ?? NULL;
if ($funzione !== "0") {
if (!empty($settings["funzioni"])) {
$funct = $settings["funzioni"];
switch($funct["type"]) {
case "json":
$array = jsonToArray($config["jsonFolder"].$funct["path"]);
if (!empty($array)) {
foreach($array AS $value => $tmp) {
$functions[] = [
"titolo"=>$tmp["titolo"],
"descrizione"=>$tmp["descrizione"],
"value"=>$value,
"modulo_riferimento"=>$tmp["modulo_riferimento"]
];
}
}
break;
case "array":
$functions = array_merge($functions,$funct["value"]);
break;
case "script":
$functions = include_once "{$root}/{$funct["path"]}";
break;
}
}
$functions = array_column($functions,null,"value");
$funzione = $functions[$funzione] ?? null;
} else {
$funzione = ["titolo"=>"Generale","descrizione"=>"Il permesso generale abilita l'utente a tutte le funzionalità compatibili con il suo profilo","value"=>0];
}
$getSezione = $_GET["sezione"];
$getCodice_elemento = $_GET["codice_elemento"];
$showAll = true;
if (!empty($funzione)) {
?>
= $funzione["titolo"] ?>
= $funzione["descrizione"] ?>
}
}
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}
?>