mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge pull request #416 from billz/bootstrap4
Bootstrap 4 / SB Admin 2 v4 update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define('RASPI_VERSION', '1.6.2');
|
||||
define('RASPI_VERSION', '2.0');
|
||||
define('RASPI_CONFIG', '/etc/raspap');
|
||||
define('RASPI_CONFIG_NETWORKING', RASPI_CONFIG.'/networking');
|
||||
define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');
|
||||
|
@@ -27,8 +27,7 @@ function DisplayWPAConfig()
|
||||
if (preg_match('/delete(\d+)/', $post, $post_match)) {
|
||||
unset($tmp_networks[$_POST['ssid' . $post_match[1]]]);
|
||||
} elseif (preg_match('/update(\d+)/', $post, $post_match)) {
|
||||
// NB, at the moment, the value of protocol from the form may
|
||||
// contain HTML line breaks
|
||||
// NB, multiple protocols are separated with a forward slash ('/')
|
||||
$tmp_networks[$_POST['ssid' . $post_match[1]]] = array(
|
||||
'protocol' => ( $_POST['protocol' . $post_match[1]] === 'Open' ? 'Open' : 'WPA' ),
|
||||
'passphrase' => $_POST['passphrase' . $post_match[1]],
|
||||
|
@@ -8,8 +8,6 @@ function DisplayDataUsage(&$extraFooterScripts)
|
||||
exec("ip -o link show | awk -F ': ' '{print $2}' | grep -v lo ", $interfacesWlo);
|
||||
echo renderTemplate("data_usage", [ "interfaces" => $interfacesWlo ]);
|
||||
|
||||
$extraFooterScripts[] = array('src'=>'dist/raphael/raphael.min.js', 'defer'=>false);
|
||||
$extraFooterScripts[] = array('src'=>'dist/morrisjs/morris.min.js', 'defer'=>false);
|
||||
$extraFooterScripts[] = array('src'=>'dist/datatables/jquery.dataTables.min.js', 'defer'=>false);
|
||||
$extraFooterScripts[] = array('src'=>'app/js/bandwidthcharts.js', 'defer'=>false);
|
||||
}
|
||||
|
@@ -58,11 +58,9 @@ function DisplayDHCPConfig()
|
||||
|
||||
if ($_POST['DNS1']){
|
||||
$config .= "dhcp-option=6," . $_POST['DNS1'];
|
||||
|
||||
if ($_POST['DNS2']){
|
||||
$config .= ','.$_POST['DNS2'];
|
||||
}
|
||||
|
||||
$config .= PHP_EOL;
|
||||
}
|
||||
|
||||
@@ -108,7 +106,7 @@ function DisplayDHCPConfig()
|
||||
}
|
||||
}
|
||||
|
||||
$serviceStatus = $dnsmasq_state ? "running" : "stopped";
|
||||
$serviceStatus = $dnsmasq_state ? "up" : "down";
|
||||
|
||||
exec('cat '. RASPI_DNSMASQ_CONFIG, $return);
|
||||
$conf = ParseConfig($return);
|
||||
@@ -123,21 +121,18 @@ function DisplayDHCPConfig()
|
||||
|
||||
$DNS1 = '';
|
||||
$DNS2 = '';
|
||||
|
||||
if (isset($conf['dhcp-option'])){
|
||||
$arrDns = explode(",", $conf['dhcp-option']);
|
||||
|
||||
if ($arrDns[0] == '6'){
|
||||
if (count($arrDns) > 1){
|
||||
$DNS1 = $arrDns[1];
|
||||
}
|
||||
|
||||
if (count($arrDns) > 2){
|
||||
$DNS2 = $arrDns[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$hselected = '';
|
||||
$mselected = '';
|
||||
$dselected = '';
|
||||
|
@@ -262,7 +262,7 @@ function ConvertToSecurity($security)
|
||||
// And you shouldn't be using WEP these days anyway.
|
||||
return 'Open';
|
||||
} else {
|
||||
return implode('<br />', $options);
|
||||
return implode(' / ', $options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,32 +303,32 @@ function DisplayOpenVPNConfig()
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><i class="fa fa-lock fa-fw"></i> Configure OpenVPN </div>
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<div class="card">
|
||||
<div class="card-header"><i class="fas fa-key fa-fw mr-2"></i>Configure OpenVPN</div>
|
||||
<div class="card-body">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#openvpnclient" data-toggle="tab">Client settings</a></li>
|
||||
<li><a href="#openvpnserver" data-toggle="tab">Server settings</a></li>
|
||||
<li class="nav-item"><a class="nav-link active" href="#openvpnclient" data-toggle="tab">Client settings</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#openvpnserver" data-toggle="tab">Server settings</a></li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<p><?php echo $status; ?></p>
|
||||
<div class="tab-pane fade in active" id="openvpnclient">
|
||||
|
||||
<div class="tab-pane active" id="openvpnclient">
|
||||
<h4>Client settings</h4>
|
||||
<form role="form" action="?page=save_hostapd_conf" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label>Select OpenVPN configuration file (.ovpn)</label>
|
||||
<input type="file" name="openvpn-config">
|
||||
<div class="form-group col-md-6">
|
||||
<div class="custom-file">
|
||||
<input type="file" class="custom-file-input" id="customFile">
|
||||
<label class="custom-file-label" for="customFile">Select OpenVPN configuration file (.ovpn)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Client Log</label>
|
||||
<input type="text" class="form-control" id="disabledInput" name="log-append" type="text" placeholder="<?php echo htmlspecialchars($arrClientConfig['log-append'], ENT_QUOTES); ?>" disabled="disabled" />
|
||||
</div>
|
||||
@@ -337,43 +337,43 @@ function DisplayOpenVPNConfig()
|
||||
<div class="tab-pane fade" id="openvpnserver">
|
||||
<h4>Server settings</h4>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Port</label>
|
||||
<input type="text" class="form-control" name="openvpn_port" value="<?php echo htmlspecialchars($arrServerConfig['port'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Protocol</label>
|
||||
<input type="text" class="form-control" name="openvpn_proto" value="<?php echo htmlspecialchars($arrServerConfig['proto'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Root CA certificate</label>
|
||||
<input type="text" class="form-control" name="openvpn_rootca" placeholder="<?php echo htmlspecialchars($arrServerConfig['ca'], ENT_QUOTES); ?>" disabled="disabled" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Server certificate</label>
|
||||
<input type="text" class="form-control" name="openvpn_cert" placeholder="<?php echo htmlspecialchars($arrServerConfig['cert'], ENT_QUOTES); ?>" disabled="disabled" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Diffie Hellman parameters</label>
|
||||
<input type="text" class="form-control" name="openvpn_dh" placeholder="<?php echo htmlspecialchars($arrServerConfig['dh'], ENT_QUOTES); ?>" disabled="disabled" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">KeepAlive</label>
|
||||
<input type="text" class="form-control" name="openvpn_keepalive" value="<?php echo htmlspecialchars($arrServerConfig['keepalive'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Server log</label>
|
||||
<input type="text" class="form-control" name="openvpn_status" placeholder="<?php echo htmlspecialchars($arrServerConfig['status'], ENT_QUOTES); ?>" disabled="disabled" />
|
||||
</div>
|
||||
@@ -388,12 +388,13 @@ function DisplayOpenVPNConfig()
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</div><!-- /.panel-body -->
|
||||
</div><!-- /.panel-primary -->
|
||||
<div class="panel-footer"> Information provided by openvpn</div>
|
||||
</div>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer"> Information provided by openvpn</div>
|
||||
</div><!-- /.card -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div><!-- /.row -->
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -425,15 +426,13 @@ function DisplayTorProxyConfig()
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><i class="fa fa-eye-slash fa-fw"></i> Configure TOR proxy</div>
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<div class="card">
|
||||
<div class="card-header"><i class="fa fa-eye-slash fa-fw"></i> Configure TOR proxy</div>
|
||||
<div class="card-body">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#basic" data-toggle="tab">Basic</a>
|
||||
</li>
|
||||
<li><a href="#relay" data-toggle="tab">Relay</a>
|
||||
<li class="nav-item"><a class="nav-link active" href="#basic" data-toggle="tab">Basic</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#relay" data-toggle="tab">Relay</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -441,42 +440,42 @@ function DisplayTorProxyConfig()
|
||||
<div class="tab-content">
|
||||
<p><?php echo $status; ?></p>
|
||||
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
<div class="tab-pane active" id="basic">
|
||||
<h4>Basic settings</h4>
|
||||
<form role="form" action="?page=save_hostapd_conf" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">VirtualAddrNetwork</label>
|
||||
<input type="text" class="form-control" name="virtualaddrnetwork" value="<?php echo htmlspecialchars($arrConfig['VirtualAddrNetwork'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">AutomapHostsSuffixes</label>
|
||||
<input type="text" class="form-control" name="automaphostssuffixes" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsSuffixes'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">AutomapHostsOnResolve</label>
|
||||
<input type="text" class="form-control" name="automaphostsonresolve" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsOnResolve'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">TransListenAddress</label>
|
||||
<input type="text" class="form-control" name="translistenaddress" value="<?php echo htmlspecialchars($arrConfig['TransListenAddress'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">DNSPort</label>
|
||||
<input type="text" class="form-control" name="dnsport" value="<?php echo htmlspecialchars($arrConfig['DNSPort'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">DNSListenAddress</label>
|
||||
<input type="text" class="form-control" name="dnslistenaddress" value="<?php echo htmlspecialchars($arrConfig['DNSListenAddress'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
@@ -485,37 +484,37 @@ function DisplayTorProxyConfig()
|
||||
<div class="tab-pane fade" id="relay">
|
||||
<h4>Relay settings</h4>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">ORPort</label>
|
||||
<input type="text" class="form-control" name="orport" value="<?php echo htmlspecialchars($arrConfig['ORPort'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">ORListenAddress</label>
|
||||
<input type="text" class="form-control" name="orlistenaddress" value="<?php echo htmlspecialchars($arrConfig['ORListenAddress'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Nickname</label>
|
||||
<input type="text" class="form-control" name="nickname" value="<?php echo htmlspecialchars($arrConfig['Nickname'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">Address</label>
|
||||
<input type="text" class="form-control" name="address" value="<?php echo htmlspecialchars($arrConfig['Address'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">RelayBandwidthRate</label>
|
||||
<input type="text" class="form-control" name="relaybandwidthrate" value="<?php echo htmlspecialchars($arrConfig['RelayBandwidthRate'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code">RelayBandwidthBurst</label>
|
||||
<input type="text" class="form-control" name="relaybandwidthburst" value="<?php echo htmlspecialchars($arrConfig['RelayBandwidthBurst'], ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
@@ -532,9 +531,8 @@ function DisplayTorProxyConfig()
|
||||
?>
|
||||
</form>
|
||||
</div><!-- /.tab-content -->
|
||||
</div><!-- /.panel-body -->
|
||||
<div class="panel-footer"> Information provided by tor</div>
|
||||
</div><!-- /.panel-primary -->
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer"> Information provided by tor</div>
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div><!-- /.row -->
|
||||
<?php
|
||||
|
@@ -44,7 +44,7 @@ function DisplayHostAPDConfig()
|
||||
exec('cat '. RASPI_HOSTAPD_CONFIG, $hostapdconfig);
|
||||
exec('pidof hostapd | wc -l', $hostapdstatus);
|
||||
|
||||
$serviceStatus = $hostapdstatus[0] == 0 ? "stopped" : "running";
|
||||
$serviceStatus = $hostapdstatus[0] == 0 ? "down" : "up";
|
||||
|
||||
foreach ($hostapdconfig as $hostapdconfigline) {
|
||||
if (strlen($hostapdconfigline) === 0) {
|
||||
|
Reference in New Issue
Block a user