Пример #1
0
    $btmp[$bcat['id']] = $bcat;
}
$category = Category::CAT_PARENT_BOOKS;
if (isset($_REQUEST["t"]) && array_key_exists($_REQUEST['t'], $btmp)) {
    $category = $_REQUEST["t"] + 0;
}
$catarray = array();
$catarray[] = $category;
$page->smarty->assign('catlist', $btmp);
$page->smarty->assign('category', $category);
$browsecount = $book->getBookCount($catarray, -1, $page->userdata["categoryexclusions"]);
$offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
$ordering = $book->getBookOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
$results = $books = array();
$results = $book->getBookRange($catarray, $offset, ITEMS_PER_COVER_PAGE, $orderby, $page->userdata["categoryexclusions"]);
$maxwords = 50;
if ($results instanceof Traversable) {
    foreach ($results as $result) {
        if (!empty($result['overview'])) {
            $words = explode(' ', $result['overview']);
            if (sizeof($words) > $maxwords) {
                $newwords = array_slice($words, 0, $maxwords);
                $result['overview'] = implode(' ', $newwords) . '...';
            }
        }
        $books[] = $result;
    }
}
$author = isset($_REQUEST['author']) && !empty($_REQUEST['author']) ? stripslashes($_REQUEST['author']) : '';
$page->smarty->assign('author', $author);