2008-07-30 20:39:40 +02:00
|
|
|
<?PHP
|
|
|
|
|
2009-06-08 20:21:21 +02:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2010-03-04 17:08:09 +01:00
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
2009-06-08 20:21:21 +02:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2008-07-30 20:39:40 +02:00
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2010-03-03 18:10:37 +01:00
|
|
|
global $config;
|
2008-10-27 16:17:20 +01:00
|
|
|
|
|
|
|
check_login ();
|
2008-07-30 20:39:40 +02:00
|
|
|
|
2009-03-31 16:32:58 +02:00
|
|
|
if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
|
2010-03-09 13:34:09 +01:00
|
|
|
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Link Management");
|
2008-07-30 20:39:40 +02:00
|
|
|
require ("general/noaccess.php");
|
2008-10-27 16:17:20 +01:00
|
|
|
exit;
|
2008-07-30 20:39:40 +02:00
|
|
|
}
|
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
// Header
|
|
|
|
print_page_header (__('Link management'), "images/extensions.png", false, "", false, "" );
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
if (isset($_POST["create"])){ // If create
|
|
|
|
$name = get_parameter_post ("name");
|
|
|
|
$link = get_parameter_post ("link");
|
|
|
|
$sql_insert = "INSERT INTO tlink (name,link) VALUES ('$name','$link')";
|
|
|
|
$result=mysql_query($sql_insert);
|
|
|
|
if (! $result)
|
|
|
|
echo "<h3 class='error'>".__('There was a problem creating link')."</h3>";
|
|
|
|
else {
|
|
|
|
echo "<h3 class='suc'>".__('Successfully created')."</h3>";
|
|
|
|
$id_link = mysql_insert_id();
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2010-03-04 17:08:09 +01:00
|
|
|
}
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
if (isset($_POST["update"])){ // if update
|
|
|
|
$id_link = entrada_limpia($_POST["id_link"]);
|
|
|
|
$name = entrada_limpia($_POST["name"]);
|
|
|
|
$link = entrada_limpia($_POST["link"]);
|
|
|
|
$sql_update ="UPDATE tlink SET name = '".$name."', link ='".$link."' WHERE id_link = '".$id_link."'";
|
|
|
|
$result=mysql_query($sql_update);
|
|
|
|
if (! $result)
|
|
|
|
echo "<h3 class='error'>".__('There was a problem modifying link')."</h3>";
|
|
|
|
else
|
|
|
|
echo "<h3 class='suc'>".__('Successfully updated')."</h3>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET["borrar"])){ // if delete
|
|
|
|
$id_link = entrada_limpia($_GET["borrar"]);
|
|
|
|
$sql_delete= "DELETE FROM tlink WHERE id_link = ".$id_link;
|
|
|
|
$result=mysql_query($sql_delete);
|
|
|
|
if (! $result)
|
|
|
|
echo "<h3 class='error'>".__('There was a problem deleting link')."</h3>";
|
|
|
|
else
|
|
|
|
echo "<h3 class='suc'>".__('Successfully deleted')."</h3>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
}
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
// Main form view for Links edit
|
|
|
|
if ((isset($_GET["form_add"])) or (isset($_GET["form_edit"]))){
|
|
|
|
if (isset($_GET["form_edit"])){
|
|
|
|
$creation_mode = 0;
|
|
|
|
$id_link = entrada_limpia($_GET["id_link"]);
|
|
|
|
$sql1='SELECT * FROM tlink WHERE id_link = '.$id_link;
|
|
|
|
$result=mysql_query($sql1);
|
|
|
|
if ($row=mysql_fetch_array($result)){
|
|
|
|
$nombre = $row["name"];
|
|
|
|
$link = $row["link"];
|
|
|
|
}
|
|
|
|
else echo "<h3 class='error'>".__('Name error')."</h3>";
|
|
|
|
} else { // form_add
|
|
|
|
$creation_mode =1;
|
|
|
|
$nombre = "";
|
|
|
|
$link = "";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2010-03-04 17:08:09 +01:00
|
|
|
echo '<table class="databox" cellpadding="4" cellspacing="4" width="500">';
|
|
|
|
echo '<form name="ilink" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/links">';
|
|
|
|
if ($creation_mode == 1)
|
|
|
|
echo "<input type='hidden' name='create' value='1'>";
|
|
|
|
else
|
|
|
|
echo "<input type='hidden' name='update' value='1'>";
|
|
|
|
echo "<input type='hidden' name='id_link' value='";
|
|
|
|
if (isset($id_link)) {echo $id_link;}
|
|
|
|
echo "'>";
|
|
|
|
echo '<tr>
|
|
|
|
<td class="datos">'.__('Link name').'</td>
|
|
|
|
<td class="datos"><input type="text" name="name" size="35" value="'.$nombre.'"></td>';
|
|
|
|
echo '</tr><tr>
|
|
|
|
<td class="datos2">'.__('Link').'</td>
|
|
|
|
<td class="datos2">
|
|
|
|
<input type="text" name="link" size="35" value="'.$link.'"></td>';
|
|
|
|
echo '</tr>';
|
|
|
|
echo "</table>";
|
|
|
|
echo "<table width='500px'>";
|
|
|
|
echo "<tr><td align='right'>
|
|
|
|
<input name='crtbutton' type='submit' class='sub upd' value='".__('Update')."'>";
|
|
|
|
echo '</form></td></tr></table>';
|
|
|
|
}
|
|
|
|
else { // Main list view for Links editor
|
|
|
|
echo "<table cellpadding='4' cellspacing='4' class='databox'>";
|
|
|
|
echo "<th width='180px'>".__('Link name')."</th>";
|
|
|
|
echo "<th width='80px'>".__('Delete')."</th>";
|
|
|
|
$sql1='SELECT * FROM tlink ORDER BY name';
|
|
|
|
$result=mysql_query($sql1);
|
|
|
|
$color=1;
|
|
|
|
while ($row=mysql_fetch_array($result)){
|
|
|
|
if ($color == 1){
|
|
|
|
$tdcolor = "datos";
|
|
|
|
$color = 0;
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2010-03-04 17:08:09 +01:00
|
|
|
else {
|
|
|
|
$tdcolor = "datos2";
|
|
|
|
$color = 1;
|
|
|
|
}
|
|
|
|
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/links&form_edit=1&id_link=".$row["id_link"]."'>".$row["name"]."</a></b></td>";
|
|
|
|
echo '<td class="'.$tdcolor.'" align="center"><a href="index.php?sec=gsetup&sec2=godmode/setup/links&id_link='.$row["id_link"].'&borrar='.$row["id_link"].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;"><img border=0 src="images/cross.png"></a></td></tr>';
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2010-03-04 17:08:09 +01:00
|
|
|
echo "</table>";
|
|
|
|
echo "<table width='290px'>";
|
|
|
|
echo "<tr><td align='right'>";
|
|
|
|
echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/links&form_add=1'>";
|
|
|
|
echo "<input type='submit' class='sub next' name='form_add' value='".__('Add')."'>";
|
|
|
|
echo "</form></table>";
|
|
|
|
}
|
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
|
|
|
?>
|