setMetaTags("Recently Added", "Most recently added new movies, pictures, games and flash-movies"); $page->header(); // Customize by media type // Defaults to using all media types if no valid settings were given $allMediaTypes = array("movies","pictures","games","flash"); $whichMedia = array(); if(isset($_GET['mediaType']) && ($_GET['mediaType'] != "")){ $attemptedMedia = explode($_GET['mediaType']); $whichMedia = array_intersect($attemptedMedia, $allMediaTypes); } if(count($whichMedia) == 0){ $whichMedia = $allMediaTypes; } $MAX_ITEMS = 20; $db = dil_connect(); $items = array(); foreach($whichMedia as $mediaType){ $queryString = "SELECT * FROM $mediaType WHERE submittedOn IS NOT NULL ORDER BY submittedOn DESC LIMIT $MAX_ITEMS"; if($result = mysql_query($queryString,$db)){ if(($numRows = mysql_num_rows($result)) && ($numRows > 0)){ for($cnt=0; $cnt<$numRows; $cnt++){ $id = mysql_result($result, $cnt, "id"); $submittedOn = mysql_result($result, $cnt, "submittedOn"); $items[$submittedOn] = array('id'=>$id, 'mediaType'=>$mediaType); } } } else { dispError($queryString); } } if(count($items) == 0){logEvent("Empty recent results in ".$_SERVER['PHP_SELF']);} krsort($items); // makes date take preference, not mediaType $style = ""; $style = "style='padding:0px;margin:0;'"; print "
\n"; $typeName = ucfirst($mediaType); if($typeName == "Flash"){$typeName .=" Movies";} $numPerCol = 4; print "\n"; print ""; $cnt = 0; foreach($items as $item){ print "\n"; if(($cnt>1) && (($cnt+1)% $numPerCol == 0)){ print "\n"; } $cnt++; if($cnt >= $MAX_ITEMS){ break; } } print "\n"; print "
Most Recent Additions
"; thumbById($item['mediaType'], $item['id']); print "

\n"; $page->bottom(); ?>