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; }
* useless pagination links at the bottom of the page. */ require_once __DIR__ . '/helpers.php'; $pages = 15; $pageSize = 40; $db = new Db($pages, $pageSize); $page = isset($_GET['p']) ? (int) $_GET['p'] : 1; try { $db->setCurrentPage($page); } catch (RangeException $e) { header('Location: ' . $_SERVER['PHP_SELF']); exit; } $items = $db->getItemsAtPage(); if (Helpers::isAjax()) { Helpers::sendJson(['items' => $items]); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Nittro Paginator widget example</title> <script type="application/json" id="nittro-params"> { "basePath": "/examples", "page": { "whitelistLinks": true } }