summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaac Vidal Daza <isvida@ugr.es>2020-09-28 11:32:26 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-09-28 20:37:47 +0200
commit67be7d8c9e7682114fc43dc88244c9374046ea47 (patch)
tree19cfaba0ff0a695c2bcde62888b547393c6bba6a
parentfa2b1244f6f48a7961e44eefdcf9cf0f3797ba80 (diff)
#1006 Fix RemotePC IP retrieving on running clients
Error in the REST API response of /ous/:id1/labs/:id2/clients/status that returns the status of the computers in a classroom. It returns running PCs with an X.X.X.1 and X.X.X.2 IP address instead of those that are actually running, which are X.X.X.15 and X.X.X.16. The error cause is, when constructing the JSON response, a foreach that ignores the "keys" of the response array. This commit adds the "keys" to the foreach to iterate also through them.
-rw-r--r--admin/WebConsole/rest/server.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/admin/WebConsole/rest/server.php b/admin/WebConsole/rest/server.php
index c7c153ad..a6256a2e 100644
--- a/admin/WebConsole/rest/server.php
+++ b/admin/WebConsole/rest/server.php
@@ -143,10 +143,10 @@ EOD;
}
// Parse responses.
reset($urls);
- foreach ($result as $res) {
+ foreach ($result as $myKey => $res) {
if (!empty($res['data'])) {
// Get status and session data.
- $ip = key($urls);
+ $ip = $myKey;
$data = json_decode($res['data']);
if (@isset($status[$data->status])) {
$stat[$ip] = $status[$data->status];