Files
librenms-librenms/includes/html/pages/delhost.inc.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
3.1 KiB
PHP
Raw Normal View History

<?php
if (! Auth::user()->hasGlobalAdmin()) {
require 'includes/html/error-no-perm.inc.php';
exit;
}
$pagetitle[] = 'Delete device';
2019-08-06 16:46:49 -05:00
if (Auth::user()->isDemo()) {
2015-02-16 23:45:28 +00:00
demo_account();
} else {
2016-02-17 13:59:58 +00:00
if (is_numeric($_REQUEST['id'])) {
echo '
<div class="row">
<div class="col-sm-offset-2 col-sm-7">
';
2016-02-17 13:59:58 +00:00
if ($_REQUEST['confirm']) {
print_message(nl2br(delete_device($_REQUEST['id'])) . "\n");
} else {
2016-02-17 13:59:58 +00:00
$device = device_by_id_cache($_REQUEST['id']);
print_error('Are you sure you want to delete device ' . $device['hostname'] . '?'); ?>
<br />
<center>
2015-09-12 20:14:46 +05:30
<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">
<?php echo csrf_field() ?>
<div class="form-group">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($_REQUEST['id']) ?>" />
<input type="hidden" name="confirm" value="1" />
<!--<input type="hidden" name="remove_rrd" value="<?php echo htmlspecialchars($_POST['remove_rrd']); ?>">-->
feature: Added support for Host dependencies (#7332) * 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
2017-12-20 17:17:52 +03:00
<button type="submit" class="btn btn-danger">Confirm device deletion</button>
2014-03-02 21:05:55 +00:00
</div>
</form>
</center>
<?php
}
echo '
</div>
</div>';
} else {
?>
<form name="form1" method="post" action="" class="form-horizontal" role="form">
<?php echo csrf_field() ?>
<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 monitored!</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>
2014-03-02 21:05:55 +00:00
<div class="form-group">
<!-- <tr>
<td>Remove RRDs (Data files): </td>
<td><input type="checkbox" name="remove_rrd" value="yes"></td>
</tr>-->
</form>
<?php
2015-07-13 20:10:26 +02:00
}
}