* Last Updated: January 17, 2004 * */ /* Authored in the Gallery coding style, because * I think it makes hacks and changes quite easy. */ /* Hack prevention. */ if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) { print _("Security violation") ."\n"; exit; } if (!isset($GALLERY_BASEDIR)) { $GALLERY_BASEDIR = './'; } require($GALLERY_BASEDIR . 'init.php'); $gallery->session->offlineAlbums["albums.php"] = true; function albumSort($a, $b) { $aTime = $a["last_mod_time"]; $bTime = $b["last_mod_time"]; if ($aTime < $bTime) { return 1; } else { return -1; } } function removeUnprintable($string) { return ereg_replace("[^[:print:]]", "", $string); } function albumFindable($db, $album) { global $gallery; if ($album->fields["marked"]) { /* Cyclic loop! */ return FALSE; } else { $album->fields["marked"] = TRUE; } if (! $gallery->user->canReadAlbum($album)) { return FALSE; } elseif ($album->isRoot()) { return TRUE; } else { $parentName = $album->fields["parentAlbumName"]; $parentAlbum = $db->getAlbumbyName($parentName); return albumFindable($db, $parentAlbum); } } /* Read the album list */ $albumDB = new AlbumDB(FALSE); $gallery->session->albumName = ""; $page = 1; $noDCDate = FALSE; $onlyFindable = TRUE; $numAlbums = 0; $albumList = array(); if (method_exists($albumDB, "getCachedNumPhotos")) { $numPhotos = $albumDB->getCachedNumPhotos($gallery->user); } else { $numPhotos = $albumDB->numPhotos($gallery->user); } foreach ($albumDB->albumList as $album) { if ($onlyFindable) { if(! albumFindable($albumDB, $album)) { continue; } } else { if(! $gallery->user->canReadAlbum($album)) { continue; } } $numAlbums++; $albumInfo = array( "name" => $album->fields["name"], "last_mod_time" => $album->fields["last_mod_time"], "title" => $album->fields["title"], "description" => removeUnprintable($album->fields["description"]), "comments" => (method_exists($album, "canViewComments")) ? $album->canViewComments($gallery->user->uid) : FALSE); array_push($albumList, $albumInfo); } $displayCommentLegend = 0; if (is_callable('pluralize_n')) { $total_str = pluralize_n($numAlbums, _("1 album"), _("albums"), _("no albums")); $image_str = pluralize_n($numPhotos, _("1 photo"), _("photos"), _("no photos")); } else { /* Probably older version of Gallery */ $total_str = pluralize($numAlbums, "album", "no"); $image_str = pluralize($numPhotos, "photo", "no"); } $description = sprintf(_("%s in %s"), $image_str, $total_str); @header("Content-Type: text/xml"); echo '<' . '?' . 'xml version="1.0"' . '?' . '>'; ?> <?= htmlspecialchars($gallery->app->galleryTitle) ?> app->photoAlbumURL ?> app->default_language)) { ?> app->default_language ?> app->adminEmail)) { ?> app->adminEmail ?> app->adminEmail ?> Gallery Generator v0.3 http://blogs.law.harvard.edu/tech/rss 40 <?= htmlspecialchars($album["title"]) ?> $tmpAlbumName)); ?>