mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2013-07-29 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php: a lot of tiny fixes. * extensions/api_checker.php: some fixes. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8591 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3b72a6a4f4
commit
d343cc4c38
@ -1,3 +1,9 @@
|
|||||||
|
2013-07-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_api.php: a lot of tiny fixes.
|
||||||
|
|
||||||
|
* extensions/api_checker.php: some fixes.
|
||||||
|
|
||||||
2013-07-29 Miguel de Dios <miguel.dedios@artica.es>
|
2013-07-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* extensions/api_checker.php: a tiny extension to make more easy
|
* extensions/api_checker.php: a tiny extension to make more easy
|
||||||
|
@ -68,7 +68,7 @@ function extension_api_checker() {
|
|||||||
$id2 = io_safe_output(get_parameter('id2', ''));
|
$id2 = io_safe_output(get_parameter('id2', ''));
|
||||||
$return_type = io_safe_output(get_parameter('return_type', ''));
|
$return_type = io_safe_output(get_parameter('return_type', ''));
|
||||||
$other = io_safe_output(get_parameter('other', ''));
|
$other = io_safe_output(get_parameter('other', ''));
|
||||||
$other_mode = io_safe_output(get_parameter('other', 'url_encode_separator_|'));
|
$other_mode = io_safe_output(get_parameter('other_mode', 'url_encode_separator_|'));
|
||||||
|
|
||||||
$api_execute = get_parameter('api_execute', 0);
|
$api_execute = get_parameter('api_execute', 0);
|
||||||
|
|
||||||
@ -76,7 +76,8 @@ function extension_api_checker() {
|
|||||||
if ($api_execute) {
|
if ($api_execute) {
|
||||||
$return_call_api =
|
$return_call_api =
|
||||||
api_execute($url, $ip, $pandora_url, $apipass, $user, $password,
|
api_execute($url, $ip, $pandora_url, $apipass, $user, $password,
|
||||||
$op, $op2, $id, $id2, $return_type, $other, $other_mode);
|
$op, $op2, urlencode($id), urlencode($id2),
|
||||||
|
$return_type, urlencode($other), $other_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_page_header (__("API checker"),
|
ui_print_page_header (__("API checker"),
|
||||||
@ -130,7 +131,7 @@ function extension_api_checker() {
|
|||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row[] = __("ID 2");
|
$row[] = __("ID 2");
|
||||||
$row[] = html_print_input_text('id', $id2, '', 50, 255, true);
|
$row[] = html_print_input_text('id2', $id2, '', 50, 255, true);
|
||||||
$table2->data[] = $row;
|
$table2->data[] = $row;
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
|
@ -81,8 +81,8 @@ function returnError($typeError, $returnType = 'string') {
|
|||||||
array('type' => 'string', 'data' => __('Id does not exist in BD.')));
|
array('type' => 'string', 'data' => __('Id does not exist in BD.')));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
returnData($returnType,
|
returnData("string",
|
||||||
array('type' => 'string', 'data' => __($typeError)));
|
array('type' => 'string', 'data' => __($returnType)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,8 +100,10 @@ function returnData($returnType, $data, $separator = ';') {
|
|||||||
case 'string':
|
case 'string':
|
||||||
if ($data['type'] == 'string') {
|
if ($data['type'] == 'string') {
|
||||||
echo $data['data'];
|
echo $data['data'];
|
||||||
} else
|
}
|
||||||
;//TODO
|
else {
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'csv':
|
case 'csv':
|
||||||
case 'csv_head':
|
case 'csv_head':
|
||||||
@ -4024,15 +4026,15 @@ 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 , '',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
|
// Extract url of the image from img tag
|
||||||
preg_match("/src='([^']*)'/i",$image, $match);
|
preg_match("/src='([^']*)'/i",$image, $match);
|
||||||
|
|
||||||
if(empty($match[1])) {
|
if (empty($match[1])) {
|
||||||
echo "Error getting graph";
|
echo "Error getting graph";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -4576,7 +4578,7 @@ function api_set_new_module($id, $id2, $other, $trash1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$values['id_modulo'] = 2;
|
$values['id_modulo'] = 2;
|
||||||
|
|
||||||
$return = modules_create_agent_module($values['id_agente'], $values['nombre'], $values);
|
$return = modules_create_agent_module($values['id_agente'], $values['nombre'], $values);
|
||||||
|
|
||||||
$data['type'] = 'string';
|
$data['type'] = 'string';
|
||||||
@ -4587,7 +4589,7 @@ function api_set_new_module($id, $id2, $other, $trash1) {
|
|||||||
$data['data'] = $return;
|
$data['data'] = $return;
|
||||||
}
|
}
|
||||||
returnData('string', $data);
|
returnData('string', $data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4813,7 +4815,7 @@ function api_set_event_validate_filter_pro($trash1, $trash2, $other, $trash3) {
|
|||||||
}
|
}
|
||||||
else if ($other['type'] == 'array') {
|
else if ($other['type'] == 'array') {
|
||||||
$filter = array();
|
$filter = array();
|
||||||
|
|
||||||
if (($other['data'][1] != null) && ($other['data'][1] != -1) && ($other['data'][1] != '')) {
|
if (($other['data'][1] != null) && ($other['data'][1] != -1) && ($other['data'][1] != '')) {
|
||||||
$filter['criticity'] = $other['data'][1];
|
$filter['criticity'] = $other['data'][1];
|
||||||
}
|
}
|
||||||
@ -5546,7 +5548,7 @@ function api_set_enable_module_alerts ($agent_name, $module_name, $thrash3, $thr
|
|||||||
returnData('string', array('type' => 'string', 'data' => "Correct alerts enable"));
|
returnData('string', array('type' => 'string', 'data' => "Correct alerts enable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_tags($thrash1, $thrash2, $other, $returnType, $user_in_db) {
|
function api_get_tags($thrash1, $thrash2, $other, $returnType, $user_in_db) {
|
||||||
if ($other['type'] == 'string') {
|
if ($other['type'] == 'string') {
|
||||||
if ($other['data'] != '') {
|
if ($other['data'] != '') {
|
||||||
returnError('error_parameter', 'Error in the parameters.');
|
returnError('error_parameter', 'Error in the parameters.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user