From 5d5579be14559a49be6672599cafb46073e6c605 Mon Sep 17 00:00:00 2001 From: raulmateos Date: Sun, 31 Dec 2006 00:29:40 +0000 Subject: [PATCH] 2006-12-31 Raul Mateos * include/functions.php, functions_db.php: Move list_group from f*.php to f*_db.php. Add two new functions to show icons. * operation/agentes/*.php, operation/eventos/eventos.php, godmode/agentes/*.php: Updated files to use the new functions for icons. Clear code. Clear sytle. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@343 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++ .../godmode/agentes/configurar_agente.php | 53 ++++++++------ .../godmode/agentes/modificar_agente.php | 72 ++++++++++++------- .../godmode/grupos/configurar_grupo.php | 33 ++++++--- .../godmode/grupos/lista_grupos.php | 65 +++++++++++------ pandora_console/include/functions.php | 17 ----- pandora_console/include/functions_db.php | 48 +++++++++++++ .../operation/agentes/estado_agente.php | 25 +------ .../operation/agentes/estado_alertas.php | 4 +- .../agentes/estado_generalagente.php | 17 ++--- .../agentes/estado_ultimopaquete.php | 50 ++++++++----- .../operation/agentes/status_monitor.php | 11 +-- pandora_console/operation/events/events.php | 14 ++-- 13 files changed, 252 insertions(+), 166 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0dc6771bf1..2bd03b7410 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2006-12-31 Raul Mateos + + * include/functions.php, functions_db.php: Move list_group from f*.php + to f*_db.php. Add two new functions to show icons. + + * operation/agentes/*.php, operation/eventos/eventos.php, + godmode/agentes/*.php: Updated files to use the new functions for icons. + Clear code. Clear sytle. + 2006-12-29 Manuel Arostegui * pandora_console.spec: Added missing path. diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 2bb3def1b8..6fa39c9e05 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -581,7 +581,7 @@ if (give_acl($id_user, 0, "AW")==1) { exit; } // Get information of the module to be deleted - $sql1='SELECT * FROM tagente_modulo + $sql1='SELECT id_agente, nombre, id_tipo_modulo FROM tagente_modulo WHERE id_agente_modulo = '.$id_borrar_modulo; $result=mysql_query($sql1); $row=mysql_fetch_array($result); @@ -683,7 +683,7 @@ while ($row=mysql_fetch_array($result)){ if (isset($id_os)){ echo ""; - $mis_grupos[]=$row["id_grupo"]; //Put in an array all the groups the user belongs - } - } - } -} - ?> diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 81bde2b984..ad7db61916 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -574,5 +574,53 @@ function give_agentmodule_flag($id_agent_module){ return $interval; } +// ---------------------------------------------------------------------- +// Returns a combo with the groups and defines an array +// to put all groups with Agent Read permission +// ---------------------------------------------------------------------- + +function list_group ($id_user){ + $mis_grupos[]=""; // Define array mis_grupos to put here all groups with Agent Read permission + $sql='SELECT id_grupo FROM tgrupo'; + $result=mysql_query($sql); + while ($row=mysql_fetch_array($result)){ + if ($row["id_grupo"] != 1){ + if (give_acl($id_user,$row["id_grupo"], "AR") == 1){ + echo ""; + $mis_grupos[]=$row["id_grupo"]; //Put in an array all the groups the user belongs + } + } + } + return ($mis_grupos); +} + +// --------------------------------------------------------------- +// Return Group iconname given its name +// --------------------------------------------------------------- + +function show_icon_group($id_group){ + $sql="SELECT icon FROM tgrupo WHERE id_grupo='$id_group'"; + $result=mysql_query($sql); + if ($row=mysql_fetch_array($result)) + $pro=$row["icon"]; + else + $pro = ""; + return $pro; +} + +// --------------------------------------------------------------- +// Return Type iconname given its name +// --------------------------------------------------------------- + +function show_icon_type($id_tipo){ + $sql="SELECT id_tipo, icon FROM ttipo_modulo WHERE id_tipo='$id_tipo'"; + $result=mysql_query($sql); + if ($row=mysql_fetch_array($result)) + $pro=$row["icon"]; + else + $pro = ""; + return $pro; +} ?> \ No newline at end of file diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 94793bc2f0..c3470d5cc3 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -63,21 +63,7 @@ if (comprueba_login() == 0) { ""; } echo ""; // Group all is always active - // Group 1 (ALL) gives A LOT of problems, be careful with this code: - // Run query on all groups and show data only if ACL check its ok: $iduser_temp is user, and acl is AR (agent read) - $mis_grupos[]=""; // Define array mis_grupos to put here all groups with Agent Read permission - - $sql='SELECT id_grupo FROM tgrupo'; - $result=mysql_query($sql); - while ($row=mysql_fetch_array($result)){ - if ($row["id_grupo"] != 1){ - if (give_acl($id_user,$row["id_grupo"], "AR") == 1){ - echo ""; - $mis_grupos[]=$row["id_grupo"]; //Put in an array all the groups the user belongs - } - } - } + $mis_grupos=list_group ($id_user); //Print combo for groups and set an array with all groups echo ""; echo "