Skip to content

Commit

Permalink
MDL-44342 air notifier: Fixied checking for empty values in event object
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva authored and Damyon Wiese committed Apr 10, 2014
1 parent 6acfacf commit ad5a8cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions message/output/airnotifier/message_output_airnotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ad5a8cd

Please sign in to comment.