2008-07-30 20:39:40 +02:00
|
|
|
<?PHP
|
|
|
|
|
2021-11-04 16:28:15 +01:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
2009-06-08 20:21:21 +02:00
|
|
|
// ==================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
// Copyright (c) 2005-2021 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.
|
2010-03-03 18:10:37 +01:00
|
|
|
global $config;
|
2008-10-27 16:17:20 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
2008-07-30 20:39:40 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
2022-02-01 13:39:18 +01:00
|
|
|
db_pandora_audit(
|
|
|
|
AUDIT_LOG_ACL_VIOLATION,
|
|
|
|
'Trying to access Link Management'
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
include 'general/noaccess.php';
|
|
|
|
exit;
|
2008-07-30 20:39:40 +02:00
|
|
|
}
|
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
// Header
|
2023-03-08 17:12:15 +01:00
|
|
|
ui_print_standard_header(
|
|
|
|
__('Admin tools'),
|
|
|
|
'images/extensions.png',
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
true,
|
|
|
|
[],
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'link' => '',
|
|
|
|
'label' => __('Link management'),
|
|
|
|
],
|
|
|
|
]
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['create'])) {
|
|
|
|
// If create
|
|
|
|
$name = get_parameter_post('name');
|
|
|
|
$link = get_parameter_post('link');
|
|
|
|
|
|
|
|
$result = false;
|
|
|
|
if ($name != '') {
|
|
|
|
$result = db_process_sql_insert('tlink', ['name' => $name, 'link' => $link]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $result) {
|
|
|
|
ui_print_error_message(__('There was a problem creating link'));
|
|
|
|
} else {
|
|
|
|
ui_print_success_message(__('Successfully created'));
|
|
|
|
$id_link = $result;
|
|
|
|
}
|
2010-03-04 17:08:09 +01:00
|
|
|
}
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (isset($_POST['update'])) {
|
|
|
|
// if update
|
|
|
|
$id_link = io_safe_input($_POST['id_link']);
|
|
|
|
$name = io_safe_input($_POST['name']);
|
|
|
|
$link = io_safe_input($_POST['link']);
|
|
|
|
|
|
|
|
$result = false;
|
|
|
|
if ($name != '') {
|
|
|
|
$result = db_process_sql_update('tlink', ['name' => $name, 'link' => $link], ['id_link' => $id_link]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $result) {
|
|
|
|
ui_print_error_message(__('There was a problem modifying link'));
|
|
|
|
} else {
|
|
|
|
ui_print_success_message(__('Successfully updated'));
|
|
|
|
}
|
2010-03-04 17:08:09 +01:00
|
|
|
}
|
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/reporting/reporting_xml.php,
operation/netflow/nf_live_view.php, operation/netflow/nf_view.php,
operation/tree.php, operation/agentes/gis_view.php,
operation/agentes/estado_monitores.php,
operation/agentes/networkmap.php,
operation/agentes/datos_agente.php,
operation/agentes/alerts_status.php, operation/menu.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/servers/manage_recontask.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_special_days.php, godmode/setup/links.php,
godmode/setup/os.php, godmode/users/configure_profile.php,
godmode/events/events.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/graph_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_menu.php, include/functions_visual_map.php,
include/functions_db.php: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (isset($_GET['borrar'])) {
|
|
|
|
// if delete
|
|
|
|
$id_link = io_safe_input($_GET['borrar']);
|
|
|
|
|
|
|
|
$result = db_process_sql_delete('tlink', ['id_link' => $id_link]);
|
|
|
|
|
|
|
|
if (! $result) {
|
|
|
|
ui_print_error_message(__('There was a problem deleting link'));
|
|
|
|
} else {
|
|
|
|
ui_print_success_message(__('Successfully deleted'));
|
|
|
|
}
|
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
|
2019-01-30 16:18:44 +01:00
|
|
|
if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
|
|
|
|
if (isset($_GET['form_edit'])) {
|
|
|
|
$creation_mode = 0;
|
|
|
|
$id_link = io_safe_input($_GET['id_link']);
|
|
|
|
|
|
|
|
$row = db_get_row('tlink', 'id_link', $id_link);
|
|
|
|
|
|
|
|
if ($row !== false) {
|
|
|
|
$nombre = $row['name'];
|
|
|
|
$link = $row['link'];
|
|
|
|
} else {
|
|
|
|
ui_print_error_message(__('Name error'));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// form_add
|
|
|
|
$creation_mode = 1;
|
|
|
|
$nombre = '';
|
|
|
|
$link = '';
|
|
|
|
}
|
|
|
|
|
2023-03-08 17:12:15 +01:00
|
|
|
echo '<table class="databox filters filter-table-adv max_floating_element_size" cellpadding="4" cellspacing="4" width="100%">';
|
2019-01-30 16:18:44 +01:00
|
|
|
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 "'>";
|
2023-03-08 17:12:15 +01:00
|
|
|
echo '<tr>';
|
|
|
|
echo '<td class="w50p">';
|
|
|
|
echo html_print_label_input_block(
|
|
|
|
__('Link name'),
|
|
|
|
html_print_input_text(
|
|
|
|
'name',
|
|
|
|
$nombre,
|
|
|
|
'',
|
|
|
|
50,
|
|
|
|
255,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
'',
|
|
|
|
'text_input'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
echo '</td>';
|
|
|
|
echo '<td class="w50p">';
|
|
|
|
echo html_print_label_input_block(
|
|
|
|
__('Link'),
|
|
|
|
html_print_input_text(
|
|
|
|
'link',
|
|
|
|
$link,
|
|
|
|
'',
|
|
|
|
50,
|
|
|
|
255,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
'',
|
|
|
|
'text_input'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
echo '</td></tr>';
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '</table>';
|
2022-10-24 13:13:56 +02:00
|
|
|
if (isset($_GET['form_add']) === true) {
|
|
|
|
$actionForPerform = __('Create');
|
|
|
|
$iconForPerform = 'wand';
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
2022-10-24 13:13:56 +02:00
|
|
|
$actionForPerform = __('Update');
|
|
|
|
$iconForPerform = 'update';
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
|
2023-03-08 17:12:15 +01:00
|
|
|
html_print_action_buttons(
|
|
|
|
html_print_submit_button(
|
|
|
|
$actionForPerform,
|
|
|
|
'crtbutton',
|
|
|
|
false,
|
|
|
|
[ 'icon' => $iconForPerform ],
|
|
|
|
true
|
|
|
|
)
|
2022-10-24 13:13:56 +02:00
|
|
|
);
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '</form></td></tr></table>';
|
|
|
|
} else {
|
|
|
|
// Main list view for Links editor
|
|
|
|
$rows = db_get_all_rows_in_table('tlink', 'name');
|
|
|
|
if ($rows === false) {
|
|
|
|
$rows = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($rows)) {
|
|
|
|
ui_print_info_message(['no_close' => true, 'message' => __("There isn't links") ]);
|
|
|
|
} else {
|
2021-03-11 15:40:23 +01:00
|
|
|
echo "<table cellpadding='0' cellspacing='0' class='info_table w100p'>";
|
2019-04-02 13:42:30 +02:00
|
|
|
echo '<thead><tr>';
|
2019-01-30 16:18:44 +01:00
|
|
|
echo "<th width='180px'>".__('Link name').'</th>';
|
|
|
|
echo "<th width='10px'>".__('Delete').'</th>';
|
2019-04-02 13:42:30 +02:00
|
|
|
echo '</tr></thead>';
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$color = 1;
|
|
|
|
foreach ($rows as $row) {
|
|
|
|
if ($color == 1) {
|
|
|
|
$tdcolor = 'datos';
|
|
|
|
$color = 0;
|
|
|
|
} 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>';
|
2022-11-30 10:14:42 +01:00
|
|
|
echo '<td class="'.$tdcolor.' table_action_buttons"><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;">'.html_print_image(
|
2023-03-10 12:40:21 +01:00
|
|
|
'images/delete.svg',
|
2021-03-11 15:40:23 +01:00
|
|
|
true,
|
|
|
|
['class' => 'invert_filter']
|
|
|
|
).'</a></td></tr>';
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '</table>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<table width='100%'>";
|
|
|
|
echo "<tr><td align='right'>";
|
|
|
|
echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/links&form_add=1'>";
|
2022-10-24 13:13:56 +02:00
|
|
|
|
2023-03-08 17:12:15 +01:00
|
|
|
html_print_action_buttons(
|
|
|
|
html_print_submit_button(
|
|
|
|
__('Add'),
|
|
|
|
'form_add',
|
|
|
|
false,
|
|
|
|
[ 'icon' => 'wand' ],
|
|
|
|
true
|
|
|
|
)
|
2022-10-24 13:13:56 +02:00
|
|
|
);
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '</form></table>';
|
2010-03-04 17:08:09 +01:00
|
|
|
}
|