0) ? $page : 1; $state = (is_numeric($state) && $state > 0) ? $state : 3; $cookieValue = ($_COOKIE['nsfw']) ? true : false; $nsfwCookie = (isLoggedIn()) ? $cookieValue : true; $hideNSFW = ($nsfwCookie) ? true : false; if(!isLoggedIn()) { $unsafeDB = " AND media.nsfw = '0' "; } if($state == '100') // gif { $ck = 'gifCount'; $selectedTab[7] = ' class="lcCurrent"'; $pageTitle = CONFIG_SITE_NAME; //($page == 1) ? CONFIG_SITE_NAME . ' - The best GIFs on the web!' : CONFIG_SITE_NAME . ' - The best GIFs on the web! - Page ' . $page; $paginateBase = '/gifs/'; $paginateFirst = '/gifs'; $order = 'ORDER BY media.ts DESC'; $breadcrumbs[] = CONFIG_SITE_NAME . ' - The best GIFs on the web!'; $dbState = "state != '100' AND mediaType = '1' "; $cmi = 7; $cmix= true; } if($state == 3) { $ck = 'hotCount'; $selectedTab[0] = ' class="lcCurrent"'; $pageTitle = CONFIG_SITE_NAME;//($page == 1) ? CONFIG_SITE_NAME . ' - The most fun place on the web!' : CONFIG_SITE_NAME . ' - The most fun place on the web! - Page ' . $page; $paginateBase = '/popular/'; $paginateFirst = '/'; $order = 'ORDER BY tsp DESC'; $breadcrumbs[] = CONFIG_SITE_NAME . ' - The most fun place on the web!'; $dbState = "state = '$state'"; $cmi = 0; $cmix= true; } else if($state == 1) { $ck = 'newCount'; $selectedTab[2] = ' class="lcCurrent"'; $pageTitle = CONFIG_SITE_NAME;//($page == 1) ? CONFIG_SITE_NAME . ' - The most fun place on the web!' : CONFIG_SITE_NAME . ' - The most fun place on the web! - Page ' . $page; $paginateBase = '/new/'; $paginateFirst = '/new'; $order = 'ORDER BY ts DESC'; $breadcrumbs[] = CONFIG_SITE_NAME . ' - The most fun place on the web!'; $dbState = "state != '100'"; $cmi = 2; } $connection = connect(); $itemsPerPage = ITEMS_PER_PAGE; $page = (is_numeric($_GET['p']) && $_GET['p'] > 0) ? $_GET['p'] : 1; $totalItems = mysql_num_rows(mysql_query("SELECT 0 = NULL FROM media WHERE $dbState AND reviewed = '1' AND nsfw = '0'", $connection)); $limitValue = $page * $itemsPerPage - $itemsPerPage; $totalPages = ceil($totalItems / $itemsPerPage); $titleAppend = ($page != 1 && $totalPages != 0) ? ' - page ' . $page : ''; if(NSFW_TOGGLE) { //$breadcrumbsright[] = ($hideNSFW) ? 'turn safe mode off' : 'turn safe mode on'; //$breadcrumbsright[] = '·'; } $breadcrumbsright[] = 'page ' . number_format($page) . ' of ' . number_format($totalPages); if($totalItems != 0) { if($page > $totalPages || $page < 1) { header('location: ' . $paginateFirst); die; } } else { $displayNoResults = '

Nothing here right now…

'; } printheader($pageTitle.$titleAppend, $cmi); if(DO_CACHE) { $cacheKeys[] = $key; } if(DO_NUM_CACHE) { $cacheKeys[] = $countKey; } ?> '.$state.''; $row['state'] = 1; $row['tsp'] = 0; } printrow($row, $hideNSFW); } require_once('includes/adsense.php'); printPagination($totalItems, $page, $paginateBase, $paginateFirst, ITEMS_PER_PAGE); printfooter(); ?>