コード例 #1
0
            $time = time();
        }
        $events = $notifier->getLatest($time);
        if (!empty($events)) {
            $lastEventTime = $events[0]['created'];
            $time = $lastEventTime;
        }
        $notifications = $notifier->getFormattedForInline($events);
        echo json_encode(array("events" => $notifications, "time" => $time));
    }
});
dispatch_get('Ajax/notifications/all', function () {
    if (Request::valid($_GET['_token'])) {
        $notifier = new \CODOF\Forum\Notification\Notifier();
        $notifications = $notifier->get();
        echo json_encode($notifier->getFormattedForInline($notifications));
    }
});
//search: from query
dispatch_get('Ajax/topics/get_topics', function () {
    if (Request::valid($_GET['token'])) {
        $topics = new Controller\Ajax\forum\topics();
        $list = $topics->get_topics($_GET['from'], isset($_GET['str']));
        echo json_encode($list);
    }
});
dispatch_get('Ajax/topics/mark_read', function () {
    if (Request::valid($_GET['token'])) {
        $tracker = new CODOF\Forum\Tracker();
        $tracker->mark_forum_as_read();
    }