pandorafms/pandora_console/godmode/servers/manage_export.php

131 lines
4.7 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// 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.
// Load global vars
require ("include/config.php");
check_login ();
if (! give_acl ($config['id_user'], 0, "PM")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Export Server Management");
require ("general/noaccess.php");
exit;
}
$name = (string) get_parameter ("name");
$export_server = (int) get_parameter ("export_server");
$preffix = (string) get_parameter ("preffix");
$interval = (int) get_parameter ("interval");
$ip_server = (string) get_parameter ("ip_server");
$connect_mode = (string) get_parameter ("connect_mode");
$user = (string) get_parameter ("user");
$password = (string) get_parameter ("password");
$port = (string) get_parameter ("port");
$directory = (string) get_parameter ("directory");
$options = (string) get_parameter ("options");
$create = (int) get_parameter ("create");
$delete = (int) get_parameter ("delete");
$update = (int) get_parameter ("update");
// Update
if ($update) {
$sql = sprintf ("UPDATE tserver_export SET name = '%s', id_export_server = %d,
preffix = '%s', `interval` = %d, ip_server = '%s', connect_mode = '%s',
user = '%s', pass = '%s', port = %d, directory = '%s', options = '%s'
WHERE id = %d",
$name, $export_server, $preffix, $interval, $ip_server, $connect_mode,
$user, $password, $port, $directory, $options, $update);
if (process_sql ($sql) === false) {
echo '<h3 class="error">'.__('Error updating export target').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully updated export target').'</h3>';
}
}
// Delete
if ($delete) {
$sql = sprintf("DELETE FROM tserver_export WHERE id = '%d'", $delete);
if (process_sql ($sql) === false) {
echo '<h3 class="error">'.__('Error deleting export target').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully deleted export target').'</h3>';
}
}
// Create
if ($create) {
$sql = sprintf ("INSERT INTO tserver_export
(`name`, `id_export_server`, `preffix`, `interval`, `ip_server`, `connect_mode`,
`user`, `pass`, `port`, `directory`, `options`)
VALUES ('%s', %d, '%s', %d, '%s', '%s', '%s', '%s', %d, '%s', '%s')",
$name, $export_server, $preffix, $interval, $ip_server, $connect_mode,
$user, $password, $port, $directory, $options);
if (process_sql ($sql) === false) {
echo '<h3 class="error">'.__('Error creating export target').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully created export target').'</h3>';
}
}
// List export servers
2009-06-25 Jorge Gonzalez <jorgegonz@artica.es> * include/functions_db.php, operation/snmpconsole/snmp_view.php, * operation/agentes/status_monitor.php, * operation/agentes/estado_grupo.php, * operation/agentes/estado_ultimopaquete.php, * operation/agentes/alerts_status.php, * operation/agentes/estado_generalagente.php, * operation/agentes/estado_agente.php, * operation/agentes/exportdata.php, * operation/agentes/estado_monitores.php, * operation/agentes/tactical.php, operation/agentes/networkmap.php, * operation/reporting/reporting_viewer.php, reporting/fgraph.php, * general/pandora_help.php, general/logoff.php, * general/logon_failed.php, godmode/setup/setup.php, * godmode/setup/links.php, godmode/snmpconsole/snmp_alert.php, * godmode/profiles/profile_list.php, godmode/db/db_main.php, * godmode/db/db_audit.php, godmode/db/db_refine.php, * godmode/db/db_info.php, godmode/db/db_event.php, * godmode/db/db_purge.php, * godmode/agentes/massive_delete_agents.php, * godmode/agentes/massive_config.php, * godmode/agentes/massive_delete_alerts.php, * godmode/agentes/massive_edit_modules.php, * godmode/agentes/module_manager.php, * godmode/agentes/massive_delete_modules.php, * godmode/agentes/configurar_agente.php, * godmode/agentes/planned_downtime.php, * godmode/modules/manage_network_templates_form.php, * godmode/modules/manage_network_components.php, * godmode/reporting/map_builder.php, * godmode/reporting/map_builder_wizard.php, * godmode/servers/manage_export.php, * godmode/servers/manage_export_form.php, * godmode/servers/plugin.php, godmode/servers/modificar_server.php, * godmode/servers/manage_recontask_form.php, * godmode/alerts/alert_compounds.php, godmode/menu.php: Some * translatable strings reused to simplify i18n work. * include/languages/es.po, include/languages/es.mo: Updated Spanish * translation. * include/languages/index.pot: Updated po template. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1768 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-06-25 10:01:18 +02:00
echo "<h2>".__('Pandora servers')." &raquo; ".__('Export targets')."</h2>";
$result = get_db_all_rows_in_table ("tserver_export");
if (!$result) {
echo '<div class="nf">'.__('There are no export targets configured').'</div>';
echo '<div class="action-buttons" style="width: 700px">';
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&create">';
echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
echo '</form>';
echo '</div>';
return;
}
$table->head = array (__('Name'), __('Preffix'), __('Interval'), __('Address'), __('Transfer mode'), __('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 (
// Name
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&update=' . $row['id'] . '"><b>' . $row['name'] . '</b></a>',
$row['preffix'],
$row['interval'],
$row['ip_server'],
$row['connect_mode'],
// Action
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export&delete=' . $row['id'] . '">
<img src="images/cross.png" border="0" /></a>&nbsp;&nbsp;<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&update=' . $row['id'] . '">
<img src="images/config.png" /></a>'
);
}
print_table ($table);
echo '<div class="action-buttons" style="width: 700px">';
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&create">';
echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
echo '</form>';
echo '</div>';
?>