2008-07-30 20:39:40 +02:00
|
|
|
<?PHP
|
|
|
|
|
|
|
|
// Pandora FMS - the Flexible Monitoring System
|
|
|
|
// ============================================
|
|
|
|
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
|
|
|
|
// Please see http://pandora.sourceforge.net 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.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
// Load global vars
|
2008-07-30 20:39:40 +02:00
|
|
|
require("include/config.php");
|
|
|
|
|
|
|
|
if (comprueba_login()) {
|
|
|
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Link Management");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
}
|
|
|
|
if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'])) {
|
|
|
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Link Management");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
}
|
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
if (isset($_POST["create"])){ // If create
|
|
|
|
$name = entrada_limpia($_POST["name"]);
|
|
|
|
$link = entrada_limpia($_POST["link"]);
|
|
|
|
$sql_insert="INSERT INTO tlink (name,link) VALUES ('$name','$link') ";
|
|
|
|
$result=mysql_query($sql_insert);
|
|
|
|
if (! $result)
|
|
|
|
echo "<h3 class='error'>".$lang_label["create_link_no"]."</h3>";
|
|
|
|
else {
|
|
|
|
echo "<h3 class='suc'>".$lang_label["create_link_ok"]."</h3>";
|
|
|
|
$id_link = mysql_insert_id();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-02 Raul Mateos <raulofpandora@gmail.com>
* images/ok.gif: Deleted
* images/cross.png, go.png, ok.png, upd.png: Added new images
* include/styles/pandora.css, tip.css, op.css: Updated. Deleted some
old styles, not all.
* include/languages/language_en.php, language_es_es.php: Added text
for no recon task.
* godmode/*.php, operation/*.php, help/*.php: Changed some icons,
updated several buttons with new icons.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@410 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-02 19:17:27 +02:00
|
|
|
if (isset($_POST["update"])){ // if update
|
2006-03-27 05:37:27 +02:00
|
|
|
$id_link = entrada_limpia($_POST["id_link"]);
|
|
|
|
$name = entrada_limpia($_POST["name"]);
|
|
|
|
$link = entrada_limpia($_POST["link"]);
|
2007-06-06 18:23:24 +02:00
|
|
|
$sql_update ="UPDATE tlink SET name = '".$name."', link ='".$link."' WHERE id_link = '".$id_link."'";
|
2006-03-27 05:37:27 +02:00
|
|
|
$result=mysql_query($sql_update);
|
|
|
|
if (! $result)
|
|
|
|
echo "<h3 class='error'>".$lang_label["modify_link_no"]."</h3>";
|
|
|
|
else
|
|
|
|
echo "<h3 class='suc'>".$lang_label["modify_link_ok"]."</h3>";
|
|
|
|
}
|
|
|
|
|
2007-04-02 Raul Mateos <raulofpandora@gmail.com>
* images/ok.gif: Deleted
* images/cross.png, go.png, ok.png, upd.png: Added new images
* include/styles/pandora.css, tip.css, op.css: Updated. Deleted some
old styles, not all.
* include/languages/language_en.php, language_es_es.php: Added text
for no recon task.
* godmode/*.php, operation/*.php, help/*.php: Changed some icons,
updated several buttons with new icons.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@410 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-02 19:17:27 +02:00
|
|
|
if (isset($_GET["borrar"])){ // if delete
|
2006-03-27 05:37:27 +02:00
|
|
|
$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'>".$lang_label["delete_link_no"]."</h3>";
|
|
|
|
else
|
|
|
|
echo "<h3 class='suc'>".$lang_label["delete_link_ok"]."</h3>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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'>".$lang_label["name_error"]."</h3>";
|
|
|
|
} else { // form_add
|
|
|
|
$creation_mode =1;
|
|
|
|
$nombre = "";
|
|
|
|
$link = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create link
|
2007-05-27 04:55:55 +02:00
|
|
|
echo "<h2>".$lang_label["setup_screen"]." > ";
|
2007-10-12 18:27:50 +02:00
|
|
|
echo $lang_label["link_management"]."</h2>";
|
|
|
|
echo '<table class="databox" cellpadding="4" cellspacing="4" width="500">';
|
2006-03-27 05:37:27 +02: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'>";
|
2007-10-12 18:27:50 +02:00
|
|
|
echo "<input type='hidden' name='id_link' value='"; ?>
|
2006-03-27 05:37:27 +02:00
|
|
|
<?php if (isset($id_link)) {echo $id_link;} ?>
|
|
|
|
<?php
|
|
|
|
echo "'>";
|
2007-06-06 18:23:24 +02:00
|
|
|
echo '<tr>
|
|
|
|
<td class="datos">'.$lang_label["link_name"].'</td>
|
|
|
|
<td class="datos"><input type="text" name="name" size="35" value="'.$nombre.'">';
|
|
|
|
echo '<tr>
|
|
|
|
<td class="datos2">'.$lang_label["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='".$lang_label["update"]."'>";
|
|
|
|
echo '</form></td></tr></table>';
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
else { // Main list view for Links editor
|
2007-05-27 04:55:55 +02:00
|
|
|
echo "<h2>".$lang_label["setup_screen"]." > ";
|
2007-10-12 18:27:50 +02:00
|
|
|
echo $lang_label["link_management"]."</h3>";
|
2007-06-06 18:23:24 +02:00
|
|
|
echo "<table cellpadding='4' cellspacing='4' class='databox'>";
|
|
|
|
echo "<th width='180px'>".$lang_label["link_name"]."</th>";
|
|
|
|
echo "<th width='80px'>".$lang_label["delete"]."</th>";
|
2006-03-27 05:37:27 +02:00
|
|
|
$sql1='SELECT * FROM tlink ORDER BY name';
|
|
|
|
$result=mysql_query($sql1);
|
2006-07-03 12:49:42 +02:00
|
|
|
$color=1;
|
2006-03-27 05:37:27 +02:00
|
|
|
while ($row=mysql_fetch_array($result)){
|
2006-07-03 12:49:42 +02:00
|
|
|
if ($color == 1){
|
|
|
|
$tdcolor = "datos";
|
|
|
|
$color = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$tdcolor = "datos2";
|
|
|
|
$color = 1;
|
|
|
|
}
|
2007-06-06 18:23:24 +02:00
|
|
|
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(\' '.$lang_label["are_you_sure"].'\')) return false;"><img border=0 src="images/cross.png"></a></td></tr>';
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2007-06-06 18:23:24 +02:00
|
|
|
echo "</table>";
|
|
|
|
echo "<table width='290px'>";
|
|
|
|
echo "<tr><td align='right'>";
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/links&form_add=1'>";
|
2007-04-02 Raul Mateos <raulofpandora@gmail.com>
* images/ok.gif: Deleted
* images/cross.png, go.png, ok.png, upd.png: Added new images
* include/styles/pandora.css, tip.css, op.css: Updated. Deleted some
old styles, not all.
* include/languages/language_en.php, language_es_es.php: Added text
for no recon task.
* godmode/*.php, operation/*.php, help/*.php: Changed some icons,
updated several buttons with new icons.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@410 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-02 19:17:27 +02:00
|
|
|
echo "<input type='submit' class='sub next' name='form_add' value='".$lang_label["add"]."'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
echo "</form></table>";
|
|
|
|
}
|
|
|
|
?>
|