2012-12-06 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_agents.php, include/functions_html.php, include/functions_netflow.php: cleaned source code style. * include/db/mysql.php: fixed into the function "mysql_db_process_sql" a big bug that runs fine the select querys in a metaconsole enviorement with several DBs but the insert querys make in the previous connection. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7235 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
1f4a1a3db6
commit
a495c5e7b1
|
@ -1,3 +1,13 @@
|
|||
2012-12-06 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_agents.php, include/functions_html.php,
|
||||
include/functions_netflow.php: cleaned source code style.
|
||||
|
||||
* include/db/mysql.php: fixed into the function
|
||||
"mysql_db_process_sql" a big bug that runs fine the select querys in
|
||||
a metaconsole enviorement with several DBs but the insert querys
|
||||
make in the previous connection.
|
||||
|
||||
2012-12-06 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_agents.php,
|
||||
|
|
|
@ -275,12 +275,13 @@ function mysql_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
|
|||
}
|
||||
else {
|
||||
$start = microtime (true);
|
||||
|
||||
if ($dbconnection == '') {
|
||||
$result = mysql_query ($sql);
|
||||
}
|
||||
else {
|
||||
$result = mysql_query ($sql, $dbconnection);
|
||||
$dbconnection = $config['dbconnection'];
|
||||
}
|
||||
|
||||
$result = mysql_query ($sql, $dbconnection);
|
||||
|
||||
$time = microtime (true) - $start;
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace ();
|
||||
|
@ -313,7 +314,7 @@ function mysql_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
|
|||
while ($row = mysql_fetch_assoc ($result)) {
|
||||
array_push ($retval, $row);
|
||||
}
|
||||
|
||||
|
||||
if ($cache === true)
|
||||
$sql_cache[$sql] = $retval;
|
||||
mysql_free_result ($result);
|
||||
|
|
|
@ -1314,7 +1314,9 @@ function agents_get_agent_id ($agent_name, $io_safe_input = false) {
|
|||
* @return string Name of the given agent.
|
||||
*/
|
||||
function agents_get_name ($id_agent, $case = "none") {
|
||||
$agent = (string) db_get_value ('nombre', 'tagente', 'id_agente', (int) $id_agent);
|
||||
$agent = (string) db_get_value ('nombre',
|
||||
'tagente', 'id_agente', (int) $id_agent);
|
||||
|
||||
// Version 3.0 has enforced case sensitive agent names
|
||||
// so we always should show real case names.
|
||||
switch ($case) {
|
||||
|
|
|
@ -213,7 +213,7 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAl
|
|||
|
||||
$fields = users_get_groups_for_select($id_user, $privilege,
|
||||
$returnAllGroup, true, $id_group);
|
||||
|
||||
|
||||
$output = html_print_select ($fields, $name, $selected, $script,
|
||||
$nothing, $nothing_value, $return, $multiple, false, $class,
|
||||
$disabled, $style, $option_style);
|
||||
|
|
|
@ -458,7 +458,7 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $u
|
|||
if ($aggregate == 'none') {
|
||||
netflow_save_cache ($values, $cache_file);
|
||||
}
|
||||
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
@ -489,14 +489,14 @@ function netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max, $
|
|||
// Execute nfdump
|
||||
$command .= " -o csv -q -s $aggregate/bytes -n $max -t " .date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||
exec($command, $string);
|
||||
|
||||
|
||||
if (! is_array($string)) {
|
||||
return array ();
|
||||
}
|
||||
|
||||
|
||||
// Remove the first line
|
||||
$string[0] = '';
|
||||
|
||||
|
||||
$i = 0;
|
||||
$values = array();
|
||||
$interval_length = $end_date - $start_date;
|
||||
|
@ -542,7 +542,7 @@ function netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max, $
|
|||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
sort_netflow_data ($values);
|
||||
|
||||
return $values;
|
||||
|
@ -575,7 +575,7 @@ function netflow_get_summary ($start_date, $end_date, $filter, $unique_id, $conn
|
|||
$temp_file = $config['attachment_store'] . '/netflow_' . $unique_id . '.tmp';
|
||||
$command .= " -o \"fmt: \" -t " .date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||
exec("$command > $temp_file");
|
||||
|
||||
|
||||
// Parse data file
|
||||
// We must parse from $start_date to avoid creating new intervals!
|
||||
$values = array ();
|
||||
|
@ -823,7 +823,7 @@ function netflow_parse_file ($start_date, $end_date, $interval_length, $file, &$
|
|||
$flow['timestamp'] = strtotime ($flow['datetime']);
|
||||
$last_timestamp = $flow['timestamp'];
|
||||
}
|
||||
|
||||
|
||||
if ($flow['timestamp'] >= $timestamp && $flow['timestamp'] <= $timestamp + $interval_length) {
|
||||
$read_flag = 1;
|
||||
if ($aggregate != 'none') {
|
||||
|
@ -847,7 +847,7 @@ function netflow_parse_file ($start_date, $end_date, $interval_length, $file, &$
|
|||
$no_data = 1;
|
||||
if ($aggregate != 'none') {
|
||||
foreach ($interval_total as $agg => $val) {
|
||||
|
||||
|
||||
// No data for this interval/aggregate
|
||||
if ($interval_count[$agg] == 0) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue