mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Transfer template logic to includes, see #749 thx @mp035
This commit is contained in:
parent
3d2d608477
commit
b21ea0d28d
@ -15,4 +15,4 @@ nearbyWifiStations($networks, !isset($_REQUEST["refresh"]));
|
||||
connectedWifiStations($networks);
|
||||
sortNetworksByRSSI($networks);
|
||||
|
||||
echo renderTemplate('wifi_stations', compact('networks'));
|
||||
echo renderTemplate('wifi_stations', compact('networks'), true);
|
||||
|
@ -1,9 +1,16 @@
|
||||
<?php
|
||||
|
||||
require_once "app/lib/Parsedown.php";
|
||||
|
||||
/**
|
||||
* Displays info about the RaspAP project
|
||||
*/
|
||||
function DisplayAbout()
|
||||
{
|
||||
echo renderTemplate("about");
|
||||
$Parsedown = new Parsedown();
|
||||
$strContent = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/BACKERS.md');
|
||||
$sponsorsHtml = $Parsedown->text($strContent);
|
||||
|
||||
echo renderTemplate("about", compact('sponsorsHtml'));
|
||||
}
|
||||
|
||||
|
@ -75,13 +75,31 @@ function DisplayAdBlockConfig()
|
||||
$dnsmasq_state = ($dnsmasq[0] > 0);
|
||||
$serviceStatus = $dnsmasq_state && $enabled ? "up" : "down";
|
||||
|
||||
$adblock_custom_content = file_get_contents(RASPI_ADBLOCK_LISTPATH .'custom.txt');
|
||||
|
||||
$adblock_log = '';
|
||||
exec('sudo chmod o+r /tmp/dnsmasq.log');
|
||||
$handle = fopen("/tmp/dnsmasq.log", "r");
|
||||
if ($handle) {
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
if (preg_match('/(0.0.0.0)/', $line)) {
|
||||
$adblock_log .= $line;
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
} else {
|
||||
$adblock_log = "Unable to open log file";
|
||||
}
|
||||
|
||||
echo renderTemplate(
|
||||
"adblock", compact(
|
||||
"status",
|
||||
"serviceStatus",
|
||||
"dnsmasq_state",
|
||||
"enabled",
|
||||
"custom_enabled"
|
||||
"custom_enabled",
|
||||
"adblock_custom_content",
|
||||
"adblock_log"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
$user = $_SERVER['PHP_AUTH_USER'];
|
||||
$pass = $_SERVER['PHP_AUTH_PW'];
|
||||
$user = $_SERVER['PHP_AUTH_USER'] ?? "";
|
||||
$pass = $_SERVER['PHP_AUTH_PW'] ?? "";
|
||||
|
||||
require_once RASPI_CONFIG.'/raspap.php';
|
||||
$config = getConfig();
|
||||
|
||||
$validated = ($user == $config['admin_user']) && password_verify($pass, $config['admin_pass']);
|
||||
|
||||
|
@ -97,5 +97,13 @@ function DisplayWPAConfig()
|
||||
connectedWifiStations($networks);
|
||||
sortNetworksByRSSI($networks);
|
||||
|
||||
echo renderTemplate("configure_client", compact("status"));
|
||||
$clientInterface = $_SESSION['wifi_client_interface'];
|
||||
|
||||
exec('ip a show '.$clientInterface, $stdoutIp);
|
||||
$stdoutIpAllLinesGlued = implode(" ", $stdoutIp);
|
||||
$stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued);
|
||||
preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState) || $matchesState[1] = 'unknown';
|
||||
$ifaceStatus = strtolower($matchesState[1]) ? "up" : "down";
|
||||
|
||||
echo renderTemplate("configure_client", compact("status", "clientInterface", "ifaceStatus"));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
require_once 'includes/config.php';
|
||||
require_once 'includes/wifi_functions.php';
|
||||
require_once 'includes/functions.php';
|
||||
|
||||
/**
|
||||
* Show dashboard page.
|
||||
@ -136,7 +137,7 @@ function DisplayDashboard(&$extraFooterScripts)
|
||||
if ($signalLevel >= 0) {
|
||||
$strLinkQuality = 100;
|
||||
} else {
|
||||
$strLinkQuality = 100 + $signalLevel;
|
||||
$strLinkQuality = 100 + intval($signalLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,9 +178,30 @@ function DisplayDashboard(&$extraFooterScripts)
|
||||
$status->addMessage(sprintf(_('Interface is %s.'), strtolower($interfaceState)), $classMsgDevicestatus);
|
||||
}
|
||||
}
|
||||
// brought in from template
|
||||
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
|
||||
$bridgedEnable = $arrHostapdConf['BridgedEnable'];
|
||||
$clientInterface = $_SESSION['wifi_client_interface'];
|
||||
$apInterface = $_SESSION['ap_interface'];
|
||||
$MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"';
|
||||
|
||||
if (getBridgedState()) {
|
||||
$moreLink = "hostapd_conf";
|
||||
exec('iw dev ' . $apInterface . ' station dump | grep -oE ' . $MACPattern, $clients);
|
||||
} else {
|
||||
$moreLink = "dhcpd_conf";
|
||||
exec('cat ' . RASPI_DNSMASQ_LEASES . '| grep -E $(iw dev ' . $apInterface . ' station dump | grep -oE ' . $MACPattern . ' | paste -sd "|")', $clients);
|
||||
}
|
||||
$ifaceStatus = $wlan0up ? "up" : "down";
|
||||
|
||||
echo renderTemplate(
|
||||
"dashboard", compact(
|
||||
"clients",
|
||||
"moreLink",
|
||||
"apInterface",
|
||||
"clientInterface",
|
||||
"ifaceStatus",
|
||||
"bridgedEnable",
|
||||
"status",
|
||||
"ipv4Addrs",
|
||||
"ipv4Netmasks",
|
||||
|
@ -1,35 +1,45 @@
|
||||
<?php
|
||||
|
||||
$rInfo=array();
|
||||
// get all default routes
|
||||
exec('ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev (\w*).*src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"', $routes);
|
||||
exec('ip route list | sed -rn "s/default dev (\w*) scope link/\1/p"',$devs);
|
||||
if(!empty($devs)) {
|
||||
foreach ($devs as $dev)
|
||||
exec('ip route list | sed -rn "s/(([0-9]{1,3}\.){3}[0-9]{1,3}).*dev.*("'.$dev.'").*scope link src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"',$routes);
|
||||
}
|
||||
if (!empty($routes) ) {
|
||||
foreach ($routes as $i => $route) {
|
||||
$prop=explode(' ', $route);
|
||||
$rInfo[$i]["interface"]=$prop[0];
|
||||
$rInfo[$i]["ip-address"]=$prop[1];
|
||||
$rInfo[$i]["gateway"]=$prop[2];
|
||||
// resolve the name of the gateway (if possible)
|
||||
unset($host);
|
||||
exec('host '.$prop[2].' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1', $host);
|
||||
$rInfo[$i]["gw-name"] = empty($host) ? "*" : $host[0];
|
||||
if (isset($checkAccess) && $checkAccess) {
|
||||
// check internet connectivity w/ and w/o DNS resolution
|
||||
unset($okip);
|
||||
exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okip);
|
||||
$rInfo[$i]["access-ip"] = empty($okip) ? false : true;
|
||||
unset($okdns);
|
||||
exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okdns);
|
||||
$rInfo[$i]["access-dns"] = empty($okdns) ? false : true;
|
||||
}
|
||||
/*
|
||||
* Fetches details of the kernel routing table
|
||||
*
|
||||
* @param boolean $checkAccesss Perform connectivity test
|
||||
* @return string
|
||||
*/
|
||||
function getRouteInfo($checkAccess)
|
||||
{
|
||||
$rInfo = array();
|
||||
// get all default routes
|
||||
exec('ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev (\w*).*src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"', $routes);
|
||||
exec('ip route list | sed -rn "s/default dev (\w*) scope link/\1/p"', $devs);
|
||||
if (!empty($devs)) {
|
||||
foreach ($devs as $dev)
|
||||
exec('ip route list | sed -rn "s/(([0-9]{1,3}\.){3}[0-9]{1,3}).*dev.*("' . $dev . '").*scope link src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"', $routes);
|
||||
}
|
||||
} else {
|
||||
$rInfo = array("error"=>"No route to the internet found");
|
||||
if (!empty($routes)) {
|
||||
foreach ($routes as $i => $route) {
|
||||
$prop = explode(' ', $route);
|
||||
$rInfo[$i]["interface"] = $prop[0];
|
||||
$rInfo[$i]["ip-address"] = $prop[1];
|
||||
$rInfo[$i]["gateway"] = $prop[2];
|
||||
// resolve the name of the gateway (if possible)
|
||||
unset($host);
|
||||
exec('host ' . $prop[2] . ' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1', $host);
|
||||
$rInfo[$i]["gw-name"] = empty($host) ? "*" : $host[0];
|
||||
if (isset($checkAccess) && $checkAccess) {
|
||||
// check internet connectivity w/ and w/o DNS resolution
|
||||
unset($okip);
|
||||
exec('ping -W1 -c 1 -I ' . $prop[0] . ' ' . RASPI_ACCESS_CHECK_IP . ' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"', $okip);
|
||||
$rInfo[$i]["access-ip"] = empty($okip) ? false : true;
|
||||
unset($okdns);
|
||||
exec('ping -W1 -c 1 -I ' . $prop[0] . ' ' . RASPI_ACCESS_CHECK_DNS . ' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"', $okdns);
|
||||
$rInfo[$i]["access-dns"] = empty($okdns) ? false : true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$rInfo = array("error" => "No route to the internet found");
|
||||
}
|
||||
return $rInfo;
|
||||
}
|
||||
$rInfo_json = json_encode($rInfo);
|
||||
?>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'includes/status_messages.php';
|
||||
require_once 'includes/internetRoute.php';
|
||||
|
||||
/**
|
||||
*
|
||||
@ -12,9 +13,14 @@ function DisplayNetworkingConfig()
|
||||
$status = new StatusMessages();
|
||||
|
||||
exec("ls /sys/class/net | grep -v lo", $interfaces);
|
||||
$routeInfo = getRouteInfo(true);
|
||||
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
|
||||
$bridgedEnabled = $arrHostapdConf['BridgedEnable'];
|
||||
|
||||
foreach ($interfaces as $interface) {
|
||||
exec("ip a show $interface", $$interface);
|
||||
}
|
||||
echo renderTemplate("networking", compact("status", "interfaces"));
|
||||
echo renderTemplate("networking", compact(
|
||||
"status",
|
||||
"interfaces",
|
||||
"routeInfo",
|
||||
"bridgedEnabled")
|
||||
);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
require_once 'includes/status_messages.php';
|
||||
require_once 'config.php';
|
||||
require_once 'app/lib/system.php';
|
||||
|
||||
/**
|
||||
* Find the version of the Raspberry Pi
|
||||
@ -151,5 +152,78 @@ function DisplaySystem()
|
||||
'vi_VN.UTF-8' => 'Tiếng Việt (Vietnamese)'
|
||||
);
|
||||
|
||||
echo renderTemplate("system", compact("arrLocales", "status", "serverPort", "serverBind"));
|
||||
#fetch system status variables.
|
||||
$system = new System();
|
||||
|
||||
$hostname = $system->hostname();
|
||||
$uptime = $system->uptime();
|
||||
$cores = $system->processorCount();
|
||||
|
||||
// mem used
|
||||
$memused = $system->usedMemory();
|
||||
$memused_status = "primary";
|
||||
if ($memused > 90) {
|
||||
$memused_status = "danger";
|
||||
$memused_led = "service-status-down";
|
||||
} elseif ($memused > 75) {
|
||||
$memused_status = "warning";
|
||||
$memused_led = "service-status-warn";
|
||||
} elseif ($memused > 0) {
|
||||
$memused_status = "success";
|
||||
$memused_led = "service-status-up";
|
||||
}
|
||||
|
||||
// cpu load
|
||||
$cpuload = $system->systemLoadPercentage();
|
||||
if ($cpuload > 90) {
|
||||
$cpuload_status = "danger";
|
||||
} elseif ($cpuload > 75) {
|
||||
$cpuload_status = "warning";
|
||||
} elseif ($cpuload >= 0) {
|
||||
$cpuload_status = "success";
|
||||
}
|
||||
|
||||
// cpu temp
|
||||
$cputemp = $system->systemTemperature();
|
||||
if ($cputemp > 70) {
|
||||
$cputemp_status = "danger";
|
||||
$cputemp_led = "service-status-down";
|
||||
} elseif ($cputemp > 50) {
|
||||
$cputemp_status = "warning";
|
||||
$cputemp_led = "service-status-warn";
|
||||
} else {
|
||||
$cputemp_status = "success";
|
||||
$cputemp_led = "service-status-up";
|
||||
}
|
||||
|
||||
// hostapd status
|
||||
$hostapd = $system->hostapdStatus();
|
||||
if ($hostapd[0] == 1) {
|
||||
$hostapd_status = "active";
|
||||
$hostapd_led = "service-status-up";
|
||||
} else {
|
||||
$hostapd_status = "inactive";
|
||||
$hostapd_led = "service-status-down";
|
||||
}
|
||||
|
||||
echo renderTemplate("system", compact(
|
||||
"arrLocales",
|
||||
"status",
|
||||
"serverPort",
|
||||
"serverBind",
|
||||
"hostname",
|
||||
"uptime",
|
||||
"cores",
|
||||
"memused",
|
||||
"memused_status",
|
||||
"memused_led",
|
||||
"cpuload",
|
||||
"cpuload_status",
|
||||
"cputemp",
|
||||
"cputemp_status",
|
||||
"cputemp_led",
|
||||
"hostapd",
|
||||
"hostapd_status",
|
||||
"hostapd_led"
|
||||
));
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ function knownWifiStations(&$networks)
|
||||
foreach ($known_return as $line) {
|
||||
if (preg_match('/network\s*=/', $line)) {
|
||||
$network = array('visible' => false, 'configured' => true, 'connected' => false);
|
||||
} elseif ($network !== null) {
|
||||
} elseif (isset($network) && $network !== null) {
|
||||
if (preg_match('/^\s*}\s*$/', $line)) {
|
||||
$networks[$ssid] = $network;
|
||||
$network = null;
|
||||
|
@ -2,11 +2,7 @@
|
||||
<div class="tab-pane fade" id="aboutsponsors">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 mt-3">
|
||||
<?php
|
||||
$Parsedown = new Parsedown();
|
||||
$strContent = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/BACKERS.md');
|
||||
echo $Parsedown->text($strContent);
|
||||
?>
|
||||
<?php echo $sponsorsHtml; ?>
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.tab-pane | sponsors tab -->
|
||||
|
@ -21,13 +21,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-8">
|
||||
<?php
|
||||
$adblock_custom = file_get_contents(RASPI_ADBLOCK_LISTPATH .'custom.txt');
|
||||
if (strlen($adblock_custom) == 0) {
|
||||
$adblock_custom = _("Custom blocklist not defined");
|
||||
}
|
||||
echo '<textarea class="logoutput" name="adblock-custom-hosts">'.htmlspecialchars($adblock_custom, ENT_QUOTES).'</textarea>';
|
||||
?>
|
||||
<?php echo '<textarea class="logoutput" name="adblock-custom-hosts">'.htmlspecialchars($adblock_custom_content, ENT_QUOTES).'</textarea>'; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.tab-pane -->
|
||||
|
@ -3,22 +3,7 @@
|
||||
<h4 class="mt-3"><?php echo _("Logging"); ?></h4>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-8">
|
||||
<?php
|
||||
$log = '';
|
||||
exec('sudo chmod o+r /tmp/dnsmasq.log');
|
||||
$handle = fopen("/tmp/dnsmasq.log", "r");
|
||||
if ($handle) {
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
if (preg_match('/(0.0.0.0)/', $line)){
|
||||
$log.=$line;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$log = "Unable to open log file";
|
||||
}
|
||||
fclose($handle);
|
||||
echo '<textarea class="logoutput">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
|
||||
?>
|
||||
<?php echo '<textarea class="logoutput">'.htmlspecialchars($adblock_log, ENT_QUOTES).'</textarea>'; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.tab-pane -->
|
||||
|
@ -1,13 +1,3 @@
|
||||
<?php
|
||||
|
||||
$client_interface = $_SESSION['wifi_client_interface'];
|
||||
|
||||
exec('ip a show '.$client_interface, $stdoutIp);
|
||||
$stdoutIpAllLinesGlued = implode(" ", $stdoutIp);
|
||||
$stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued);
|
||||
preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState) || $matchesState[1] = 'unknown';
|
||||
$ifaceStatus = strtolower($matchesState[1]) ? "up" : "down";
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
@ -19,7 +9,7 @@ $ifaceStatus = strtolower($matchesState[1]) ? "up" : "down";
|
||||
<div class="col">
|
||||
<button class="btn btn-light btn-icon-split btn-sm service-status float-right">
|
||||
<span class="icon"><i class="fas fa-circle service-status-<?php echo $ifaceStatus ?>"></i></span>
|
||||
<span class="text service-status"><?php echo strtolower($client_interface) .' '. _($ifaceStatus) ?></span>
|
||||
<span class="text service-status"><?php echo strtolower($clientInterface) .' '. _($ifaceStatus) ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
|
@ -1,19 +1,3 @@
|
||||
<?php
|
||||
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
|
||||
|
||||
$client_interface = $_SESSION['wifi_client_interface'];
|
||||
|
||||
$ap_iface = $_SESSION['ap_interface'];
|
||||
$MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"';
|
||||
if ($arrHostapdConf['BridgedEnable'] == 1) {
|
||||
$moreLink = "hostapd_conf";
|
||||
exec('iw dev '.$ap_iface.' station dump | grep -oE '.$MACPattern, $clients);
|
||||
} else {
|
||||
$moreLink = "dhcpd_conf";
|
||||
exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(iw dev '.$ap_iface.' station dump | grep -oE '.$MACPattern.' | paste -sd "|")', $clients);
|
||||
}
|
||||
$ifaceStatus = $wlan0up ? "up" : "down";
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
@ -25,7 +9,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
|
||||
<div class="col">
|
||||
<button class="btn btn-light btn-icon-split btn-sm service-status float-right">
|
||||
<span class="icon"><i class="fas fa-circle service-status-<?php echo $ifaceStatus ?>"></i></span>
|
||||
<span class="text service-status"><?php echo strtolower($ap_iface) .' '. _($ifaceStatus) ?></span>
|
||||
<span class="text service-status"><?php echo strtolower($apInterface) .' '. _($ifaceStatus) ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
@ -38,7 +22,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h4><?php echo _("Hourly traffic amount"); ?></h4>
|
||||
<div id="divInterface" class="d-none"><?php echo $_SESSION['ap_interface']; ?></div>
|
||||
<div id="divInterface" class="d-none"><?php echo $apInterface; ?></div>
|
||||
<div class="col-md-12">
|
||||
<canvas id="divDBChartBandwidthhourly"></canvas>
|
||||
</div>
|
||||
@ -53,7 +37,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md">
|
||||
<div class="info-item"><?php echo _("Connected To"); ?></div><div><?php echo htmlspecialchars($connectedSSID, ENT_QUOTES); ?></div>
|
||||
<div class="info-item"><?php echo _("Interface"); ?></div><div><?php echo htmlspecialchars($_SESSION['wifi_client_interface']); ?></div>
|
||||
<div class="info-item"><?php echo _("Interface"); ?></div><div><?php echo htmlspecialchars($clientInterface); ?></div>
|
||||
<div class="info-item"><?php echo _("AP Mac Address"); ?></div><div><?php echo htmlspecialchars($connectedBSSID, ENT_QUOTES); ?></div>
|
||||
<div class="info-item"><?php echo _("Bitrate"); ?></div><div><?php echo htmlspecialchars($bitrate, ENT_QUOTES); ?></div>
|
||||
<div class="info-item"><?php echo _("Signal Level"); ?></div><div><?php echo htmlspecialchars($signalLevel, ENT_QUOTES); ?></div>
|
||||
@ -78,7 +62,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php if ($arrHostapdConf['BridgedEnable'] == 1) : ?>
|
||||
<?php if ($bridgedEnable == 1) : ?>
|
||||
<th><?php echo _("MAC Address"); ?></th>
|
||||
<?php else : ?>
|
||||
<th><?php echo _("Host name"); ?></th>
|
||||
@ -88,7 +72,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($arrHostapdConf['BridgedEnable'] == 1) : ?>
|
||||
<?php if ($bridgedEnable == 1) : ?>
|
||||
<tr>
|
||||
<td><small class="text-muted"><?php echo _("Bridged AP mode is enabled. For Hostname and IP, see your router's admin page.");?></small></td>
|
||||
</tr>
|
||||
@ -126,12 +110,12 @@ $ifaceStatus = $wlan0up ? "up" : "down";
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<?php if (!RASPI_MONITOR_ENABLED) : ?>
|
||||
<?php if (!$wlan0up) : ?>
|
||||
<input type="submit" class="btn btn-success" value="<?php echo _("Start").' '.$client_interface ?>" name="ifup_wlan0" />
|
||||
<input type="submit" class="btn btn-success" value="<?php echo _("Start").' '.$clientInterface ?>" name="ifup_wlan0" />
|
||||
<?php else : ?>
|
||||
<input type="submit" class="btn btn-warning" value="<?php echo _("Stop").' '.$client_interface ?>" name="ifdown_wlan0" />
|
||||
<input type="submit" class="btn btn-warning" value="<?php echo _("Stop").' '.$clientInterface ?>" name="ifdown_wlan0" />
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<a href="<?php echo $_GET['page'] ?>" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,12 +12,6 @@
|
||||
<div id="msgNetworking"></div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="nav-item"><a class="nav-link active" href="#summary" aria-controls="summary" role="tab" data-toggle="tab"><?php echo _("Summary"); ?></a></li>
|
||||
<?php
|
||||
// Get Bridged AP mode status
|
||||
$arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini');
|
||||
// defaults to false
|
||||
$bridgedEnabled = $arrHostapdConf['BridgedEnable'];
|
||||
?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="summary">
|
||||
@ -38,12 +32,10 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$checkAccess=true;
|
||||
require "includes/internetRoute.php";
|
||||
if (isset($rInfo["error"]) || empty($rInfo)) {
|
||||
if (isset($routeInfo["error"]) || empty($routeInfo)) {
|
||||
echo "<tr><td colspan=5>No route to the internet found</td></tr>";
|
||||
} else {
|
||||
foreach($rInfo as $route) {
|
||||
foreach($routeInfo as $route) {
|
||||
echo "<tr>";
|
||||
echo "<td>".$route["interface"]."</td>";
|
||||
echo "<td>".$route["ip-address"]."</td>";
|
||||
@ -65,6 +57,7 @@
|
||||
</div>
|
||||
<h4 class="mt-3"><?php echo _("Current settings") ?></h4>
|
||||
<div class="row">
|
||||
<?php if (!$bridgedEnabled) : // No interface details when bridged ?>
|
||||
<?php foreach ($interfaces as $if): ?>
|
||||
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
|
||||
<div class="col-md-6 mb-3">
|
||||
@ -76,84 +69,18 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php endif ?>
|
||||
</div><!-- /.row -->
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<a href="#" class="btn btn-outline btn-primary" id="btnSummaryRefresh"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh"); ?></a>
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div><!-- /.tab-pane -->
|
||||
|
||||
<?php foreach ($interfaces as $if): ?>
|
||||
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
|
||||
<div role="tabpanel" class="tab-pane fade in" id="<?php echo $if_quoted ?>">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
|
||||
<form id="frm-<?php echo $if_quoted ?>">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<div class="form-group">
|
||||
<h4 class="mt-3"><?php echo _("Adapter IP Address Settings") ?></h4>
|
||||
<div class="btn-group" role="group" data-toggle="buttons">
|
||||
<label class="btn btn-primary">
|
||||
<input class="mr-2" type="radio" name="<?php echo $if_quoted ?>-addresstype" id="<?php echo $if_quoted ?>-dhcp" autocomplete="off"><?php echo _("DHCP") ?>
|
||||
</label>
|
||||
<label class="btn btn-primary">
|
||||
<input class="mr-2" type="radio" name="<?php echo $if_quoted ?>-addresstype" id="<?php echo $if_quoted ?>-static" autocomplete="off"><?php echo _("Static IP") ?>
|
||||
</label>
|
||||
</div><!-- /.btn-group -->
|
||||
<h4 class="mt-3"><?php echo _("Enable Fallback to Static Option") ?></h4>
|
||||
<div class="btn-group" role="group" data-toggle="buttons">
|
||||
<label class="btn btn-primary">
|
||||
<input class="mr-2" type="radio" name="<?php echo $if_quoted ?>-dhcpfailover" id="<?php echo $if_quoted ?>-failover" autocomplete="off"><?php echo _("Enabled") ?>
|
||||
</label>
|
||||
<label class="btn btn-warning">
|
||||
<input class="mr-2" type="radio" name="<?php echo $if_quoted ?>-dhcpfailover" id="<?php echo $if_quoted ?>-nofailover" autocomplete="off"><?php echo _("Disabled") ?>
|
||||
</label>
|
||||
</div><!-- /.btn-group -->
|
||||
</div><!-- /.form-group -->
|
||||
|
||||
<hr />
|
||||
|
||||
<h4><?php echo _("Static IP Options") ?></h4>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $if_quoted ?>-ipaddress"><?php echo _("IP Address") ?></label>
|
||||
<input type="text" class="form-control" id="<?php echo $if_quoted ?>-ipaddress" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $if_quoted ?>-netmask"><?php echo _("Subnet Mask") ?></label>
|
||||
<input type="text" class="form-control" id="<?php echo $if_quoted ?>-netmask" placeholder="255.255.255.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $if_quoted ?>-gateway"><?php echo _("Default Gateway") ?></label>
|
||||
<input type="text" class="form-control" id="<?php echo $if_quoted ?>-gateway" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $if_quoted ?>-dnssvr"><?php echo _("DNS Server") ?></label>
|
||||
<input type="text" class="form-control" id="<?php echo $if_quoted ?>-dnssvr" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $if_quoted ?>-dnssvralt"><?php echo _("Alternate DNS Server") ?></label>
|
||||
<input type="text" class="form-control" id="<?php echo $if_quoted ?>-dnssvralt" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $if_quoted ?>-metric"><?php echo _("Metric") ?></label>
|
||||
<input type="text" class="form-control" id="<?php echo $if_quoted ?>-metric" placeholder="0">
|
||||
</div>
|
||||
<?php if (!RASPI_MONITOR_ENABLED) : ?>
|
||||
<a href="#" class="btn btn-outline btn-primary intsave" data-int="<?php echo $if_quoted ?>"><?php echo _("Save settings") ?></a>
|
||||
<a href="#" class="btn btn-warning intapply" data-int="<?php echo $if_quoted ?>"><?php echo _("Apply settings") ?></a>
|
||||
<?php endif ?>
|
||||
</form>
|
||||
|
||||
<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
</div>
|
||||
</div><!-- /.tab-panel -->
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
|
||||
</div><!-- /.tab-content -->
|
||||
</div>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer"><?php echo _("Information provided by /sys/class/net"); ?></div>
|
||||
</div><!-- /.card -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
|
||||
|
@ -35,12 +35,11 @@ include('includes/sysstats.php');
|
||||
|
||||
<form action="system_info" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<a href="<?php echo $_GET['page'] ?>" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
|
||||
<?php if (!RASPI_MONITOR_ENABLED) : ?>
|
||||
<input type="submit" class="btn btn-warning" name="system_reboot" value="<?php echo _("Reboot"); ?>" />
|
||||
<input type="submit" class="btn btn-warning" name="system_shutdown" value="<?php echo _("Shutdown"); ?>" />
|
||||
<?php endif ?>
|
||||
<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -8,6 +8,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-outline btn-primary" name="SaveLanguage" value="<?php echo _("Save settings"); ?>" />
|
||||
<a href="<?php echo $_GET['page'] ?>" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
</div>
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<form action="system_info" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<a href="<?php echo $_GET['page'] ?>" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh"); ?></a>
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
</form>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user