diff options
author | ramon <ramongomez@us.es> | 2016-07-05 16:19:54 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2016-07-05 16:19:54 +0000 |
commit | 4e12ae632ea3e356e2f4a40eee6937b3dfbff452 (patch) | |
tree | 0da1a13c96d8a7a260a6d257f04696d2a8b50d5f /admin/WebConsole/rest/ogagent.php | |
parent | 210ee85d68c030148e80f4ee10578503518fc416 (diff) |
#718: Mejoras en mensajes registrados por las funciones REST que atienden a mensajes del OGAgent.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@4979 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/WebConsole/rest/ogagent.php')
-rw-r--r-- | admin/WebConsole/rest/ogagent.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/admin/WebConsole/rest/ogagent.php b/admin/WebConsole/rest/ogagent.php index 55eeb9ba..e7874e5b 100644 --- a/admin/WebConsole/rest/ogagent.php +++ b/admin/WebConsole/rest/ogagent.php @@ -24,7 +24,7 @@ $app->post('/ogagent/started', //... } else { // Insecure agent exception. - throw new Exception("Insecure agent: ip=$ip, mac=$mac"); + throw new Exception("Insecure OGAgent started: ip=$ip, mac=$mac"); } // May check that client is included in the server database? // Default processing: log activity. @@ -35,7 +35,7 @@ $app->post('/ogagent/started', } catch (Exception $e) { // Comunication error. $response["message"] = $e->getMessage(); - file_put_contents(LOG_FILE, date(DATE_RSS).": ERROR: ".$response["message"]."\n", FILE_APPEND); + file_put_contents(LOG_FILE, date(DATE_RSS).": ".__FUNCTION__.": ERROR: ".$response["message"]."\n", FILE_APPEND); jsonResponse(400, $response); } } @@ -58,7 +58,7 @@ $app->post('/ogagent/stopped', } catch (Exception $e) { // Comunication error. $response["message"] = $e->getMessage(); - file_put_contents(LOG_FILE, date(DATE_RSS).": ERROR: ".$response["message"]."\n", FILE_APPEND); + file_put_contents(LOG_FILE, date(DATE_RSS).": ".__FUNCTION__.": ERROR: ".$response["message"]."\n", FILE_APPEND); jsonResponse(400, $response); } } @@ -74,7 +74,8 @@ $app->post('/ogagent/loggedin', $ip = htmlspecialchars($input->ip); $user = htmlspecialchars($input->user); if (isset($input->ostype)) $osType = htmlspecialchars($input->ostype); - if (isset($input->osversion)) $osVersion = str_replace(",", "", htmlspecialchars($input->osVersion)); + //if (isset($input->osversion)) $osVersion = htmlspecialchars(implode(",", $input->osversion)); + if (isset($input->osversion)) $osVersion = str_replace(",", ";", htmlspecialchars($input->osversion)); // May check that client is included in the server database? // Default processing: log activity. file_put_contents(LOG_FILE, date(DATE_RSS).": User logged in: ip=$ip, user=$user, os=$osType:$osVersion.\n", FILE_APPEND); @@ -84,7 +85,7 @@ $app->post('/ogagent/loggedin', } catch (Exception $e) { // Comunication error. $response["message"] = $e->getMessage(); - file_put_contents(LOG_FILE, date(DATE_RSS).": ERROR: ".$response["message"]."\n", FILE_APPEND); + file_put_contents(LOG_FILE, date(DATE_RSS).": ".__FUNCTION__.": ERROR: ".$response["message"]."\n", FILE_APPEND); jsonResponse(400, $response); } } @@ -100,17 +101,17 @@ $app->post('/ogagent/loggedout', $ip = htmlspecialchars($input->ip); $user = htmlspecialchars($input->user); if (isset($input->ostype)) $osType = htmlspecialchars($input->ostype); - if (isset($input->osversion)) $osVersion = str_replace(",", "", htmlspecialchars($input->osVersion)); + if (isset($input->osversion)) $osVersion = str_replace(",", ";", htmlspecialchars($input->osversion)); // May check that client is included in the server database? // Default processing: log activity. - file_put_contents(LOG_FILE, date(DATE_RSS).": User logged in: ip=$ip, user=$user, os=$osType:$osVersion.\n", FILE_APPEND); + file_put_contents(LOG_FILE, date(DATE_RSS).": User logged out: ip=$ip, user=$user, os=$osType:$osVersion.\n", FILE_APPEND); // Response. $response = ""; jsonResponse(200, $response); } catch (Exception $e) { // Comunication error. $response["message"] = $e->getMessage(); - file_put_contents(LOG_FILE, date(DATE_RSS).": ERROR: ".$response["message"]."\n", FILE_APPEND); + file_put_contents(LOG_FILE, date(DATE_RSS).": ".__FUNCTION__.": ERROR: ".$response["message"]."\n", FILE_APPEND); jsonResponse(400, $response); } } |