mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge branch 'master' into i18n
This commit is contained in:
29
includes/config.php
Normal file
29
includes/config.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
define('RASPI_CONFIG', '/etc/raspap');
|
||||
define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking');
|
||||
define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');
|
||||
define('RASPI_WIFI_CLIENT_INTERFACE', 'wlan0');
|
||||
|
||||
// Constants for configuration file paths.
|
||||
// These are typical for default RPi installs. Modify if needed.
|
||||
define('RASPI_DNSMASQ_CONFIG', '/etc/dnsmasq.conf');
|
||||
define('RASPI_DNSMASQ_LEASES', '/var/lib/misc/dnsmasq.leases');
|
||||
define('RASPI_HOSTAPD_CONFIG', '/etc/hostapd/hostapd.conf');
|
||||
define('RASPI_WPA_SUPPLICANT_CONFIG', '/etc/wpa_supplicant/wpa_supplicant.conf');
|
||||
define('RASPI_HOSTAPD_CTRL_INTERFACE', '/var/run/hostapd');
|
||||
define('RASPI_WPA_CTRL_INTERFACE', '/var/run/wpa_supplicant');
|
||||
define('RASPI_OPENVPN_CLIENT_CONFIG', '/etc/openvpn/client.conf');
|
||||
define('RASPI_OPENVPN_SERVER_CONFIG', '/etc/openvpn/server.conf');
|
||||
define('RASPI_TORPROXY_CONFIG', '/etc/tor/torrc');
|
||||
|
||||
// Optional services, set to true to enable.
|
||||
define('RASPI_HOTSPOT_ENABLED', true );
|
||||
define('RASPI_NETWORK_ENABLED', true );
|
||||
define('RASPI_DHCP_ENABLED', true );
|
||||
define('RASPI_OPENVPN_ENABLED', false );
|
||||
define('RASPI_TORPROXY_ENABLED', false );
|
||||
define('RASPI_CONFAUTH_ENABLED', true );
|
||||
define('RASPI_CHANGETHEME_ENABLED', true );
|
||||
|
||||
?>
|
@@ -41,6 +41,9 @@ function DisplayWPAConfig(){
|
||||
$network['protocol'] = 'Open';
|
||||
}
|
||||
break;
|
||||
case 'priority':
|
||||
$network['priority'] = trim($lineArr[1], '"');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,6 +66,9 @@ function DisplayWPAConfig(){
|
||||
'passphrase' => $_POST['passphrase' . $post_match[1]],
|
||||
'configured' => true
|
||||
);
|
||||
if (array_key_exists('priority' . $post_match[1], $_POST)) {
|
||||
$tmp_networks[$_POST['ssid' . $post_match[1]]]['priority'] = $_POST['priority' . $post_match[1]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,22 +78,30 @@ function DisplayWPAConfig(){
|
||||
fwrite($wpa_file, "network={".PHP_EOL);
|
||||
fwrite($wpa_file, "\tssid=\"".$ssid."\"".PHP_EOL);
|
||||
fwrite($wpa_file, "\tkey_mgmt=NONE".PHP_EOL);
|
||||
if (array_key_exists('priority', $network)) {
|
||||
fwrite($wpa_file, "\tpriority=".$network['priority'].PHP_EOL);
|
||||
}
|
||||
fwrite($wpa_file, "}".PHP_EOL);
|
||||
} else {
|
||||
if (strlen($network['passphrase']) >=8 && strlen($network['passphrase']) <= 63) {
|
||||
unset($wpa_passphrase);
|
||||
unset($wpa_passphrase);
|
||||
unset($line);
|
||||
exec( 'wpa_passphrase '.escapeshellarg($ssid). ' ' . escapeshellarg($network['passphrase']),$wpa_passphrase );
|
||||
exec( 'wpa_passphrase '.escapeshellarg($ssid). ' ' . escapeshellarg($network['passphrase']),$wpa_passphrase );
|
||||
foreach($wpa_passphrase as $line) {
|
||||
fwrite($wpa_file, $line.PHP_EOL);
|
||||
if (preg_match('/^\s*}\s*$/', $line)) {
|
||||
if (array_key_exists('priority', $network)) {
|
||||
fwrite($wpa_file, "\tpriority=".$network['priority'].PHP_EOL);
|
||||
}
|
||||
fwrite($wpa_file, $line.PHP_EOL);
|
||||
} else {
|
||||
fwrite($wpa_file, $line.PHP_EOL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$status->addMessage('WPA passphrase must be between 8 and 63 characters', 'danger');
|
||||
$ok = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($ok) {
|
||||
@@ -109,16 +123,16 @@ function DisplayWPAConfig(){
|
||||
}
|
||||
}
|
||||
|
||||
exec( 'sudo wpa_cli scan' );
|
||||
exec( 'sudo wpa_cli -i ' . RASPI_WIFI_CLIENT_INTERFACE . ' scan' );
|
||||
sleep(3);
|
||||
exec( 'sudo wpa_cli scan_results',$scan_return );
|
||||
exec( 'sudo wpa_cli -i ' . RASPI_WIFI_CLIENT_INTERFACE . ' scan_results',$scan_return );
|
||||
for( $shift = 0; $shift < 2; $shift++ ) {
|
||||
array_shift($scan_return);
|
||||
}
|
||||
// display output
|
||||
foreach( $scan_return as $network ) {
|
||||
$arrNetwork = preg_split("/[\t]+/",$network);
|
||||
if (array_key_exists($arrNetwork[4], $networks)) {
|
||||
if (array_key_exists(4, $arrNetwork) && array_key_exists($arrNetwork[4], $networks)) {
|
||||
$networks[$arrNetwork[4]]['visible'] = true;
|
||||
$networks[$arrNetwork[4]]['channel'] = ConvertToChannel($arrNetwork[1]);
|
||||
// TODO What if the security has changed?
|
||||
@@ -134,7 +148,7 @@ function DisplayWPAConfig(){
|
||||
}
|
||||
}
|
||||
|
||||
exec( 'iwconfig wlan0', $iwconfig_return );
|
||||
exec( 'iwconfig ' . RASPI_WIFI_CLIENT_INTERFACE, $iwconfig_return );
|
||||
foreach ($iwconfig_return as $line) {
|
||||
if (preg_match( '/ESSID:\"([^"]+)\"/i',$line,$iwconfig_ssid )) {
|
||||
$networks[$iwconfig_ssid[1]]['connected'] = true;
|
||||
@@ -150,9 +164,9 @@ function DisplayWPAConfig(){
|
||||
<div class="panel-body">
|
||||
<p><?php $status->showMessages(); ?></p>
|
||||
<h4><?php echo _("Client settings"); ?></h4>
|
||||
<div class="btn-group btn-block">
|
||||
<a href=".?<?php echo $_SERVER['QUERY_STRING']; ?>" style="padding:10px;float: right;display: block;position: relative;margin-top: -55px;" class="col-md-2 btn btn-info" id="update"><?php echo _("Rescan"); ?></a>
|
||||
</div>
|
||||
<div class="btn-group btn-block">
|
||||
<a href=".?<?php echo $_SERVER['QUERY_STRING']; ?>" style="padding:10px;float: right;display: block;position: relative;margin-top: -55px;" class="col-md-2 btn btn-info" id="update"><?php echo _("Rescan"); ?></a>
|
||||
</div>
|
||||
<form method="POST" action="?page=wpa_conf" name="wpa_conf_form">
|
||||
<?php CSRFToken() ?>
|
||||
<input type="hidden" name="client_settings" ?>
|
||||
@@ -172,7 +186,7 @@ function DisplayWPAConfig(){
|
||||
<?php if ($network['configured']) { ?>
|
||||
<i class="fa fa-check-circle fa-fw"></i>
|
||||
<?php } ?>
|
||||
<?php if ($network['connected']) { ?>
|
||||
<?php if (array_key_exists('connected', $network) && $network['connected']) { ?>
|
||||
<i class="fa fa-exchange fa-fw"></i>
|
||||
<?php } ?>
|
||||
</td>
|
||||
@@ -180,12 +194,17 @@ function DisplayWPAConfig(){
|
||||
<input type="hidden" name="ssid<?php echo $index ?>" value="<?php echo htmlentities($ssid) ?>" />
|
||||
<?php echo $ssid ?>
|
||||
</td>
|
||||
<?php if ($network['visible']) { ?>
|
||||
<?php if (array_key_exists('visible', $network) && $network['visible']) { ?>
|
||||
<td><?php echo $network['channel'] ?></td>
|
||||
<?php } else { ?>
|
||||
<td><span class="label label-warning">X</span></td>
|
||||
<?php } ?>
|
||||
<td><input type="hidden" name="protocol<?php echo $index ?>" value="<?php echo $network['protocol'] ?>" /><?php echo $network['protocol'] ?></td>
|
||||
<td>
|
||||
<?php if (array_key_exists('priority', $network)) { ?>
|
||||
<input type="hidden" name="priority<?php echo $index ?>" value="<?php echo $network['priority'] ?>" />
|
||||
<?php } ?>
|
||||
<input type="hidden" name="protocol<?php echo $index ?>" value="<?php echo $network['protocol'] ?>" /><?php echo $network['protocol'] ?>
|
||||
</td>
|
||||
<?php if ($network['protocol'] === 'Open') { ?>
|
||||
<td><input type="hidden" name="passphrase<?php echo $index ?>" value="" />---</td>
|
||||
<?php } else { ?>
|
||||
|
@@ -8,8 +8,8 @@ function DisplayDashboard(){
|
||||
|
||||
$status = new StatusMessages();
|
||||
|
||||
exec( 'ip a s wlan0', $return );
|
||||
exec( 'iwconfig wlan0', $return );
|
||||
exec( 'ip a s ' . RASPI_WIFI_CLIENT_INTERFACE , $return );
|
||||
exec( 'iwconfig ' . RASPI_WIFI_CLIENT_INTERFACE, $return );
|
||||
|
||||
$strWlan0 = implode( " ", $return );
|
||||
$strWlan0 = preg_replace( '/\s\s+/', ' ', $strWlan0 );
|
||||
@@ -35,7 +35,7 @@ function DisplayDashboard(){
|
||||
$strRxBytes = $result[1];
|
||||
preg_match( '/TX Bytes:(\d+ \(\d+.\d+ [K|M|G]iB\))/i',$strWlan0,$result ) || $result[1] = 'No Data';
|
||||
$strTxBytes = $result[1];
|
||||
preg_match( '/ESSID:\"([a-zA-Z0-9\s]+)\"/i',$strWlan0,$result ) || $result[1] = 'Not connected';
|
||||
preg_match( '/ESSID:\"([a-zA-Z0-9\s].+)\"/i',$strWlan0,$result ) || $result[1] = 'Not connected';
|
||||
$strSSID = str_replace( '"','',$result[1] );
|
||||
preg_match( '/Access Point: ([0-9a-f:]+)/i',$strWlan0,$result ) || $result[1] = '';
|
||||
$strBSSID = $result[1];
|
||||
@@ -58,17 +58,17 @@ function DisplayDashboard(){
|
||||
}
|
||||
|
||||
if( isset($_POST['ifdown_wlan0']) ) {
|
||||
exec( 'ifconfig wlan0 | grep -i running | wc -l',$test );
|
||||
exec( 'ifconfig ' . RASPI_WIFI_CLIENT_INTERFACE . ' | grep -i running | wc -l',$test );
|
||||
if($test[0] == 1) {
|
||||
exec( 'sudo ip link set wlan0 down',$return );
|
||||
exec( 'sudo ip link set ' . RASPI_WIFI_CLIENT_INTERFACE . ' down',$return );
|
||||
} else {
|
||||
echo 'Interface already down';
|
||||
}
|
||||
} elseif( isset($_POST['ifup_wlan0']) ) {
|
||||
exec( 'ifconfig wlan0 | grep -i running | wc -l',$test );
|
||||
exec( 'ifconfig ' . RASPI_WIFI_CLIENT_INTERFACE . ' | grep -i running | wc -l',$test );
|
||||
if($test[0] == 0) {
|
||||
exec( 'sudo ip link set wlan0 up',$return );
|
||||
exec( 'sudo ip -s a f label wlan0',$return);
|
||||
exec( 'sudo ip link set ' . RASPI_WIFI_CLIENT_INTERFACE . ' up',$return );
|
||||
exec( 'sudo ip -s a f label ' . RASPI_WIFI_CLIENT_INTERFACE,$return);
|
||||
} else {
|
||||
echo 'Interface already up';
|
||||
}
|
||||
@@ -81,55 +81,54 @@ function DisplayDashboard(){
|
||||
<div class="panel-body">
|
||||
<p><?php $status->showMessages(); ?></p>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h4><?php echo _("Interface Information"); ?></h4>
|
||||
<div class="info-item"><?php echo _("Interface Name"); ?></div> wlan0</br>
|
||||
<div class="info-item"><?php echo _("IP Address"); ?></div> <?php echo $strIPAddress ?></br>
|
||||
<div class="info-item"><?php echo _("Subnet Mask"); ?></div> <?php echo $strNetMask ?></br>
|
||||
<div class="info-item"><?php echo _("Mac Address"); ?></div> <?php echo $strHWAddress ?></br></br>
|
||||
<div class="panel-body">
|
||||
<h4><?php echo _("Interface Information"); ?></h4>
|
||||
<div class="info-item"><?php echo _("Interface Name"); ?></div> <?php echo RASPI_WIFI_CLIENT_INTERFACE ?></br>
|
||||
<div class="info-item"><?php echo _("IP Address"); ?></div> <?php echo $strIPAddress ?></br>
|
||||
<div class="info-item"><?php echo _("Subnet Mask"); ?></div> <?php echo $strNetMask ?></br>
|
||||
<div class="info-item"><?php echo _("Mac Address"); ?></div> <?php echo $strHWAddress ?></br></br>
|
||||
|
||||
<h4><?php echo _("Interface Statistics"); ?></h4>
|
||||
<div class="info-item"><?php echo _("Received Packets"); ?></div> <?php echo $strRxPackets ?></br>
|
||||
<div class="info-item"><?php echo _("Received Bytes"); ?></div> <?php echo $strRxBytes ?></br></br>
|
||||
<div class="info-item"><?php echo _("Transferred Packets"); ?></div> <?php echo $strTxPackets ?></br>
|
||||
<div class="info-item"><?php echo _("Transferred Bytes"); ?></div> <?php echo $strTxBytes ?></br>
|
||||
</div><!-- /.panel-body -->
|
||||
</div><!-- /.panel-default -->
|
||||
<h4><?php echo _("Interface Statistics"); ?></h4>
|
||||
<div class="info-item"><?php echo _("Received Packets"); ?></div> <?php echo $strRxPackets ?></br>
|
||||
<div class="info-item"><?php echo _("Received Bytes"); ?></div> <?php echo $strRxBytes ?></br></br>
|
||||
<div class="info-item"><?php echo _("Transferred Packets"); ?></div> <?php echo $strTxPackets ?></br>
|
||||
<div class="info-item"><?php echo _("Transferred Bytes"); ?></div> <?php echo $strTxBytes ?></br>
|
||||
</div><!-- /.panel-body -->
|
||||
</div><!-- /.panel-default -->
|
||||
</div><!-- /.col-md-6 -->
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body wireless">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body wireless">
|
||||
<h4><?php echo _("Wireless Information"); ?></h4>
|
||||
<div class="info-item"><?php echo _("Connected To"); ?></div> <?php echo $strSSID ?></br>
|
||||
<div class="info-item"><?php echo _("AP Mac Address"); ?></div> <?php echo $strBSSID ?></br>
|
||||
<div class="info-item"><?php echo _("Bitrate"); ?></div> <?php echo $strBitrate ?></br>
|
||||
<div class="info-item"><?php echo _("Signal Level"); ?></div> <?php echo $strSignalLevel ?></br>
|
||||
<div class="info-item"><?php echo _("Transmit Power"); ?></div> <?php echo $strTxPower ?></br>
|
||||
<div class="info-item"><?php echo _("Frequency"); ?></div> <?php echo $strFrequency ?></br></br>
|
||||
<div class="info-item"><?php echo _("Link Quality"); ?></div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-info progress-bar-striped active"
|
||||
role="progressbar"
|
||||
aria-valuenow="<?php echo $strLinkQuality ?>" aria-valuemin="0" aria-valuemax="100"
|
||||
style="width: <?php echo $strLinkQuality ?>%;"><?php echo $strLinkQuality ?>%
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.panel-body -->
|
||||
</div><!-- /.panel-default -->
|
||||
</div><!-- /.col-md-6 -->
|
||||
</div><!-- /.row -->
|
||||
<div class="info-item"><?php echo _("Connected To"); ?></div> <?php echo $strSSID ?></br>
|
||||
<div class="info-item"><?php echo _("AP Mac Address"); ?></div> <?php echo $strBSSID ?></br>
|
||||
<div class="info-item"><?php echo _("Bitrate"); ?></div> <?php echo $strBitrate ?></br>
|
||||
<div class="info-item"><?php echo _("Signal Level"); ?></div> <?php echo $strSignalLevel ?></br>
|
||||
<div class="info-item"><?php echo _("Transmit Power"); ?></div> <?php echo $strTxPower ?></br>
|
||||
<div class="info-item"><?php echo _("Frequency"); ?></div> <?php echo $strFrequency ?></br></br>
|
||||
<div class="info-item"><?php echo _("Link Quality"); ?></div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-info progress-bar-striped active"
|
||||
role="progressbar"
|
||||
aria-valuenow="<?php echo $strLinkQuality ?>" aria-valuemin="0" aria-valuemax="100"
|
||||
style="width: <?php echo $strLinkQuality ?>%;"><?php echo $strLinkQuality ?>%
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.panel-body -->
|
||||
</div><!-- /.panel-default -->
|
||||
</div><!-- /.col-md-6 -->
|
||||
</div><!-- /.row -->
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<form action="?page=wlan0_info" method="POST">
|
||||
<?php if ( !$wlan0up ) {
|
||||
echo '<input type="submit" class="btn btn-success" value="' . _("Start wlan0") . '" name="ifup_wlan0" />';
|
||||
echo '<input type="submit" class="btn btn-success" value="' . _("Start ") . RASPI_WIFI_CLIENT_INTERFACE . '" name="ifup_wlan0" />';
|
||||
} else {
|
||||
echo '<input type="submit" class="btn btn-warning" value="' . _("Stop wlan0") . '" name="ifdown_wlan0" />';
|
||||
}
|
||||
echo '<input type="submit" class="btn btn-warning" value="' . _("Stop ") . RASPI_WIFI_CLIENT_INTERFACE . '" name="ifdown_wlan0" />';
|
||||
}
|
||||
?>
|
||||
<input type="button" class="btn btn-outline btn-primary" value="<?php echo _("Refresh"); ?>" onclick="document.location.reload(true)" />
|
||||
</form>
|
||||
|
@@ -55,7 +55,7 @@ function safefilerewrite($fileName, $dataToSave) {
|
||||
*/
|
||||
function CSRFToken() {
|
||||
?>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>" />
|
||||
<input id="csrf_token" type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -138,8 +138,16 @@ function ParseConfig( $arrConfig ) {
|
||||
* @return $channel
|
||||
*/
|
||||
function ConvertToChannel( $freq ) {
|
||||
$channel = ($freq - 2407)/5;
|
||||
if ($channel > 0 && $channel < 14) {
|
||||
if ($freq >= 2412 && $freq <= 2484) {
|
||||
$channel = ($freq - 2407)/5;
|
||||
} elseif ($freq >= 4915 && $freq <= 4980) {
|
||||
$channel = ($freq - 4910)/5 + 182;
|
||||
} elseif ($freq >= 5035 && $freq <= 5865) {
|
||||
$channel = ($freq - 5030)/5 + 6;
|
||||
} else {
|
||||
$channel = -1;
|
||||
}
|
||||
if ($channel >= 1 && $channel <= 196) {
|
||||
return $channel;
|
||||
} else {
|
||||
return 'Invalid Channel';
|
||||
|
125
includes/networking.php
Normal file
125
includes/networking.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
include_once( 'includes/status_messages.php' );
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function DisplayNetworkingConfig(){
|
||||
|
||||
$status = new StatusMessages();
|
||||
|
||||
exec("ls /sys/class/net | grep -v lo", $interfaces);
|
||||
|
||||
foreach($interfaces as $interface) {
|
||||
exec("ip a show $interface",$$interface);
|
||||
}
|
||||
|
||||
CSRFToken();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel panel-heading">
|
||||
<i class="fa fa-sitemap fa-fw"></i> Configure Networking
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="msgNetworking"></div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="active"><a href="#summary" aria-controls="summary" role="tab" data-toggle="tab">Summary</a></li>
|
||||
<?php
|
||||
foreach($interfaces as $interface) {
|
||||
echo '<li role="presentation"><a href="#'.$interface.'" aria-controls="'.$interface.'" role="tab" data-toggle="tab">'.$interface.'</a></li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="summary">
|
||||
<h4>Current Settings</h4>
|
||||
<div class="row">
|
||||
<?php
|
||||
foreach($interfaces as $interface) {
|
||||
echo '<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">'.$interface.'</div>
|
||||
<div class="panel-body" id="'.$interface.'-summary"></div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
</div><!-- /.row -->
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<a href="#" class="btn btn-outline btn-primary" id="btnSummaryRefresh"><i class="fa fa-refresh"></i> Refresh</a>
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div><!-- /.tab-pane -->
|
||||
<?php
|
||||
foreach($interfaces as $interface) {
|
||||
echo '
|
||||
<div role="tabpanel" class="tab-pane fade in" id="'.$interface.'">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<form id="frm-'.$interface.'">
|
||||
<div class="form-group">
|
||||
<h4>Adapter IP Address Settings</h4>
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-primary">
|
||||
<input type="radio" name="'.$interface.'-addresstype" id="'.$interface.'-dhcp" autocomplete="off">DHCP
|
||||
</label>
|
||||
<label class="btn btn-primary">
|
||||
<input type="radio" name="'.$interface.'-addresstype" id="'.$interface.'-static" autocomplete="off">Static IP
|
||||
</label>
|
||||
</div><!-- /.btn-group -->
|
||||
<h4>Enable Fallback to Static Option</h4>
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-primary">
|
||||
<input type="radio" name="'.$interface.'-dhcpfailover" id="'.$interface.'-failover" autocomplete="off">Enabled
|
||||
</label>
|
||||
<label class="btn btn-warning">
|
||||
<input type="radio" name="'.$interface.'-dhcpfailover" id="'.$interface.'-nofailover" autocomplete="off">Disabled
|
||||
</label>
|
||||
</div><!-- /.btn-group -->
|
||||
</div><!-- /.form-group -->
|
||||
<hr />
|
||||
<h4>Static IP Options</h4>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-ipaddress">IP Address</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-ipaddress" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-netmask">Subnet Mask</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-netmask" placeholder="255.255.255.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-gateway">Default Gateway</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-gateway" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-dnssvr">DNS Server</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-dnssvr" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-dnssvralt">Alternate DNS Server</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-dnssvralt" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<a href="#" class="btn btn-outline btn-primary intsave" data-int="'.$interface.'">Save Settings</a>
|
||||
<a href="#" class="btn btn-warning intapply" data-int="'.$interface.'">Apply Settings</a>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.tab-panel -->
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
</div><!-- /.tab-content -->
|
||||
</div><!-- /.panel-body -->
|
||||
<div class="panel-footer">Information provided by /sys/class/net</div>
|
||||
</div><!-- /.panel-primary -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
@@ -66,7 +66,7 @@ function DisplaySystem(){
|
||||
|
||||
// mem used
|
||||
$memused_status = "primary";
|
||||
exec("free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { print used/total*100}'", $memarray);
|
||||
exec("free -m | awk '/Mem:/ { total=$2 ; used=$3 } END { print used/total*100}'", $memarray);
|
||||
$memused = floor($memarray[0]);
|
||||
if ($memused > 90) { $memused_status = "danger"; }
|
||||
elseif ($memused > 75) { $memused_status = "warning"; }
|
||||
|
Reference in New Issue
Block a user