Example #1
0
    }
    if (!empty($system->config['perpage'])) {
        $pages = ceil(sizeof($images) / $system->config['perpage']);
        if (!empty($_GET['page']) && (int) $_GET['page'] > 0) {
            $page = (int) $_GET['page'] - 1;
        } else {
            $page = 0;
        }
        $start = $page * $system->config['perpage'];
        $total = $system->config['perpage'];
    } else {
        $pages = 1;
        $page = 0;
        $start = 0;
        $total = sizeof($images);
    }
    $keys = @array_keys($images);
    $data['pagination'] = rcms_pagination(sizeof($images), $system->config['perpage'], $page + 1, '?' . $_SERVER['QUERY_STRING']);
    $c = $start;
    $data['images'] = array();
    while ($total > 0 && $c < sizeof($keys)) {
        $image =& $images[$keys[$c]];
        if ($image_data = $gallery->getData($image)) {
            $data['images'][$image] = $image_data + array('thumbnail' => $gallery->getThumbnail($image), 'comments' => $gallery->countComments($image));
        }
        $total--;
        $c++;
    }
    $data['linkdata'] = $linkdata;
    show_window('<a href="?module=gallery">' . __('Gallery') . '</a>' . (cfr('GALLERY') ? '&nbsp;' . edit_button(ADMIN_FILE . '?show=module&id=gallery.upload&tab=5') : '') . (get('keyword') ? ' &rarr; ' . get('keyword') : ''), !empty($images) ? rcms_parse_module_template('gallery.tpl', $data) : __('Nothing founded'), 'center');
}