From f77fb660bfc128147b8127712fb9ac3ac9d59bb7 Mon Sep 17 00:00:00 2001 From: Christian Zeitnitz Date: Tue, 16 Mar 2021 19:11:40 +0100 Subject: [PATCH] Fix missing mobiledata.ini and some cleanup --- app/img/wifi-qr-code.php | 10 +--------- includes/functions.php | 3 --- includes/get_clients.php | 9 ++++----- includes/internetRoute.php | 1 - templates/networking.php | 2 +- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/app/img/wifi-qr-code.php b/app/img/wifi-qr-code.php index 21092f82..57e6d238 100644 --- a/app/img/wifi-qr-code.php +++ b/app/img/wifi-qr-code.php @@ -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 diff --git a/includes/functions.php b/includes/functions.php index 2a70712b..4d03fe8b 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -740,6 +740,3 @@ function preg_only_match($pat,$haystack) { } return $match; } - -?> - diff --git a/includes/get_clients.php b/includes/get_clients.php index f8a43c4a..3f5bd3f2 100644 --- a/includes/get_clients.php +++ b/includes/get_clients.php @@ -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); } } - -?> diff --git a/includes/internetRoute.php b/includes/internetRoute.php index 0143a099..67913197 100755 --- a/includes/internetRoute.php +++ b/includes/internetRoute.php @@ -41,5 +41,4 @@ function getRouteInfo($checkAccess) } return $rInfo; } -?> diff --git a/templates/networking.php b/templates/networking.php index 6df5ba87..e925367b 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -81,7 +81,7 @@ -