function getSubalbumImages($folder) { global $imagelist, $gallery; if (hasDynamicAlbumSuffix($folder)) { return; } $album = new Album($gallery, $folder); $images = $album->getImages(); foreach ($images as $image) { $imagelist[] = '/' . $folder . '/' . $image; } $albums = $album->getAlbums(); foreach ($albums as $folder) { getSubalbumImages($folder); } }
<?php include "core.php5/DB/ORM.class.php"; include "core.php5/DB/DataBase.class.php"; include 'core.php5/GUI/Album.class.php'; ?> <?php $albumes = array(); $albumes = Album::getAlbums($albumes); //print_r($albumes); ?> <div class="box"> <h2>Albumes</h2> <div class="imageRow"> <?php foreach ($albumes as $album) { $foto = $album->foto; $nombre = explode(".", $foto->name); ?> <div class="single"> <a href="javascript:;" onclick="get('albumviewer.php?id=<?php echo $album->id; ?> ','content');" title="<?php echo $album->description; ?> " ><img src="images/thumbnails/<?php echo $nombre[0]; ?> _thumb.jpg" alt="<?php
/** * adds (sub)albums to menu base with their gallery sorting order intact * * @param string $menuset chosen menu set * @param object $gallery a gallery object * @param int $id table id of the parent. * @param string $link folder name of the album * @param string $sort xxx-xxx-xxx style sort order for album */ function addSubalbumMenus($menuset, $gallery, $id, $link, $sort) { $album = new Album($gallery, $link); $show = $album->get('show'); $title = $album->getTitle(); $sql = "INSERT INTO " . prefix('menu') . " (`link`,`type`,`title`,`show`,`menuset`,`sort_order`, `parentid`) " . 'VALUES (' . db_quote($link) . ', "album",' . db_quote($album->name) . ', ' . $show . ',' . db_quote($menuset) . ',' . db_quote($sort) . ',' . $id . ')'; $result = query($sql, false); if ($result) { $id = db_insert_id(); } else { $result = query_single_row('SELECT `id` FROM' . prefix('menu') . ' WHERE `type`="album" AND `link`=' . db_quote($link)); $id = $result['id']; } if (!$album->isDynamic()) { $albums = $album->getAlbums(); foreach ($albums as $key => $link) { addSubalbumMenus($menuset, $gallery, $id, $link, $sort . '-' . sprintf('%03u', $key)); } } }
/** * Handles an album for printAlbumMenuList * * @param array $albums albums array * @param string $path for createAlbumMenuLink * @param string $folder * @param string $option see printAlbumMenuList * @param string $showcount see printAlbumMenuList * @param int $showsubs see printAlbumMenuList * @param string $css_class see printAlbumMenuList * @param string $css_class_topactive see printAlbumMenuList * @param string $css_class_active see printAlbumMenuList * @param bool $firstimagelink If set to TRUE and if the album has images the link will point to page of the first image instead the album thumbnail page * @param bool $keeptopactive If set to TRUE the toplevel album entry will stay marked as active if within its subalbums ("list" only) * @param int $limit truncation of display text */ function printAlbumMenuListAlbum($albums, $path, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, $keeptopactive, $limit = NULL) { global $_zp_gallery, $_zp_current_album; if (is_null($limit)) { $limit = MENU_TRUNCATE_STRING; } if (is_null($showcount)) { $showcount = ALBUM_MENU_COUNT; } if (is_null($showsubs)) { $showsubs = ALBUM_MENU_SHOWSUBS; } if ($showsubs && !is_numeric($showsubs)) { $showsubs = 9999999999.0; } if (empty($keeptopactive)) { $keeptopactive = false; } $pagelevel = count(explode('/', $folder)); $currenturalbumname = ""; foreach ($albums as $album) { $level = count(explode('/', $album)); $process = $level < $showsubs && $option == "list" || $option != 'list-top' && strpos($folder, $album) === 0 && $level <= $pagelevel; $topalbum = new Album($_zp_gallery, $album, true); if ($level > 1 || $option != 'omit-top') { // listing current level album if ($level == 1) { $css_class_t = $css_class_topactive; } else { $css_class_t = $css_class_active; } if ($keeptopactive) { if (isset($_zp_current_album) && is_object($_zp_current_album)) { $currenturalbum = getUrAlbum($_zp_current_album); $currenturalbumname = $currenturalbum->name; } } $count = ""; if ($showcount) { $toplevelsubalbums = $topalbum->getAlbums(); $toplevelsubalbums = count($toplevelsubalbums); $topalbumnumimages = $topalbum->getNumImages(); $count = ' <span style="white-space:nowrap;"><small>('; if ($toplevelsubalbums > 0) { $count .= sprintf(ngettext('%u album', '%u albums', $toplevelsubalbums), $toplevelsubalbums); } if ($topalbumnumimages > 0) { if ($toplevelsubalbums) { $count .= ' '; } $count .= sprintf(ngettext('%u image', '%u images', $topalbumnumimages), $topalbumnumimages); } $count .= ')</small></span>'; } if (in_context(ZP_ALBUM) && !in_context(ZP_SEARCH_LINKED) && (getAlbumID() == $topalbum->getAlbumID() || $topalbum->name == $currenturalbumname)) { $current = $css_class_t . ' '; } else { $current = ""; } $title = $topalbum->getTitle(); if ($limit) { $display = shortenContent($title, $limit, MENU_TRUNCATE_INDICATOR); } else { $display = $title; } if ($firstimagelink && $topalbum->getNumImages() != 0) { $imgurl = getFirstImageOfAlbum($topalbum); $link = "<li><a " . $current . "href='" . $imgurl . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count; } else { $link = "<li><a " . $current . "href='" . html_encode($path . pathurlencode($topalbum->name)) . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count; } echo $link; } if ($process) { // listing subalbums $subalbums = $topalbum->getAlbums(); if (!empty($subalbums)) { echo "\n<ul" . $css_class . ">\n"; printAlbumMenuListAlbum($subalbums, $path, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, false, $limit); echo "\n</ul>\n"; } } if ($option == 'list' || $option == 'list-top' || $level > 1) { // close the LI echo "\n</li>\n"; } } }
/** * * Checks for bad parentIDs from old move/copy bug * @param unknown_type $albumname * @param unknown_type $id */ function checkAlbumParentid($albumname, $id) { global $_zp_gallery; $album = new Album($_zp_gallery, $albumname); $oldid = $album->get('parentid'); if ($oldid !== $id) { $album->set('parentid', $id); $album->save(); if (is_null($oldid)) { $oldid = '<em>NULL</em>'; } if (is_null($id)) { $id = '<em>NULL</em>'; } printf('Fixed album <strong>%1$s</strong>: parentid was %2$s should have been %3$s<br />', $albumname, $oldid, $id); } $id = $album->id; if (!$album->isDynamic()) { $albums = $album->getAlbums(); foreach ($albums as $albumname) { checkAlbumParentid($albumname, $id); } } }
if (isset($_GET['mismatch'])) { echo "\n<div class=\"errorbox fade-message\">"; echo "\n<h2>" . gettext("Your passwords did not match") . "</h2>"; echo "\n</div>"; } else { echo "\n<div class=\"messagebox fade-message\">"; echo "\n<h2>" . gettext("Changes applied") . "</h2>"; echo "\n</div>"; } } $albumdir = ""; if (isset($_GET['album'])) { $folder = sanitize_path($_GET['album']); $album = new Album($gallery, $folder); if ($album->isMyItem(ALBUM_RIGHTS)) { $albums = $album->getAlbums(); $pieces = explode('/', $folder); $albumdir = "&album=" . pathurlencode($folder) . '&tab=subalbuminfo'; } else { $albums = array(); } } else { $albumsprime = $gallery->getAlbums(); $albums = array(); foreach ($albumsprime as $folder) { // check for rights $album = new Album($gallery, $folder); if ($album->isMyItem(ALBUM_RIGHTS)) { $albums[] = $folder; } }