} //--- $isAjax = !empty($ajax) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; if ($isAjax && !isset($_REQUEST[$pageVarKey])) { return; } /** @var pdoPage $pdoPage */ if (!$modx->loadClass('pdotools.pdoPage', MODX_CORE_PATH . 'components/pdotools/model/', false, true)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Could not load pdoPage from "MODX_CORE_PATH/components/pdotools/model/".'); return false; } $pdoPage = new pdoPage($modx, $scriptProperties); $pdoPage->pdoTools->addTime('pdoTools loaded'); // Page if (isset($_REQUEST[$pageVarKey]) && (!is_numeric($_REQUEST[$pageVarKey]) || $_REQUEST[$pageVarKey] <= 1 && !$isAjax)) { return $pdoPage->redirectToFirst($isAjax); } elseif (!empty($_REQUEST[$pageVarKey])) { $page = (int) $_REQUEST[$pageVarKey]; } $scriptProperties['page'] = $page; $scriptProperties['request'] = $_REQUEST; // Limit if (isset($_REQUEST['limit'])) { if (is_numeric($_REQUEST['limit']) && abs($_REQUEST['limit']) > 0) { $scriptProperties['limit'] = abs($_REQUEST['limit']); } else { unset($_GET['limit']); return $pdoPage->redirectToFirst($isAjax); } } if (!empty($maxLimit) && !empty($scriptProperties['limit']) && $scriptProperties['limit'] > $maxLimit) {
if (!empty($pageLastTpl)) { $scriptProperties['tplPageLast'] = $pageLastTpl; } if (!empty($pageSkipTpl)) { $scriptProperties['tplPageSkip'] = $pageSkipTpl; } if (!empty($pageNavScheme)) { $scriptProperties['scheme'] = $pageNavScheme; } if (!empty($cache_expires)) { $scriptProperties['cacheTime'] = $cache_expires; } //--- // Page if (isset($_REQUEST[$pageVarKey]) && (!is_numeric($_REQUEST[$pageVarKey]) || $_REQUEST[$pageVarKey] <= 1)) { return $pdoPage->redirectToFirst(); } elseif (!empty($_REQUEST[$pageVarKey])) { $page = (int) $_REQUEST[$pageVarKey]; } $scriptProperties['page'] = $page; $scriptProperties['request'] = $_REQUEST; // Limit if (isset($_REQUEST['limit'])) { if (is_numeric($_REQUEST['limit']) && abs($_REQUEST['limit']) > 0) { $scriptProperties['limit'] = abs($_REQUEST['limit']); } else { unset($_GET['limit']); return $pdoPage->redirectToFirst(); } } if (!empty($maxLimit) && !empty($scriptProperties['limit']) && $scriptProperties['limit'] > $maxLimit) {