2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/core.php';
|
|
|
|
|
|
|
|
switch (get('op')) {
|
|
|
|
// Imposta un valore ad un array di $_SESSION
|
|
|
|
// esempio: push di un valore in $_SESSION['dashboard']['idtecnici']
|
|
|
|
// iversed: specifica se rimuovere dall'array il valore trovato e applicare quindi una deselezione (valori 0 o 1, default 1)
|
|
|
|
case 'session_set_array':
|
|
|
|
$array = explode(',', get('session'));
|
|
|
|
$value = "'".get('value')."'";
|
|
|
|
$inversed = get('inversed');
|
|
|
|
|
|
|
|
$found = false;
|
|
|
|
|
|
|
|
// Ricerca valore nell'array
|
|
|
|
foreach ($_SESSION[$array[0]][$array[1]] as $idx => $val) {
|
|
|
|
// Se il valore esiste lo tolgo
|
|
|
|
if ($val == $value) {
|
|
|
|
$found = true;
|
|
|
|
|
|
|
|
if ((int) $inversed == 1) {
|
|
|
|
unset($_SESSION[$array[0]][$array[1]][$idx]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$found) {
|
|
|
|
array_push($_SESSION[$array[0]][$array[1]], $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
// print_r($_SESSION[$array[0]][$array[1]]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Imposta un valore ad una sessione
|
|
|
|
case 'session_set':
|
|
|
|
$array = explode(',', get('session'));
|
|
|
|
$value = get('value');
|
|
|
|
$clear = get('clear');
|
|
|
|
|
|
|
|
if ($clear == 1 || $value == '') {
|
|
|
|
unset($_SESSION[$array[0]][$array[1]]);
|
|
|
|
} else {
|
2018-03-22 15:40:20 +01:00
|
|
|
$_SESSION[$array[0]][$array[1]] = $value;
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2018-06-26 14:30:26 +02:00
|
|
|
|
|
|
|
case 'list_attachments':
|
2018-07-02 15:41:38 +02:00
|
|
|
$id_module = get('id_module');
|
|
|
|
$id_record = get('id_record');
|
|
|
|
$id_plugin = get('id_plugin');
|
2018-06-26 14:30:26 +02:00
|
|
|
|
2018-07-02 15:41:38 +02:00
|
|
|
echo '{( "name": "filelist_and_upload", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "id_plugin": "'.$id_plugin.'" )}';
|
2018-06-26 14:30:26 +02:00
|
|
|
|
|
|
|
break;
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|