* Revision: 4.0 * Revision Date: 11/25/07 * */ require_once('appheader.php'); require_once(PATH_ROOT . 'classes/ads.php'); require_once(PATH_ROOT . 'include/tags.2.php'); if(trim($_REQUEST['tag'])) $linktag = trim(str_replace("'","", $_REQUEST['tag'])); if($linktag){ $tag = parseSafeLink($linktag); // upper first of each word $tagp = explode(" ",$tag); for($i = 0; $i < count($tagp); $i++) $tagp[$i] = ucfirst($tagp[$i]); $tag = implode(" ",$tagp); }else{ // no tag! header("Location: //www.desktopnexus.com/tag/"); exit; } // find page number if(!empty($_REQUEST['page']) && is_numeric($_REQUEST['page'])) $pagenum = $_REQUEST['page']; else $pagenum = 1; /* $alt = queryfirst("SELECT * FROM `system` WHERE `name`='active_wallpaper_table' LIMIT 1"); $alt = ($alt['value'] == 'alt') ? '_alt' : ''; $memTableIns = '_mem' . $alt; */ // get thumbnail query //$row = queryfirst("SELECT COUNT(*) AS `num` FROM `tags` LEFT JOIN `wallpapers{$memTableIns}` ON `tags`.`wallpaper_id`=`wallpapers{$memTableIns}`.`id` WHERE `tags`.`tag`='{$tag}'{$filterres}", false, true); $totalthumbs = DNRedis::getCount('tag:' . strtolower($tag), 'set'); //$row = queryfirst("SELECT COUNT(*) AS `num` FROM `tags` LEFT JOIN `wallpapers` ON `tags`.`wallpaper_id`=`wallpapers`.`id` WHERE `tags`.`tag`='{$tag}'", false, true); //$totalthumbs = $row['num']; $totalpages = ceil($totalthumbs / $browse_thumbs_per_page); if(!$_SESSION['id'] || $_SESSION['contentFilter'] == "1"){ //$contentFilterIns = " AND `wallpapers{$memTableIns}`.`contentFilter`='0'"; $contentFilterIns = " AND `wallpapers`.`contentFilter`='0'"; } if($pagenum > $totalpages){ header('HTTP/1.0 404 Not Found'); $thumbs = array(); }else{ /* dbSetLongCache(); $thumbs = queryrows("SELECT `wallpapers{$memTableIns}`.* FROM `tags` LEFT JOIN `wallpapers{$memTableIns}` ON `tags`.`wallpaper_id`=`wallpapers{$memTableIns}`.`id` LEFT JOIN `wallpapers_downloads` ON `wallpapers{$memTableIns}`.`id`=`wallpapers_downloads`.`WallpaperID` WHERE `tags`.`tag`='{$tag}' {$contentFilterIns} ORDER BY `wallpapers{$memTableIns}`.`score` DESC LIMIT " . (($pagenum - 1) * $browse_thumbs_per_page) . ",{$browse_thumbs_per_page} "); */ $thumbs = DNRedis::getWallpapersForLocation('tag:' . strtolower($tag), $pagenum, $browse_thumbs_per_page, 'set'); } $pageins = ($pagenum > 1) ? " - Page $pagenum" : ''; if(!isset($viewfn)) $viewfn = ''; ////////////////////////////////////////////////////////////// // Header Information (meta passed to header file) $header_tags = "{$tag} Wallpapers, {$tag} Backgrounds, {$tag} Images{$viewfn} {$pageins}- Desktop Nexus"; $header_tags .= ""; $header_tags .= ""; // Done with header meta information ////////////////////////////////////////////////////////////// $tagCloud = fetchTagCloud("tag",$tag); $adTags = explode('',$tagCloud); array_pop($adTags); foreach($adTags as &$tagPart) $tagPart = trim(strip_tags($tagPart)); $adTags[] = strtolower($tag); $adTags = array_unique($adTags); $pageAds = new Ads($dncat, '', $adTags); $pageAds->initSlot('Tag_Page_Upper', 300, 250); $pageAds->initSlot('Tag_Page_Middle', 300, 250); $pageAds->initSlot('Tag_Page_Lower', 300, 250); $pageAds->initSlot('Browse_Banner_Top', 468, 60); $header_tags .= $pageAds->getHeaderIncludes(); require(PATH_ROOT . 'header.3.php'); // filtering resolutions warning if(!empty($_SESSION['filter_width']) && !empty($_SESSION['filter_height']) && empty($_SESSION['hidewarning'])){ echo "
"; echo ""; echo "You're currently browsing Desktop Nexus in a {$_SESSION['filter_width']}x{$_SESSION['filter_height']} original resolution filtered mode! Our systems were developed to automatically resize and remaster any wallpaper for any resolution or aspect ratio, so you're only viewing a small portion of all the wallpapers we offer! To clear this filter and view all wallpapers, click here. If you know what you're doing, and want to hide this warning, click here."; echo "
"; } echo "
"; echo "
"; echo '
' . number_format($totalthumbs) . ' Image' . ($totalthumbs != 1 ? 's' : '') . '
'; echo "\"\" "; echo "

{$tag} Wallpapers

"; echo ""; $n = 1; if(count($thumbs) > 0) foreach($thumbs as $wallId => $thumb){ $thumb['id'] = $wallId; $c = $n - 1; $thumb['title'] = htmlspecialchars($thumb['title']); if($thumb['title'] == "") $thumb['title'] = "Untitled Wallpaper"; if($c % 3 == 0) echo ""; echo ""; if($c % 3 == 2) echo ""; $n++; } if($c % 4 != 3) echo ""; ?>
"; echo ""; // start relative div for banners if(strtotime($thumb['created']) > strtotime("-36 HOURS")){ // New Wallpaper echo "
"; echo "\"\""; echo "
"; } // end banner relative div echo "\"{$thumb['title']}\""; echo "
"; createThumbPopupDiv_new($n, $thumb); // For moderators, show if an image is filtered or not :) if($_SESSION['accesslevel'] >= 3 && $thumb['contentFilter'] == '1') echo "
FILTERED
"; echo "