File size: 0.99Kb
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/system/App.php');
if(isset($_POST) && $_SERVER['REQUEST_METHOD'] == 'POST')
{
if(!$me)
{
$json = ['error' => 1, 'comment' => 'Данная функция доступна только для зарегистрированных пользователей сайта'];
}
else
{
$categories = $gifts->getCats(0, 20);
if(!empty($categories))
{
foreach($categories as $category)
{
$getGifts = $gifts->getGiftsByID($category['id'], 0, 50);
$result[] = ['id' => $category['id'], 'name' => $category['name'], 'type' => $category['type'], 'gifts' => $getGifts];
}
$json = ['success' => 1, 'response' => $result];
}
else
{
$json = ['error' => 1, 'comment' => 'Пока пусто'];
}
}
}
else
{
$json = ['error' => 1, 'comment' => 'Пустое значение'];
}
echo json_encode($json, JSON_UNESCAPED_UNICODE);
?>