private static function pushNotification($userKey, $message, $title = null, $url = null, $urltitle = null)
 {
     Notifications::addLog('Pushalot - $userKey=[' . $userKey . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
     if (is_null($userKey)) {
         throw new Exception("Pushalot - User/API key not specified", 500);
     }
     $notification = new Pushalot($userKey);
     //$pushalot->setProxy('http://localhost:12345','user:pass');
     $success = $notification->sendMessage(array('Title' => $title, 'Body' => $message, 'IsImportant' => true, 'IsSilent' => false, 'Image' => 'http://wiki.tarski.nl/skins/common/images/AmpersandLogo.png', 'Source' => 'Ampersand prototype'));
     if (!$success) {
         Notifications::addError("Pushalot error '{$notification->getError}()' sending notification to '{$userKey}'");
     } else {
         Notifications::addSuccess('Pushalot message sent.');
     }
 }
Example #2
0
} else {
    $body = $_POST["body"];
}
$link = $_POST["link"];
$img = $_POST["img"];
if ($_POST["imp"] === "imp") {
    $imp = true;
} else {
    $imp = false;
}
if ($_POST["sil"] === "sil") {
    $sil = true;
} else {
    $sil = false;
}
//$pushalot->setProxy('http://localhost:12345','user:pass');
$success = $pushalot->sendMessage(array('Title' => $title, 'Body' => $body, 'LinkTitle' => $link, 'Link' => $link, 'IsImportant' => $imp, 'IsSilent' => $sil, 'Image' => $img));
echo $success ? 'The message was submitted.' : $pushalot->getError();
?>
</p>

<p style="text-align: center;">
<a href="/">Go back...</a>
</p>

</form>
</div>

</body>
</html>