2012-04-02 Hirofumi Kosaka <kosaka@rworks.jp>

* include/functions_api.php: Added new functions
	get_module_groups and get_plugins to the API.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5858 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
hkosaka 2012-04-02 07:14:42 +00:00
parent 6341966222
commit 9f866ed528
2 changed files with 78 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2012-04-02 Hirofumi Kosaka <kosaka@rworks.jp>
* include/functions_api.php: Added new functions
get_module_groups and get_plugins to the API.
2012-03-31 Junichi Satoh <junichi@rworks.jp>
* extensions/users_connected.php, extensions/module_groups.php: Fixed

View File

@ -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 <csv_separator> 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 <csv_separator> 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.
*