2013-10-11 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_agents.php, include/functions_graph.php,
	include/functions_api.php: fixed a pair of bugs of the api calls.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8892 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-10-11 11:33:07 +00:00
parent 5cd887aba4
commit 09e5a830aa
4 changed files with 28 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2013-10-11 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_agents.php, include/functions_graph.php,
include/functions_api.php: fixed a pair of bugs of the api calls.
2013-10-11 Sergio Martin <sergio.martin@artica.es> 2013-10-11 Sergio Martin <sergio.martin@artica.es>
* include/graphs/flot/pandora.flot.js: Fixed strange * include/graphs/flot/pandora.flot.js: Fixed strange

View File

@ -1711,7 +1711,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
db_process_delete_temp ("tagente", "id_agente", $id_agent); db_process_delete_temp ("tagente", "id_agente", $id_agent);
db_pandora_audit( "Agent management", db_pandora_audit( "Agent management",
"Deleted agent '$agent_name'"); "Deleted agent '$agent_name'");
/* Break the loop on error */ /* Break the loop on error */

View File

@ -223,6 +223,8 @@ function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db) {
function api_get_agent_module_name_last_value($agentName, $moduleName, $other = ';', $returnType) function api_get_agent_module_name_last_value($agentName, $moduleName, $other = ';', $returnType)
{ {
global $config;
$idAgent = agents_get_agent_id($agentName); $idAgent = agents_get_agent_id($agentName);
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
@ -260,7 +262,7 @@ function api_get_agent_module_name_last_value($agentName, $moduleName, $other =
} }
} }
else { else {
get_module_last_value($idModuleAgent, null, $other, $returnType); api_get_module_last_value($idModuleAgent, null, $other, $returnType);
} }
} }
@ -918,7 +920,8 @@ function api_get_custom_field_id($t1, $t2, $other, $returnType) {
function api_set_delete_agent($id, $thrash1, $thrast2, $thrash3) { function api_set_delete_agent($id, $thrash1, $thrast2, $thrash3) {
$agentName = $id; $agentName = $id;
$idAgent[0] = agents_get_agent_id($agentName); $idAgent[0] = agents_get_agent_id($agentName);
if (!agents_delete_agent ($idAgent, true))
if (($idAgent[0] === 0) || (!agents_delete_agent ($idAgent, true)))
returnError('error_delete', 'Error in delete operation.'); returnError('error_delete', 'Error in delete operation.');
else else
returnData('string', array('type' => 'string', 'data' => __('Correct Delete'))); returnData('string', array('type' => 'string', 'data' => __('Correct Delete')));
@ -4248,6 +4251,7 @@ function api_get_graph_module_data($id, $thrash1, $other, $thrash2) {
$start_date = $other['data'][4]; $start_date = $other['data'][4];
$date = strtotime($start_date); $date = strtotime($start_date);
$homeurl = '../'; $homeurl = '../';
$ttl = 1; $ttl = 1;
@ -4255,20 +4259,28 @@ function api_get_graph_module_data($id, $thrash1, $other, $thrash2) {
$config['flash_charts'] = 0; $config['flash_charts'] = 0;
$image = grafico_modulo_sparse ($id, $period, $draw_events, $image = grafico_modulo_sparse ($id, $period, $draw_events,
$width, $height , '',null, $width, $height , $label, null,
$draw_alerts, $avg_only, false, $draw_alerts, $avg_only, false,
$date, '', 0, 0,true, $date, '', 0, 0,true,
false, $homeurl, $ttl); false, $homeurl, $ttl);
// Extract url of the image from img tag preg_match("/<div class=\"nodata_text\">/",
preg_match("/src='([^']*)'/i",$image, $match); $image, $match);
if (empty($match[1])) { if (!empty($match[0])) {
echo "Error getting graph"; echo "Error no data";
} }
else { else {
header('Content-type: image/png'); // Extract url of the image from img tag
header('Location: ' . $match[1]); preg_match("/src='([^']*)'/i", $image, $match);
if (empty($match[1])) {
echo "Error getting graph";
}
else {
header('Content-type: image/png');
header('Location: ' . $match[1]);
}
} }
} }

View File

@ -695,6 +695,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
global $config; global $config;
global $graphic_type; global $graphic_type;
$flash_chart = $config['flash_charts']; $flash_chart = $config['flash_charts'];
enterprise_include_once("include/functions_reporting.php"); enterprise_include_once("include/functions_reporting.php");