Files

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

99 lines
3.6 KiB
PHP
Raw Permalink Normal View History

2010-12-20 12:26:26 +00:00
<?php
2011-03-16 23:10:10 +00:00
if ($_POST['editing']) {
if (Auth::user()->hasGlobalAdmin()) {
2021-03-28 17:25:30 -05:00
$ipmi_hostname = $_POST['ipmi_hostname'];
$ipmi_port = (int) $_POST['ipmi_port'];
2021-03-28 17:25:30 -05:00
$ipmi_username = $_POST['ipmi_username'];
$ipmi_password = $_POST['ipmi_password'];
$ipmi_kg_key = $_POST['ipmi_kg_key'];
2015-07-13 20:10:26 +02:00
if ($ipmi_hostname != '') {
set_dev_attrib($device, 'ipmi_hostname', $ipmi_hostname);
2016-08-18 20:28:22 -05:00
} else {
del_dev_attrib($device, 'ipmi_hostname');
}
2015-07-13 20:10:26 +02:00
if ($ipmi_port != '') {
set_dev_attrib($device, 'ipmi_port', $ipmi_port);
} else {
set_dev_attrib($device, 'ipmi_port', '623'); // Default port
}
if ($ipmi_username != '') {
set_dev_attrib($device, 'ipmi_username', $ipmi_username);
2016-08-18 20:28:22 -05:00
} else {
del_dev_attrib($device, 'ipmi_username');
2010-12-20 12:26:26 +00:00
}
if ($ipmi_password != '') {
set_dev_attrib($device, 'ipmi_password', $ipmi_password);
2016-08-18 20:28:22 -05:00
} else {
del_dev_attrib($device, 'ipmi_password');
2015-07-13 20:10:26 +02:00
}
if ($ipmi_kg_key != '') {
set_dev_attrib($device, 'ipmi_kg_key', $ipmi_kg_key);
} else {
del_dev_attrib($device, 'ipmi_kg_key');
}
$update_message = 'Device IPMI data updated.';
$updated = 1;
2016-08-18 20:28:22 -05:00
} else {
2019-04-11 23:26:42 -05:00
include 'includes/html/error-no-perm.inc.php';
2015-07-13 20:10:26 +02:00
}//end if
}//end if
2011-03-16 23:10:10 +00:00
if ($updated && $update_message) {
2010-12-20 12:26:26 +00:00
print_message($update_message);
2016-08-18 20:28:22 -05:00
} elseif ($update_message) {
2010-12-20 12:26:26 +00:00
print_error($update_message);
}
?>
2014-06-16 23:06:04 +01:00
<form id="edit" name="edit" method="post" action="" role="form" class="form-horizontal">
2019-07-17 07:20:26 -05:00
<?php echo csrf_field() ?>
2014-06-16 23:06:04 +01:00
<input type="hidden" name="editing" value="yes">
<div class="form-group">
<label for="ipmi_hostname" class="col-sm-2 control-label">IPMI/BMC Hostname</label>
<div class="col-sm-6">
<input id="ipmi_hostname" name="ipmi_hostname" class="form-control" value="<?php echo get_dev_attrib($device, 'ipmi_hostname'); ?>" />
</div>
</div>
<div class="form-group">
<label for="ipmi_port" class="col-sm-2 control-label">IPMI/BMC Port</label>
<div class="col-sm-6">
<input id="ipmi_port" name="ipmi_port" class="form-control" value="<?php echo get_dev_attrib($device, 'ipmi_port'); ?>" placeholder="623" />
</div>
</div>
2014-06-16 23:06:04 +01:00
<div class="form-group">
<label for="ipmi_username" class="col-sm-2 control-label">IPMI/BMC Username</label>
<div class="col-sm-6">
<input id="ipmi_username" name="ipmi_username" class="form-control" value="<?php echo get_dev_attrib($device, 'ipmi_username'); ?>" />
</div>
</div>
<div class="form-group">
<label for="impi_password" class="col-sm-2 control-label">IPMI/BMC Password</label>
<div class="col-sm-6">
<input id="ipmi_password" name="ipmi_password" type="password" class="form-control" value="<?php echo get_dev_attrib($device, 'ipmi_password'); ?>" />
</div>
</div>
<div class="form-group">
<label for="ipmi_kg_key" class="col-sm-2 control-label">IPMIv2 Kg key</label>
<div class="col-sm-6">
<input id="ipmi_kg_key" name="ipmi_kg_key" type="password" class="form-control" value="<?php echo get_dev_attrib($device, 'ipmi_kg_key'); ?>" placeholder="A0FE1A760B304... (Leave blank if none)" />
</div>
</div>
2015-09-16 16:07:15 +05:30
<div class="row">
<div class="col-md-1 col-md-offset-2">
<button type="submit" name="Submit" class="btn btn-default"><i class="fa fa-check"></i> Save</button>
</div>
</div>
<br><br>
<div class="alert alert-info" role="alert">
<p>To disable IPMI polling, please clear the setting fields and click <b>Save</b>.</p>
</div>
2014-06-16 23:06:04 +01:00
</form>