Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit 4a3480c

Browse files
authored
Merge pull request #5 from lamaral/offset_fix
Fix undefined offset errors in functions.inc.php.
2 parents 8b2ae62 + fc63505 commit 4a3480c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/functions.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function getConfigItem($section, $key, $configs) {
4141
}
4242
$sectionpos++;
4343
}
44-
44+
4545
return substr($configs[$sectionpos], strlen($key) + 1);
4646
}
4747

@@ -87,24 +87,24 @@ function getConnectedGateways($logLines) {
8787
}
8888

8989
function getLinkedGateways($logLines) {
90-
//0000000000111111111122222222223333333333444444444455555555556666666666
90+
//0000000000111111111122222222223333333333444444444455555555556666666666
9191
//0123456789012345678901234567890123456789012345678901234567890123456789
9292
//M: 2016-06-24 11:11:41.787 Currently linked repeaters/gateways:
9393
//M: 2016-06-24 11:11:41.787 GATEWAY : 217.82.212.214:42000 2/60
9494
//M: 2016-06-24 11:11:41.787 DM0GER : 217.251.59.165:42000 5/60
9595

9696
$gateways = Array();
97-
for ($i = count($logLines); $i>0; $i--) {
97+
for ($i = count($logLines)-1; $i>0; $i--) {
9898
$logLine = $logLines[$i];
99-
99+
100100
if (strpos($logLine, "Starting YSFReflector")) {
101101
return $gateways;
102102
}
103103
if (strpos($logLine, "No repeaters/gateways linked")) {
104104
return $gateways;
105105
}
106106
if (strpos($logLine, "Currently linked repeaters/gateways")) {
107-
for ($j = $i+1; $j <= count($logLines); $j++) {
107+
for ($j = $i+1; $j <= count($logLines)-1; $j++) {
108108
$logLine = $logLines[$j];
109109
if (!startsWith(substr($logLine,27), " ")) {
110110
return $gateways;
@@ -117,7 +117,7 @@ function getLinkedGateways($logLines) {
117117
if ($key === NULL) {
118118
array_push($gateways, Array('callsign'=>$callsign,'timestamp'=>$timestamp,'ipport'=>$ipport));
119119
}
120-
}
120+
}
121121
}
122122
}
123123
}
@@ -136,7 +136,7 @@ function getHeardList($logLines) {
136136
}
137137
$callsign2 = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
138138
$callsign = trim($callsign2);
139-
$target = substr($logLine, strpos($logLine, "to") + 3, strpos($logLine,"at") - strpos($logLine,"to") +6 );
139+
$target = substr($logLine, strpos($logLine, "to") + 3, strpos($logLine,"at") - strpos($logLine,"to") +6 );
140140
$gateway = substr($logLine, strrpos($logLine,"at") + 3);
141141
// Callsign or ID should be less than 11 chars long, otherwise it could be errorneous
142142
if ( strlen($callsign) < 11 ) {
@@ -176,4 +176,4 @@ function getSize($filesize, $precision = 2) {
176176
}
177177
return round($filesize, $precision).' '.$units[$idUnit].'B';
178178
}
179-
?>
179+
?>

0 commit comments

Comments
 (0)