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, "LM")) {
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">'.__('Succesfully 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-04-13 Esteban Sanchez <estebans@artica.es> * general/footer.php: Removed Firefox icon. Style correction. * godmode/agentes/agent_manager.php: Replaced &gt; with &raquo;. Style correction when setting bold attributes. * godmode/agentes/manage_config_remote.php, godmode/agentes/modificar_agente.php, godmode/agentes/module_manager.php, godmode/alerts/alert_list.php, godmode/db/db_audit.php, godmode/db/db_event.php, godmode/db/db_info.php, godmode/db/db_main.php, godmode/db/db_purge.php, godmode/db/db_refine.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/modules/manage_nc_groups.php, godmode/modules/manage_network_components.php, godmode/modules/manage_network_templates.php, godmode/modules/manage_network_templates_form.php, godmode/modules/module_list.php, godmode/profiles/profile_list.php, godmode/reporting/graph_builder.php, godmode/reporting/map_builder.php, godmode/reporting/reporting_builder.php, godmode/servers/manage_export.php, godmode/servers/manage_export_form.php, godmode/servers/manage_recontask.php, godmode/servers/manage_recontask_form.php, godmode/servers/modificar_server.php, godmode/setup/setup_visuals.php, godmode/setup/links.php, godmode/setup/news.php, godmode/snmpconsole/snmp_alert.php, godmode/users/configure_user.php, godmode/users/user_list.php, operation/agentes/alerts_status.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/estado_grupo.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/exportdata.php, operation/agentes/networkmap.php, operation/agentes/status_monitor.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_statistics.php, operation/messages/message.php, operation/reporting/custom_reporting.php, operation/reporting/graph_viewer.php, operation/reporting/reporting_viewer.php, operation/servers/view_server.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/visual_console/index.php, godmode/agentes/agent_template.php: Replaced &gt; with &raquo; * operation/agentes/datos_agente.php: Return instead of exit * include/javascript/jquery.pandora.controls.js: Added pandoraSelectOS control to preview the OS icon on a select. * include/functions_reports.php: Fixed a bug on delete_report() that returns error when the report has no content. * include/functions_ui.php: Removed border attribute on print_os_icon(). Some fixes to meta refresh element on process_page_head(). Fixed format_filesize() when length is zero. * godmode/menu.php: Replaced link to file manager. Added enterprise hook. * godmode/setup/file_manager.php: Renamed from obfuscated name filemgr.php * include/styles/pandora.css: Textarea width reduced to 99% * godmode/setup/setup.php: Added get_os_icon AJAX operation. * images/mimetypes/, images/mimetypes/zip.png, images/mimetypes/image.png, images/mimetypes/unknown.png, images/mimetypes/directory.png: Added to repository. Mime type icons. * extras/pandoradb_migrate_v2.x_to_v3.0.sql: Removed date comments. * include/functions_filemanager.php: Added to repository. Minimal API for file manager system. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1608 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-13 11:50:56 +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>';
?>