2006-12-31 Raul Mateos <raulofpandora@gmail.com>

* 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
This commit is contained in:
raulmateos 2006-12-31 00:29:40 +00:00
parent efbcae7299
commit 5d5579be14
13 changed files with 252 additions and 166 deletions

View File

@ -1,3 +1,12 @@
2006-12-31 Raul Mateos <raulofpandora@gmail.com>
* 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 <marostegui@artica.es>
* pandora_console.spec: Added missing path.

View File

@ -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 "<option value='".$id_os."'>".dame_so_name($id_os);
}
$sql1='SELECT * FROM tconfig_os ORDER BY name';
$sql1='SELECT id_os, name FROM tconfig_os ORDER BY name';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_os"]."'>".$row["name"];
@ -696,7 +696,7 @@ while ($row=mysql_fetch_array($result)){
<select name="id_server" class="w130">
<?php
echo "<option value='".$id_server."'>".give_server_name($id_server);
$sql1='SELECT * FROM tserver where network_server = 1 ORDER BY name';
$sql1='SELECT id_server, name FROM tserver where network_server = 1 ORDER BY name';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_server"]."'>".$row["name"];
@ -760,19 +760,15 @@ if (isset($_GET["creacion"])){
if ( $creacion_agente != 1) {
// MODULE VISUALIZATION
// ======================
// Load icon index for ttipo_modulo
$iconindex[]="";
$sql_t='SELECT * FROM ttipo_modulo';
$result_t=mysql_query($sql_t);
while ($row_t=mysql_fetch_array($result_t)){
$iconindex[$row_t["id_tipo"]] = $row_t["icon"];
}
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'" order by nombre';
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'"
ORDER BY nombre';
$result=mysql_query($sql1);
if ($row=mysql_num_rows($result)){
?>
<h3><?php echo $lang_label["assigned_modules"]?><a href='help/<?php echo $help_code ?>/chap3.php#321' target='_help' class='help'>&nbsp;<span><?php echo $lang_label["help"] ?></span></a></h3>
<h3><?php echo $lang_label["assigned_modules"]?>
<a href='help/<?php echo $help_code ?>/chap3.php#321' target='_help' class='help'>
<span><?php echo $lang_label["help"] ?></span></a></h3>
<table width="700" cellpadding="3" cellspacing="3" class="fon">
<tr>
<th><?php echo $lang_label["module_name"]?>
@ -803,7 +799,7 @@ if ( $creacion_agente != 1) {
echo "<tr><td class='".$tdcolor."_id'>".$nombre_modulo;
echo "<td class='".$tdcolor."f9'>";
if ($id_tipo > 0) {
echo "<img src='images/".$iconindex[$id_tipo]."' border=0>";
echo "<img src='images/".show_icon_type($id_tipo)."' border=0>";
}
if ($module_interval2!=0){
echo "<td class='$tdcolor'>".$module_interval2;
@ -811,8 +807,9 @@ if ( $creacion_agente != 1) {
echo "<td class='$tdcolor'> N/A";
}
echo "<td class='$tdcolor'>".substr($descripcion,0,30);
echo "<td class='$tdcolor'>".substr(dame_nombre_grupomodulo($module_group2),0,15);
echo "<td class='$tdcolor'>".substr($descripcion,0,30)."</td>";
echo "<td class='$tdcolor'>".
substr(dame_nombre_grupomodulo($module_group2),0,15)."</td>";
echo "<td class='$tdcolor'>";
if ($module_max == $module_min) {
$module_max = "N/A";
@ -821,8 +818,17 @@ if ( $creacion_agente != 1) {
echo $module_max." / ".$module_min;
echo "<td class='$tdcolor'>";
if ($id_tipo != -1)
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."&delete_module=".$row["id_agente_modulo"]."'><img src='images/cancel.gif' border=0 alt='".$lang_label["delete"]."'></b></a> &nbsp; ";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."&update_module=".$row["id_agente_modulo"]."#modules'><img src='images/config.gif' border=0 alt='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
echo "<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&
id_agente=".$id_agente."&
delete_module=".$row["id_agente_modulo"]."'>
<img src='images/cancel.gif' border=0 alt='".$lang_label["delete"]."'>
</b></a> &nbsp; ";
echo "<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&
id_agente=".$id_agente."&
update_module=".$row["id_agente_modulo"]."#modules'>
<img src='images/config.gif' border=0 alt='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
}
echo "<tr><td colspan='7'><div class='raya'></div></td></tr>";
} else
@ -852,7 +858,8 @@ $result=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
//module type modulo is $row2["nombre"];
$sql3='SELECT * FROM talerta_agente_modulo WHERE id_agente_modulo = '.$row["id_agente_modulo"]; // From all the alerts give me which are from my agent
$sql3='SELECT * FROM talerta_agente_modulo
WHERE id_agente_modulo = '.$row["id_agente_modulo"]; // From all the alerts give me which are from my agent
$result3=mysql_query($sql3);
while ($row3=mysql_fetch_array($result3)){
if ($color == 1){
@ -876,8 +883,14 @@ $result=mysql_query($sql1);
$string = $string."<td class='$tdcolor'>";
$id_grupo = dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "LW")==1){
$string = $string."<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."&delete_alert=".$row3["id_aam"]."'><img src='images/cancel.gif' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string = $string."<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."&update_alert=".$row3["id_aam"]."#alerts'><img src='images/config.gif' border=0 alt='".$lang_label["update"]."'></a>";
$string = $string."<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&
id_agente=".$id_agente."&delete_alert=".$row3["id_aam"]."'>
<img src='images/cancel.gif' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string = $string."<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&
id_agente=".$id_agente."&update_alert=".$row3["id_aam"]."#alerts'>
<img src='images/config.gif' border=0 alt='".$lang_label["update"]."'></a>";
}
}
}

View File

@ -26,52 +26,54 @@ if (give_acl($id_user, 0, "AW")==1) {
$id_grupo = dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "AW")==1){
// Firts delete from agents table
$sql_delete= "DELETE FROM tagente WHERE id_agente = ".$id_agente;
$sql_delete= "DELETE FROM tagente
WHERE id_agente = ".$id_agente;
$result=mysql_query($sql_delete);
if (! $result)
echo "<h3 class='error'>".$lang_label["delete_agent_no"]."</h3>";
else
echo "<h3 class='suc'>".$lang_label["delete_agent_ok"]."</h3>";
// Delete agent access table
$sql_delete = "DELETE FROM tagent_access WHERE id_agent = ".$id_agente;
$sql_delete = "DELETE FROM tagent_access
WHERE id_agent = ".$id_agente;
// Delete tagente_datos data
$result=mysql_query($sql_delete);
$sql_delete4="DELETE FROM tagente_datos WHERE id_agente=".$id_agente;
$sql_delete4="DELETE FROM tagente_datos
WHERE id_agente=".$id_agente;
$result=mysql_query($sql_delete4);
// Delete tagente_datos_string data
$result=mysql_query($sql_delete);
$sql_delete4="DELETE FROM tagente_datos_string WHERE id_agente=".$id_agente;
$sql_delete4="DELETE FROM tagente_datos_string
WHERE id_agente=".$id_agente;
$result=mysql_query($sql_delete4);
// Delete from tagente_datos
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$sql1='SELECT * FROM tagente_modulo
WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete4="DELETE FROM tagente_datos_inc WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete4="DELETE FROM tagente_datos_inc
WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result=mysql_query($sql_delete4);
}
$sql_delete2 ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente; // delete from tagente_modulo
$sql_delete3 ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente; // delete from tagente_estado
$sql_delete2 ="DELETE FROM tagente_modulo
WHERE id_agente = ".$id_agente; // delete from tagente_modulo
$sql_delete3 ="DELETE FROM tagente_estado
WHERE id_agente = ".$id_agente; // delete from tagente_estado
$result=mysql_query($sql_delete2);
$result=mysql_query($sql_delete3);
} else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to delete an Agent");
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
"Trying to delete an Agent");
require ("general/noaccess.php");
}
}
echo "<h2>".$lang_label["agent_conf"]."</h2>";
echo "<h3>".$lang_label["agent_defined2"]."
<a href='help/".$help_code."/chap3.php#3' target='_help' class='help'>
&nbsp;<span>".$lang_label["help"]."</span></a></h3>";
<span>".$lang_label["help"]."</span></a></h3>";
// Load icon index from tgrupos
$iconindex_g[]="";
$sql_g='SELECT * FROM tgrupo';
$result_g=mysql_query($sql_g);
while ($row_g=mysql_fetch_array($result_g)){
$iconindex_g[$row_g["id_grupo"]] = $row_g["icon"];
}
$sql1='SELECT * FROM tagente ORDER BY nombre';
$sql1='SELECT id_agente, nombre, id_grupo, comentarios
FROM tagente ORDER BY nombre';
$result=mysql_query($sql1);
if (mysql_num_rows($result)){
echo "<table cellpadding='3' cellspacing='3' width='600'>";
@ -91,27 +93,43 @@ if (give_acl($id_user, 0, "AW")==1) {
$color = 1;
}
if (give_acl($id_user, $id_grupo, "AW")==1){
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$row["id_agente"]."'>".$row["nombre"]."</a></b>";
echo "<td class='$tdcolor'> <img src='images/g_".$iconindex_g[$id_grupo].".gif' border='0'> ( ".dame_grupo($id_grupo)." )</td>";
echo "<tr><td class='$tdcolor'>
<b><a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&
id_agente=".$row["id_agente"]."'>".$row["nombre"]."</a></b></td>";
echo "<td class='$tdcolor'>
<img src='images/g_".show_icon_group($id_grupo).".gif' border='0'>
( ".dame_grupo($id_grupo)." )</td>";
echo "<td class='$tdcolor'>".$row["comentarios"]."</td>";
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$row["id_agente"]."' onClick='if (!confirm(\' ".$lang_label["are_you_sure"]."\')) return false;'><img border='0' src='images/cancel.gif'></a></td>";
echo "<td class='$tdcolor' align='center'>
<a href='index.php?sec=gagente&
sec2=godmode/agentes/modificar_agente&
borrar_agente=".$row["id_agente"]."'
onClick='if (!confirm(\' ".$lang_label["are_you_sure"]."\'))
return false;'>
<img border='0' src='images/cancel.gif'></a></td>";
}
}
echo "<tr><td colspan='4'><div class='raya'></div></td></tr>";
echo "<tr><td align='right' colspan='4'>";
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&creacion=1'>";
echo "<input type='submit' class='sub' name='crt' value='".$lang_label["create_agent"]."'>";
echo "<form method='post' action='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&creacion=1'>";
echo "<input type='submit' class='sub' name='crt'
value='".$lang_label["create_agent"]."'>";
echo "</form></td></tr>";
echo "</table>";
} else {
echo "<div class='nf'>".$lang_label["no_agent_def"]."</div>";
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&creacion=1'>";
echo "<input type='submit' class='sub' name='crt' value='".$lang_label["create_agent"]."'>";
echo "<form method='post' action='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&creacion=1'>";
echo "<input type='submit' class='sub' name='crt'
value='".$lang_label["create_agent"]."'>";
echo "</form>";
}
} // Fin pagina
else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Management");
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
}
?>

View File

@ -36,7 +36,7 @@ if (comprueba_login() == 0)
if (isset($_GET["id_grupo"])){
// Conecto con la BBDD
$id_grupo = entrada_limpia($_GET["id_grupo"]);
$sql1='SELECT * FROM tgrupo WHERE id_grupo = '.$id_grupo;
$sql1='SELECT nombre, icon FROM tgrupo WHERE id_grupo = '.$id_grupo;
$result=mysql_query($sql1);
if ($row=mysql_fetch_array($result)){
$nombre = $row["nombre"];
@ -57,7 +57,8 @@ if (comprueba_login() == 0)
?>
<table width="450">
<form name="grupo" method="post" action="index.php?sec=gagente&sec2=godmode/grupos/lista_grupos">
<form name="grupo" method="post" action="index.php?sec=gagente&
sec2=godmode/grupos/lista_grupos">
<?php
if ($creacion_grupo == 1)
@ -68,11 +69,26 @@ if (comprueba_login() == 0)
}
?>
<tr><td class='lb' rowspan='3' width='5'>
<tr><td class="datos"><?php echo $lang_label["group_name"] ?><td class="datos"><input type="text" name="nombre" size="35" value="<?php echo $nombre ?>">
<tr><td class="datos2"><?php echo $lang_label["icon"] ?><td class="datos2"><input type="icon" name="icon" size="25" value="<?php if (isset($icono)){echo $icono;} ?>">
<tr><td class="datos"><?php echo $lang_label["group_name"] ?></td>
<td class="datos">
<input type="text" name="nombre" size="35" value="<?php echo $nombre ?>">
</td></tr>
<tr><td class="datos2"><?php echo $lang_label["icon"] ?></td>
<td class="datos2">
<input type="icon" name="icon" size="25"
value="<?php if (isset($icono)){echo $icono;} ?>">
</td></tr>
<tr><td colspan='3'><div class='raya'></div></td></tr>
<tr><td colspan="3" align="right"><?php if (isset($_GET["creacion_grupo"])){echo "<input name='crtbutton' type='submit' class='sub' value='".$lang_label["create"]."'>";}
else {echo "<input name='uptbutton' type='submit' class='sub' value='".$lang_label["update"]."'>";} ?>
<tr><td colspan="3" align="right">
<?php
if (isset($_GET["creacion_grupo"])){
echo "<input name='crtbutton' type='submit' class='sub'
value='".$lang_label["create"]."'>";
} else {
echo "<input name='uptbutton' type='submit' class='sub'
value='".$lang_label["update"]."'>";
}
?>
</form>
</table>
@ -80,7 +96,8 @@ else {echo "<input name='uptbutton' type='submit' class='sub' value='".$lang_lab
<?php
} // fin pagina
else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Group Management2");
require ("general/noaccess.php");
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
"Trying to access Group Management2");
require ("general/noaccess.php");
}
?>

View File

@ -26,7 +26,8 @@ if (comprueba_login() == 0)
if (isset($_POST["crear_grupo"])){ // Create group
$nombre = entrada_limpia($_POST["nombre"]);
$icon = entrada_limpia($_POST["icon"]);
$sql_insert="INSERT INTO tgrupo (nombre, icon) VALUES ('".$nombre."', '".$icon."') ";
$sql_insert="INSERT INTO tgrupo (nombre, icon)
VALUES ('".$nombre."', '".$icon."') ";
echo $sql_insert;
$result=mysql_query($sql_insert);
if (! $result)
@ -41,7 +42,9 @@ if (comprueba_login() == 0)
$nombre = entrada_limpia($_POST["nombre"]);
$id_grupo = entrada_limpia($_POST["id_grupo"]);
$icon = entrada_limpia($_POST["icon"]);
$sql_update ="UPDATE tgrupo SET nombre = '".$nombre."', icon = '".$icon."' WHERE id_grupo = '".$id_grupo."'";
$sql_update ="UPDATE tgrupo
SET nombre = '".$nombre."', icon = '".$icon."'
WHERE id_grupo = '".$id_grupo."'";
$result=mysql_query($sql_update);
if (! $result)
echo "<h3 class='error'>".$lang_label["modify_group_no"]."</h3>";
@ -61,38 +64,58 @@ if (comprueba_login() == 0)
echo "<h3 class='suc'>".$lang_label["delete_group_ok"]."</h3>";
}
echo "<h2>".$lang_label["group_management"]."</h2>";
echo "<h3>".$lang_label["definedgroups"]."<a href='help/".$help_code."/chap3.php#31' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h3>";
echo "
<h3>".$lang_label["definedgroups"]."
<a href='help/".$help_code."/chap3.php#31' target='_help' class='help'>
<span>".$lang_label["help"]."</span></a>
</h3>";
// Load icon index from tgrupos
$iconindex_g[]="";
echo "<table cellpadding=3 cellspacing=3>";
echo "<th class='w40'>".$lang_label["icon"]."</th>";
echo "<th class='w180'>".$lang_label["group_name"]."</th>";
echo "<th class='w80'>".$lang_label["delete"]."</th>";
$sql1='SELECT * FROM tgrupo ORDER BY nombre';
$sql1='SELECT id_grupo, nombre FROM tgrupo ORDER BY nombre';
$result=mysql_query($sql1);
$color=0;
while ($row=mysql_fetch_array($result)){
$iconindex_g[$row["id_grupo"]] = $row["icon"];
if ($color == 1){
$tdcolor = "datos";
$color = 0;
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
if ($row["id_grupo"] != 1){
echo "
<tr>
<td class='$tdcolor' align='center'>
<img src='images/g_".show_icon_group($row["id_grupo"]).".gif'
border='0'>
</td>
<td class='$tdcolor'>
<b><a href='index.php?sec=gagente&
sec2=godmode/grupos/configurar_grupo&
id_grupo=".$row["id_grupo"]."'>".$row["nombre"]."</a>
</b></td>
<td class='$tdcolor' align='center'>
<a href='index.php?sec=gagente&
sec2=godmode/grupos/lista_grupos&
id_grupo=".$row["id_grupo"]."&
borrar_grupo=".$row["id_grupo"]."'
onClick='if (!confirm(\' ".$lang_label["are_you_sure"]."\'))
return false;'>
<img border='0' src='images/cancel.gif'></a>
</td>
</tr>";
}
else {
$tdcolor = "datos2";
$color = 1;
}
if ($row["id_grupo"] != 1){
echo "<tr><td class='$tdcolor' align='center'><img src='images/g_".$iconindex_g[$row["id_grupo"]].".gif' border='0'>" ;
echo "<td class='$tdcolor'><b><a href='index.php?sec=gagente&sec2=godmode/grupos/configurar_grupo&id_grupo=".$row["id_grupo"]."'>".$row["nombre"]."</a></b>";
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=gagente&sec2=godmode/grupos/lista_grupos&id_grupo=".$row["id_grupo"]."&borrar_grupo=".$row["id_grupo"]."' onClick='if (!confirm(\' ".$lang_label["are_you_sure"]."\')) return false;'><img border='0' src='images/cancel.gif'></a>";
}
}
echo "<tr><td colspan='3'><div class='raya'></div></td></tr>";
echo "<tr><td colspan='3' align='right'>";
echo "<form method=post action='index.php?sec=gagente&sec2=godmode/grupos/configurar_grupo&creacion_grupo=1'>";
echo "<form method=post action='index.php?sec=gagente&
sec2=godmode/grupos/configurar_grupo&creacion_grupo=1'>";
echo "<input type='submit' class='sub' name='crt' value='".$lang_label["create_group"]."'>";
echo "</form></table>";
echo "</form></td></tr></table>";
} // Fin pagina
else {

View File

@ -464,21 +464,4 @@ function pagination ($count, $url, $offset ) {
}
}
function list_group ($id_user){
$mis_grupos[]=""; // Define array mis_grupos to put here all groups with Agent Read permission
$iconindex_g[]="";
$sql='SELECT id_grupo, icon FROM tgrupo';
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
$iconindex_g[$row["id_grupo"]] = $row["icon"];
if ($row["id_grupo"] != 1){
if (give_acl($id_user,$row["id_grupo"], "AR") == 1){
echo "<option value='".$row["id_grupo"]."'>".
dame_nombre_grupo($row["id_grupo"])."</option>";
$mis_grupos[]=$row["id_grupo"]; //Put in an array all the groups the user belongs
}
}
}
}
?>

View File

@ -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 "<option value='".$row["id_grupo"]."'>".
dame_nombre_grupo($row["id_grupo"])."</option>";
$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;
}
?>

View File

@ -63,21 +63,7 @@ if (comprueba_login() == 0) {
"</option>";
}
echo "<option value=1>".dame_nombre_grupo(1)."</option>"; // 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 "<option value='".$row["id_grupo"]."'>".
dame_nombre_grupo($row["id_grupo"])."</option>";
$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 "</select>";
echo "<td valign='middle'>
<noscript>
@ -97,13 +83,6 @@ if (comprueba_login() == 0) {
$result=mysql_query($sql);
if (mysql_num_rows($result)){
// Load icon index from tgrupos
$iconindex_g[]="";
$sql_g='SELECT id_grupo, icon FROM tgrupo';
$result_g=mysql_query($sql_g);
while ($row_g=mysql_fetch_array($result_g)){
$iconindex_g[$row_g["id_grupo"]] = $row_g["icon"];
}
echo "<td class='f9l30'>";
echo "<img src='images/dot_red.gif'> - ".$lang_label["fired"];
echo "&nbsp;&nbsp;</td>";
@ -231,7 +210,7 @@ if (comprueba_login() == 0) {
echo "<td class='$tdcolor'>".$intervalo."</td>";
}
echo '<td class="'.$tdcolor.'">
<img src="images/g_'.$iconindex_g[$id_grupo].'.gif">
<img src="images/g_'.show_icon_group($id_grupo).'.gif">
( '.dame_grupo($id_grupo).' )</td>';
echo "<td class='$tdcolor'> ".
$numero_modulos." <b>/</b> ".$numero_monitor;

View File

@ -96,9 +96,9 @@ if (comprueba_login() == 0) {
// Show only selected groups
if ($ag_group > 1)
$sql='SELECT * FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
$sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
else
$sql='SELECT * FROM tagente ORDER BY id_grupo, nombre';
$sql='SELECT id_agente, nombre, disabled FROM tagente ORDER BY id_grupo, nombre';
$result=mysql_query($sql);
if (mysql_num_rows($result)){

View File

@ -49,16 +49,7 @@ if (comprueba_login() == 0) {
exit;
}
}
// Load icon index from tgrupos
$iconindex_g[]="";
$sql_tg='SELECT id_grupo, icon FROM tgrupo';
$result_tg=mysql_query($sql_tg);
while ($row_tg=mysql_fetch_array($result_tg)){
$iconindex_g[$row_tg["id_grupo"]] = $row_tg["icon"];
}
echo "<h2>".$lang_label["ag_title"]."</h2>";
echo "<h3>".$lang_label["view_agent_general_data"]."<a href='help/".$help_code."/chap3.php#3321' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h3>";
echo '<table cellspacing="3" cellpadding="3" width="750">';
@ -110,8 +101,8 @@ if (comprueba_login() == 0) {
echo '<tr>
<td class="datos2"><b>'.salida_limpia($lang_label["group"]).'</b></td>
<td class="datos2">
<img src="images/g_'.$iconindex_g[$row["id_grupo"]].'.gif" >
( '.dame_grupo($id_grupo).' )';
<img src="images/g_'.show_icon_group($row["id_grupo"]).'.gif" >
( '.dame_grupo($id_grupo).' )</td></tr>';
if ($agent_type == 0) {
echo '<tr><td class="datos"><b>'.$lang_label["agentversion"].'</b>
<td class="datos">'.salida_limpia($agent_version).'</td>';
@ -123,9 +114,9 @@ if (comprueba_login() == 0) {
<td class="datos2">';
$total_paketes= 0;
$id_agente = dame_agente_id($nombre_agente);
$sql_2='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$sql_2='SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result_t=mysql_query($sql_2);
while ($row=mysql_fetch_array($result_t)){
while ($row=mysql_fetch_array($result_t)){
$sql_3='SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo = '.$row["id_agente_modulo"];
$result_3=mysql_query($sql_3);
$row3=mysql_fetch_array($result_3);

View File

@ -39,15 +39,6 @@ if (comprueba_login() == 0) {
if (isset($_GET["id_agente"])){
$id_agente = $_GET["id_agente"];
}
// Load icon index from ttipo_modulo
$iconindex[]="";
$sql_tm='SELECT id_tipo, icon FROM ttipo_modulo';
$result_tm=mysql_query($sql_tm);
while ($row_tm=mysql_fetch_array($result_tm)){
$iconindex[$row_tm["id_tipo"]] = $row_tm["icon"];
}
// View last data packet
// Get timestamp of last packet
@ -108,9 +99,21 @@ if (comprueba_login() == 0) {
if (give_acl($id_usuario, $id_grupo, "AW")==1){
if ($row3["id_tipo_modulo"] > 4){
if ($row3["flag"] == 0){
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row3["id_agente_modulo"]."&flag=1&refr=60'><img src='images/target.gif' border=0></a>";
echo "<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$id_agente."&
id_agente_modulo=".$row3["id_agente_modulo"]."&
flag=1&
refr=60'>
<img src='images/target.gif' border=0></a>";
} else {
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row3["id_agente_modulo"]."&flag=1&refr=60'><img src='images/refresh.gif' border=0></a>";
echo "<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$id_agente."&
id_agente_modulo=".$row3["id_agente_modulo"]."&
flag=1&
refr=60'>
<img src='images/refresh.gif' border=0></a>";
}
}
}
@ -119,7 +122,9 @@ if (comprueba_login() == 0) {
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
$label_group = -1;
$last_label = $nombre_grupomodulo;
$texto = $texto. "<td class='$tdcolor' align='center' colspan=7><b>".$nombre_grupomodulo."</b>";
$texto = $texto. "
<td class='$tdcolor' align='center' colspan=7>
<b>".$nombre_grupomodulo."</b>";
}
}
@ -127,7 +132,7 @@ if (comprueba_login() == 0) {
echo "<td class='".$tdcolor."_id'>";
echo salida_limpia(substr($row3["nombre"],0,15));
echo "<td class='".$tdcolor."'>";
echo "<img src='images/".$iconindex[$row3["id_tipo_modulo"]]."' border=0>";
echo "<img src='images/".show_icon_type($row3["id_tipo_modulo"])."' border=0>";
echo "<td class='".$tdcolor."'>";
if ($row3["module_interval"] != 0)
echo $row3["module_interval"];
@ -140,7 +145,9 @@ if (comprueba_login() == 0) {
echo "...";
}
// For types not string type (3 data_string, 9 tcp_string, 14 snmp_string)
if (($row3["id_tipo_modulo"] != 3) AND ($row3["id_tipo_modulo"] != 10) AND ($row3["id_tipo_modulo"] != 17)){
if (($row3["id_tipo_modulo"] != 3)
AND ($row3["id_tipo_modulo"] != 10)
AND ($row3["id_tipo_modulo"] != 17)){
echo "<td class=".$tdcolor.">";
if (($row3["datos"] != 0) AND (is_numeric($row3["datos"]))){
$mytempdata = fmod($row3["datos"], $row3["datos"]);
@ -182,11 +189,16 @@ if (comprueba_login() == 0) {
}
echo "<td class=".$tdcolor." width=70>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.gif'>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.gif'>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.gif'>";
echo "<td class='".$tdcolor."f9'>".$row3["timestamp"];
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.gif'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.gif'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.gif'></a>";
echo "<td class='".$tdcolor."f9'>";
if ($row3["timestamp"] == "0000-00-00 00:00:00"){
echo $lang_label["never"];
} else {
echo $row3["timestamp"];
}
echo "</td></tr>";
//}
}
echo '<tr><td colspan="9"><div class="raya"></div></td></tr></table>';

View File

@ -21,14 +21,6 @@ require("include/config.php");
if (comprueba_login() == 0) {
if ((give_acl($id_user, 0, "AR")==1) or (give_acl($id_user,0,"AW")) or (dame_admin($id_user)==1)) {
// Load icon index array from ttipo_modulo
$iconindex[]="";
$sql_tm='SELECT id_tipo, icon FROM ttipo_modulo';
$result_tm=mysql_query($sql_tm);
while ($row_tm=mysql_fetch_array($result_tm)){
$iconindex[$row_tm["id_tipo"]] = $row_tm["icon"];
}
echo "<h2>".$lang_label["ag_title"]."</h2>";
echo "<h3>".$lang_label["monitor_listing"]."<a href='help/".$help_code."/chap3.php#334' target='_help' class='help'>
&nbsp;<span>".$lang_label["help"]."</span></a></h3>";
@ -161,7 +153,8 @@ if (comprueba_login() == 0) {
dame_nombre_agente($data["id_agente"])."</a></b></td>";
$string=$string."<td class='$tdcolor'>";
$string=$string."
<img src='images/".$iconindex[$data["id_tipo_modulo"]]."' border=0></td>";
<img src='images/".show_icon_type($data["id_tipo_modulo"])."' border=0>
</td>";
$string=$string."<td class='$tdcolor'>".
$data["nombre"]."</td>";
$string=$string."<td class='".$tdcolor."f9'>".

View File

@ -157,7 +157,6 @@ if (comprueba_login() == 0) {
echo "<td><form method='post' action='index.php?sec=eventos&sec2=operation/events/events&refr=60'>";
echo "<select name='event' onChange='javascript:this.form.submit();' class='w155'>";
// Prepare index for pagination
$event_list[]="";
if (isset($_POST["event"])){
@ -202,12 +201,14 @@ if (comprueba_login() == 0) {
}
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["evento"]."'>".$row["evento"]."</option>";
}
echo "<option value='".$row["evento"]."'>".$row["evento"]."</option>";
}
echo "</select>";
echo "</form>";
echo "<td valign='middle'>";
echo "<noscript><input type='submit' class='sub' value='".$lang_label["show"]."'></noscript>";
echo "<noscript>
<input type='submit' class='sub' value='".$lang_label["show"]."'>
</noscript>";
echo "</td></tr>";
echo "</table>";
echo "<br>";
@ -215,7 +216,6 @@ if (comprueba_login() == 0) {
//pagination
$total_eventos = count($event_list);
pagination($total_eventos, "index.php?sec=eventos&sec2=operation/events/events", $offset);
if (isset($_GET["offset"])){
$offset=entrada_limpia($_GET["offset"]);
} else {
@ -289,14 +289,14 @@ if (comprueba_login() == 0) {
echo "<td class='$tdcolor'>".$row["evento"];
if ($row["id_agente"] > 0){
echo "<td class='$tdcolor'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$row["id_agente"]."'><b>".dame_nombre_agente($row["id_agente"])."</b></a>";
echo "<td class='$tdcolor'><img src='images/g_".$iconindex_g[$id_group].".gif'> ( ".dame_grupo($id_group)." )</td>";
echo "<td class='$tdcolor'><img src='images/g_".show_icon_group($id_group).".gif'> ( ".dame_grupo($id_group)." )</td>";
echo "<td class='$tdcolor'>";
} else { // for SNMP generated alerts
echo "<td class='$tdcolor' colspan='2'>".$lang_label["alert"]." / SNMP";
echo "<td class='$tdcolor'>";
}
if ($row["estado"] <> 0)
echo "<a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$row["id_user"]."'><a href='#' class='tip'>&nbsp;<span>".dame_nombre_real($row["id_user"])."</span></a>".substr($row["id_user"],0,8)."</a>";
echo "<a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$row["id_usuario"]."'><a href='#' class='tip'>&nbsp;<span>".dame_nombre_real($row["id_usuario"])."</span></a>".substr($row["id_usuario"],0,8)."</a>";
echo "<td class='$tdcolor'>".$row["timestamp"];
echo "<td class='$tdcolor' align='center'>";