19 changed files with 215 additions and 192 deletions
-
2ajax/networking/wifi_stations.php
-
9includes/about.php
-
20includes/adblock.php
-
7includes/authenticate.php
-
10includes/configure_client.php
-
24includes/dashboard.php
-
68includes/internetRoute.php
-
14includes/networking.php
-
76includes/system.php
-
2includes/wifi_functions.php
-
6templates/about/sponsors.php
-
8templates/adblock/custom.php
-
17templates/adblock/logging.php
-
12templates/configure_client.php
-
32templates/dashboard.php
-
91templates/networking.php
-
3templates/system/basic.php
-
2templates/system/language.php
-
4templates/themes.php
@ -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')); |
|||
} |
|||
|
@ -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); |
|||
} |
|||
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"); |
|||
} |
|||
} else { |
|||
$rInfo = array("error"=>"No route to the internet found"); |
|||
return $rInfo; |
|||
} |
|||
$rInfo_json = json_encode($rInfo); |
|||
?>
|
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue