2012-01-17 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_agents.php extensions/module_groups.php: Fixed bug: sql error in extension "Module Groups" and popup alert. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5376 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0cb5d0bc62
commit
985083d10d
|
@ -1,3 +1,9 @@
|
|||
2012-01-17 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* include/functions_agents.php
|
||||
extensions/module_groups.php: Fixed bug: sql error in
|
||||
extension "Module Groups" and popup alert.
|
||||
|
||||
2012-01-16 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* godmode/netflow/nf_edit.php
|
||||
|
|
|
@ -28,9 +28,9 @@ if (is_ajax ()) {
|
|||
|
||||
$data = false;
|
||||
if ($get_info_alert_module_group) {
|
||||
$agents = agents_get_group_agents($id_agent_group);
|
||||
$agents = agents_get_group_agents($id_agent_group);
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple($agents);
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
if ($module_group == $module['id_module_group']) {
|
||||
|
@ -49,8 +49,7 @@ if (is_ajax ()) {
|
|||
FROM talert_template_module_actions AS t1
|
||||
INNER JOIN talert_actions AS t2 ON t1.id_alert_action = t2.id
|
||||
WHERE t1.id_alert_template_module = ' . $template['id'] . '
|
||||
OR t2.id = ' . $template['id_alert_action'] . ';';
|
||||
|
||||
OR t2.id = ' . $template['id_alert_action'] . ';';
|
||||
$actions = db_get_all_rows_sql($sql);
|
||||
if ($actions === false) {
|
||||
$actions = array();
|
||||
|
@ -129,7 +128,7 @@ function mainModuleGroups() {
|
|||
ui_print_page_header (__("Combined table of agent group and module group"), "images/brick.png", false, "", false, '');
|
||||
|
||||
echo "<p>" . __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") . "</p>";
|
||||
|
||||
|
||||
|
||||
$agentGroups = users_get_groups ($config['id_user'], "AR", false);
|
||||
$modelGroups = users_get_all_model_groups();
|
||||
|
@ -165,18 +164,17 @@ function mainModuleGroups() {
|
|||
|
||||
foreach ($modelGroups as $idModelGroup => $modelGroup) {
|
||||
$query = sprintf($sql,$idAgentGroup, $idModelGroup);
|
||||
|
||||
|
||||
$rowsDB = db_get_all_rows_sql ($query);
|
||||
|
||||
|
||||
|
||||
$agents = agents_get_group_agents($idAgentGroup);
|
||||
|
||||
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple($agents);
|
||||
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
|
||||
|
||||
if ($idModelGroup == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$fired = true;
|
||||
|
@ -184,7 +182,7 @@ function mainModuleGroups() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$states = array();
|
||||
if ($rowsDB !== false) {
|
||||
foreach ($rowsDB as $rowDB) {
|
||||
|
@ -193,6 +191,7 @@ function mainModuleGroups() {
|
|||
}
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach ($states as $idState => $state) {
|
||||
$count += $state;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
|
|||
$orderbyText = sprintf("ORDER BY %s", $orderby);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.nombre AS agent_name, t4.name AS template_name';
|
||||
if ($count !== false) {
|
||||
$selectText = 'COUNT(talert_template_modules.id) AS count';
|
||||
|
@ -198,7 +198,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
|
|||
}else if ($extra_sql != '') {
|
||||
$extra_sql .= ' OR ';
|
||||
}
|
||||
|
||||
|
||||
$sql = sprintf ("SELECT %s
|
||||
FROM talert_template_modules
|
||||
INNER JOIN tagente_modulo t2
|
||||
|
@ -951,11 +951,10 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
|
|||
*/
|
||||
function agents_get_modules ($id_agent = null, $details = false, $filter = false, $indexed = true, $get_not_init_modules = true) {
|
||||
global $config;
|
||||
|
||||
|
||||
if ($id_agent === null) {
|
||||
//Extract the agents of group user.
|
||||
$groups = users_get_groups(false, 'AR', false);
|
||||
|
||||
if(empty($groups)) {
|
||||
return array();
|
||||
}
|
||||
|
@ -975,8 +974,10 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
|||
}
|
||||
$id_agent = $temp;
|
||||
}
|
||||
|
||||
$id_agent = safe_int ($id_agent, 1);
|
||||
|
||||
if (!is_array($id_agent)) {
|
||||
$id_agent = safe_int ($id_agent, 1);
|
||||
}
|
||||
|
||||
$extra_sql = '';
|
||||
if ($id_agent != 0){
|
||||
|
|
Loading…
Reference in New Issue