1 $tags_condition"; $sql = sprintf ("SELECT id_agente, evento, utimestamp FROM tevento LEFT JOIN tagent_secondary_group ON tevento.id_agente = tagent_secondary_group.id_agent WHERE %s ORDER BY utimestamp DESC LIMIT %d", $filter, $limit); $result = db_get_all_rows_sql ($sql); $events = array(); if (! empty($result)) { foreach ($result as $key => $value) { $event = array(); $event['agent'] = (empty($value['id_agente'])) ? "System" : agents_get_name($value['id_agente']); $event['text'] = io_safe_output($value['evento']); $event['date'] = date(io_safe_output($config['date_format']), $value['utimestamp']); $events[] = $event; } } else { sleep(5); } echo json_encode($events); return; } return; } ?>