mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Fix missing mobiledata.ini and some cleanup
This commit is contained in:
		@@ -21,14 +21,6 @@ $hostapd = parse_ini_file(RASPI_HOSTAPD_CONFIG, false, INI_SCANNER_RAW);
 | 
				
			|||||||
$type = "WPA";
 | 
					$type = "WPA";
 | 
				
			||||||
$password = isset($hostapd['wpa_psk']) ? $hostapd['wpa_psk'] : $hostapd['wpa_passphrase'];
 | 
					$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 password is still empty, assume nopass
 | 
				
			||||||
if (empty($password)) {
 | 
					if (empty($password)) {
 | 
				
			||||||
    $type = "nopass";
 | 
					    $type = "nopass";
 | 
				
			||||||
@@ -54,5 +46,5 @@ header("Content-Length: $content_length");
 | 
				
			|||||||
header("Last-Modified: $last_modified");
 | 
					header("Last-Modified: $last_modified");
 | 
				
			||||||
header("ETag: \"$etag\"");
 | 
					header("ETag: \"$etag\"");
 | 
				
			||||||
header("X-QR-Code-Content: $data");
 | 
					header("X-QR-Code-Content: $data");
 | 
				
			||||||
echo shell_exec($command);
 | 
					echo $svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -740,6 +740,3 @@ function preg_only_match($pat,$haystack) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  return $match;
 | 
					  return $match;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -214,11 +214,12 @@ function setClientState($state) {
 | 
				
			|||||||
                preg_match("/^([0-9]{1,3}\.){3}/",$connected,$ipadd);
 | 
					                preg_match("/^([0-9]{1,3}\.){3}/",$connected,$ipadd);
 | 
				
			||||||
                $ipadd = $ipadd[0].'1'; // ip address of the Hilink api
 | 
					                $ipadd = $ipadd[0].'1'; // ip address of the Hilink api
 | 
				
			||||||
                $mode = ($state == "up") ? 1 : 0;
 | 
					                $mode = ($state == "up") ? 1 : 0;
 | 
				
			||||||
                if (file_exists(RASPI_CONFIG."/networking/mobiledata.ini")) {
 | 
									$pin="";
 | 
				
			||||||
                    $dat = parse_ini_file(RASPI_CONFIG."/networking/mobiledata.ini");
 | 
					                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"] : "";
 | 
					                    $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;
 | 
					                break;
 | 
				
			||||||
            case "ppp":
 | 
					            case "ppp":
 | 
				
			||||||
                if($state == "up") exec('sudo ifup '.$dev["name"]);
 | 
					                if($state == "up") exec('sudo ifup '.$dev["name"]);
 | 
				
			||||||
@@ -230,5 +231,3 @@ function setClientState($state) {
 | 
				
			|||||||
        if($state=="up") waitClientConnected($dev["name"],15);
 | 
					        if($state=="up") waitClientConnected($dev["name"],15);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,5 +41,4 @@ function getRouteInfo($checkAccess)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return $rInfo;
 | 
					    return $rInfo;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -81,7 +81,7 @@
 | 
				
			|||||||
			  </div>
 | 
								  </div>
 | 
				
			||||||
			</div>
 | 
								</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"]=""; }
 | 
					                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">
 | 
					          <div role="tabpanel" class="tab-pane fade in" id="netdevices">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user