コード例 #1
0
ファイル: index.php プロジェクト: rair/yacs
} elseif (isset($context['arguments'][0])) {
    $page = $context['arguments'][0];
} else {
    $page = 1;
}
$page = max(1, intval($page));
// load the skin
load_skin('servers');
// the maximum number of servers per page
if (!defined('SERVERS_PER_PAGE')) {
    define('SERVERS_PER_PAGE', 50);
}
// the title of the page
$context['page_title'] = i18n::s('Servers');
// count servers in the database
$stats = Servers::stat();
if ($stats['count']) {
    $context['page_menu'] += array('_count' => sprintf(i18n::ns('%d server', '%d servers', $stats['count']), $stats['count']));
}
// stop hackers
if ($page > 1 && ($page - 1) * SERVERS_PER_PAGE > $stats['count']) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
} else {
    // navigation commands for servers, if necessary
    if ($stats['count'] > SERVERS_PER_PAGE) {
        $home = 'servers/';
        if ($context['with_friendly_urls'] == 'Y') {
            $prefix = $home . 'index.php/';
        } elseif ($context['with_friendly_urls'] == 'R') {
            $prefix = $home;