diff --git a/classes/notificationsmanager.class.php b/classes/notificationsmanager.class.php index 06507e8f..2639ce28 100644 --- a/classes/notificationsmanager.class.php +++ b/classes/notificationsmanager.class.php @@ -675,7 +675,12 @@ public static function save_settings($UserID, $Settings) { WHERE UserID = '$UserID'"); $PushService = (int) $_POST['pushservice']; - $PushOptions = db_string(serialize(array("PushKey" => $_POST['pushkey']))); + $PushOptionsArray = array("PushKey" => $_POST['pushkey']); + if ($PushService === 6) { //pushbullet + $PushOptionsArray['PushDevice'] = $_POST['pushdevice']; + + } + $PushOptions = db_string(serialize($PushOptionsArray)); if ($PushService != 0) { G::$DB->query(" @@ -752,13 +757,23 @@ public static function send_push($UserIDs, $Title, $Body, $URL = '', $Type = 'Gl case '5': $Service = "Pushover"; break; + case '6': + $Service = "PushBullet"; + break; default: break; } if (!empty($Service) && !empty($PushOptions['PushKey'])) { - $JSON = json_encode(array("service" => strtolower($Service), + $Options = array("service" => strtolower($Service), "user" => array("key" => $PushOptions['PushKey']), - "message" => array("title" => $Title, "body" => $Body, "url" => $URL))); + "message" => array("title" => $Title, "body" => $Body, "url" => $URL)); + + if ($Service === 'PushBullet') { + $Options["user"]["device"] = $PushOptions['PushDevice']; + + } + + $JSON = json_encode($Options); G::$DB->query(" INSERT INTO push_notifications_usage (PushService, TimesUsed) diff --git a/classes/notificationsmanagerview.class.php b/classes/notificationsmanagerview.class.php index d44db8f3..5215dbb3 100644 --- a/classes/notificationsmanagerview.class.php +++ b/classes/notificationsmanagerview.class.php @@ -20,6 +20,9 @@ public static function load_js() { private static function render_push_settings() { $PushService = self::$Settings['PushService']; $PushOptions = unserialize(self::$Settings['PushOptions']); + if (empty($PushOptions['PushDevice'])) { + $PushOptions['PushDevice'] = ''; + } ?> Push notifications @@ -31,10 +34,15 @@ private static function render_push_settings() { +