Example #1
0
    if ($path_info == '/notify_feed/feed.atom') {
        $type = 'ATOM1.0';
    } else {
        header('HTTP/1.0 404 Not Found');
        exit;
    }
}
if (!isset($_SERVER["PHP_AUTH_USER"]) or !OCP\User::checkPassword($uid = $_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
    header('WWW-Authenticate: Basic realm="ownCloud Login"');
    header('HTTP/1.0 401 Unauthorized');
    exit;
}
$lang = OC_Preferences::getValue($uid, 'core', 'lang', OC_L10N::findLanguage());
$l = OC_L10N::get('notify', $lang);
//TODO: use different feed creator library (like Zend_Feed) and switch html flag to true
$notifications = OC_Notify::getNotifications($uid, 50, $lang, false);
$baseAddress = (isset($_SERVER["HTTPS"]) ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"];
$rssURI = $baseAddress . $baseuri . 'feed.rss';
$atomURI = $baseAddress . $baseuri . 'feed.atom';
$feed = new UniversalFeedCreator();
$feed->title = $l->t('ownCloud notifications');
$feed->description = $l->t('ownCloud notification stream of the user "%s".', array($uid));
$feed->link = $baseAddress . OC::$WEBROOT;
$feed->syndicationURL = $baseAddress . $_SERVER["PHP_SELF"];
$feed->image = new FeedImage();
$feed->image->title = 'ownCloud';
$feed->image->url = $baseAddress . OCP\Util::imagePath('core', 'logo-inverted.png');
$feed->image->link = $feed->link;
foreach ($notifications as $notification) {
    $item = new FeedItem();
    $item->title = strip_tags($notification["summary"]);
Example #2
0
<?php

OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled("notify");
if (isset($_POST["count"])) {
    $count = (int) $_POST["count"];
} else {
    //$count = 10;
    //FIXME
    $count = null;
}
OCP\JSON::encodedPrint(OC_Notify::getNotifications(null, $count));