function getGalleryPhoto($gallery, $photo, $offset) { $result = FALSE; $images = getGalleryContents($gallery); if ($images) { //find it $index = getGalleryPhotoIndex($gallery, $photo); if ($index != -1) { $index = ($index + $offset + count($images)) % count($images); $result = $images[$index]; } } return $result; }
if ($galleries) { //render gallery list foreach ($galleries as $k => $v) { $name = $v['name']; $url = './?gallery=' . urlencode($name); echo <<<EOD \t<div class="gallery"> \t\t<div class="galleryname"><a href="{$url}">{$name}</a></div> \t</div> EOD; } } } } else { if ($photo == '') { $images = getGalleryContents($gallery); if ($images) { $thumbwidth = THUMB_WIDTH; $thumbheight = THUMB_HEIGHT; if (!SINGLE_GALLERY && LIST_GALLERIES) { $top = '<div class="toolbar"><a href="./">[Top]</a></div>'; } else { $top = ''; } if (!SINGLE_GALLERY) { $galleryname = '<div class="galleryname">' . $gallery . '</div>'; } else { $galleryname = ''; } echo <<<EOD <div class="gallery">