2008-08-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
* godmode/servers/modificar_server.php. godmode/servers/manage_recontask_form.php, godmode/servers/manage_recontask.php: HTML and SQL overhaul. Now uses the new functions that are available in functions_html.php. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1016 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
cdeb746651
commit
79f24e4daf
|
@ -3,6 +3,13 @@
|
|||
* general/pandora_help.php: Added a require of a functions file. Added
|
||||
missing HTML tags.
|
||||
|
||||
2008-08-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* godmode/servers/modificar_server.php.
|
||||
godmode/servers/manage_recontask_form.php,
|
||||
godmode/servers/manage_recontask.php: HTML and SQL overhaul. Now uses
|
||||
the new functions that are available in functions_html.php.
|
||||
|
||||
2008-08-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* godmode/profiles/profile_list.php: HTML overhaul (close tags, put
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
|
||||
|
@ -31,154 +30,108 @@ if (! give_acl ($config['id_user'], 0, "LM")) {
|
|||
// --------------------------------
|
||||
// DELETE A RECON TASKs
|
||||
// --------------------------------
|
||||
if (isset($_GET["delete"])) {
|
||||
$id = entrada_limpia($_GET["delete"]);
|
||||
$sql = "DELETE FROM trecon_task WHERE id_rt = $id ";
|
||||
$result = mysql_query($sql);
|
||||
if ($result)
|
||||
echo "<h3 class='suc'>".__('Deleted successfully')."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".__('Not deleted. Error deleting data')."</h3>";
|
||||
if (isset ($_GET["delete"])) {
|
||||
$id = get_parameter_get ("delete");
|
||||
$sql = sprintf("DELETE FROM trecon_task WHERE id_rt = '%d'",$id);
|
||||
$result = process_sql ($sql);
|
||||
if ($result !== false) {
|
||||
echo '<h3 class="suc">'.__('Succesfully deleted recon task').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('Error deleting recon task').'</h3>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((isset($_GET["update"])) OR ((isset($_GET["create"])))){
|
||||
$name = entrada_limpia($_POST["name"]);
|
||||
$network = entrada_limpia($_POST["network"]);
|
||||
$description = entrada_limpia($_POST["description"]);
|
||||
$id_recon_server = entrada_limpia($_POST["id_recon_server"]);
|
||||
$interval = entrada_limpia($_POST["interval"]);
|
||||
$id_group = entrada_limpia($_POST["id_group"]);
|
||||
$create_incident = entrada_limpia($_POST["create_incident"]);
|
||||
$id_network_profile = entrada_limpia($_POST["id_network_profile"]);
|
||||
$id_os = get_parameter ("id_os", 10);
|
||||
|
||||
// --------------------------------
|
||||
// GET PARAMETERS IF UPDATE OR CREATE
|
||||
// --------------------------------
|
||||
if ((isset ($_GET["update"])) OR ((isset ($_GET["create"])))) {
|
||||
$name = get_parameter_post ("name");
|
||||
$network = get_parameter_post ("network");
|
||||
$description = get_parameter_post ("description");
|
||||
$id_recon_server = get_parameter_post ("id_recon_server");
|
||||
$interval = get_parameter_post ("interval");
|
||||
$id_group = get_parameter_post ("id_group");
|
||||
$create_incident = get_parameter_post ("create_incident");
|
||||
$id_network_profile = get_parameter_post ("id_network_profile");
|
||||
$id_os = get_parameter_post ("id_os", 10);
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// UPDATE A RECON TASK
|
||||
// --------------------------------
|
||||
if (isset($_GET["update"])) {
|
||||
$id = entrada_limpia($_GET["update"]);
|
||||
$sql = "UPDATE trecon_task SET id_os = $id_os, name = '$name', subnet = '$network',
|
||||
description='$description', id_recon_server = $id_recon_server,
|
||||
create_incident = $create_incident, id_group = $id_group, interval_sweep = $interval,
|
||||
id_network_profile = $id_network_profile WHERE id_rt = $id";
|
||||
$result=mysql_query($sql);
|
||||
if ($result)
|
||||
echo "<h3 class='suc'>".__('Updated successfully')."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".__('Not updated. Error updating data')."</h3>";
|
||||
$id = get_parameter_get ("update");
|
||||
$sql = sprintf ("UPDATE trecon_task SET id_os = %d, name = '%s', subnet = '%s',
|
||||
description = '%s', id_recon_server = %d, create_incident = %b, id_group = %d, interval_sweep = %u,
|
||||
id_network_profile = %d WHERE id_rt = %u",$id_os,$name,$network,$description,$id_recon_server,$create_incident,$id_group,$interval,$id_network_profile,$id);
|
||||
|
||||
if (process_sql ($sql) !== false) {
|
||||
echo '<h3 class="suc">'.__('Successfully updated recon task').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('Error updating recon task').'</h3>';
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// CREATE A RECON TASK
|
||||
// --------------------------------
|
||||
if (isset($_GET["create"])) {
|
||||
$sql = "INSERT INTO trecon_task (name, subnet, description, id_recon_server, create_incident, id_group, id_network_profile, interval_sweep, id_os) VALUES ( '$name', '$network', '$description', $id_recon_server, $create_incident, $id_group, $id_network_profile, $interval, $id_os)";
|
||||
$result=mysql_query($sql);
|
||||
if ($result)
|
||||
echo "<h3 class='suc'>".__('Created successfully')."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".__('Not created. Error inserting data')."</h3>";
|
||||
$sql = sprintf ("INSERT INTO trecon_task
|
||||
(name, subnet, description, id_recon_server, create_incident, id_group, id_network_profile, interval_sweep, id_os)
|
||||
VALUES ( '%s', '%s', '%s', %u, %b, %d, %d, %u, %d)",$name,$network,$description,$id_recon_server,$create_incident,$id_group,$id_network_profile,$interval,$id_os);
|
||||
|
||||
if (process_sql ($sql) !== false) {
|
||||
echo '<h3 class="suc">'.__('Successfully created recon task').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('Error creating recon task').'</h3>';
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// SHOW TABLE WITH ALL RECON TASKs
|
||||
// --------------------------------
|
||||
echo "<h2>".__('Pandora servers')." > ";
|
||||
echo __('Manage recontask')."</h2>";
|
||||
$query="SELECT * FROM trecon_task";
|
||||
$result=mysql_query($query);
|
||||
echo "<h2>".__('Pandora servers')." > ".__('Manage recontask')."</h2>";
|
||||
|
||||
$result = get_db_all_rows_in_table ("trecon_task");
|
||||
$color=1;
|
||||
if (mysql_num_rows($result)){
|
||||
echo "<table cellpadding='4' cellspacing='4' width='700' class='databox'>";
|
||||
echo "<tr><th class='datos'>".__('Name')."</th>";
|
||||
echo "<th class='datos'>".__('Type')."</th>";
|
||||
echo "<th class='datos'>".__('Network')."</th>";
|
||||
echo "<th class='datos'>".__('Network profile')."</th>";
|
||||
echo "<th class='datos'>".__('Group')."</th>";
|
||||
echo "<th class='datos'>".__('Incident')."</th>";
|
||||
echo "<th class='datos'>".__('OS')."</th>";
|
||||
echo "<th class='datos'>".__('Interval')."</th>";
|
||||
echo "<th class='datos'>".__('Action')."</th></tr>";
|
||||
if ($result !== false) {
|
||||
$table->head = array (__('Name'), __('Network'), __('Network profile'), __('Group'), __('Incident'), __('OS'), __('Interval'), __('Action'));
|
||||
$table->align = array ("","","","center","","","center","center");
|
||||
$table->width = 700;
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->class = "databox";
|
||||
|
||||
foreach ($result as $row) {
|
||||
$table->data[] = array (
|
||||
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'"><b>'.$row["name"].'</b></a>',
|
||||
// Network (subnet)
|
||||
$row["subnet"],
|
||||
// Network profile name
|
||||
'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates&id='.$row["id_network_profile"].'">'.give_network_profile_name ($row["id_network_profile"]).'</a>',
|
||||
// GROUP
|
||||
'<img class="bot" src="images/groups_small/'.show_icon_group ($row["id_group"]).'.png" alt="">',
|
||||
// INCIDENT
|
||||
(($row["create_incident"] == 1) ? __('Yes') : __('No')),
|
||||
// OS
|
||||
(($row["id_os"] > 0) ? '<img src="images/'.dame_so_icon ($row["id_os"]).'" />' : __('Any')),
|
||||
// INTERVAL
|
||||
human_time_description_raw($row["interval_sweep"]),
|
||||
// ACTION
|
||||
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">
|
||||
<img src="images/cross.png" border="0" /></a> <a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">
|
||||
<img src="images/config.png" /></a>'
|
||||
);
|
||||
}
|
||||
print_table ($table);
|
||||
unset ($table);
|
||||
} else {
|
||||
echo '<div class="nf">'.__('There are no recon task configured').'</div>';
|
||||
}
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$id_rt = $row["id_rt"];
|
||||
$name = $row["name"];
|
||||
$network = $row["subnet"];
|
||||
$description = $row["description"];
|
||||
// $id_server = $row["server"];
|
||||
$type = $row["type"];
|
||||
$id_recon_server = $row["id_recon_server"];
|
||||
$interval = $row["interval_sweep"];
|
||||
$id_group = $row["id_group"];
|
||||
$create_incident = $row["create_incident"];
|
||||
$id_network_profile = $row["id_network_profile"];
|
||||
$id_os = $row["id_os"];
|
||||
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
echo "<a href='index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update=$id_rt'><b>$name</b></A>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($type ==1)
|
||||
echo "ICMP";
|
||||
|
||||
// Network
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $network;
|
||||
|
||||
// Network profile name
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo "<a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates&id=$id_network_profile'>".give_network_profile_name($id_network_profile)."</a>";
|
||||
|
||||
// GROUP
|
||||
echo "</td><td class='$tdcolor' align='center'>";
|
||||
echo "<img class='bot' src='images/groups_small/".show_icon_group($id_group).".png' alt=''>";
|
||||
|
||||
// INCIDENT
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($create_incident == 1)
|
||||
echo __('Yes');
|
||||
else
|
||||
echo __('No');
|
||||
|
||||
// OS
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($id_os > 0){
|
||||
$icon = get_db_sql ("SELECT icon_name FROM tconfig_os WHERE id_os = $id_os");
|
||||
echo "<img src='images/$icon'>";
|
||||
}
|
||||
|
||||
// INTERVAL
|
||||
echo "</td><td class='$tdcolor' align='center'>";
|
||||
echo human_time_description_raw($interval);
|
||||
|
||||
// ACTION
|
||||
echo "</td><td class='".$tdcolor."' align='center'><a href='index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete=$id_rt'><img src='images/cross.png' border='0'>";
|
||||
echo " ";
|
||||
echo "<a href='index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update=$id_rt'><img src='images/config.png'></A>";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
if (!mysql_num_rows($result)){
|
||||
echo "<div class='nf'>".__('There are no recon task configured')."</div>";
|
||||
}
|
||||
|
||||
echo "<table width='700'>";
|
||||
echo "<tr><td align='right'>";
|
||||
echo "<form method='post' action='index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create'>";
|
||||
echo "<input type='submit' class='sub next' name='crt' value='".__('Create')."'>";
|
||||
echo "</form></table>";
|
||||
|
||||
$table->align = array ("right");
|
||||
$table->width = 700;
|
||||
$table->data[] = array ('<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create">'.print_submit_button (__('Create'),"crt",false,'class="sub next"',true).'</form>');
|
||||
print_table($table);
|
||||
unset($table);
|
||||
?>
|
||||
|
|
|
@ -28,160 +28,126 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
|
|||
}
|
||||
|
||||
if (isset ($_GET["update"])) { // Edit mode
|
||||
$id_rt = $_GET["update"];
|
||||
$query="SELECT * FROM trecon_task where id_rt = $id_rt";
|
||||
$result=mysql_query($query);
|
||||
$row=mysql_fetch_array($result);
|
||||
$id_rt = (int) get_parameter_get ("update");
|
||||
$row = get_db_row ("trecon_task","id_rt",$id_rt);
|
||||
$name = $row["name"];
|
||||
$network = $row["subnet"];
|
||||
$id_recon_server = $row["id_recon_server"];
|
||||
$description = $row["description"];
|
||||
$type = $row["type"];
|
||||
$interval = $row["interval_sweep"];
|
||||
$id_group = $row["id_group"];
|
||||
$create_incident = $row["create_incident"];
|
||||
$id_network_profile = $row["id_network_profile"];
|
||||
$id_os = $row["id_os"];
|
||||
|
||||
} elseif (isset ($_GET["create"])) {
|
||||
$id_rt = -1;
|
||||
$name = "";
|
||||
$network = "";
|
||||
$description = "";
|
||||
$id_recon_server = 0;
|
||||
$type = 1;
|
||||
$interval = 43200;
|
||||
$id_group = 1;
|
||||
$create_incident = 1;
|
||||
$id_network_profile = 1;
|
||||
$id_os = 10; // Other
|
||||
$id_os = -1; // Any
|
||||
}
|
||||
|
||||
echo '<h2>'.__('Pandora servers').' > ';
|
||||
echo __('Manage recontask');
|
||||
echo '<h2>'.__('Pandora servers').' > '.__('Manage recontask');
|
||||
pandora_help ("recontask");
|
||||
echo '</h2>';
|
||||
echo '<table width="700" cellspacing="4" cellpadding="4" class="databox_color">';
|
||||
|
||||
$table->width=700;
|
||||
$table->cellspacing=4;
|
||||
$table->cellpadding=4;
|
||||
$table->class="databox_color";
|
||||
|
||||
// Different Form url if it's a create or if it's a update form
|
||||
if ($id_rt != -1)
|
||||
echo "<form name='modulo' method='post' action='index.php?sec=gservers&sec2=godmode/servers/manage_recontask&update=$id_rt'>";
|
||||
else
|
||||
echo "<form name='modulo' method='post' action='index.php?sec=gservers&sec2=godmode/servers/manage_recontask&create=1'>";
|
||||
echo '<form name="modulo" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&'.(($id_rt != -1) ? 'update='.$id_rt : 'create=1').'">';
|
||||
|
||||
// Name
|
||||
echo '<tr><td class="datos2">'.__('Task name');
|
||||
echo "<td class='datos2'><input type='text' name='name' size='25' value='$name'>";
|
||||
$table->data[] = array (__('Task name'),print_input_text ('name',$name,'',25,0,true));
|
||||
|
||||
// Recon server
|
||||
echo "<td class='datos2'>".__('Recon Server');
|
||||
echo '<a href="#" class="tip"> <span>'.__('You must select a Recon Server for the Task, otherwise the Recon Task will never run').'</span></a>';
|
||||
echo "<td class='datos2'>";
|
||||
echo '<select name="id_recon_server">';
|
||||
echo "<option value='$id_recon_server'>" . give_server_name($id_recon_server);
|
||||
$sql1="SELECT id_server, name FROM tserver WHERE recon_server = 1 ORDER BY name ";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
echo "<option value='".$row["id_server"]."'>".$row["name"]."</option>";
|
||||
$sql = "SELECT id_server, name FROM tserver WHERE recon_server = 1 ORDER BY name";
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
foreach ($result as $row) {
|
||||
$selectbox[$row["id_server"]] = $row["name"];
|
||||
}
|
||||
echo "</select>";
|
||||
$table->data[] = array (__('Recon Server').'<a href="#" class="tip"> <span>'.__('You must select a Recon Server for the Task, otherwise the Recon Task will never run').'</span></a>',
|
||||
print_select ($selectbox, "id_recon_server", $id_recon_server,'','','',true));
|
||||
unset ($selectbox);
|
||||
|
||||
// Network
|
||||
echo "<tr>";
|
||||
echo '<td class="datos">'.__('Network').'</td>';
|
||||
echo '<td class="datos">';
|
||||
echo '<input type="text" name="network" size="25" value="'.$network.'"></td>';
|
||||
$table->data[] = array (__('Network'),print_input_text ('network',$network,'',25,0,true));
|
||||
|
||||
// Interval
|
||||
echo '<td class="datos">'.__('Interval').'</td>';
|
||||
echo '<td class="datos">';
|
||||
echo "<select name='interval'>";
|
||||
if ($interval != 0){
|
||||
if ($interval < 43200)
|
||||
echo "<option value='$interval'>".($interval / 3600).__('hours')."</option>";
|
||||
else
|
||||
echo "<option value='$interval'>".($interval / 86400).__('days')."</option>";
|
||||
}
|
||||
echo "<option value='3600'>1 ".__('One hour')."</option>";
|
||||
echo "<option value='7200'>2 ".__('hours')."</option>";
|
||||
echo "<option value='21600'>6 ".__('hours')."</option>";
|
||||
echo "<option value='43200'>1/2 ".__('day')."</option>";
|
||||
echo "<option value='86400'>1 ".__('day')."</option>";
|
||||
echo "<option value='432000'>5 ".__('days')."</option>";
|
||||
echo "<option value='604800'>1 ".__('week')."</option>";
|
||||
echo "<option value='1209600'>2 ".__('week')."</option>";
|
||||
echo "<option value='2592000'>1 ".__('month')."</option>";
|
||||
echo "</select>";
|
||||
$selectbox = array (
|
||||
3600 => '1 '.__('hour'),
|
||||
7200 => '2 '.__('hours'),
|
||||
21600 => '6 '.__('hours'),
|
||||
43200 => '12 '.__('hours'),
|
||||
86400 => '1 '.__('day'),
|
||||
432000 => '5 '.__('days'),
|
||||
604800 => '1 '.__('week'),
|
||||
1209600 => '2 '.__('weeks'),
|
||||
2592000 => '1 '.__('month')
|
||||
);
|
||||
|
||||
$table->data[] = array (__('Interval'),print_select ($selectbox, "interval", $interval,'','','',true));
|
||||
unset ($selectbox);
|
||||
|
||||
// Network profile
|
||||
echo "<tr>";
|
||||
echo "<td class='datos2'>".__('Network profile') . "</td>";
|
||||
echo "<td class='datos2'>";
|
||||
echo "<select name='id_network_profile'>";
|
||||
echo "<option value='$id_network_profile'>".give_network_profile_name($id_network_profile);
|
||||
$sql1 = "SELECT * FROM tnetwork_profile where id_np != '$id_network_profile'";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result))
|
||||
echo "<option value='".$row["id_np"]."'>".$row["name"]."</option>";
|
||||
echo "</select></td>";
|
||||
$sql = sprintf("SELECT id_np, name FROM tnetwork_profile");
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
foreach($result as $row) {
|
||||
$selectbox[$row["id_np"]] = $row["name"];
|
||||
}
|
||||
|
||||
$table->data[] = array (__('Network profile'),print_select ($selectbox, "id_network_profile", $id_network_profile,'','','',true));
|
||||
unset ($selectbox);
|
||||
|
||||
// OS
|
||||
echo "<td class='datos2'>". __('OS') . "</td>";
|
||||
echo "<td class='datos2'>";
|
||||
echo "<select name='id_os'>";
|
||||
if ($id_os != 0)
|
||||
echo "<option value='$id_os'>".get_db_sql ("SELECT name FROM tconfig_os WHERE id_os = $id_os");
|
||||
echo "<option value=-1>". __('Any');
|
||||
$sql1 = "SELECT * FROM tconfig_os ORDER BY name";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result))
|
||||
echo "<option value='".$row["id_os"]."'>".$row["name"]."</option>";
|
||||
echo "</select></td>";
|
||||
$sql = "SELECT id_os, name FROM tconfig_os ORDER BY name";
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
$selectbox[-1] = __('Any');
|
||||
foreach ($result as $row) {
|
||||
$selectbox[$row["id_os"]] = $row["name"];
|
||||
}
|
||||
|
||||
$table->data[] = array (__('OS'),print_select ($selectbox, "id_os", $id_os,'','','',true));
|
||||
unset ($selectbox);
|
||||
|
||||
// Group
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>".__('Group')."</td>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<select name='id_group'>";
|
||||
echo "<option value='$id_group'>".dame_nombre_grupo($id_group)."</option>";
|
||||
$sql1 = "SELECT * FROM tgrupo where id_grupo != $id_group";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result))
|
||||
echo "<option value='".$row["id_grupo"]."'>".$row["nombre"]."</option>";
|
||||
echo "</select></td>";
|
||||
$sql = "SELECT id_grupo, nombre FROM tgrupo";
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
foreach ($result as $row) {
|
||||
$selectbox[$row["id_grupo"]] = $row["nombre"];
|
||||
}
|
||||
$table->data[] = array (__('Group'),print_select ($selectbox, "id_group", $id_group,'','','',true));
|
||||
unset ($selectbox);
|
||||
|
||||
// Incident
|
||||
echo "<tr>";
|
||||
echo "<td class='datos2'>".__('Incident')."</td>";
|
||||
echo "<td class='datos2'>";
|
||||
echo "<select name='create_incident'>";
|
||||
if ($create_incident == 1){
|
||||
echo "<option value='1'>".__('Yes')."</option>";
|
||||
echo "<option value='0'>".__('No')."</option>";
|
||||
}
|
||||
else {
|
||||
echo "<option value='0'>".__('No')."</option>";
|
||||
echo "<option value='1'>".__('Yes')."</option>";
|
||||
}
|
||||
echo "</select></td>";
|
||||
echo "<td class='datos2' colspan=2> </td></tr>";
|
||||
$selectbox = array ( 0 => __('No'), 1 => __('Yes') );
|
||||
$table->data[] = array (__('Incident'),print_select ($selectbox, "create_incident", $create_incident,'','','',true));
|
||||
|
||||
// Comments
|
||||
echo '<tr><td class="datost">'.__('Comments');
|
||||
echo '<td class="datos" colspan=3>';
|
||||
echo '<textarea name="description" cols=70 rows=2>';
|
||||
echo $description;
|
||||
echo "</textarea>";
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
$table->data[] = array (__('Comments'),print_textarea ("description", 2, 70, $description,'',true));
|
||||
print_table ($table);
|
||||
unset ($table);
|
||||
|
||||
//Table with buttons
|
||||
$table->align = array ("right");
|
||||
$table->width = 700;
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
if ($id_rt != "-1") {
|
||||
$table->data[] = array ('<input name="updbutton" type="submit" class="sub upd" value="'.__('Update').'">');
|
||||
} else {
|
||||
$table->data[] = array ('<input name="crtbutton" type="submit" class="sub wand" value="'.__('Add').'">');
|
||||
}
|
||||
print_table($table);
|
||||
unset($table);
|
||||
|
||||
echo "<table cellpadding='4' cellspacing='4' width='700'>";
|
||||
echo "<td align='right'>";
|
||||
if ($id_rt != "-1")
|
||||
echo '<input name="updbutton" type="submit" class="sub upd" value="'.__('Update').'">';
|
||||
else
|
||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.__('Add').'">';
|
||||
echo "</form>";
|
||||
echo "</table>";
|
||||
|
||||
?>
|
||||
|
|
|
@ -24,159 +24,114 @@ if (! give_acl ($config["id_user"], 0, "AR") && ! give_acl($config['id_user'], 0
|
|||
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to access Server Management");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset ($_GET["delete"])) {
|
||||
$id_server = entrada_limpia($_GET["server_del"]);
|
||||
$sql = "DELETE FROM tserver WHERE id_server='".$id_server."'";
|
||||
$result=mysql_query($sql);
|
||||
if ($result) echo "<h3 class='suc'>".__('Server deleted successfully')."</h3>";
|
||||
else echo "<h3 class='suc'>".__('There was a problem deleting server')."</h3>";
|
||||
}
|
||||
|
||||
if (isset($_GET["update"])) {
|
||||
$name=entrada_limpia($_POST["name"]);
|
||||
$address=entrada_limpia($_POST["address"]);
|
||||
$description=entrada_limpia($_POST["description"]);
|
||||
$id_server=entrada_limpia($_POST["server"]);
|
||||
$sql = "UPDATE tserver SET name='".$name."', ip_address='".$address."', description='".$description."' WHERE id_server='".$id_server."'";
|
||||
$result=mysql_query($sql);
|
||||
if ($result) echo "<h3 class='suc'>".__('Server updated successfully')."</h3>";
|
||||
else echo "<h3 class='suc'>".__('There was a problem updating server')."</h3>";
|
||||
$id_server = get_parameter_get ("server_del");
|
||||
$sql = sprintf ("DELETE FROM tserver WHERE id_server='%d'",$id_server);
|
||||
$result = process_sql ($sql);
|
||||
if ($result !== false) {
|
||||
echo '<h3 class="suc">'.__('Server deleted successfully').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('There was a problem deleting the server').'</h3>';
|
||||
}
|
||||
} elseif (isset($_GET["update"])) {
|
||||
$name = get_parameter_post ("name");
|
||||
$address = get_parameter_post ("address");
|
||||
$description = get_parameter_post ("description");
|
||||
$id_server = get_parameter_post ("server");
|
||||
$sql = sprintf ("UPDATE tserver SET name = '%s', ip_address = '%s', description = '%s' WHERE id_server = %d",$name,$address,$description,$server);
|
||||
$result = process_sql ($sql);
|
||||
if ($result !== false) {
|
||||
echo '<h3 class="suc">'.__('Server updated successfully').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('There was a problem updating the server').'</h3>';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET["server"])) {
|
||||
$id_server=entrada_limpia($_GET["server"]);
|
||||
echo "<h2>".__('Pandora servers')." > ";
|
||||
echo __('Update Server')."</h2>";
|
||||
$id_server= get_parameter_get ("server");
|
||||
echo "<h2>".__('Pandora servers')." > ".__('Update Server')."</h2>";
|
||||
$sql = sprintf("SELECT name, ip_address, description FROM tserver WHERE id_server = %d",$id_server);
|
||||
$row = get_db_row_sql ($sql);
|
||||
echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">';
|
||||
print_input_hidden ("server",$id_server);
|
||||
|
||||
$table->cellpadding=4;
|
||||
$table->cellspacing=4;
|
||||
$table->width=450;
|
||||
$table->class="databox_color";
|
||||
|
||||
$table->data[] = array (__('Name'),print_input_text ('name',$row["name"],'',50,0,true));
|
||||
$table->data[] = array (__('IP Address'),print_input_text ('address',$row["ip_address"],'',50,0,true));
|
||||
$table->data[] = array (__('Description'),print_input_text ('description',$row["description"],'',50,0,true));
|
||||
|
||||
print_table($table);
|
||||
unset ($table->data, $table->class);
|
||||
|
||||
$query="SELECT * FROM tserver WHERE id_server=".$id_server;
|
||||
$result=mysql_query($query);
|
||||
if (mysql_num_rows($result)){
|
||||
$row=mysql_fetch_array($result);
|
||||
$name = $row["name"];
|
||||
$address = $row["ip_address"];
|
||||
$status = $row["status"];
|
||||
$laststart = $row["laststart"];
|
||||
$keepalive = $row["keepalive"];
|
||||
$network_server = $row["network_server"];
|
||||
$data_server = $row["data_server"];
|
||||
$snmp_server = $row["snmp_server"];
|
||||
$master = $row["master"];
|
||||
$checksum = $row["checksum"];
|
||||
$description = $row["description"];
|
||||
echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">';
|
||||
echo "<table cellpadding='4' cellspacing='4' width='450' class='databox_color'>";
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>".__('Name')."</td><td class='datos'><input type='text' name='name' value='".$name."' width='200px'>";
|
||||
echo "<tr><td class='datos2'>".__('IP Address')."</td><td class='datos2'><input type='text' name='address' value='".$address."' width='200px'>";
|
||||
echo "<tr><td class='datos'>".__('Description')."<td class='datos'><input type='text' name='description' value='".$description."'><input type='hidden' name='server' value='".entrada_limpia($_GET["server"])."'></input>";
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
|
||||
}
|
||||
echo '</table>';
|
||||
echo '<table cellpadding="4" cellspacing="4" width="450">';
|
||||
echo '<tr><td align="right">';
|
||||
echo '<input type="submit" class="sub upd" value="'.__('Update').'"></table>';
|
||||
}
|
||||
else {
|
||||
$table->align=array ("right");
|
||||
$table->data[] = array ('<input type="submit" class="sub upd" value="'.__('Update').'">');
|
||||
print_table($table);
|
||||
unset ($table);
|
||||
} else {
|
||||
$result = get_db_all_rows_in_table ("tserver");
|
||||
echo "<h2>".__('Pandora servers')." > ".__('Manage servers')."</h2>";
|
||||
|
||||
$sql='SELECT * FROM tserver';
|
||||
echo "<h2>".__('Pandora servers')." > ";
|
||||
echo __('Manage servers')."</h2>";
|
||||
|
||||
$result=mysql_query($sql);
|
||||
if (mysql_num_rows($result)){
|
||||
echo "<table cellpadding='4' cellspacing='4' witdh='550' class='databox'>";
|
||||
echo "<tr><th class='datos'>".__('Name')."</th>";
|
||||
echo "<th class='datos'>".__('Status')."</th>";
|
||||
echo "<th class='datos'>".__('IP Address')."</th>";
|
||||
echo "<th class='datos'>".__('Description')."</th>";
|
||||
echo "<th class='datos' width=80>".__('Type')."</th>";
|
||||
echo "<th class='datos'>".__('Started at')."</th>";
|
||||
echo "<th class='datos'>".__('Updated at')."</th>";
|
||||
echo "<th class='datos'>".__('Delete')."</th>";
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$name = $row["name"];
|
||||
$address = $row["ip_address"];
|
||||
$status = $row["status"];
|
||||
$laststart = $row["laststart"];
|
||||
$keepalive = $row["keepalive"];
|
||||
$network_server = $row["network_server"];
|
||||
$data_server = $row["data_server"];
|
||||
$snmp_server = $row["snmp_server"];
|
||||
$master = $row["master"];
|
||||
$checksum = $row["checksum"];
|
||||
$description = $row["description"];
|
||||
$id_server = $row["id_server"];
|
||||
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
if ($result !== false) {
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = "100%";
|
||||
$table->class = "databox";
|
||||
$table->align = array ('',"center","center","center","center","center","center","center");
|
||||
$table->head = array (__('Name'),__('Status'),__('IP Address'),__('Description'),__('Type'),__('Started at'),__('Updated at'),__('Delete'));
|
||||
|
||||
foreach ($result as $row) {
|
||||
$server = "";
|
||||
if($row["network_server"] == 1) {
|
||||
$server .= '<img src="images/network.png" /> ';
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
if ($row["data_server"] == 1) {
|
||||
$server .= '<img src="images/data.png" /> ';
|
||||
}
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
echo "<a href='index.php?sec=gservers&sec2=godmode/servers/modificar_server&server=".$id_server."'><b>$name</b></a>";
|
||||
echo "</td><td class='$tdcolor' align='middle'>";
|
||||
if ($status ==0){
|
||||
echo "<img src='images/dot_red.png'>";
|
||||
} else {
|
||||
echo "<img src='images/dot_green.png'>";
|
||||
if ($row["snmp_server"] == 1) {
|
||||
$server .= '<img src="images/snmp.png" /> ';
|
||||
}
|
||||
echo "</td><td class='$tdcolor' align='middle'>";
|
||||
echo "$address";
|
||||
echo "</td><td class='".$tdcolor."f9'>".substr($description,0,25);
|
||||
echo "</td><td class='$tdcolor' align='middle'>";
|
||||
if ($network_server == 1){
|
||||
echo " <img src='images/network.png'>";
|
||||
}
|
||||
if ($data_server == 1){
|
||||
echo " <img src='images/data.png'>";
|
||||
}
|
||||
if ($snmp_server == 1){
|
||||
echo " <img src='images/snmp.png'>";
|
||||
}
|
||||
if ($master == 1){
|
||||
echo " <img src='images/master.png'>";
|
||||
}
|
||||
if ($checksum == 1){
|
||||
echo " <img src='images/binary.png'>";
|
||||
if ($row["master"] == 1) {
|
||||
$server .= '<img src="images/master.png" /> ';
|
||||
}
|
||||
echo "</td>";
|
||||
echo "<td class='".$tdcolor."f9' align='middle'>".substr($laststart,0,25)."</td>";
|
||||
echo "<td class='".$tdcolor."f9' align='middle'>".substr($keepalive,0,25)."</td>";
|
||||
echo "<td class='".$tdcolor."f9' align='middle'>
|
||||
<a href='index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del=".$id_server."&delete'>
|
||||
<img src='images/cross.png' border='0'></td></tr>";
|
||||
if ($row["checksum"] == 1) {
|
||||
$server .= '<img src="images/binary.png" /> ';
|
||||
}
|
||||
|
||||
$table->data[] = array (
|
||||
'<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$row["id_server"].'"><b>'.$row["name"].'</b></a>',
|
||||
'<img src="images/dot_'.(($row["status"] == 0) ? 'red' : 'green').'">',
|
||||
$row["ip_address"],
|
||||
substr($row["description"],0,25),
|
||||
$server,
|
||||
$LOCALE->fmt_time($row["laststart"],"MYSQL","DATE").' '.$LOCALE->fmt_time($row["laststart"],"MYSQL","LONGTIME"),
|
||||
$LOCALE->fmt_time($row["keepalive"],"MYSQL","DATE").' '.$LOCALE->fmt_time($row["keepalive"],"MYSQL","LONGTIME"),
|
||||
'<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$row["id_server"].'&delete"><img src="images/cross.png" border="0">'
|
||||
);
|
||||
|
||||
}
|
||||
echo '</table>';
|
||||
echo "<table cellpadding=2 cellspacing=0>";
|
||||
echo "
|
||||
<tr>
|
||||
<td>
|
||||
<span class='net'>".__('Network Server')."</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class='master'>".__('Master')."</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class='data'>".__('Data Server')."</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class='binary'>".__('MD5 Check')."</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class='snmp'>".__('SNMP Console')."</span>
|
||||
</td>
|
||||
</tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
else {
|
||||
print_table ($table);
|
||||
unset ($table);
|
||||
|
||||
//Lagend
|
||||
$table->cellpadding = 2;
|
||||
$table->cellspacing = 0;
|
||||
$table->data[] = array (
|
||||
'<span class="net">'.__('Network Server').'</span>',
|
||||
'<span class="master">'.__('Master').'</span>',
|
||||
'<span class="data">'.__('Data Server').'</span>',
|
||||
'<span class="binary">'.__('MD5 Check').'</span>',
|
||||
'<span class="snmp">'.__('SNMP Console').'</span>'
|
||||
);
|
||||
print_table ($table);
|
||||
unset ($table);
|
||||
} else {
|
||||
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue