Repositories | Polyback | Log in to see private repositories
669 bytes | parent directory
<?php require $_SERVER['DOCUMENT_ROOT'].'/api/private/core.php';
// Chat page: all of your friends with their status (and avatars), and unread counts.
// Response: {"success":true,"friends":[...],"unread":{"<friendId>":n},"unreadTotal":n}
use pizzaboxer\ProjectPolygon\API;
use pizzaboxer\ProjectPolygon\Chat;
API::initialize(["method" => "POST", "logged_in" => true, "secure" => true]);
$unread = Chat::GetUnreadCounts(SESSION["user"]["id"]);
API::respondCustom([
"status" => 200,
"success" => true,
"message" => "OK",
"friends" => Chat::GetFriendsPresence(SESSION["user"]["id"], true),
"unread" => (object) $unread,
"unreadTotal" => array_sum($unread)
]);