From 8710d7713c61c8b7c689f9ec9c35f65aa25b28b0 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 4 Mar 2014 10:53:09 +0000 Subject: [PATCH] 2014-03-04 Miguel de Dios * include/functions_api.php: fixed the function "api_get_tactical_view". Thanks Cucumber. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9492 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 ++++ pandora_console/include/functions_api.php | 30 ++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ad86923c66..8e71289c08 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2014-03-04 Miguel de Dios + + * include/functions_api.php: fixed the function + "api_get_tactical_view". Thanks Cucumber. + 2014-03-04 Miguel de Dios * include/functions_api.php: fixed the function "api_get_gis_agent". diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 4c0bafe8ab..ae241bd90e 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -3602,7 +3602,7 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) { foreach ($fields_plugin_module as $field) { if ($other['data'][$cont] != "" and $field != 'id') { $values[$field] = $other['data'][$cont]; - + if( $field === 'macros' ) { $values[$field] = base64_decode($values[$field]); } @@ -6403,17 +6403,25 @@ function api_set_create_event($id, $trash1, $other, $returnType) { // http://localhost/pandora_console/include/api.php?op=get&op2=tactical_view&apipass=1234&user=admin&pass=pandora function api_get_tactical_view($trash1, $trash2, $trash3, $returnType) { $tactical_info = reporting_get_group_stats(); - $i = 0; - foreach ($tactical_info as $key => $data) { - if ($i == 0) - $result = $key.': '.$data.'
'; - else - $result .= $key.': '.$data.'
'; - - $i++; - } - $data = array('type' => 'string', 'data' => $result); + switch ($returnType) { + case 'string': + $i = 0; + foreach ($tactical_info as $key => $data) { + if ($i == 0) + $result = $key . ': ' . $data . '
'; + else + $result .= $key . ': ' . $data . '
'; + + $i++; + } + + $data = array('type' => 'string', 'data' => $result); + break; + case 'csv': + $data = array('type' => 'array', 'data' => array($tactical_info)); + break; + } returnData($returnType, $data); return;