예제 #1
0
    $ctmp[$ccat['id']] = $ccat;
}
$category = Category::CAT_PC_GAMES;
if (isset($_REQUEST["t"]) && array_key_exists($_REQUEST['t'], $ctmp)) {
    $category = $_REQUEST["t"] + 0;
}
$catarray = array();
$catarray[] = $category;
$page->smarty->assign('catlist', $ctmp);
$page->smarty->assign('category', $category);
$browsecount = $games->getGamesCount($catarray, -1, $page->userdata["categoryexclusions"]);
$offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
$ordering = $games->getGamesOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
$results = $games2 = array();
$results = $games->getGamesRange($catarray, $offset, ITEMS_PER_COVER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]);
$maxwords = 50;
foreach ($results as $result) {
    if (!empty($result['review'])) {
        // remove "Overview" from start of review if present
        if (0 === strpos($result['review'], 'Overview')) {
            $result['review'] = substr($result['review'], 8);
        }
        $words = explode(' ', $result['review']);
        if (sizeof($words) > $maxwords) {
            $newwords = array_slice($words, 0, $maxwords);
            $result['review'] = implode(' ', $newwords) . '...';
        }
    }
    $games2[] = $result;
}