*** rss.php Sat Jan 17 05:09:58 2004 --- rss.php Sat Jan 17 05:53:48 2004 *************** *** 1,15 **** ! * Last Updated: January 2, 2004 * */ /* Authored in the Gallery coding style, because ! * I think it makes hacking quite easy. */ /* Hack prevention. */ if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) || --- 1,15 ---- ! * 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"]) || *************** require($GALLERY_BASEDIR . 'init.php'); *** 27,39 **** $gallery->session->offlineAlbums["albums.php"] = true; /* Read the album list */ $albumDB = new AlbumDB(FALSE); $gallery->session->albumName = ""; $page = 1; $noDCDate = FALSE; - /* If there are albums in our list, display them in the table */ $numAlbums = 0; $albumList = array(); if (method_exists($albumDB, "getCachedNumPhotos")) { --- 27,75 ---- $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")) { *************** if (method_exists($albumDB, "getCachedNu *** 43,59 **** } foreach ($albumDB->albumList as $album) { ! if (! $gallery->user->canReadAlbum($album)) { ! continue; } $numAlbums++; $albumInfo = array( "name" => $album->fields["name"], ! "last_mod_time" => $album->getLastModificationDate(), "title" => $album->fields["title"], ! "description" => $album->fields["description"], "comments" => (method_exists($album, "canViewComments")) ? $album->canViewComments($gallery->user->uid) : FALSE); --- 79,101 ---- } 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); *************** if (is_callable('pluralize_n')) { *** 72,88 **** $image_str = pluralize($numPhotos, "photo", "no"); } - function albumSort($a, $b) { - $aTime = strtotime($a["last_mod_time"]); - $bTime = strtotime($b["last_mod_time"]); - - if ($aTime < $bTime) { - return 1; - } else { - return -1; - } - } - $description = sprintf(_("%s in %s"), $image_str, $total_str); @header("Content-Type: text/xml"); --- 114,119 ---- *************** usort($albumList, "albumSort"); *** 112,120 **** foreach($albumList as $album) { $tmpAlbumName = $album["name"]; $albumURL = makeAlbumUrl($tmpAlbumName); ! $unixDate = strtotime($album["last_mod_time"]); ! $rfcDate = date("r", $unixDate); ! $dcDate = date("Y-m-d\TH:i:sO", $unixDate); /* CAUTION: This will not work in zones with * half-our time offsets --- 143,153 ---- foreach($albumList as $album) { $tmpAlbumName = $album["name"]; $albumURL = makeAlbumUrl($tmpAlbumName); ! $unixDate = $album["last_mod_time"]; ! if (IsSet($unixDate)) { ! $rfcDate = date("r", $unixDate); ! $dcDate = date("Y-m-d\TH:i:sO", $unixDate); ! } /* CAUTION: This will not work in zones with * half-our time offsets *************** foreach($albumList as $album) { *** 135,145 **** ! ! \ No newline at end of file --- 168,180 ---- + ! + !