2013-04-02 Dario Rodriguez <dario@artica.es>
* include/functions_api.php: New function to create a tag via API. * include/functions_tags.php: Create tag only if not exists. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
38576c4470
commit
1706c1f9fd
|
@ -1,3 +1,9 @@
|
|||
2013-04-02 Dario Rodriguez <dario@artica.es>
|
||||
|
||||
* include/functions_api.php: New function to create a tag
|
||||
via API.
|
||||
* include/functions_tags.php: Create tag only if not exists.
|
||||
|
||||
2013-04-02 Mario Pulido <mario.pulido@artica.es>
|
||||
|
||||
* include/help/en/help_inventory_tab.php,
|
||||
|
|
|
@ -5698,6 +5698,40 @@ function api_get_event_info($id_event, $trash1, $trash, $returnType) {
|
|||
return;
|
||||
}
|
||||
|
||||
//http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_tag&other=tag_name|tag_description|tag_url|tag_email&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||
function api_set_create_tag ($id, $trash1, $other, $returnType) {
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($other['type'] == 'string') {
|
||||
$data["name"] = $other["data"];
|
||||
} else if ($other['type'] == 'array') {
|
||||
|
||||
$data['name'] = $other["data"][0];
|
||||
|
||||
if ($other["data"][1] != '') {
|
||||
$data['description'] = $other["data"][1];
|
||||
} else {
|
||||
$data['description'] = "";
|
||||
}
|
||||
|
||||
if ($other["data"][1] != '') {
|
||||
$data['url'] = $other["data"][2];
|
||||
} else {
|
||||
$data['url'] = "";
|
||||
}
|
||||
|
||||
if ($other["data"][1] != '') {
|
||||
$data['email'] = $other["data"][3];
|
||||
} else {
|
||||
$data['email'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
tags_create_tag ($data);
|
||||
}
|
||||
|
||||
|
||||
//http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_event&id=name_event&other=2|system|3|admin|2|1|10|0|comments||Pandora||critical_inst|warning_inst|unknown_inst|other&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||
function api_set_create_event($id, $trash1, $other, $returnType) {
|
||||
|
||||
|
|
|
@ -197,6 +197,11 @@ function tags_create_tag($values) {
|
|||
if (empty($values)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//No create tag if the tag exists
|
||||
if (tags_get_id($values["name"])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return db_process_sql_insert('ttag',$values);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue