html_wrap['frame']; // Cache for speed. Requires lwp-request, a Perl libwww utility. // // cron (update every 15 minutes): // // */15 * * * * root /path/to/gallery/cache_recent_albums > /dev/null // // cache script /path/to/gallery/cache_recent_albums: // // #!/bin/sh // lwp-request http://brainkrash.com/photo/recent_albums.php?cache=1 > /usr/local/www/v2/photo/cache.recent_albums.tmp // mv -f /usr/local/www/v2/photo/cache.recent_albums.tmp /usr/local/www/v2/photo/cache.recent_albums // ?> user->isLoggedIn() && ! $cache && ! $set_recentListPage) { if (file_exists('cache.recent_albums')) { includeHtmlWrap("wrapper.header"); include('cache.recent_albums'); // not logged in includeHtmlWrap("wrapper.footer"); includeHtmlWrap("../html/footer.inc"); exit; } } /* Read the album list */ $albumDB = new AlbumDB(); $gallery->session->albumName = ""; $recent_albums =& get_recent(0, count($albumDB->albumList)); function get_recent($start, $finish) { global $gallery, $albumDB; $recent_albums = array(); for ($i = $start; $i < $finish; $i++) { $gallery->album =& $albumDB->albumList[$i]; if (! $gallery->album->isRoot()) { for ($j = 1; $j < $gallery->album->numPhotos(); $j++) { $isNested = $gallery->album->isAlbum($j); if (! $isNested) break; } $hasPhotos = ($j != $gallery->album->numPhotos()); } if (is_nightlife($gallery->album) && $gallery->user->canReadAlbum($gallery->album) && !$gallery->album->isRoot() && $hasPhotos && $gallery->album->numPhotos()) { //hack last_mod_time $recent_albums[($gallery->album->fields["clicks_date"]+$i)] =& $gallery->album; // wish for a database } } krsort($recent_albums, SORT_NUMERIC); // decending sort by date $i = 1; $ret = array(); foreach($recent_albums as $album) { $ret[$i] = $album; $i++; } return($ret); } function is_nightlife($album) { global $albumDB; $parentIsNightlife = false; while($parentName = $album->fields['parentAlbumName']) { $album = $albumDB->getAlbumbyName($parentName); if (!strcmp($album->fields["name"], "nightlife")) { $parentIsNightlife = true; } } return($parentIsNightlife); } function get_crumbs($album) { global $albumDB; while($parentName = $album->fields['parentAlbumName']) { $album = $albumDB->getAlbumbyName($parentName); $url = makeAlbumUrl($album->fields["name"]); $trail = "".$album->fields['title'].'::'.$trail; } return($trail); } // DISPLAY $numAlbums = count($recent_albums); if ($set_recentListPage) $gallery->session->recentListPage = $set_recentListPage; if (!$gallery->session->recentListPage) { $gallery->session->recentListPage = 1; } $perPage = $gallery->app->albumsPerPage; $maxPages = max(ceil($numAlbums / $perPage), 1); if ($gallery->session->recentListPage > $maxPages) { $gallery->session->recentListPage = $maxPages; } $pixelImage = ""; $navigator["page"] = $gallery->session->recentListPage; $navigator["pageVar"] = "set_recentListPage"; $navigator["url"] = makeGalleryUrl("recent_albums.php"); $navigator["maxPages"] = $maxPages; $navigator["spread"] = 6; $navigator["fullWidth"] = 100; $navigator["widthUnits"] = "%"; $navigator["bordercolor"] = $borderColor; ?> :: Recent Clubbing Albums