mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* First draft of the modals and the config interfaces * GUI part done * Backend code and db schema addition * Documentation added, fixed alerting bug * Fix typos * Do not try to push an older db_schame.yaml * Small db fix * More db fixes * Travis CI fixes * missed a line in the travis error * Fixed dependency clearing bug, Manage Host dependencies button now shows current selections * Removed unnecessary index * Correct faulty query * Fixed sql query as requested, and renamed sql file * Added requested changes * Removed debug code * Renamed sql file * More fixes as requested * Trying to fix db_schema.yaml * adding laf's diff * Corrected a small bug * Try to resolve scrutinizer issue * Main page bootgrid ajax modifications * Also corrected travis ci errors * Added select2 for pull downs, removed a redundant debug output. Changed parent_id to text * Add missing class in the device settings page * Fix bug where a link wasn't added after save * Better parent down detection * Add missing comma * Behold the multi-parent code * Added lookup table * Ready for testing * Trying to fix documentation conflicts * Fix copy paste errors, and possible sql injection * indentation problems * Modified db_schema.yaml as well * Typos, typos * This should correct alerts * Try to fix travis ci error * Fix the typo in index.php * Changed to Tony's query * function explanation text changed * Updated db_schema.yaml * Trying to make automated tests happy * Changes as requested * Added acknowledgment for select2 * Added laf's patch * dbBulkInsert when adding parents
83 lines
2.9 KiB
PHP
83 lines
2.9 KiB
PHP
<?php
|
|
|
|
if ($_SESSION['userlevel'] < 10) {
|
|
require 'includes/error-no-perm.inc.php';
|
|
exit;
|
|
}
|
|
|
|
$pagetitle[] = "Delete device";
|
|
|
|
if ($_SESSION['userlevel'] == 11) {
|
|
demo_account();
|
|
} else {
|
|
if (is_numeric($_REQUEST['id'])) {
|
|
echo('
|
|
<div class="row">
|
|
<div class="col-sm-offset-2 col-sm-7">
|
|
');
|
|
if ($_REQUEST['confirm']) {
|
|
print_message(nl2br(delete_device(mres($_REQUEST['id'])))."\n");
|
|
} else {
|
|
$device = device_by_id_cache($_REQUEST['id']);
|
|
print_error("Are you sure you want to delete device " . $device['hostname'] . "?");
|
|
?>
|
|
<br />
|
|
<center>
|
|
<font color="red"></font><i class="fa fa-exclamation-triangle fa-3x"></i></font>
|
|
<br>
|
|
<form name="form1" method="post" action="" class="form-horizontal" role="form">
|
|
<div class="form-group">
|
|
<input type="hidden" name="id" value="<?php echo $_REQUEST['id'] ?>" />
|
|
<input type="hidden" name="confirm" value="1" />
|
|
<!--<input type="hidden" name="remove_rrd" value="<?php echo $_POST['remove_rrd']; ?>">-->
|
|
<button type="submit" class="btn btn-danger">Confirm device deletion</button>
|
|
</div>
|
|
</form>
|
|
</center>
|
|
<?php
|
|
}
|
|
echo('
|
|
</div>
|
|
</div>');
|
|
} else {
|
|
?>
|
|
|
|
<form name="form1" method="post" action="" class="form-horizontal" role="form">
|
|
<div class="form-group">
|
|
<div class="col-sm-offset-2 col-sm-7">
|
|
<div><h2>Delete Device</h2></div>
|
|
<div class="alert alert-danger" role="alert">
|
|
<center>
|
|
<p>Warning, this will remove the device from being monitered!</p>
|
|
<p>It will also remove historical data about this device such as <mark>Syslog</mark>, <mark>Eventlog</mark> and <mark>Alert log</mark> data.</p>
|
|
</center>
|
|
</div>
|
|
<div class="well">
|
|
<div class="form-group">
|
|
<label for="id" class="col-sm-2 control-label">Device:</label>
|
|
<div class="col-sm-10">
|
|
<select name="id" class="form-control" id="id">
|
|
<option disabled="disabled" selected="selected">Please select</option>
|
|
<?php
|
|
foreach (dbFetchRows("SELECT `device_id`, `hostname` FROM `devices` ORDER BY `hostname`") as $data) {
|
|
echo("<option value='".$data['device_id']."'>".$data['hostname']."</option>");
|
|
}
|
|
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<input id="confirm" type="hidden" name="confirm" value="0" />
|
|
<center><button id="confirm_delete" type="submit" class="btn btn-default">Delete Device</button></center>
|
|
</div>
|
|
<div class="form-group">
|
|
<!-- <tr>
|
|
<td>Remove RRDs (Data files): </td>
|
|
<td><input type="checkbox" name="remove_rrd" value="yes"></td>
|
|
</tr>-->
|
|
</form>
|
|
<?php
|
|
}
|
|
}
|