public static function sendJson(array $data)
{
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
function checkAdminAuth() { if (!checkAuth()) { return false; } global $session, $app; if ('admin' !== $session->getUserType()) { Helpers::sendJson(array('error' => array('error_code' => 'forbidden', 'error_msg' => 'Доступ мають лише адміністратори'))); return false; } return true; }