diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 98dacdc7e5..61675912c3 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -70,7 +70,7 @@ function mainAgentsModules() { $hor_offset = (int)get_parameter('hor_offset', 0); $block = $config['block_size']; if(get_parameter('modulegroup') != null){ - $agents_id = (array)get_parameter('id_agents2', -1); + $agents_id = (array)get_parameter('id_agents2', null); } $selection_a_m = (int)get_parameter('selection_agent_module'); $modules_selected = (array)get_parameter('module', 0); @@ -100,6 +100,9 @@ function mainAgentsModules() { if($agents_id[0] != -1 ){ serialize_in_temp($agents_id, $config['id_user']."_agents", 1); } + + + //if($agents_id != -1) $agents_id = null; if ($config["pure"] == 0) { if($modules_selected[0] && $agents_id[0]){ @@ -132,8 +135,6 @@ function mainAgentsModules() { } } - $groups = users_get_groups (); - //groups $filter_groups_label = ''.__('Group').''; $filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;'); @@ -144,18 +145,7 @@ function mainAgentsModules() { $filter_module_groups_label = ''.__('Module group').''; $filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", 'modulegroup', $modulegroup, '',__('All'), 0, true, false, true, false, 'width: auto;'); - - $agents_select = array(); - if (is_array($id_agents) || is_object($id_agents)){ - foreach ($id_agents as $id) { - foreach ($agents as $key => $a) { - if ($key == (int)$id) { - $agents_select[$key] = $key; - } - } - } - } - + //agent $agents = agents_get_group_agents($group_id); if ((empty($agents)) || $agents == -1) $agents = array(); @@ -293,6 +283,7 @@ function mainAgentsModules() { $count = 0; foreach ($agents as $agent) { + // TODO TAGS agents_get_modules $module = agents_get_modules($agent, false, $filter_module_group, true, true); if ($module == false) { @@ -301,7 +292,6 @@ function mainAgentsModules() { $count++; } $total_pagination = count($agents); - if($agents_id[0] != -1){ $all_modules = array(); foreach ($modules_selected as $key => $value) { @@ -332,11 +322,11 @@ function mainAgentsModules() { foreach ($result_sql as $key => $value) { $all_modules[$value['id_agente_modulo']] = io_safe_output($name); } - } - // $all_modules[$value] = modules_get_agentmodule_name($value); + } } } else { + // TODO TAGS agents_get_modules $all_modules = agents_get_modules($agents, false, $filter_module_group, true, true); } @@ -346,7 +336,6 @@ function mainAgentsModules() { $modules_by_name = array(); $name = ''; $cont = 0; - foreach ($all_modules as $key => $module) { if ($module == $name) { $modules_by_name[$cont-1]['id'][] = $key; @@ -358,7 +347,6 @@ function mainAgentsModules() { $cont ++; } } - if ($config["pure"] == 1) { $block = count($modules_by_name); } @@ -381,7 +369,10 @@ function mainAgentsModules() { $filter_groups['id_grupo'] = $group_id; } } - $agents = agents_get_agents ($filter_groups); + + if (!empty($filter_groups['id_agente'])) { + $agents = agents_get_agents ($filter_groups); + } $nagents = count($agents); if ($all_modules == false || $agents == false) { @@ -499,10 +490,10 @@ function mainAgentsModules() { " . $alias['alias'] . ""; + // TODO TAGS agents_get_modules $agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true); $nmodules = 0; - foreach ($modules_by_name as $module) { $nmodules++; diff --git a/pandora_console/extensions/matrix_events/ajax.php b/pandora_console/extensions/matrix_events/ajax.php index fc05d45f19..8e94e396f5 100644 --- a/pandora_console/extensions/matrix_events/ajax.php +++ b/pandora_console/extensions/matrix_events/ajax.php @@ -32,26 +32,17 @@ if (is_ajax()) { $limit = (int) get_parameter("limit", 5); $tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND'); - $filter = "estado<>1 $tags_condition"; + + $filter = "estado <> 1 $tags_condition"; - switch ($config["dbtype"]) { - case "mysql": - case "postgresql": - $sql = sprintf ("SELECT id_agente, evento, utimestamp - FROM tevento - WHERE %s - ORDER BY utimestamp DESC LIMIT %d", - $filter, $limit); - break; - case "oracle": - $sql = sprintf ("SELECT * - FROM tevento - WHERE %s - AND rownum <= %d - ORDER BY utimestamp DESC", - $filter, $limit); - break; - } + $sql = sprintf ("SELECT id_agente, evento, utimestamp + FROM tevento + LEFT JOIN tagent_secondary_group + ON tevento.id_agente = tagent_secondary_group.id_agent + WHERE %s + ORDER BY utimestamp DESC LIMIT %d", + $filter, $limit); + $result = db_get_all_rows_sql ($sql); $events = array(); diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 82f0af0f7e..4af38ec669 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -106,8 +106,6 @@ $form .= html_print_table($table, true); $form .= ''; ui_toggle($form, __("Filter"), "", false); -// ui_toggle(graphic_user_activity(400, 150), __("Chart")); - $filter = "1=1"; if (!empty($filter_type)) { diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 793db54308..49a9a85d9a 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -207,11 +207,6 @@ if ($create_agent) { $agent_creation_error = __('No agent alias specified'); $agent_created_ok = 0; } - /*elseif (agents_get_agent_id ($nombre_agente)) { - $agent_creation_error = - __('There is already an agent in the database with this name'); - $agent_created_ok = 0; - }*/ else { if($alias_as_name){ $sql = 'SELECT nombre FROM tagente WHERE nombre = "' . $alias . '"'; diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 091e6f413b..dc606ad1f5 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -424,9 +424,11 @@ foreach ($order as $ord) { $limit = (int) $config["block_size"]; $offset = (int) get_parameter ('offset'); -$params = implode(',', +$params = ($checked) + ? "tagente_modulo.*, tmodule_group.*" + : implode(',', array( - 'id_agente_modulo', + 'tagente_modulo.id_agente_modulo', 'id_tipo_modulo', 'descripcion', 'nombre', @@ -453,80 +455,46 @@ $search_string_entities = io_safe_input($search_string); $basic_where = sprintf("(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities); -$where_tags = tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 'tagente_modulo'); +// Tags acl +$agent_tags = tags_get_user_applied_agent_tags($id_agente); +if ($agent_tags !== true) { + $where_tags = " AND ttag_module.id_tag IN (" . implode(',', $agent_tags) . ")"; +} $paginate_module = false; if (isset($config['paginate_module'])) $paginate_module = $config['paginate_module']; -switch ($config["dbtype"]) { - case "postgresql": - if ($paginate_module) { - $limit_sql = " LIMIT $limit OFFSET $offset "; - } - else { - $limit_sql = ''; - } - case "mysql": - if ($paginate_module) { - if (!isset($limit_sql)) { - $limit_sql = " LIMIT $offset, $limit "; - } - } - else { - $limit_sql = ''; - } - if ($checked) { - $sql = sprintf("SELECT * - FROM tagente_modulo - LEFT JOIN tmodule_group - ON tagente_modulo.id_module_group = tmodule_group.id_mg - WHERE %s %s %s %s %s", - $basic_where, $where, $where_tags, $order_sql, $limit_sql); - } - else { - $sql = sprintf("SELECT %s - FROM tagente_modulo - LEFT JOIN tmodule_group - ON tagente_modulo.id_module_group = tmodule_group.id_mg - WHERE %s %s %s %s %s", - $params, $basic_where, $where, $where_tags, $order_sql, $limit_sql); - } - - - $modules = db_get_all_rows_sql($sql); - break; - case "oracle": - $set = array(); - if ($paginate_module) { - $set['limit'] = $limit; - $set['offset'] = $offset; - } - - if ($checked) { - $sql = sprintf("SELECT * - FROM tagente_modulo - LEFT JOIN tmodule_group - ON tmodule_group.id_mg = tagente_modulo.id_module_group - WHERE %s %s %s %s", - $basic_where, $where, $where_tags, $order_sql); - } - else { - $sql = sprintf("SELECT %s - FROM tagente_modulo - LEFT JOIN tmodule_group - ON tmodule_group.id_mg = tagente_modulo.id_module_group - WHERE %s %s %s %s", - $params, $basic_where, $where, $where_tags, $order_sql); - } - - $modules = oracle_recode_query ($sql, $set, 'AND', false); - break; +if ($paginate_module) { + if (!isset($limit_sql)) { + $limit_sql = " LIMIT $offset, $limit "; + } } +else { + $limit_sql = ''; +} +$sql = sprintf("SELECT tagente_modulo.*, tmodule_group.* + FROM tagente_modulo + LEFT JOIN tmodule_group + ON tagente_modulo.id_module_group = tmodule_group.id_mg + LEFT JOIN ttag_module + ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo + WHERE %s %s %s + GROUP BY tagente_modulo.id_agente_modulo + %s %s", + $basic_where, $where, $where_tags, + $order_sql, $limit_sql +); -$sql_total_modules = sprintf("SELECT count(*) +$modules = db_get_all_rows_sql($sql); + +$sql_total_modules = sprintf( + "SELECT count(DISTINCT(tagente_modulo.id_agente_modulo)) FROM tagente_modulo - WHERE %s %s %s", $basic_where, $where, $where_tags); + LEFT JOIN ttag_module + ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo + WHERE %s %s %s", $basic_where, $where, $where_tags +); $total_modules = db_get_value_sql($sql_total_modules); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 9208c8fd77..0527bea08d 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -189,9 +189,23 @@ $table_simple->data[0][3] .= html_print_select_from_sql ('SELECT id_mg, name FRO $in_policy = strstr($page, "policy_modules"); if (!$in_policy) { + // Cannot select the current module to be itself parent + $module_parent_filter = $id_agent_module + ? array("tagente_modulo.id_agente_modulo" => "<>$id_agent_module") + : ""; $table_simple->data[1][0] = __('Module parent'); - $table_simple->data[1][1] .= html_print_select_from_sql ('SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = ' . $id_agente . ' ORDER BY nombre', - 'parent_module_id', $parent_module_id, '', __('Not assigned'), '0', true, false, true); + $modules_can_be_parent = agents_get_modules($id_agente, false, $module_parent_filter); + // If the user cannot have access to parent module, only print the name + if ($parent_module_id != 0 && !in_array($parent_module_id, array_keys($modules_can_be_parent))) { + $table_simple->data[1][1] = db_get_value( + 'nombre', 'tagente_modulo', 'id_agente_modulo', $parent_module_id + ); + } else { + $table_simple->data[1][1] = html_print_select ( + $modules_can_be_parent, 'parent_module_id', $parent_module_id, '', + __('Not assigned'), '0', true + ); + } } $table_simple->data[2][0] = __('Type').' ' . ui_print_help_icon ('module_type', true); diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 85ce6c3c02..887c6b2b31 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -70,6 +70,7 @@ if (! $id_agente) { $table->data[0][0] = __('Module'); $modules = array (); + if ($id_agente) $modules = agents_get_modules ($id_agente, false, array("delete_pending" => 0)); diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index f83d19e14d..8c305fd90f 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -399,9 +399,8 @@ if (!is_metaconsole()) { $text_module, false, true, '', array(), true, $id_agent_module); } -$sources = events_get_all_source(); $table ->data[22][0] = '' . __('Source') . ''; -$table ->data[22][1] = html_print_select ($sources, 'source', $source, '', '', '', true); +$table ->data[22][1] = html_print_input_text ('source', $source, '', 35, 255, true); $table ->data[23][0] = '' . __('Extra ID') . ''; $table ->data[23][1] = html_print_input_text ('id_extra', $id_extra, '', 11, 255, true); diff --git a/pandora_console/godmode/massive/massive_add_tags.php b/pandora_console/godmode/massive/massive_add_tags.php deleted file mode 100755 index 6d97f0d9e9..0000000000 --- a/pandora_console/godmode/massive/massive_add_tags.php +++ /dev/null @@ -1,249 +0,0 @@ - $name_module) { - $modules_id[] = $id_module; - } - } - } - - - $conttotal = 0; - $contsuccess = 0; - foreach ($modules_id as $id_module) { - $err_count = tags_insert_module_tag($id_module, $id_tags); - - if ($err_count == 0) { - $contsuccess ++; - } - - $conttotal ++; - } - - if ($contsuccess > 0) { - db_pandora_audit("Massive management", "Add tags", false, false, - ""); - } - else { - db_pandora_audit("Massive management", "Fail try to add tags", - false, false, ""); - } - - ui_print_result_message ($contsuccess > 0, - __('Successfully added') . "(" . $contsuccess . "/" . $conttotal . ")", - __('Could not be added')); - -} - -$id_agents = get_parameter ('id_agents'); -$id_tags = get_parameter ('id_tags'); -$modules = get_parameter ('module'); - -$add = (bool) get_parameter_post ('add'); - -if ($add) { - process_manage_add ($id_agents, $modules, $id_tags); -} - -$groups = users_get_groups (); -$own_info = get_user_info($config['id_user']); -if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW")) - $return_all_group = false; -else - $return_all_group = true; - -$table->id = 'add_table'; -$table->width = '98%'; -$table->data = array (); -$table->style = array (); -$table->style[0] = 'font-weight: bold; vertical-align:top'; -$table->style[2] = 'font-weight: bold; vertical-align:top'; -$table->size = array (); -$table->size[0] = '15%'; -$table->size[1] = '40%'; -$table->size[2] = '15%'; -$table->size[3] = '40%'; - -$table->data = array (); - -$table->data[0][0] = __('Group'); -$table->data[0][1] = html_print_select_groups(false, "AW", - $return_all_group, 'id_group', 0, '', 'Select', -1, true, false, - true, '', false, 'width:180px;'); - -$table->data[1][0] = __('Agents'); -$table->data[1][0] .= ''; - -$agents = agents_get_group_agents( - array_keys(users_get_groups ($config["id_user"], "AW", false))); -$table->data[1][1] = html_print_select ($agents, - 'id_agents[]', '', '', '', '', true, true, true, '', false, 'width:180px;'); - -$table->data[1][2] = __('Modules'); -$table->data[1][2] .= ''; -$table->data[1][3] = '' . - html_print_select (array(), 'module[]', '', false, '', '', true, true, false, '', false, 'width:180px;'); - - -$table->data[2][0] = __('Tags'); -$tags = tags_get_all_tags(); -$table->data[2][1] = html_print_select ($tags, - 'id_tags[]', '', '', '', '', true, true, true, '', false, 'width:180px;'); - - -echo '
'; -html_print_table ($table); - -echo '
'; -html_print_input_hidden ('add', 1); - -html_print_submit_button (__('Add'), 'go', false, 'class="sub add"'); -echo '
'; -echo '
'; - -// TODO: Change to iu_print_error system -echo ''; - -//Hack to translate text "none" in PHP to javascript -echo ''; - -ui_require_jquery_file ('form'); -ui_require_jquery_file ('pandora.controls'); -?> - - diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index 4646dea1a8..be10127a80 100755 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -78,146 +78,18 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all' if (($module_name[0] == "0") and (is_array($module_name)) and (count($module_name) == 1)) $filter_for_module_deletion = false; else - $filter_for_module_deletion = sprintf('nombre IN ("%s")', implode('","', $module_name)); + $filter_for_module_deletion = sprintf('tagente_modulo.nombre IN ("%s")', implode('","', $module_name)); - if ($config['dbtype'] == "oracle") { - $all_agent_modules = false; - if (($module_name[0] == "0") and (is_array($module_name)) and (count($module_name) == 1)) { - $all_agent_modules = true; - } - $names_to_long = array(); - $i = 0; - foreach ($module_name as $name) { - if (strlen($name) > 30) { - $original_names[] = $module_name[$i]; - unset($module_name[$i]); - $names_to_long[] = substr($name, 0, 28) . "%"; - } - $i++; - } - $modules = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE"; - $modules .= sprintf(" id_agente IN (%s)", implode(",", $id_agents)); - if (!empty($module_name) && (!$all_agent_modules)) { - $modules .= sprintf(" AND nombre IN ('%s')", implode("','", $module_name)); - } - $modules = db_get_all_rows_sql($modules); - $modules2 = ""; - if (!empty($names_to_long) && (!$all_agent_modules)) { - $modules2 = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE"; - $modules2 .= sprintf(" id_agente IN (%s) AND (", implode(",", $id_agents)); - $j = 0; - foreach ($names_to_long as $name) { - if ($j == 0) { - $modules2 .= "nombre LIKE ('" . $name . "')"; - } - else { - $modules2 .= " OR nombre LIKE ('" . $name . "')"; - } - $j++; - } - $modules2 .= ")"; - $modules2 = db_get_all_rows_sql($modules2); - $modules = array_merge($modules, $modules2); - } - $all_names = array(); - foreach ($modules as $module) { - $all_modules[] = $module['id_agente_modulo']; - $all_names[] = $module['nombre']; - } - $modules = $all_modules; - $modules = array_unique($modules); - if (!empty($names_to_long) && (!$all_agent_modules)) { - $j = 0; - foreach ($all_names as $name) { - if (strlen($name) > 30) { - if (!in_array($name, $original_names)) { - unset($modules[$j]); - } - } - $j++; - } - } - } - else { - $modules = agents_get_modules ($id_agents, 'id_agente_modulo', - $filter_for_module_deletion, true); - } + $modules = agents_get_modules ($id_agents, 'id_agente_modulo', + $filter_for_module_deletion, true); } else { - if ($config['dbtype'] == "oracle") { - $all_agent_modules = false; - $names_to_long = array(); - if (($module_name[0] == "0") and (is_array($module_name)) and (count($module_name) == 1)) { - $all_agent_modules = true; - } - $i = 0; - foreach ($module_name as $name) { - if (strlen($name) > 30) { - $original_names[] = $module_name[$i]; - unset($module_name[$i]); - $names_to_long[] = substr($name, 0, 28) . "%"; - } - $i++; - } - $modules = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE"; - $any_agent = false; - if ($id_agents == null) { - $any_agent = true; - } - if (!empty($id_agents)) { - $modules .= sprintf(" id_agente IN (%s)", implode(",", $id_agents)); - $agents_selected = true; - } - if (!empty($module_name) && (!$all_agent_modules)) { - if ($any_agent) { - $modules .= sprintf(" nombre IN ('%s')", implode("','", $module_name)); - } - else { - $modules .= sprintf(" AND nombre IN ('%s')", implode("','", $module_name)); - } - } - $modules = db_get_all_rows_sql($modules); - if (!empty($names_to_long) && (!$all_agent_modules)) { - $modules2 = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE"; - $modules2 .= sprintf(" id_agente IN (%s) AND (", implode(",", $id_agents)); - $j = 0; - foreach ($names_to_long as $name) { - if ($j == 0) { - $modules2 .= "nombre LIKE ('" . $name . "')"; - } - else { - $modules2 .= " OR nombre LIKE ('" . $name . "')"; - } - $j++; - } - $modules2 .= ")"; - $modules2 = db_get_all_rows_sql($modules2); - $modules = array_merge($modules, $modules2); - } - $all_names = array(); - foreach ($modules as $module) { - $all_modules[] = $module['id_agente_modulo']; - $all_names[] = $module['nombre']; - } - $modules = $all_modules; - $modules = array_unique($modules); - if (!empty($names_to_long) && (!$all_agent_modules)) { - $j = 0; - foreach ($all_names as $name) { - if (strlen($name) > 30) { - if (!in_array($name, $original_names)) { - unset($modules[$j]); - } - } - $j++; - } - } - } - else { - if ($status_module != -1) // If module status filter has been applied - $modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s") AND id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = %s OR utimestamp=0 )', implode('","',$module_name), $status_module), true); - else - $modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s")', implode('","',$module_name)), true); + if ($status_module != -1) { + $modules = agents_get_modules ($id_agents, 'id_agente_modulo', + sprintf('tagente_modulo.nombre IN ("%s") AND tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = %s OR utimestamp=0 )', implode('","',$module_name), $status_module), true); + } else { + $modules = agents_get_modules ($id_agents, 'id_agente_modulo', + 'tagente_modulo.nombre IN ("' . implode('","',$module_name) . '")', true); } } @@ -236,12 +108,7 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all' } $count_deleted_modules = count($modules); - if ($config['dbtype'] == "oracle") { - $success = db_process_sql(sprintf("DELETE FROM tagente_modulo WHERE id_agente_modulo IN (%s)", implode(",", $modules))); - } - else { - $success = modules_delete_agent_module ($modules); - } + $success = modules_delete_agent_module ($modules); if (! $success) { ui_print_error_message( @@ -258,8 +125,6 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all' } $module_type = (int) get_parameter ('module_type'); -$idGroupMassive = (int) get_parameter('id_group_massive'); -$idAgentMassive = (int) get_parameter('id_agent_massive'); $group_select = get_parameter('groups_select'); $delete = (bool) get_parameter_post ('delete'); @@ -281,9 +146,7 @@ if ($delete) { $agents_ = array(); } - foreach ($agents_select as $agent_name) { - $agents_[] = agents_get_agent_id(io_safe_output($agent_name)); - } + $agents_ = $agents_select; $modules_ = $module_name; break; case 'agents': @@ -366,35 +229,18 @@ $groups = users_get_groups (); $agents = agents_get_group_agents (array_keys (users_get_groups ()), false, "none"); -switch ($config["dbtype"]) { - case "mysql": - $module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo', - array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', - 'id_agente' => array_keys ($agents), - 'disabled' => 0, - 'order' => 'ttipo_modulo.nombre'), - array ('DISTINCT(id_tipo)', - 'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description')); - break; - case "oracle": - $module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo', - array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', - 'id_agente' => array_keys ($agents), - 'disabled' => 0, - 'order' => 'ttipo_modulo.nombre'), - array ('ttipo_modulo.id_tipo', - 'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description')); - break; - case "postgresql": - $module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo', - array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', - 'id_agente' => array_keys ($agents), - 'disabled' => 0, - 'order' => 'description'), - array ('DISTINCT(id_tipo)', - 'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description')); - break; -} +$module_types = db_get_all_rows_filter ( + 'tagente_modulo,ttipo_modulo', + array ( + 'tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', + 'id_agente' => array_keys ($agents), + 'disabled' => 0, + 'order' => 'ttipo_modulo.nombre' + ), array ( + 'DISTINCT(id_tipo)', + 'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description' + ) +); if ($module_types === false) $module_types = array (); @@ -410,16 +256,12 @@ $table->data = array (); $table->style[0] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold'; - - $table->data['selection_mode'][0] = __('Selection mode'); $table->data['selection_mode'][1] = ''.__('Select modules first ') . '' . html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'
'; $table->data['selection_mode'][1] .= ''.__('Select agents first ') . '' . html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true); - - $table->rowclass['form_modules_1'] = 'select_modules_row'; $table->data['form_modules_1'][0] = __('Module type'); $table->data['form_modules_1'][0] .= '