2008-06-30 Esteban Sanchez <estebans@artica.es>
* godmode/groups/configure_group.php: Complete rewritten. Use Pandora functions and added javascript support. * godmode/groups/group_list.php: Rewrite to use Pandora functions. Code cleanup. * godmode/reporting/map_builder.php: Added width and height support to graphics layout items type. * godmode/reporting/reporting_builder.php: Style correction. * operation/agentes/networkmap.php: Unused code cleanup. Style correction. Use hex color codes instead of names, because graphviz was complaining about them. Avoid a warning on graphviz about "color" in a TD. Replaced lang_label with lang_string(). Show error if map could not be generated. * operation/reporting/reporting_viewer_pdf.php: Style correction and code cleanup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@907 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bb39747631
commit
cb9cadd524
|
@ -1,3 +1,25 @@
|
||||||
|
2008-06-30 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* godmode/groups/configure_group.php: Complete rewritten. Use Pandora
|
||||||
|
functions and added javascript support.
|
||||||
|
|
||||||
|
* godmode/groups/group_list.php: Rewrite to use Pandora functions.
|
||||||
|
Code cleanup.
|
||||||
|
|
||||||
|
* godmode/reporting/map_builder.php: Added width and height support to
|
||||||
|
graphics layout items type.
|
||||||
|
|
||||||
|
* godmode/reporting/reporting_builder.php: Style correction.
|
||||||
|
|
||||||
|
* operation/agentes/networkmap.php: Unused code cleanup. Style
|
||||||
|
correction. Use hex color codes instead of names, because graphviz was
|
||||||
|
complaining about them. Avoid a warning on graphviz about "color" in a
|
||||||
|
TD. Replaced lang_label with lang_string(). Show error if map could
|
||||||
|
not be generated.
|
||||||
|
|
||||||
|
* operation/reporting/reporting_viewer_pdf.php: Style correction and
|
||||||
|
code cleanup.
|
||||||
|
|
||||||
2008-06-30 Sancho Lerena <slerena@artica.es>
|
2008-06-30 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* agent_manager.php: Agent names are now show in order.
|
* agent_manager.php: Agent names are now show in order.
|
||||||
|
|
|
@ -22,134 +22,135 @@
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Load global vars
|
// Load global vars
|
||||||
|
|
||||||
require("include/config.php");
|
require("include/config.php");
|
||||||
|
|
||||||
if (comprueba_login() == 0)
|
if (comprueba_login ()) {
|
||||||
$id_user = $_SESSION["id_usuario"];
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Group Management2");
|
||||||
if (give_acl($id_user, 0, "PM")==1) {
|
|
||||||
// Init vars
|
|
||||||
$id_grupo = "";
|
|
||||||
$nombre = "";
|
|
||||||
$id_parent = "";
|
|
||||||
$disabled = 0;
|
|
||||||
|
|
||||||
if (isset($_GET["create_g"])){ //
|
|
||||||
$create_g = entrada_limpia($_GET["create_g"]);
|
|
||||||
} else
|
|
||||||
$create_g = 0;
|
|
||||||
|
|
||||||
if (isset($_GET["id_grupo"])){
|
|
||||||
$id_grupo = entrada_limpia($_GET["id_grupo"]);
|
|
||||||
$sql1='SELECT * FROM tgrupo WHERE id_grupo = '.$id_grupo;
|
|
||||||
$result=mysql_query($sql1);
|
|
||||||
if ($row=mysql_fetch_array($result)){
|
|
||||||
$nombre = $row["nombre"];
|
|
||||||
$icono = $row["icon"];
|
|
||||||
$disabled = $row["disabled"];
|
|
||||||
$id_parent = entrada_limpia($row["parent"]);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
echo "<h3 class='error'>".$lang_label["group_error"]."</h3>";
|
|
||||||
echo "</table>";
|
|
||||||
include ("general/footer.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<h2>".$lang_label["group_management"]." > ";
|
|
||||||
if (isset($_GET["create_g"])) {
|
|
||||||
echo $lang_label["create_group"];
|
|
||||||
}
|
|
||||||
if (isset($_GET["id_grupo"])) {
|
|
||||||
echo $lang_label["update_group"];
|
|
||||||
}
|
|
||||||
echo "</h2>"
|
|
||||||
|
|
||||||
?>
|
|
||||||
<table width="450" cellpadding=4 cellspacing=4 class='databox_color'>
|
|
||||||
|
|
||||||
<form name="grupo" method="post" action="index.php?sec=gagente&
|
|
||||||
sec2=godmode/groups/group_list">
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if ($create_g == 1)
|
|
||||||
echo "<input type='hidden' name='create_g' value='1'>";
|
|
||||||
else {
|
|
||||||
echo "<input type='hidden' name='update_g' value='1'>";
|
|
||||||
echo "<input type='hidden' name='id_grupo' value='".$id_grupo."'>";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<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"];
|
|
||||||
echo '<td class="datos2">';
|
|
||||||
|
|
||||||
echo '<select name="icon">';
|
|
||||||
|
|
||||||
if ($icono != ""){
|
|
||||||
echo '<option>' . $icono;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ficheros = list_files ('images/groups_small/', "png", 1, 0);
|
|
||||||
$size = count ($ficheros);
|
|
||||||
for ($i = 0; $i < $size; $i++) {
|
|
||||||
echo "<option>".substr($ficheros[$i],0,strlen($ficheros[$i])-4);
|
|
||||||
}
|
|
||||||
echo '</select>';
|
|
||||||
|
|
||||||
// Parent
|
|
||||||
|
|
||||||
echo "<tr><td class='datos'>";
|
|
||||||
echo $lang_label["parent"];
|
|
||||||
echo '<td class="datos">';
|
|
||||||
echo '<select name="parent">';
|
|
||||||
if ($id_parent != ""){
|
|
||||||
echo "<option value=$id_parent>".dame_nombre_grupo($id_parent);
|
|
||||||
$sql1='SELECT * FROM tgrupo WHERE id_grupo != '.$id_grupo;
|
|
||||||
} else {
|
|
||||||
$sql1='SELECT * FROM tgrupo';
|
|
||||||
}
|
|
||||||
$result=mysql_query($sql1);
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
|
||||||
$nombre = $row["nombre"];
|
|
||||||
$id_grupo2 = $row["id_grupo"];
|
|
||||||
echo "<option value=$id_grupo2>" . $nombre;
|
|
||||||
}
|
|
||||||
echo "<option value=0>None";
|
|
||||||
echo '</select>';
|
|
||||||
|
|
||||||
// Disabled
|
|
||||||
echo "<tr><td class='datos2'>";
|
|
||||||
echo $lang_label["alerts"];
|
|
||||||
echo '<td class="datos2">';
|
|
||||||
echo '<select name="disabled">';
|
|
||||||
if ($disabled == 1){
|
|
||||||
echo "<option value=1>".$lang_label["disabled"];
|
|
||||||
echo "<option value=0>".$lang_label["enabled"];
|
|
||||||
} else {
|
|
||||||
echo "<option value=0>".$lang_label["enabled"];
|
|
||||||
echo "<option value=1>".$lang_label["disabled"];
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</select>";
|
|
||||||
|
|
||||||
echo "</table>";
|
|
||||||
echo "<table width=450>";
|
|
||||||
echo '<tr><td align="right">';
|
|
||||||
if (isset($_GET["create_g"]))
|
|
||||||
echo "<input name='crtbutton' type='submit' class='sub wand' value='".$lang_label["create"]."'>";
|
|
||||||
else
|
|
||||||
echo "<input name='uptbutton' type='submit' class='sub upd' value='".$lang_label["update"]."'>";
|
|
||||||
|
|
||||||
echo "</form></table>";
|
|
||||||
|
|
||||||
} else {
|
|
||||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
|
|
||||||
"Trying to access Group Management2");
|
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! give_acl ($config['id_user'], 0, "PM")) {
|
||||||
|
audit_db ($id_user, $REMOTE_ADDR, "ACL Violation", "Trying to access Group Management2");
|
||||||
|
require ("general/noaccess.php");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init vars
|
||||||
|
$icon = "";
|
||||||
|
$name = "";
|
||||||
|
$id_parent = 0;
|
||||||
|
$alerts_disabled = 0;
|
||||||
|
|
||||||
|
$create_group = (bool) get_parameter ('create_group');
|
||||||
|
$id_group = (int) get_parameter ('id_group');
|
||||||
|
|
||||||
|
if ($id_group) {
|
||||||
|
$group = get_db_row ('tgrupo', 'id_grupo', $id_group);
|
||||||
|
if ($group) {
|
||||||
|
$name = $group["nombre"];
|
||||||
|
$icon = $group["icon"].'.png';
|
||||||
|
$alerts_isabled = $group["disabled"];
|
||||||
|
$id_parent = $group["parent"];
|
||||||
|
} else {
|
||||||
|
echo "<h3 class='error'>".$lang_label["group_error"]."</h3>";
|
||||||
|
echo "</table>";
|
||||||
|
include ("general/footer.php");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<h2>".$lang_label["group_management"]." > ";
|
||||||
|
if ($id_group) {
|
||||||
|
echo $lang_label["update_group"];
|
||||||
|
} else {
|
||||||
|
echo $lang_label["create_group"];
|
||||||
|
}
|
||||||
|
echo "</h2>";
|
||||||
|
|
||||||
|
$table->width = '450px';
|
||||||
|
$table->data = array ();
|
||||||
|
$table->data[0][0] = lang_string ('name');
|
||||||
|
$table->data[0][1] = print_input_text ('name', $name, '', 35, 100, true);
|
||||||
|
$table->data[1][0] = lang_string ('icon');
|
||||||
|
$files = list_files ('images/groups_small/', "png", 1, 0);
|
||||||
|
$table->data[1][1] = print_select ($files, 'icon', $icon, '', 'None', '', true);
|
||||||
|
$table->data[1][1] .= ' <span id="icon_preview">';
|
||||||
|
if ($icon) {
|
||||||
|
$table->data[1][1] .= '<img src="images/groups_small/'.$icon.'" />';
|
||||||
|
}
|
||||||
|
$table->data[1][1] .= '</span>';
|
||||||
|
$table->data[2][0] = lang_string ('parent');
|
||||||
|
$sql = 'SELECT * FROM tgrupo ';
|
||||||
|
if ($id_group)
|
||||||
|
$sql .= sprintf ('WHERE id_grupo != %d', $id_group);
|
||||||
|
$table->data[2][1] = print_select_from_sql ($sql, 'parent', $id_parent, '', 'None', 0, true);
|
||||||
|
$table->data[2][1] .= ' <span id="parent_preview">';
|
||||||
|
if ($id_parent) {
|
||||||
|
echo '<img src="images/groups_small/'.dame_grupo_icono ($id_parent).'.png" />';
|
||||||
|
}
|
||||||
|
echo'</span>';
|
||||||
|
$table->data[3][0] = lang_string ('alerts');
|
||||||
|
$table->data[3][1] = print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true);
|
||||||
|
|
||||||
|
echo '<form name="grupo" method="post" action="index.php?sec=gagente&sec2=godmode/groups/group_list">';
|
||||||
|
print_table ($table);
|
||||||
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
|
if ($id_group) {
|
||||||
|
print_input_hidden ('update_group', 1);
|
||||||
|
print_input_hidden ('id_group', $id_group);
|
||||||
|
print_submit_button (lang_string ('update'), 'updbutton', false, 'class="sub upd"');
|
||||||
|
} else {
|
||||||
|
print_input_hidden ('create_group', 1);
|
||||||
|
print_submit_button (lang_string ('create'), 'crtbutton', false, 'class="sub wand"');
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
echo '</form>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="include/javascript/jquery.js"></script>
|
||||||
|
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
function icon_changed () {
|
||||||
|
var inputs = [];
|
||||||
|
var data = this.value;
|
||||||
|
console.log (this.value);
|
||||||
|
$('#icon_preview').fadeOut ('normal', function () {
|
||||||
|
$('#icon_preview').empty ();
|
||||||
|
if (data != "") {
|
||||||
|
$('#icon_preview').append ($('<img />').attr ('src', 'images/groups_small/'+data));
|
||||||
|
}
|
||||||
|
$('#icon_preview').fadeIn ();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function parent_changed () {
|
||||||
|
var inputs = [];
|
||||||
|
inputs.push ("get_group_json=1");
|
||||||
|
inputs.push ("id_group=" + this.value);
|
||||||
|
inputs.push ("page=godmode/groups/group_list");
|
||||||
|
jQuery.ajax ({
|
||||||
|
data: inputs.join ("&"),
|
||||||
|
type: 'GET',
|
||||||
|
url: action="ajax.php",
|
||||||
|
timeout: 10000,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
var data_ = data;
|
||||||
|
$('#parent_preview').fadeOut ('normal', function () {
|
||||||
|
$('#parent_preview').empty ();
|
||||||
|
if (data_ != null) {
|
||||||
|
$('#parent_preview').append ($('<img />').attr ('src', 'images/groups_small/'+data['icon']+'.png'));
|
||||||
|
}
|
||||||
|
$('#parent_preview').fadeIn ();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready (function () {
|
||||||
|
$('#icon').change (icon_changed);
|
||||||
|
$('#parent').change (parent_changed);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -51,101 +51,97 @@ if (defined ('AJAX')) {
|
||||||
exit ();
|
exit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST["create_g"])) { // Create group
|
$create_group = (bool) get_parameter ('create_group');
|
||||||
$nombre = entrada_limpia($_POST["nombre"]);
|
$update_group = (bool) get_parameter ('update_group');
|
||||||
$icon = entrada_limpia($_POST["icon"]);
|
$delete_group = (bool) get_parameter ('delete_group');
|
||||||
$parent = entrada_limpia($_POST["parent"]);
|
|
||||||
$disabled = entrada_limpia($_POST["disabled"]);
|
/* Create group */
|
||||||
$sql_insert="INSERT INTO tgrupo (nombre, icon, parent, disabled)
|
if ($create_group) {
|
||||||
VALUES ('$nombre', '$icon', '$parent', $disabled) ";
|
$name = (string) get_parameter ('name');
|
||||||
$result=mysql_query($sql_insert);
|
$icon = (string) get_parameter ('icon');
|
||||||
if (! $result)
|
$id_parent = (int) get_parameter ('id_parent');
|
||||||
echo "<h3 class='error'>".$lang_label["create_group_no"]."</h3>";
|
$alerts_disabled = (bool) get_parameter ('alerts_disabled');
|
||||||
else {
|
|
||||||
echo "<h3 class='suc'>".$lang_label["create_group_ok"]."</h3>";
|
$sql = sprintf ('INSERT INTO tgrupo (nombre, icon, parent, disabled)
|
||||||
$id_grupo = mysql_insert_id();
|
VALUES ("%s", "%s", %d, %d)',
|
||||||
}
|
$name, substr ($icon, 0, -4), $id_parent, $alerts_disabled);
|
||||||
|
$result = mysql_query ($sql);
|
||||||
|
if ($result) {
|
||||||
|
echo "<h3 class='suc'>".lang_string ("create_group_ok")."</h3>";
|
||||||
|
} else {
|
||||||
|
echo "<h3 class='error'>".lang_string ("create_group_no")."</h3>"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST["update_g"])){ // if modified any parameter
|
/* Update group */
|
||||||
$nombre = entrada_limpia($_POST["nombre"]);
|
if ($update_group) {
|
||||||
$id_grupo = entrada_limpia($_POST["id_grupo"]);
|
$id_group = (int) get_parameter ('id_group');
|
||||||
$icon = entrada_limpia($_POST["icon"]);
|
$name = (string) get_parameter ('name');
|
||||||
$disabled = entrada_limpia($_POST["disabled"]);
|
$icon = (string) get_parameter ('icon');
|
||||||
$parent = entrada_limpia($_POST["parent"]);
|
$id_parent = (int) get_parameter ('id_parent');
|
||||||
$sql_update ="UPDATE tgrupo
|
$alerts_enabled = (bool) get_parameter ('alerts_enabled');
|
||||||
SET nombre = '$nombre', icon = '$icon', disabled = $disabled, parent = '$parent'
|
|
||||||
WHERE id_grupo = '$id_grupo'";
|
|
||||||
$result=mysql_query($sql_update);
|
|
||||||
if (! $result)
|
|
||||||
echo "<h3 class='error'>".$lang_label["modify_group_no"]."</h3>";
|
|
||||||
else
|
|
||||||
echo "<h3 class='suc'>".$lang_label["modify_group_ok"]."</h3>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET["delete_g"])){ // if delete
|
|
||||||
$id_borrar_modulo = entrada_limpia($_GET["id_grupo"]);
|
|
||||||
|
|
||||||
// First delete from tagente_modulo
|
$sql = sprintf ('UPDATE tgrupo SET nombre = "%s",
|
||||||
$sql_delete= "DELETE FROM tgrupo WHERE id_grupo = ".$id_borrar_modulo;
|
icon = "%s", disabled = %d, parent = %d
|
||||||
$result=mysql_query($sql_delete);
|
WHERE id_grupo = %d',
|
||||||
|
$name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $id_group);
|
||||||
|
$result = mysql_query ($sql);
|
||||||
|
if ($result) {
|
||||||
|
echo "<h3 class='suc'>".lang_string ("modify_group_ok")."</h3>";
|
||||||
|
} else {
|
||||||
|
echo "<h3 class='error'>".lang_string ("modify_group_no")."</h3>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Delete group */
|
||||||
|
if ($delete_group) {
|
||||||
|
$id_group = (int) get_parameter ('id_group');
|
||||||
|
|
||||||
|
$sql = sprintf ('UPDATE tagente set id_grupo = 1 WHERE id_grupo = %d', $id_group);
|
||||||
|
$result = mysql_query ($sql);
|
||||||
|
$sql = sprintf ('DELETE FROM tgrupo WHERE id_grupo = %d', $id_group);
|
||||||
|
$result = mysql_query ($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
echo "<h3 class='error'>".$lang_label["delete_group_no"]."</h3>";
|
echo "<h3 class='error'>".lang_string ("delete_group_no")."</h3>";
|
||||||
else
|
else
|
||||||
echo "<h3 class='suc'>".$lang_label["delete_group_ok"]."</h3>";
|
echo "<h3 class='suc'>".lang_string ("delete_group_ok")."</h3>";
|
||||||
}
|
}
|
||||||
echo "<h2>".$lang_label["group_management"]." > ";
|
|
||||||
echo $lang_label["definedgroups"]."</h2>";
|
|
||||||
|
|
||||||
echo "<table cellpadding=4 cellspacing=4 width='400' class='databox'>";
|
echo "<h2>".lang_string ("group_management")." > ";
|
||||||
echo "<th>".$lang_label["icon"]."</th>";
|
echo lang_string ("definedgroups")."</h2>";
|
||||||
echo "<th>".$lang_label["group_name"]."</th>";
|
|
||||||
echo "<th>".$lang_label["parent"]."</th>";
|
|
||||||
echo "<th>".$lang_label["alerts"]."</th>";
|
|
||||||
echo "<th>".$lang_label["delete"]."</th>";
|
|
||||||
$sql1='SELECT * FROM tgrupo ORDER BY nombre';
|
|
||||||
$result=mysql_query($sql1);
|
|
||||||
$color=0;
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
|
||||||
if ($color == 1){
|
|
||||||
$tdcolor = "datos";
|
|
||||||
$color = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$tdcolor = "datos2";
|
|
||||||
$color = 1;
|
|
||||||
}
|
|
||||||
if ($row["id_grupo"] != 1){
|
|
||||||
echo "<tr><td class='$tdcolor' align='center'>";
|
|
||||||
echo "<img src='images/groups_small/".$row["icon"].".png' border='0'>";
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td class='$tdcolor'>";
|
|
||||||
echo "<b><a href='index.php?sec=gagente&sec2=godmode/groups/configure_group&id_grupo=".$row["id_grupo"]."'>".$row["nombre"]."</a>";
|
|
||||||
echo "</b></td>";
|
|
||||||
echo "<td class='$tdcolor'>";
|
|
||||||
echo dame_nombre_grupo ($row["parent"]);
|
|
||||||
echo "</td>";
|
|
||||||
|
|
||||||
// Disabled?
|
$table->width = '400px';
|
||||||
echo "<td class='$tdcolor' align='center'>";
|
$table->head = array ();
|
||||||
if ($row["disabled"]==1)
|
$table->head[0] = lang_string ("icon");
|
||||||
echo "<img src='images/flag_red.png'> ".$lang_label["disabled"];
|
$table->head[1] = lang_string ("name");
|
||||||
else
|
$table->head[2] = lang_string ("parent");
|
||||||
echo "<img src='images/flag_green.png'> ".$lang_label["enabled"];
|
$table->head[3] = lang_string ("alerts");
|
||||||
echo "</td>";
|
$table->head[4] = lang_string ("delete");
|
||||||
|
$table->align = array ();
|
||||||
|
$table->align[4] = 'center';
|
||||||
|
$table->data = array ();
|
||||||
|
|
||||||
echo "<td class='$tdcolor' align='center'>";
|
$groups = get_user_groups ($config['id_user']);
|
||||||
echo "<a href='index.php?sec=gagente&sec2=godmode/groups/group_list&id_grupo=".$row["id_grupo"]."&delete_g=".$row["id_grupo"]."'";
|
|
||||||
echo ' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
|
foreach ($groups as $id_group => $group_name) {
|
||||||
echo "<img border='0' src='images/cross.png'></a></td></tr>";
|
$data = array ();
|
||||||
}
|
|
||||||
|
$group = get_db_row ('tgrupo', 'id_grupo', $id_group);
|
||||||
|
|
||||||
|
$data[0] = '<img src="images/groups_small/'.$group["icon"].'.png" border="0">';
|
||||||
|
$data[1] = '<strong><a href="index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$id_group.'">'.$group_name.'</a></strong>';
|
||||||
|
$data[2] = dame_nombre_grupo ($group["parent"]);
|
||||||
|
$data[3] = $group['disabled'] ? lang_string ('disabled') : lang_string ('enabled');
|
||||||
|
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1" onClick="if (!confirm(\' '.lang_string ("are_you_sure").'\')) return false;"><img border="0" src="images/cross.png"></a>';
|
||||||
|
|
||||||
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
echo "</table>";
|
|
||||||
echo "<table cellpadding=4 cellspacing=4 width='400'>";
|
print_table ($table);
|
||||||
echo "<tr><td align='right'>";
|
|
||||||
echo "<form method=post action='index.php?sec=gagente&
|
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_group">';
|
||||||
sec2=godmode/groups/configure_group&create_g=1'>";
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
echo "<input type='submit' class='sub next' name='crt' value='".$lang_label["create_group"]."'>";
|
print_submit_button (lang_string ("create_group"), 'crt', false, 'class="sub next"');
|
||||||
echo "</form></td></tr></table>";
|
echo '</div>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -145,16 +145,20 @@ if ($create_layout_data) {
|
||||||
$layout_data_parent_item = (int) get_parameter ("parent_item");
|
$layout_data_parent_item = (int) get_parameter ("parent_item");
|
||||||
$layout_data_period = (int) get_parameter ("period");
|
$layout_data_period = (int) get_parameter ("period");
|
||||||
$layout_data_map_linked = (int) get_parameter ("map_linked");
|
$layout_data_map_linked = (int) get_parameter ("map_linked");
|
||||||
|
$layout_data_width = (int) get_parameter ("width");
|
||||||
|
$layout_data_height = (int) get_parameter ("height");
|
||||||
|
|
||||||
$sql = sprintf ('INSERT INTO tlayout_data (id_layout, label, id_layout_linked,
|
$sql = sprintf ('INSERT INTO tlayout_data (id_layout, label, id_layout_linked,
|
||||||
label_color, image, type, id_agente_modulo, parent_item, period, no_link_color)
|
label_color, image, type, id_agente_modulo, parent_item, period, no_link_color,
|
||||||
VALUES (%d, "%s", %d, "%s", "%s", %d, %d, %d, %d, 1)',
|
width, height)
|
||||||
|
VALUES (%d, "%s", %d, "%s", "%s", %d, %d, %d, %d, 1, %d, %d)',
|
||||||
$id_layout, $layout_data_label,
|
$id_layout, $layout_data_label,
|
||||||
$layout_data_map_linked,
|
$layout_data_map_linked,
|
||||||
$layout_data_label_color,
|
$layout_data_label_color,
|
||||||
$layout_data_image, $layout_data_type,
|
$layout_data_image, $layout_data_type,
|
||||||
$layout_data_id_agent_module,
|
$layout_data_id_agent_module,
|
||||||
$layout_data_parent_item, $layout_data_period * 3600);
|
$layout_data_parent_item, $layout_data_period * 3600,
|
||||||
|
$layout_data_width, $layout_data_height);
|
||||||
$result = mysql_query ($sql);
|
$result = mysql_query ($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
@ -171,6 +175,7 @@ if ($update_layout_data_coords) {
|
||||||
$id_layout_data = (int) get_parameter ('id_layout_data');
|
$id_layout_data = (int) get_parameter ('id_layout_data');
|
||||||
$layout_data_x = (int) get_parameter ("coord_x");
|
$layout_data_x = (int) get_parameter ("coord_x");
|
||||||
$layout_data_y = (int) get_parameter ("coord_y");
|
$layout_data_y = (int) get_parameter ("coord_y");
|
||||||
|
|
||||||
$sql = sprintf ('UPDATE tlayout_data SET
|
$sql = sprintf ('UPDATE tlayout_data SET
|
||||||
pos_x = %d, pos_y = %d
|
pos_x = %d, pos_y = %d
|
||||||
WHERE id = %d',
|
WHERE id = %d',
|
||||||
|
@ -209,13 +214,16 @@ if ($update_layout_data) {
|
||||||
$layout_data_parent_item = (int) get_parameter ("parent_item");
|
$layout_data_parent_item = (int) get_parameter ("parent_item");
|
||||||
$layout_data_period = (int) get_parameter ("period");
|
$layout_data_period = (int) get_parameter ("period");
|
||||||
$layout_data_map_linked = (int) get_parameter ("map_linked");
|
$layout_data_map_linked = (int) get_parameter ("map_linked");
|
||||||
|
$layout_data_width = (int) get_parameter ("width");
|
||||||
|
$layout_data_height = (int) get_parameter ("height");
|
||||||
|
|
||||||
$sql = sprintf ('UPDATE tlayout_data SET
|
$sql = sprintf ('UPDATE tlayout_data SET
|
||||||
image = "%s", label = "%s",
|
image = "%s", label = "%s",
|
||||||
label_color = "%s",
|
label_color = "%s",
|
||||||
id_agente_modulo = %d,
|
id_agente_modulo = %d,
|
||||||
type = %d, parent_item = %d,
|
type = %d, parent_item = %d,
|
||||||
period = %d, id_layout_linked = %d
|
period = %d, id_layout_linked = %d,
|
||||||
|
width = %d, height = %d
|
||||||
WHERE id = %d',
|
WHERE id = %d',
|
||||||
$layout_data_image, $layout_data_label,
|
$layout_data_image, $layout_data_label,
|
||||||
$layout_data_label_color,
|
$layout_data_label_color,
|
||||||
|
@ -223,6 +231,7 @@ if ($update_layout_data) {
|
||||||
$layout_data_type, $layout_data_parent_item,
|
$layout_data_type, $layout_data_parent_item,
|
||||||
$layout_data_period * 3600,
|
$layout_data_period * 3600,
|
||||||
$layout_data_map_linked,
|
$layout_data_map_linked,
|
||||||
|
$layout_data_width, $layout_data_height,
|
||||||
$id_layout_data);
|
$id_layout_data);
|
||||||
$result = mysql_query ($sql);
|
$result = mysql_query ($sql);
|
||||||
|
|
||||||
|
@ -371,6 +380,9 @@ if (! $edit_layout && ! $id_layout) {
|
||||||
|
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
$table->id = 'table_layout_data';
|
$table->id = 'table_layout_data';
|
||||||
|
$table->rowstyle = array ();
|
||||||
|
$table->rowstyle[3] = 'display: none';
|
||||||
|
$table->rowstyle[4] = 'display: none';
|
||||||
|
|
||||||
$table->data[0][0] = lang_string ('label');
|
$table->data[0][0] = lang_string ('label');
|
||||||
$table->data[0][1] = print_input_text ('label', '', '', 20, 200, true);
|
$table->data[0][1] = print_input_text ('label', '', '', 20, 200, true);
|
||||||
|
@ -378,20 +390,24 @@ if (! $edit_layout && ! $id_layout) {
|
||||||
$table->data[1][1] = print_input_text ('label_color', '#000000', '', 7, 7, true);
|
$table->data[1][1] = print_input_text ('label_color', '#000000', '', 7, 7, true);
|
||||||
$table->data[2][0] = lang_string ('type');
|
$table->data[2][0] = lang_string ('type');
|
||||||
$table->data[2][1] = print_select (get_layout_data_types (), 'type', '', '', '', '', true);
|
$table->data[2][1] = print_select (get_layout_data_types (), 'type', '', '', '', '', true);
|
||||||
$table->data[3][0] = lang_string ('agent');
|
$table->data[3][0] = lang_string ('height');
|
||||||
$table->data[3][1] = print_select ($agents, 'agent', '', '', '--', 0, true);
|
$table->data[3][1] = print_input_text ('height', '', '', 5, 5, true);
|
||||||
$table->data[4][0] = lang_string ('module');
|
$table->data[4][0] = lang_string ('width');
|
||||||
$table->data[4][1] = print_select (array (), 'module', '', '', '--', 0, true);
|
$table->data[4][1] = print_input_text ('width', '', '', 5, 5, true);
|
||||||
$table->data[5][0] = lang_string ('period');
|
$table->data[5][0] = lang_string ('agent');
|
||||||
$table->data[5][1] = print_select ($intervals, 'period', '', '', '--', 0, true);
|
$table->data[5][1] = print_select ($agents, 'agent', '', '', '--', 0, true);
|
||||||
$table->data[6][0] = lang_string ('image');
|
$table->data[6][0] = lang_string ('module');
|
||||||
$table->data[6][1] = print_select ($images_list, 'image', '', '', 'None', '', true);
|
$table->data[6][1] = print_select (array (), 'module', '', '', '--', 0, true);
|
||||||
$table->data[6][1] .= '<div id="image_preview"> </div>';
|
$table->data[7][0] = lang_string ('period');
|
||||||
$table->data[7][0] = lang_string ('parent');
|
$table->data[7][1] = print_select ($intervals, 'period', '', '', '--', 0, true);
|
||||||
$table->data[7][1] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '.$id_layout,
|
$table->data[8][0] = lang_string ('image');
|
||||||
|
$table->data[8][1] = print_select ($images_list, 'image', '', '', 'None', '', true);
|
||||||
|
$table->data[8][1] .= '<div id="image_preview"> </div>';
|
||||||
|
$table->data[9][0] = lang_string ('parent');
|
||||||
|
$table->data[9][1] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '.$id_layout,
|
||||||
'parent_item', '', '', 'None', '', true);
|
'parent_item', '', '', 'None', '', true);
|
||||||
$table->data[8][0] = lang_string ('map_linked');
|
$table->data[10][0] = lang_string ('map_linked');
|
||||||
$table->data[8][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout,
|
$table->data[10][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout,
|
||||||
'map_linked', '', '', 'None', '', true);
|
'map_linked', '', '', 'None', '', true);
|
||||||
|
|
||||||
echo '<form id="form_layout_data_editor" method="post" action="index.php?sec=greporting&sec2=godmode/reporting/map_builder">';
|
echo '<form id="form_layout_data_editor" method="post" action="index.php?sec=greporting&sec2=godmode/reporting/map_builder">';
|
||||||
|
@ -518,13 +534,18 @@ $(document).ready (function () {
|
||||||
id_layout_data: id
|
id_layout_data: id
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
|
console.log (data);
|
||||||
$("#form_layout_data_editor #text-label").attr ('value', data['label']);
|
$("#form_layout_data_editor #text-label").attr ('value', data['label']);
|
||||||
$("#form_layout_data_editor #type").attr ('value', data['type']);
|
$("#form_layout_data_editor #type").attr ('value', data['type']);
|
||||||
|
$("#form_layout_data_editor #type").change ();
|
||||||
$("#form_layout_data_editor #image").attr ('value', data['image']);
|
$("#form_layout_data_editor #image").attr ('value', data['image']);
|
||||||
|
$("#form_layout_data_editor #width").attr ('value', data['width']);
|
||||||
|
$("#form_layout_data_editor #height").attr ('value', data['height']);
|
||||||
$("#form_layout_data_editor #image").change ();
|
$("#form_layout_data_editor #image").change ();
|
||||||
$("#form_layout_data_editor #id_layout_data").attr ('value', data['id']);
|
$("#form_layout_data_editor #id_layout_data").attr ('value', data['id']);
|
||||||
$("#form_layout_data_editor #period").attr ('value', data['period'] / 3600);
|
$("#form_layout_data_editor #period").attr ('value', data['period'] / 3600);
|
||||||
$("#form_layout_data_editor #agent").attr ('value', data['id_agent']);
|
$("#form_layout_data_editor #agent").attr ('value', data['id_agent']);
|
||||||
|
$("#form_layout_data_editor #parent_item").attr ('value', data['parent_item']);
|
||||||
$("#form_layout_data_editor #map_linked").attr ('value', data['id_layout_linked']);
|
$("#form_layout_data_editor #map_linked").attr ('value', data['id_layout_linked']);
|
||||||
$("#form_layout_data_editor #hidden-update_layout_data").attr ('value', 1);
|
$("#form_layout_data_editor #hidden-update_layout_data").attr ('value', 1);
|
||||||
$("#form_layout_data_editor #hidden-create_layout_data").attr ('value', 0);
|
$("#form_layout_data_editor #hidden-create_layout_data").attr ('value', 0);
|
||||||
|
@ -563,6 +584,16 @@ $(document).ready (function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#form_layout_data_editor #agent").change (agent_changed);
|
$("#form_layout_data_editor #agent").change (agent_changed);
|
||||||
|
$("#form_layout_data_editor #type").change (function () {
|
||||||
|
if (this.value == 0) {
|
||||||
|
$("#table_layout_data #table_layout_data-3, #table_layout_data #table_layout_data-4").fadeOut ();
|
||||||
|
$("#table_layout_data #table_layout_data-8").fadeIn ();
|
||||||
|
} else {
|
||||||
|
$("#table_layout_data #table_layout_data-3, #table_layout_data #table_layout_data-4").fadeIn ();
|
||||||
|
$("#table_layout_data #table_layout_data-8").fadeOut ();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
$("#form_layout_data_editor #text-label_color").attachColorPicker();
|
$("#form_layout_data_editor #text-label_color").attachColorPicker();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -27,7 +27,7 @@ if (comprueba_login() != 0) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((give_acl($id_user,0,"AW") != 1 ) AND (dame_admin($id_user)!=1)) {
|
if ((give_acl($id_user, 0, "AW") != 1) && (dame_admin ($id_user) != 1)) {
|
||||||
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
||||||
include ("general/noaccess.php");
|
include ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -45,39 +45,24 @@ function generate_dot ($simple = 0) {
|
||||||
else {
|
else {
|
||||||
$orphans[$agent['id_agente']] = 1;
|
$orphans[$agent['id_agente']] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a new subgraph for the group
|
|
||||||
//if ($group_id != $agent['id_grupo'] && isset($_POST['group'])) {
|
|
||||||
// Close the previous group
|
|
||||||
//if ($group_id != -1) {
|
|
||||||
// $graph .= close_group();
|
|
||||||
//}
|
|
||||||
//$group_id = $agent['id_grupo'];
|
|
||||||
//$graph .= open_group($group_id);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Add node
|
// Add node
|
||||||
$graph .= create_node($agent , $simple);
|
$graph .= create_node($agent , $simple)."\n\t\t";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the last subgraph
|
|
||||||
//if (isset($_POST['group'])) {
|
|
||||||
// $graph .= close_group();
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Create a central node if orphan nodes exist
|
// Create a central node if orphan nodes exist
|
||||||
if (count($orphans) > 0) {
|
if (count ($orphans)) {
|
||||||
$graph .= create_pandora_node ($pandora_name);
|
$graph .= create_pandora_node ($pandora_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define edges
|
// Define edges
|
||||||
foreach ($parents as $node => $parent_id) {
|
foreach ($parents as $node => $parent_id) {
|
||||||
$graph .= create_edge($node, $parent_id);
|
$graph .= create_edge ($node, $parent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define edges for orphan nodes
|
// Define edges for orphan nodes
|
||||||
foreach(array_keys($orphans) as $node) {
|
foreach (array_keys($orphans) as $node) {
|
||||||
$graph .= create_edge('0', $node);
|
$graph .= create_edge ('0', $node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close graph
|
// Close graph
|
||||||
|
@ -88,7 +73,7 @@ function generate_dot ($simple = 0) {
|
||||||
|
|
||||||
// Returns an edge definition
|
// Returns an edge definition
|
||||||
function create_edge ($head, $tail) {
|
function create_edge ($head, $tail) {
|
||||||
$edge = $head . ' -- ' . $tail . '[color="#BDBDBD", headclip=false, tailclip=false];';
|
$edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false];';
|
||||||
return $edge;
|
return $edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,27 +97,23 @@ function create_node ($agent, $simple = 0) {
|
||||||
|
|
||||||
// Short name
|
// Short name
|
||||||
$name = strtolower ($agent["nombre"]);
|
$name = strtolower ($agent["nombre"]);
|
||||||
if (strlen($name) > 12)
|
if (strlen ($name) > 12)
|
||||||
$name = substr($name,0,12);
|
$name = substr ($name, 0, 12);
|
||||||
|
|
||||||
if ($simple == 0){
|
if ($simple == 0){
|
||||||
// Set node icon
|
// Set node icon
|
||||||
if (file_exists('images/networkmap/' . $agent['id_os'] . '.png')) {
|
if (file_exists ('images/networkmap/'.$agent['id_os'].'.png')) {
|
||||||
$img_node = 'images/networkmap/' . $agent['id_os'] . '.png';
|
$img_node = 'images/networkmap/'.$agent['id_os'].'.png';
|
||||||
} else {
|
} else {
|
||||||
$img_node = 'images/networkmap/0.png';
|
$img_node = 'images/networkmap/0.png';
|
||||||
}
|
}
|
||||||
|
$node = $agent['id_agente'].' [ color="'.$status_color.'", fontsize=9, style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD><IMG SRC="'.$img_node.'"/></TD></TR>
|
||||||
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=9, style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0">
|
<TR><TD>'.$name.'</TD></TR></TABLE>>,
|
||||||
<TR><TD><IMG SRC="' . $img_node . '"/></TD></TR>
|
|
||||||
<TR><TD color="green">' . $name . '</TD></TR></TABLE>>,
|
|
||||||
shape="ellipse", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",
|
shape="ellipse", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",
|
||||||
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='
|
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];';
|
||||||
. $agent['id_agente'].'"];';
|
|
||||||
} else {
|
} else {
|
||||||
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=7, style="filled", fixedsize=true, width=0.20, height=0.20, label="",
|
$node = $agent['id_agente'].' [ color="'.$status_color.'", fontsize=7, style="filled", fixedsize=true, width=0.20, height=0.20, label="",
|
||||||
tooltip="ajax.php?page=operation/agentes/ver_agente&
|
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];';
|
||||||
get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];';
|
|
||||||
}
|
}
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
@ -141,8 +122,8 @@ function create_node ($agent, $simple = 0) {
|
||||||
function create_pandora_node ($name) {
|
function create_pandora_node ($name) {
|
||||||
$node = '0 [ color="#364D1F", fontsize=10, style="filled", fixedsize=true, width=0.8, height=0.6, label=<<TABLE BORDER="0">
|
$node = '0 [ color="#364D1F", fontsize=10, style="filled", fixedsize=true, width=0.8, height=0.6, label=<<TABLE BORDER="0">
|
||||||
<TR><TD><IMG SRC="images/networkmap/pandora_node.png"/></TD></TR>
|
<TR><TD><IMG SRC="images/networkmap/pandora_node.png"/></TD></TR>
|
||||||
<TR><TD BGCOLOR="white">' . $name . '</TD></TR></TABLE>>,
|
<TR><TD BGCOLOR="#FFFFFF">'.$name.'</TD></TR></TABLE>>,
|
||||||
shape="ellipse", tooltip="' . $name . '", URL="index.php?sec=estado&sec2=operation/agentes/estado_grupo" ];';
|
shape="ellipse", tooltip="'.$name.'", URL="index.php?sec=estado&sec2=operation/agentes/estado_grupo" ];';
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
@ -154,8 +135,8 @@ function open_group ($id) {
|
||||||
|
|
||||||
$group = 'subgraph cluster_' . $id .
|
$group = 'subgraph cluster_' . $id .
|
||||||
' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER="0">
|
' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER="0">
|
||||||
<TR><TD><IMG SRC="' . $img . '"/></TD><TD>' . $name . '</TD></TR>
|
<TR><TD><IMG SRC="'.$img.'"/></TD><TD>'.$name.'</TD></TR>
|
||||||
</TABLE>>; tooltip="' . $name . '";
|
</TABLE>>; tooltip="'.$name.'";
|
||||||
URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='
|
URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='
|
||||||
. $id . '";';
|
. $id . '";';
|
||||||
|
|
||||||
|
@ -168,7 +149,7 @@ function close_group () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens a graph definition
|
// Opens a graph definition
|
||||||
function open_graph() {
|
function open_graph () {
|
||||||
global $config, $layout, $nooverlap, $pure, $zoom, $ranksep;
|
global $config, $layout, $nooverlap, $pure, $zoom, $ranksep;
|
||||||
$overlap = 'compress';
|
$overlap = 'compress';
|
||||||
$size_x = 8;
|
$size_x = 8;
|
||||||
|
@ -205,12 +186,12 @@ function open_graph() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closes a graph definition
|
// Closes a graph definition
|
||||||
function close_graph() {
|
function close_graph () {
|
||||||
return '}';
|
return '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the filter used to achieve the desired layout
|
// Returns the filter used to achieve the desired layout
|
||||||
function set_filter() {
|
function set_filter () {
|
||||||
global $layout;
|
global $layout;
|
||||||
|
|
||||||
switch($layout) {
|
switch($layout) {
|
||||||
|
@ -254,7 +235,7 @@ if ((give_acl($id_user, 0, "AR") != 1 ) && (dame_admin($id_user) !=1 )) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<h2>' . $lang_label['ag_title'].' > '.lang_string("Network Map").' ';
|
echo '<h2>'.lang_string ('ag_title').' > '.lang_string("Network Map").' ';
|
||||||
if ($pure == 1) {
|
if ($pure == 1) {
|
||||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=0"><img src="images/monitor.png" title="' . lang_string('Normal screen') . '"></a>';
|
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=0"><img src="images/monitor.png" title="' . lang_string('Normal screen') . '"></a>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -303,7 +284,7 @@ if ($pure == "1") {
|
||||||
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
|
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
echo '<input name="updbutton" type="submit" class="sub upd" value="'.
|
echo '<input name="updbutton" type="submit" class="sub upd" value="'.
|
||||||
$lang_label["update"] . '">';
|
lang_string ("update").'">';
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
@ -328,6 +309,10 @@ if ($result !== false) {
|
||||||
}
|
}
|
||||||
echo '<img src="attachment/networkmap.png" usemap="#networkmap"/>';
|
echo '<img src="attachment/networkmap.png" usemap="#networkmap"/>';
|
||||||
include $config["attachment_store"]."/networkmap.map";
|
include $config["attachment_store"]."/networkmap.map";
|
||||||
|
} else {
|
||||||
|
echo '<h2 class="err">'.lang_string ('Map could not be generated').'</h2>';
|
||||||
|
echo $result;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -24,36 +24,32 @@ require_once ("../../include/functions_db.php");
|
||||||
require_once ("../../include/languages/language_".$config["language"].".php");
|
require_once ("../../include/languages/language_".$config["language"].".php");
|
||||||
require_once ("../../include/functions_reporting_pdf.php");
|
require_once ("../../include/functions_reporting_pdf.php");
|
||||||
|
|
||||||
if (!isset($_SESSION["id_usuario"])){
|
if (!isset ($_SESSION["id_usuario"])) {
|
||||||
session_start();
|
session_start();
|
||||||
session_write_close();
|
session_write_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
$config ["id_user"] = $_SESSION["id_usuario"];
|
|
||||||
|
|
||||||
// Session check
|
// Session check
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
// Login check
|
// Login check
|
||||||
$id_user=$_SESSION["id_usuario"];
|
|
||||||
global $REMOTE_ADDR;
|
global $REMOTE_ADDR;
|
||||||
|
|
||||||
if (comprueba_login() != 0) {
|
if (comprueba_login ()) {
|
||||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
||||||
include ("general/noaccess.php");
|
include ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((give_acl($id_user,0,"AR") != 1 ) AND (dame_admin($id_user)!=1)) {
|
if (! give_acl ($id_user, 0, "AR") && ! dame_admin ($id_user)) {
|
||||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
||||||
include ("general/noaccess.php");
|
include ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_report = (int) get_parameter ('id');
|
||||||
$id_report = get_parameter ('id');
|
if (! $id_report) {
|
||||||
if ($id_report == ""){
|
audit_db ($id_user, $REMOTE_ADDR, "HACK Attempt", "Trying to access graph viewer withoud ID");
|
||||||
audit_db($id_user,$REMOTE_ADDR, "HACK Attempt","Trying to access graph viewer withoud ID");
|
|
||||||
include ("general/noaccess.php");
|
include ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -61,22 +57,21 @@ if ($id_report == ""){
|
||||||
$report_private= get_db_value ("private", "treport", "id_report", $id_report);
|
$report_private= get_db_value ("private", "treport", "id_report", $id_report);
|
||||||
$report_user = get_db_value ("id_user", "treport", "id_report", $id_report);
|
$report_user = get_db_value ("id_user", "treport", "id_report", $id_report);
|
||||||
|
|
||||||
if (($report_user == $id_user) OR (dame_admin($id_user)==1) OR ($report_private == 0)) {
|
if ($report_user == $id_user || dame_admin ($id_user) || ! $report_private) {
|
||||||
// Without report type parameter: ABORT
|
$report_type = get_parameter ("rtype");
|
||||||
if (isset($_GET["rtype"])) // YES, R-type was a classic game :-)
|
// Without report type parameter: ABORT
|
||||||
$report_type = get_parameter ("rtype");
|
if (! $report_type) {
|
||||||
else {
|
echo "<h2>No access without report type</h2>";
|
||||||
echo "<h2>No access without report type</h2>";
|
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access report without specify reportype");
|
||||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access report without specify reportype");
|
exit;
|
||||||
exit;
|
}
|
||||||
}
|
|
||||||
|
// Available PDF reports:
|
||||||
// Available PDF reports:
|
switch ($report_type) {
|
||||||
switch ($report_type){
|
case "general":
|
||||||
case "general":
|
general_report ($id_report);
|
||||||
general_report ($id_report);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue