mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Fix miscellaneous php warnings
This commit is contained in:
parent
94174a3920
commit
2b543c605f
@ -92,6 +92,8 @@ function DisplayHostAPDConfig()
|
|||||||
// assign disassoc_low_ack boolean if value is set
|
// assign disassoc_low_ack boolean if value is set
|
||||||
if (isset($arrConfig['disassoc_low_ack'])) {
|
if (isset($arrConfig['disassoc_low_ack'])) {
|
||||||
$arrConfig['disassoc_low_ack_bool'] = 1;
|
$arrConfig['disassoc_low_ack_bool'] = 1;
|
||||||
|
} else {
|
||||||
|
$arrConfig['disassoc_low_ack_bool'] = 0;
|
||||||
}
|
}
|
||||||
// assign country_code from iw reg if not set in config
|
// assign country_code from iw reg if not set in config
|
||||||
if (empty($arrConfig['country_code']) && isset($country_code[0])) {
|
if (empty($arrConfig['country_code']) && isset($country_code[0])) {
|
||||||
|
@ -19,6 +19,7 @@ function DisplayProviderConfig()
|
|||||||
$publicIP = get_public_ip();
|
$publicIP = get_public_ip();
|
||||||
$serviceStatus = 'down';
|
$serviceStatus = 'down';
|
||||||
$statusDisplay = 'down';
|
$statusDisplay = 'down';
|
||||||
|
$ctlState = '';
|
||||||
|
|
||||||
if (!file_exists($binPath)) {
|
if (!file_exists($binPath)) {
|
||||||
$status->addMessage(sprintf(_('Expected %s binary not found at: %s'), $providerName, $binPath), 'warning');
|
$status->addMessage(sprintf(_('Expected %s binary not found at: %s'), $providerName, $binPath), 'warning');
|
||||||
@ -155,7 +156,7 @@ function getCliOverride($id, $group, $item)
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$id--;
|
$id--;
|
||||||
if ($obj['providers'][$id][$group][$item] === null) {
|
if (empty($obj['providers'][$id][$group][$item])) {
|
||||||
return $item;
|
return $item;
|
||||||
} else {
|
} else {
|
||||||
return $obj['providers'][$id][$group][$item];
|
return $obj['providers'][$id][$group][$item];
|
||||||
@ -202,13 +203,13 @@ function getCountries($id, $binPath)
|
|||||||
$cmd = getCliOverride($id, 'cmd_overrides', 'countries');
|
$cmd = getCliOverride($id, 'cmd_overrides', 'countries');
|
||||||
$pattern = getCliOverride($id, 'regex', 'pattern');
|
$pattern = getCliOverride($id, 'regex', 'pattern');
|
||||||
$replace = getCliOverride($id, 'regex', 'replace');
|
$replace = getCliOverride($id, 'regex', 'replace');
|
||||||
$slice = getCliOverride($id, 'regex', 'slice');
|
|
||||||
exec("sudo $binPath $cmd", $output);
|
exec("sudo $binPath $cmd", $output);
|
||||||
|
|
||||||
// CLI country output differs considerably between different providers.
|
// CLI country output differs considerably between different providers.
|
||||||
// Ideally, custom parsing would be avoided in favor of a pure regex solution
|
// Ideally, custom parsing would be avoided in favor of a pure regex solution
|
||||||
switch ($id) {
|
switch ($id) {
|
||||||
case 1: // expressvpn
|
case 1: // expressvpn
|
||||||
|
$slice = getCliOverride($id, 'regex', 'slice');
|
||||||
$output = array_slice($output, $slice);
|
$output = array_slice($output, $slice);
|
||||||
foreach ($output as $item) {
|
foreach ($output as $item) {
|
||||||
$item = preg_replace($pattern, $replace, $item);
|
$item = preg_replace($pattern, $replace, $item);
|
||||||
@ -264,6 +265,7 @@ function getCountries($id, $binPath)
|
|||||||
*/
|
*/
|
||||||
function getProviderLog($id, $binPath, &$country)
|
function getProviderLog($id, $binPath, &$country)
|
||||||
{
|
{
|
||||||
|
$providerLog = '';
|
||||||
$cmd = getCliOverride($id, 'cmd_overrides', 'log');
|
$cmd = getCliOverride($id, 'cmd_overrides', 'log');
|
||||||
exec("sudo $binPath $cmd", $cmd_raw);
|
exec("sudo $binPath $cmd", $cmd_raw);
|
||||||
$output = stripArtifacts($cmd_raw);
|
$output = stripArtifacts($cmd_raw);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user