diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1a3becc807..9f8f5729bf 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-04-02 Hirofumi Kosaka + + * include/functions_api.php: Added new functions + get_module_groups and get_plugins to the API. + 2012-03-31 Junichi Satoh * extensions/users_connected.php, extensions/module_groups.php: Fixed diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index fb9ded3876..2d725985ba 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -2244,7 +2244,7 @@ function get_all_alert_templates($thrash1, $thrash2, $other, $thrash3) { returnError('error_get_all_alert_templates', __('Error getting all alert templates.')); } else { - returnData('csv', $data, ';'); + returnData('csv', $data, $separator); } } @@ -2291,6 +2291,78 @@ function get_alert_template($id_template, $thrash1, $other, $thrash3) { } } +/** + * Get module groups, and print all the result like a csv. + * + * @param $thrash1 Don't use. + * @param $thrash2 Don't use. + * @param array $other it's array, but only is available. + * example: + * + * api.php?op=get&op2=module_groups&return_type=csv&other=; + * + * @param $thrash3 Don't use. + */ +function get_module_groups($thrash1, $thrash2, $other, $thrash3) { + + if (!isset($other['data'][0])) + $separator = ';'; // by default + else + $separator = $other['data'][0]; + + $filter = false; + + $module_groups = @db_get_all_rows_filter ('tmodule_group', $filter); + + if ($module_groups !== false) { + $data['type'] = 'array'; + $data['data'] = $module_groups; + } + + if (!$module_groups) { + returnError('error_get_module_groups', __('Error getting module groups.')); + } + else { + returnData('csv', $data, $separator); + } +} + +/** + * Get plugins, and print all the result like a csv. + * + * @param $thrash1 Don't use. + * @param $thrash2 Don't use. + * @param array $other it's array, but only is available. + * example: + * + * api.php?op=get&op2=plugins&return_type=csv&other=; + * + * @param $thrash3 Don't use. + */ +function get_plugins($thrash1, $thrash2, $other, $thrash3) { + + if (!isset($other['data'][0])) + $separator = ';'; // by default + else + $separator = $other['data'][0]; + + $filter = false; + + $plugins = @db_get_all_rows_filter ('tplugin', $filter); + + if ($plugins !== false) { + $data['type'] = 'array'; + $data['data'] = $plugins; + } + + if (!$plugins) { + returnError('error_get_plugins', __('Error getting plugins.')); + } + else { + returnData('csv', $data, $separator); + } +} + /** * Assign a module to an alert template. And return the id of new relationship. *