app->rssEnabled)) {
$gallery->app->rssEnabled = "yes";
$gallery->app->rssMode = "basic";
$gallery->app->rssHighlight = "";
$gallery->app->rssVisibleOnly = "yes";
$gallery->app->rssDCDate = "no";
$gallery->app->rssBigPhoto = "yes";
$gallery->app->rssPhotoTag = "yes";
}
$MAXITEMS = 20;
if ($gallery->app->rssEnabled == "no") {
header("Location: " . makeAlbumHeaderUrl());
}
$gallery->session->offlineAlbums["albums.php"] = true;
function photoSort($a, $b) {
$aTime = $a["uploadTS"];
$bTime = $b["uploadTS"];
if ($aTime < $bTime) {
return 1;
} else {
return -1;
}
}
function removeUnprintable($string) {
return preg_replace("/[^[:print:]]/", "", $string);
}
function buildItem($album, $photo)
{
$userDB = new Gallery_UserDB();
$user = $userDB->getUserByUid($photo->owner);
$size = filesize($album->getAlbumDir().'/'.$photo->image->name.'.'.$photo->image->type);
$item = array(
"title" => htmlspecialchars(removeUnprintable($photo->getCaption())),
"link" => $album->getAlbumDirURL("full").'/'.$photo->image->name.'.'.$photo->image->type,
"description" => htmlentities($photo->getThumbnailTag($album->getAlbumDirUrl("thumb"))),
"pubDate" => date("r", $photo->uploadDate),
"author" => $user->getEmail()." (".$user->getUsername().")",
"uploadTS" => $photo->uploadDate,
"enclosure" => array (
"url" => $album->getAlbumDirURL("full").'/'.$photo->image->name.'.'.$photo->image->type,
"length" => $size,
"type" => "image/$photo->image->type"
)
);
return $item;
}
function buildAlbum($album)
{
global $albumDB;
global $gallery;
if(!$gallery->user->canReadAlbum($album)) {
return;
}
$photos = array();
if(!$album->photos) { print $gallery->app->albumDir."/".$album->fields['name']."
"; }
foreach($album->photos as $photo)
{
if(!$photo->isHidden()) {
if($photo->isAlbum())
{
$subAlbum = $albumDB->getAlbumByName($photo->isAlbumName);
$photos = array_merge($photos, buildAlbum($subAlbum));
}
else {
$photos[] = buildItem($album, $photo);
}
}
}
return $photos;
}
/* Read the album list */
$albumDB = new AlbumDB(FALSE);
$gallery->session->albumName = "";
if(!$_GET['set_albumName']) {
$photos = array();
$rootAlbmus = array();
$title = $gallery->app->galleryTitle;
foreach($albumDB->albumList as $album) {
if($album->isRoot()) {
$rootAlbums[] = $album->fields['name'];
}
}
foreach($rootAlbums as $name) {
$album = $albumDB->getAlbumByName($name);
$photos = array_merge($photos, buildAlbum($album));
}
list($numPhotos, $numAlbums,) = $albumDB->numAccessibleItems($gallery->user);
$total_str = pluralize_n2(ngettext(_("1 album"), _("%s albums"), $numAlbums), $numAlbums, _("no albums"));
$image_str = pluralize_n2(ngettext(_("1 photo"), _("%s photos"), $numPhotos), $numPhotos, _("no photos"));
$description = sprintf(_("%s in %s"), $image_str, $total_str);
$url = $gallery->app->photoAlbumURL;
}
else {
$album = $albumDB->getAlbumByName($_GET['set_albumName']);
$title = $album->fields['title'];
$description = htmlentities($album->fields['summary']);
$photos = buildAlbum($album);
$url = $gallery->app->photoAlbumURL . '/' . $_GET['set_albumName'];
}
uasort($photos, "photoSort");
header("Content-Type: application/rss+xml");
echo '<' . '?xml version="1.0" ?' . '>';
?>
Gallery version; ?>
$MAXITEMS) { break; }
?>
-
= $photo['title'] ?>
= $photo['link'] ?>
= $photo['description'] ?>
= $photo['pubDate'] ?>
= $photo['author'] ?>