Fix DMRnetwork error

This commit is contained in:
phl0 2017-01-10 21:14:15 +01:00
parent 78e39950f5
commit 2d5a5db58b
No known key found for this signature in database
GPG key ID: 48EA1E640798CA9A

View file

@ -48,16 +48,24 @@ function setDMRNetwork($network) {
} }
function getDMRNetwork() { function getDMRNetwork() {
$fp = fopen('config/DMRNetwork.txt', 'r'); $filename = 'config/DMRNetwork.txt';
$network = '';
if (file_exists($filename)) {
$fp = fopen($filename, 'r');
$network = fread($fp, filesize("config/DMRNetwork.txt")); $network = fread($fp, filesize("config/DMRNetwork.txt"));
fclose($fp); fclose($fp);
}
return $network; return $network;
} }
function getDMRNetwork2() { function getDMRNetwork2() {
$filename = '../config/DMRNetwork.txt';
$network = '';
if (file_exists($filename)) {
$fp = fopen('../config/DMRNetwork.txt', 'r'); $fp = fopen('../config/DMRNetwork.txt', 'r');
$network = fread($fp, filesize("../config/DMRNetwork.txt")); $network = fread($fp, filesize("../config/DMRNetwork.txt"));
fclose($fp); fclose($fp);
}
return $network; return $network;
} }