Fix missing mobiledata.ini and some cleanup

This commit is contained in:
Christian Zeitnitz 2021-03-16 19:11:40 +01:00
parent 8bccf1d077
commit f77fb660bf
5 changed files with 6 additions and 19 deletions

View file

@ -21,14 +21,6 @@ $hostapd = parse_ini_file(RASPI_HOSTAPD_CONFIG, false, INI_SCANNER_RAW);
$type = "WPA";
$password = isset($hostapd['wpa_psk']) ? $hostapd['wpa_psk'] : $hostapd['wpa_passphrase'];
// use wep if configured
$wep_default_key = intval($hostapd['wep_default_key']);
$wep_key = 'wep_key' . $wep_default_key;
if (array_key_exists($wep_key, $hostapd)) {
$type = "WEP";
$password = $hostapd[$wep_key];
}
// if password is still empty, assume nopass
if (empty($password)) {
$type = "nopass";
@ -54,5 +46,5 @@ header("Content-Length: $content_length");
header("Last-Modified: $last_modified");
header("ETag: \"$etag\"");
header("X-QR-Code-Content: $data");
echo shell_exec($command);
echo $svg

View file

@ -740,6 +740,3 @@ function preg_only_match($pat,$haystack) {
}
return $match;
}
?>

View file

@ -214,11 +214,12 @@ function setClientState($state) {
preg_match("/^([0-9]{1,3}\.){3}/",$connected,$ipadd);
$ipadd = $ipadd[0].'1'; // ip address of the Hilink api
$mode = ($state == "up") ? 1 : 0;
if (file_exists(RASPI_CONFIG."/networking/mobiledata.ini")) {
$dat = parse_ini_file(RASPI_CONFIG."/networking/mobiledata.ini");
$pin="";
if (file_exists(($f = RASPI_CONFIG."/networking/mobiledata.ini"))) {
$dat = parse_ini_file($f);
$pin = (isset($dat["pin"]) && preg_match("/^[0-9]*$/",$dat["pin"])) ? $dat["pin"] : "";
exec('sudo '.RASPI_CLIENT_SCRIPT_PATH.'/onoff_huawei_hilink.sh -c '.$mode.' -h '.$ipadd.' -p '.$pin);
}
exec('sudo '.RASPI_CLIENT_SCRIPT_PATH.'/onoff_huawei_hilink.sh -c '.$mode.' -h '.$ipadd.' -p '.$pin);
break;
case "ppp":
if($state == "up") exec('sudo ifup '.$dev["name"]);
@ -230,5 +231,3 @@ function setClientState($state) {
if($state=="up") waitClientConnected($dev["name"],15);
}
}
?>

View file

@ -41,5 +41,4 @@ function getRouteInfo($checkAccess)
}
return $rInfo;
}
?>

View file

@ -81,7 +81,7 @@
</div>
</div>
</div>
<?php $arrMD = parse_ini_file('/etc/raspap/networking/mobiledata.ini');
<?php $arrMD = file_exists(($f = RASPI_CONFIG."/networking/mobiledata.ini")) ? parse_ini_file($f) : false;
if ($arrMD==false) { $arrMD=[]; $arrMD["pin"]=$arrMD["apn"]=$arrMD["apn_user"]=$arrMD["apn_pw"]=$arrMD["router_user"]=$arrMD["router_pw"]=""; }
?>
<div role="tabpanel" class="tab-pane fade in" id="netdevices">