コード例 #1
0
ファイル: index.php プロジェクト: rair/yacs
        $home = 'servers/';
        if ($context['with_friendly_urls'] == 'Y') {
            $prefix = $home . 'index.php/';
        } elseif ($context['with_friendly_urls'] == 'R') {
            $prefix = $home;
        } else {
            $prefix = $home . '?page=';
        }
        $context['page_menu'] += Skin::navigate($home, $prefix, $stats['count'], SERVERS_PER_PAGE, $page);
    }
    // seek the database
    $cache_id = 'servers/index.php#text#' . $page;
    if (!($text = Cache::get($cache_id))) {
        // query the database and layout that stuff
        $offset = ($page - 1) * SERVERS_PER_PAGE;
        if (!($text = Servers::list_by_date($offset, SERVERS_PER_PAGE, 'full'))) {
            $text = '<p>' . i18n::s('No server has been created yet.') . '</p>';
        }
        // we have an array to format
        if (is_array($text)) {
            $text =& Skin::build_list($text, 'decorated');
        }
        // cache this to speed subsequent queries
        Cache::put($cache_id, $text, 'servers');
    }
    $context['text'] .= $text;
}
// page tools
if (Surfer::is_associate()) {
    $context['page_tools'][] = Skin::build_link('servers/edit.php', i18n::s('Add a server'));
    $context['page_tools'][] = Skin::build_link('servers/ping.php', i18n::s('Ping the cloud'));