File size: 889B
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/system/App.php');
if($sys->isAjax() && $_SERVER['REQUEST_METHOD'] == 'POST' && $me)
{
$offset = isset($_POST['offset']) && !empty($_POST['offset']) ? (int) $_POST['offset'] : 0;
$count = isset($_POST['count']) && !empty($_POST['count']) ? (int) $_POST['count'] : 10;
$type = isset($_POST['type']) && $_POST['type'] == 1 ? true : false;
$arrNotifications = ($type ? $notifications->getNew($offset, $count) : $notifications->get($offset, $count));
if (!empty($arrNotifications) && is_array($arrNotifications))
{
$json = [
'success' => 1,
'response' => $arrNotifications,
];
}
else
{
$json = [
'error' => 1,
'comment' => 'Пока пусто'
];
}
}
else
{
$json = [
'error' => 1,
'comment' => '404 Bad Request'
];
}
echo json_encode($json, JSON_UNESCAPED_UNICODE);