1 $tags_condition"; switch ($config["dbtype"]) { case "mysql": case "postgresql": $sql = sprintf ("SELECT id_agente, evento, utimestamp FROM tevento WHERE %s ORDER BY utimestamp DESC LIMIT %d", $filter, $limit); break; case "oracle": $sql = sprintf ("SELECT * FROM tevento WHERE %s AND rownum <= %d ORDER BY utimestamp DESC", $filter, $limit); break; } $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; } ?>