diff --git a/message/output/airnotifier/message_output_airnotifier.php b/message/output/airnotifier/message_output_airnotifier.php index b1fe4cf5a6c91..7a98b89ea6c27 100755 --- a/message/output/airnotifier/message_output_airnotifier.php +++ b/message/output/airnotifier/message_output_airnotifier.php @@ -68,7 +68,8 @@ public function send_message($eventdata) { "type" => $eventdata->component . '_' . $eventdata->name, "device" => "xxxxxxxxxx", // Since at this point we don't know the device, we use a 10 chars device platform. "notif" => "x", // 1 or 0 wheter is a notification or not (it may be a private message). - "userfrom" => fullname($eventdata->userfrom)); + "userfrom" => (!empty($eventdata->userfrom)) ? fullname($eventdata->userfrom) : '' + ); // Calculate the size of the message knowing Apple payload must be lower than 256 bytes. // Airnotifier using few bytes of the payload, we must limit our message to even less characters. @@ -109,10 +110,10 @@ public function send_message($eventdata) { $curl->setHeader($header); $params = array( 'alert' => $message, - 'date' => $eventdata->timecreated, + 'date' => (!empty($eventdata->timecreated)) ? $eventdata->timecreated : time(), 'site' => $siteid, 'type' => $eventdata->component . '_' . $eventdata->name, - 'userfrom' => fullname($eventdata->userfrom), + 'userfrom' => (!empty($eventdata->userfrom)) ? fullname($eventdata->userfrom) : '', 'device' => $devicetoken->platform, 'notif' => (!empty($eventdata->notification)) ? '1' : '0', 'token' => $devicetoken->pushid);