Пример #1
0
// load the skin
load_skin('tables');
// the maximum number of tables per page
if (!defined('TABLES_PER_PAGE')) {
    define('TABLES_PER_PAGE', 50);
}
// the title of the page
$context['page_title'] = i18n::s('Tables');
// this page is really only for associates
if (!Surfer::is_associate()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // display the index
} else {
    // count tables in the database
    $stats = Tables::stat();
    if ($stats['count']) {
        $context['page_menu'] += array('_count' => sprintf(i18n::ns('%d table', '%d tables', $stats['count']), $stats['count']));
    }
    // navigation commands for tables, if necessary
    if ($stats['count'] > TABLES_PER_PAGE) {
        $home = 'tables/';
        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'], TABLES_PER_PAGE, $page);
    }