$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 { $_SESSION[$array[0]][$array[1]] = $value; } break; case 'list_attachments': echo '{( "name": "filelist_and_upload", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "id_plugin": "'.$id_plugin.'" )}'; break; case 'checklists': echo '{( "name": "checklists", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "id_plugin": "'.$id_plugin.'" )}'; break; case 'active_users': $posizione = get('id_module'); if (isset($id_record)) { $posizione .= ', '.get('id_record'); } $user = Auth::user(); $interval = setting('Timeout notifica di presenza (minuti)') * 60 * 2; $dbo->query('UPDATE zz_semaphores SET updated = NOW() WHERE id_utente = :user_id AND posizione = :position', [ ':user_id' => $user['id'], ':position' => $posizione, ]); // Rimozione record scaduti $dbo->query('DELETE FROM zz_semaphores WHERE DATE_ADD(updated, INTERVAL :interval SECOND) <= NOW()', [ ':interval' => $interval, ]); $datas = $dbo->fetchArray('SELECT DISTINCT username FROM zz_semaphores INNER JOIN zz_users ON zz_semaphores.id_utente=zz_users.id WHERE zz_semaphores.id_utente != :user_id AND posizione = :position', [ ':user_id' => $user['id'], ':position' => $posizione, ]); echo json_encode($datas); break; case 'hooks': $hooks = Hook::all(); $results = []; foreach ($hooks as $hook) { if ($hook->permission != '-') { $results[] = [ 'id' => $hook->id, 'name' => $hook->name, ]; } } echo json_encode($results); break; case 'hook': $hook_id = filter('id'); $hook = Hook::find($hook_id); $response = $hook->execute(); echo json_encode($response); break; case 'flash': $response = flash()->getMessages(); echo json_encode($response); break; }