4
0
mirror of https://github.com/cwinfo/envayasms.git synced 2025-07-04 05:57:44 +00:00

send new log messages to server on each HTTP request; notify server of changes in device status (currently power/battery state)

This commit is contained in:
Jesse Young
2011-10-10 16:19:38 -07:00
parent f253f54704
commit 2889bf9b4b
11 changed files with 259 additions and 31 deletions

View File

@ -22,6 +22,16 @@ if (!isset($password) || !$request->is_validated($password))
return;
}
// append to EnvayaSMS app log
$app_log = $request->log;
if ($app_log)
{
$log_file = dirname(__DIR__)."/log/sms_".preg_replace('#[^\w]#', '', $request->phone_number).".log";
$f = fopen($log_file, "a");
fwrite($f, $app_log);
fclose($f);
}
$action = $request->get_action();
switch ($action->type)
@ -79,6 +89,10 @@ switch ($action->type)
echo "invalid id";
}
return;
case EnvayaSMS::ACTION_DEVICE_STATUS:
error_log("device_status = {$action->status}");
echo "OK";
return;
case EnvayaSMS::ACTION_TEST:
echo "OK";
return;