diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2ed71e1eb3..c5f8324ff9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2013-10-23 Miguel de Dios + + * include/functions_api.php: fixed the get events filtered by the + group in the parameters. + 2013-10-22 Hirofumi Kosaka * include/ajax/module.php: changed the code to avoid to try to diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 518a46e2f6..d393cfe51b 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -5377,15 +5377,28 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db //to a function. $groups = users_get_groups ($user_in_db, "IR"); + $id_groups_user = array(); + if (!empty($groups)) + $id_groups_user = array_keys ($groups); $is_admin = (bool)db_get_value('is_admin', 'tusuario', 'id_user', $user_in_db); $sql_post = ''; - if (!empty($groups)) { - $sql_post = " AND id_grupo IN (".implode (",", array_keys ($groups)).")"; + if (($id_group == -1) || ($id_group == 0)) { + if (!empty($groups)) { + $sql_post = " AND id_grupo IN (".implode (",", $id_groups_user).")"; + } + else if ($is_admin) { + $sql_post = " AND 1 = 0"; + } } - else if ($is_admin) { - $sql_post = " AND 1 = 0"; + else { + if (array_search($id_group, $id_groups_user) !== false) { + $sql_post = " AND id_grupo = " . $id_group; + } + else { + $sql_post = " AND 1 = 0"; + } } // Skip system messages if user is not PM