function m9GetRSS($option) { global $_zp_current_album; $host = htmlentities($_SERVER['HTTP_HOST'], ENT_QUOTES, 'UTF-8'); $lang = getOption('locale'); switch ($option) { case 'gallery': return 'http://' . $host . WEBPATH . '/rss.php?lang=' . $lang; case 'album': return 'http://' . $host . WEBPATH . '/rss.php?albumtitle=' . urlencode(getAlbumTitle()) . '&albumname=' . urlencode($_zp_current_album->getFolder()) . '&lang=' . $lang; case 'collection': return 'http://' . $host . WEBPATH . '/rss.php?albumtitle=' . urlencode(getAlbumTitle()) . '&folder=' . urlencode($_zp_current_album->getFolder()) . '&lang=' . $lang; case 'comments': return 'http://' . $host . WEBPATH . '/rss-comments.php?lang=' . $lang; case 'comments-image': return 'http://' . $host . WEBPATH . '/rss-comments.php?id=' . getImageID() . '&title=' . urlencode(getImageTitle()) . '&type=image&lang=' . $lang; case 'comments-album': return 'http://' . $host . WEBPATH . '/rss-comments.php?id=' . getAlbumID() . '&title=' . urlencode(getAlbumTitle()) . '&type=album&lang=' . $lang; case 'albums-rss': return 'http://' . $host . WEBPATH . '/rss.php?lang=' . $lang . '&albumsmode'; } }
/** * @deprecated */ function hitcounter($option = 'image', $viewonly = false, $id = NULL) { deprecated_function_notify(gettext('Use getHitcounter().')); switch ($option) { case "image": if (is_null($id)) { $id = getImageID(); } $dbtable = prefix('images'); break; case "album": if (is_null($id)) { $id = getAlbumID(); } $dbtable = prefix('albums'); break; } $sql = "SELECT `hitcounter` FROM {$dbtable} WHERE `id` = {$id}"; $result = query_single_row($sql); $resultupdate = $result['hitcounter']; return $resultupdate; }
/** * A printAlbumMenu() helper function that checks what subalbum level should be displayed. If you are in an subalbum * that it itself an subalbum and containts subalbums it returns true and lets the album menu display the parent album, * the current level and the next sublevel * Not for standalone use. * * @param object $currentalbum The album object of the current album in whose level we are * @param object $parentalbum The album object of the parent album * @param string $currentfolder The current folder * @param int $level The level the function should check for (1-4 for sublevel 1 - 4) * @return bool */ function checkAlbumDisplayLevel($currentalbum, $parentalbum, $currentfolder, $level) { $sublevel_folder = explode("/", $currentalbum->name); $sublevel_current = explode("/", $currentfolder); switch ($level) { case 1: $sublevelfolder = $sublevel_folder[0]; $sublevelcurrent = $sublevel_current[0]; $sublevelcurrentfolder = $parentalbum->name; break; case 2: $sublevelfolder = $sublevel_folder[0] . "/" . $sublevel_folder[1]; $sublevelcurrent = $sublevel_current[1]; $sublevelcurrentfolder = $sublevel_folder[1]; break; case 3: $sublevelfolder = $sublevel_folder[0] . "/" . $sublevel_folder[1] . "/" . $sublevel_folder[2]; $sublevelcurrent = $sublevel_current[2]; $sublevelcurrentfolder = $sublevel_folder[2]; break; case 4: $sublevelfolder = $sublevel_folder[0] . "/" . $sublevel_folder[1] . "/" . $sublevel_folder[2] . "/" . $sublevel_folder[3]; $sublevelcurrent = $sublevel_current[3]; $sublevelcurrentfolder = $sublevel_folder[3]; break; } if (!empty($currentfolder) and !empty($parentalbum->name)) { // if in parentalbum) OR (if in subalbum) if (strpos($currentalbum->name, $parentalbum->name) === 0 and strpos($currentalbum->name, $currentfolder) === 0 and $currentfolder === $sublevelfolder or getAlbumID() != $parentalbum->getAlbumID() and strpos($currentalbum->name, $parentalbum->name) === 0 and $sublevelcurrent === $sublevelcurrentfolder) { return true; } else { return false; } } else { return false; } }
$crumbs[1]['name'] = $lang['orphanedMedia']; break; case "last": $currentAblum['name'] = $lang['lastBatch']; @($lastBatch = mysqli_result_patch(mysqli_query($db, "SELECT batch_id FROM {$dbinfo[pre]}media WHERE owner = '{$memID}' ORDER BY batch_id DESC"))); if (!$lastBatch) { $lastBatch = '0'; } // Just in case there is no last batch yet $sql = "\r\n\t\t\t\t\tSELECT SQL_CALC_FOUND_ROWS *\r\n\t\t\t\t\tFROM {$dbinfo[pre]}media \r\n\t\t\t\t\tWHERE owner = {$memID} \r\n\t\t\t\t\tAND active = 1 \r\n\t\t\t\t\tAND batch_id = '{$lastBatch}' \r\n\t\t\t\t\tGROUP BY media_id\r\n\t\t\t\t\tORDER BY media_id DESC\r\n\t\t\t\t"; $crumbs[1]['linkto'] = $siteURL . "/contributor.my.media.php?mode=last"; // Check for SEO $crumbs[1]['name'] = $lang['lastBatch']; break; case "album": $currentAlbumID = getAlbumID($_SESSION['contrAlbumID']); $currentAblum['name'] = $_SESSION['member']['contrAlbumsData'][$currentAlbumID]['name']; $currentGallery = $_SESSION['galleriesData'][$currentAlbumID]; // Assign the current gallery details if (!$_SESSION['sessGallerySortBy']) { // If sessGallerySortBy isn't set then use the default $_SESSION['sessGallerySortBy'] = $currentGallery['dsorting'] ? $currentGallery['dsorting'] : $config['settings']['dsorting']; } if (!$_SESSION['sessGallerySortType']) { // If sessGallerySortType isn't set then use the default $_SESSION['sessGallerySortType'] = $currentGallery['dsorting2'] ? $currentGallery['dsorting2'] : $config['settings']['dsorting2']; } if ($_SESSION['sessGallerySortBy'] != 'media_id') { // Add a secondary ordering type just in case $sql .= ",{$dbinfo[pre]}media.media_id DESC"; }
/** * 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"; } } }
/** * @deprecated * @since 1.4.2 */ function getRSSHeaderLink($option, $linktext = '', $lang = '') { deprecated_functions::notify(gettext('Use the template function <code>getRSSLink()</code> instead. NOTE: While this function gets a full html link <code>getRSSLink()</code> just returns the URL.')); global $_zp_current_album; $host = html_encode($_SERVER["HTTP_HOST"]); $protocol = PROTOCOL . '://'; if (empty($lang)) { $lang = getOption("locale"); } switch ($option) { case "Gallery": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss&lang=" . $lang . "\" />\n"; } case "Album": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss&albumtitle=" . urlencode(getAlbumTitle()) . "&albumname=" . urlencode($_zp_current_album->getFileName()) . "&lang=" . $lang . "\" />\n"; } case "Collection": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss&albumtitle=" . urlencode(getAlbumTitle()) . "&folder=" . urlencode($_zp_current_album->getFileName()) . "&lang=" . $lang . "\" />\n"; } case "Comments": if (getOption('RSS_comments')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss=comments&lang=" . $lang . "\" />\n"; } case "Comments-image": if (getOption('RSS_comments')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss=comments&id=" . getImageID() . "&title=" . urlencode(getImageTitle()) . "&type=image&lang=" . $lang . "\" />\n"; } case "Comments-album": if (getOption('RSS_comments')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss=comments&id=" . getAlbumID() . "&title=" . urlencode(getAlbumTitle()) . "&type=album&lang=" . $lang . "\" />\n"; } case "AlbumsRSS": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss=comments&lang=" . $lang . "&albumsmode\" />\n"; } } }
/** * To show the content of an media album with .flv/.mp4/.mp3 movie/audio files only as a playlist or as separate players with flv player * NOTE: The flv player plugin needs to be installed (This plugin currently internally uses FLV player 3 because of FLV player 4 Api changes!) * * The playlist is meant to replace the 'next_image()' loop on a theme's album.php. * It can be used with a special 'album theme' that can be assigned to media albums with with .flv/.mp4/.mp3s * movie/audio files only. See the examples below * You can either show a 'one player window' playlist or show all items as separate players paginated * (set in the settings for thumbs per page) on one page (like on a audio or podcast blog). * * If there is no preview image for a mp3 file existing only the player control bar is shown. * * The two modes: * a) 'playlist' * Replace the entire 'next_image()' loop on album.php with this: * <?php flvPlaylist("playlist"); ?> * * It uses a xspf file found in 'zp-core/flvplayer/flvplayer/playlist.php' for the playlist that you also can modify. You can also use other XML formats for a playlist See http://developer.longtailvideo.com/trac/wiki/FlashFormats * * b) 'players' * Modify the 'next_image()' loop on album.php like this: * <?php * while (next_image(): * printImageTitle(); * flvPlaylist("players"); * endwhile; * ?> * Of course you can add further functions to b) like title, description, date etc., too. * * @param string $option the mode to use "playlist" or "players" */ function flvPlaylist($option = '') { global $_zp_current_album, $_zp_current_image, $_flv_player, $_zp_flash_player; if (checkAlbumPassword($_zp_current_album->getFolder(), $hint)) { if ($option === "players") { $moviepath = getUnprotectedImageURL(); $ext = strtolower(strrchr(getUnprotectedImageURL(), ".")); } $imagetitle = getImageTitle(); } $albumid = getAlbumID(); switch ($option) { case "playlist": if (getNumImages() != 0) { ?> <div id="flvplaylist"><?php echo gettext("The flv player is not installed. Please install or activate the flv player plugin."); ?> </div> <script type="text/javascript"> var so = new SWFObject('<?php echo WEBPATH . '/' . USER_PLUGIN_FOLDER; ?> /flvplayer/<?php echo $_flv_player; ?> ','flvplaylist','<?php echo getOption('flvplaylist_width'); ?> ','<?php echo getOption('flvplaylist_height'); ?> ','8'); so.addParam('allowfullscreen','true'); so.addVariable('stretching','<?php echo getOption('flv_player_stretching'); ?> '); so.addVariable('playlist', '<?php echo getOption('flvplaylist_position'); ?> '); so.addVariable('playlistsize','<?php echo getOption('flvplaylist_size'); ?> '); so.addVariable('repeat','<?php echo getOption('flvplaylist_repeat'); ?> '); so.addVariable('backcolor','<?php echo getOptionColor('flv_player_backcolor'); ?> '); so.addVariable('frontcolor','<?php echo getOptionColor('flv_player_frontcolor'); ?> '); so.addVariable('lightcolor','<?php echo getOptionColor('flv_player_lightcolor'); ?> '); so.addVariable('screencolor','<?php echo getOptionColor('flv_player_screencolor'); ?> '); so.addVariable('file','<?php echo WEBPATH . "/" . USER_PLUGIN_FOLDER; ?> /flvplayer/playlist.php?albumid=<?php echo $albumid; ?> '); so.addVariable('javascriptid','jstest'); so.addVariable('enablejs','true'); so.write('flvplaylist'); </script> <?php } break; case "players": if ($ext == ".flv" || $ext == ".mp3" || $ext == ".mp4") { if (is_null($_zp_flash_player)) { echo "<img src='" . WEBPATH . '/' . ZENFOLDER . "'/images/err-noflashplayer.gif' alt='" . gettext('The flv player is not installed. Please install or activate the flv player plugin.') . "' />"; } else { $_zp_flash_player->printPlayerConfig(getFullImageURL(), $_zp_current_image->getTitle(), $_zp_current_image->get("id")); } } break; } }
/** * Returns the RSS link for use in the HTML HEAD * * @param string $option type of RSS: "Gallery" feed for the whole gallery * "Album" for only the album it is called from * "Collection" for the album it is called from and all of its subalbums * "Comments" for all comments * "Comments-image" for comments of only the image it is called from * "Comments-album" for comments of only the album it is called from * @param string $linktext title of the link * @param string $lang optional to display a feed link for a specific language. Enter the locale like "de_DE" (the locale must be installed on your Zenphoto to work of course). If empty the locale set in the admin option or the language selector (getOption('locale') is used. * * * @return string * @since 1.1 */ function getRSSHeaderLink($option, $linktext = '', $lang = '') { global $_zp_current_album; $host = html_encode($_SERVER["HTTP_HOST"]); $protocol = SERVER_PROTOCOL . '://'; if ($protocol == 'https_admin') { $protocol = 'https://'; } if (empty($lang)) { $lang = getOption("locale"); } switch ($option) { case "Gallery": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss&lang=" . $lang . "\" />\n"; } case "Album": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss&albumtitle=" . urlencode(getAlbumTitle()) . "&albumname=" . urlencode($_zp_current_album->getFolder()) . "&lang=" . $lang . "\" />\n"; } case "Collection": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss&albumtitle=" . urlencode(getAlbumTitle()) . "&folder=" . urlencode($_zp_current_album->getFolder()) . "&lang=" . $lang . "\" />\n"; } case "Comments": if (getOption('RSS_comments')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss-comments&lang=" . $lang . "\" />\n"; } case "Comments-image": if (getOption('RSS_comments')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss-comments&id=" . getImageID() . "&title=" . urlencode(getImageTitle()) . "&type=image&lang=" . $lang . "\" />\n"; } case "Comments-album": if (getOption('RSS_comments')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss-comments&id=" . getAlbumID() . "&title=" . urlencode(getAlbumTitle()) . "&type=album&lang=" . $lang . "\" />\n"; } case "AlbumsRSS": if (getOption('RSS_album_image')) { return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"" . $protocol . $host . WEBPATH . "/index.php?rss-comments&lang=" . $lang . "&albumsmode\" />\n"; } } }
function getImages($albumId, $showHidden = false) { $albumId = getAlbumID($albumId); return \cf\query2arrays("\r\n\t\tSELECT cf_gallery_images.id AS id, IFNULL(code,cf_gallery_images.id) AS code, name, image, short_descr, hidden, url\r\n\t\tFROM cf_gallery_images\r\n\t\tINNER JOIN cf_gallery_image_in_album ON cf_gallery_images.id=cf_gallery_image_in_album.image_id\r\n\t\tWHERE cf_gallery_image_in_album.album_id=:aid\r\n\t\tORDER BY sort_order", array('aid' => $albumId)); }
/** * Returns the RSS link for use in the HTML HEAD * * @param string $option type of RSS: "Gallery" feed for the whole gallery * "Album" for only the album it is called from * "Collection" for the album it is called from and all of its subalbums * "Comments" for all comments * "Comments-image" for comments of only the image it is called from * "Comments-album" for comments of only the album it is called from * @param string $linktext title of the link * @param string $lang optional to display a feed link for a specific language. Enter the locale like "de_DE" (the locale must be installed on your Zenphoto to work of course). If empty the locale set in the admin option or the language selector (getOption('locale') is used. * * * @return string * @since 1.1 */ function getRSSHeaderLink($option, $linktext = '', $lang = '') { global $_zp_current_album; $host = htmlentities($_SERVER["HTTP_HOST"], ENT_QUOTES, 'UTF-8'); if (empty($lang)) { $lang = getOption("locale"); } switch ($option) { case "Gallery": return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"http://" . $host . WEBPATH . "/rss.php?lang=" . $lang . "\" />\n"; case "Album": return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"http://" . $host . WEBPATH . "/rss.php?albumtitle=" . urlencode(getAlbumTitle()) . "&albumname=" . urlencode($_zp_current_album->getFolder()) . "&lang=" . $lang . "\" />\n"; case "Collection": return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"http://" . $host . WEBPATH . "/rss.php?albumtitle=" . urlencode(getAlbumTitle()) . "&folder=" . urlencode($_zp_current_album->getFolder()) . "&lang=" . $lang . "\" />\n"; case "Comments": return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"http://" . $host . WEBPATH . "/rss-comments.php?lang=" . $lang . "\" />\n"; case "Comments-image": return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"http://" . $host . WEBPATH . "/rss-comments.php?id=" . getImageID() . "&title=" . urlencode(getImageTitle()) . "&type=image&lang=" . $lang . "\" />\n"; case "Comments-album": return "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . html_encode($linktext) . "\" href=\"http://" . $host . WEBPATH . "/rss-comments.php?id=" . getAlbumID() . "&title=" . urlencode(getAlbumTitle()) . "&type=album&lang=" . $lang . "\" />\n"; } }
/** * Get the rating for an image or album, * * @param string $option 'totalvalue' or 'totalvotes' * @param string $option2 'image' or 'album' * @param int $id id of the image or album * @see getImageRating() and getAlbumRating() * @return unknown */ function getRating($option, $option2, $id) { switch ($option) { case "totalvalue": $rating = "total_value"; break; case "totalvotes": $rating = "total_votes"; break; } switch ($option2) { case "image": if (!$id) { $id = getImageID(); } $dbtable = prefix('images'); break; case "album": if (!$id) { $id = getAlbumID(); } $dbtable = prefix('albums'); break; } $result = query_single_row("SELECT " . $rating . " FROM {$dbtable} WHERE id = {$id}"); return $result[$rating]; }
/** * Prints a link to call the slideshow (not shown if there are no images in the album) * To be used on album.php and image.php * A CSS id names 'slideshowlink' is attached to the link so it can be directly styled. * * If the mode is set to "jQuery Colorbox" and the Colorbox plugin is enabled this link starts a Colorbox slideshow * from a hidden HTML list of all images in the album. On album.php it starts with the first always, on image.php with the current image. * * @param string $linktext Text for the link * @param string $linkstyle Style of Text for the link */ function printSlideShowLink($linktext = '', $linkstyle = '') { global $_zp_gallery, $_zp_current_image, $_zp_current_album, $_zp_current_search, $slideshow_instance, $_zp_gallery_page; if (empty($_GET['page'])) { $pagenr = 1; } else { $pagenr = sanitize_numeric($_GET['page']); } $slideshowhidden = ''; $numberofimages = 0; if (in_context(ZP_SEARCH)) { $imagenumber = ''; $imagefile = ''; $albumnr = 0; $slideshowlink = rewrite_path("/page/slideshow", "index.php?p=slideshow"); $slideshowhidden = '<input type="hidden" name="preserve_search_params" value="' . html_encode($_zp_current_search->getSearchParams()) . '" />'; } else { if (in_context(ZP_IMAGE)) { $imagenumber = imageNumber(); $imagefile = $_zp_current_image->filename; } else { $imagenumber = ''; $imagefile = ''; } if (in_context(ZP_SEARCH_LINKED)) { $albumnr = -getAlbumID(); $slideshowhidden = '<input type="hidden" name="preserve_search_params" value="' . html_encode($_zp_current_search->getSearchParams()) . '" />'; } else { $albumnr = getAlbumID(); } $slideshowlink = rewrite_path(pathurlencode($_zp_current_album->getFolder()) . "/page/slideshow", "index.php?p=slideshow&album=" . urlencode($_zp_current_album->getFolder())); } $numberofimages = getNumImages(); $option = getOption('slideshow_mode'); switch ($option) { case 'jQuery': case 'flash': if ($numberofimages > 1) { ?> <form name="slideshow_<?php echo $slideshow_instance; ?> " method="post" action="<?php echo $slideshowlink; ?> "> <?php echo $slideshowhidden; ?> <input type="hidden" name="pagenr" value="<?php echo html_encode($pagenr); ?> " /> <input type="hidden" name="albumid" value="<?php echo $albumnr; ?> " /> <input type="hidden" name="numberofimages" value="<?php echo $numberofimages; ?> " /> <input type="hidden" name="imagenumber" value="<?php echo $imagenumber; ?> " /> <input type="hidden" name="imagefile" value="<?php echo html_encode($imagefile); ?> " /> <?php if (!empty($linkstyle)) { echo '<p style="' . $linkstyle . '">'; } ?> <a id="slideshowlink_<?php echo $slideshow_instance; ?> " href="javascript:document.slideshow_<?php echo $slideshow_instance; ?> .submit()"><?php echo $linktext; ?> </a> <?php if (!empty($linkstyle)) { echo '</p>'; } ?> </form> <?php } $slideshow_instance++; break; case 'colorbox': $theme = $_zp_gallery->getCurrentTheme(); $script = stripSuffix($_zp_gallery_page); if (!getOption('colorbox_' . $theme . '_' . $script)) { $themes = $_zp_gallery->getThemes(); ?> <p class="errorbox"><?php printf(gettext('Slideshow not available because colorbox is not enabled on %1$s <em>%2$s</em> pages.'), $themes[$theme]['name'], $script); ?> </p> <?php break; } if ($numberofimages > 1) { if (in_context(ZP_SEARCH) || in_context(ZP_SEARCH_LINKED)) { $images = $_zp_current_search->getImages(0); } else { $images = $_zp_current_album->getImages(0); } $count = ''; ?> <script type="text/javascript"> $(document).ready(function(){ $("a[rel='slideshow']").colorbox({ slideshow: true, loop: true, transition: '<?php echo getOption('slideshow_colorbox_transition'); ?> ', slideshowSpeed: <?php echo getOption('slideshow_speed'); ?> , slideshowStart: '<?php echo gettext("start slideshow"); ?> ', slideshowStop: '<?php echo gettext("stop slideshow"); ?> ', previous: '<?php echo gettext("previous"); ?> ', next: '<?php echo gettext("next"); ?> ', close: '<?php echo gettext("close"); ?> ', maxWidth:'98%', maxHeight:'98%', photo: true }); }); </script> <?php foreach ($images as $image) { if (is_array($image)) { $suffix = getSuffix($image['filename']); } else { $suffix = getSuffix($image); } $suffixes = array('jpg', 'jpeg', 'gif', 'png'); if (in_array($suffix, $suffixes)) { $count++; if (is_array($image)) { $albobj = new Album($_zp_gallery, $image['folder']); $imgobj = newImage($albobj, $image['filename']); } else { $imgobj = newImage($_zp_current_album, $image); } if ($_zp_gallery_page == 'image.php' || in_context(ZP_SEARCH_LINKED)) { if (in_context(ZP_SEARCH_LINKED)) { if ($count == 1) { $style = ''; } else { $style = ' style="display:none"'; } } else { if ($_zp_current_image->filename == $image) { $style = ''; } else { $style = ' style="display:none"'; } } } elseif ($_zp_gallery_page == 'album.php' || $_zp_gallery_page == 'search.php') { if ($count == 1) { $style = ''; } else { $style = ' style="display:none"'; } } switch (getOption('slideshow_colorbox_imagetype')) { case 'fullimage': $imagelink = $imgobj->getFullImage(); break; case 'sizedimage': $imagelink = $imgobj->getSizedImage(getOption("slideshow_width")); break; } ?> <p> <a href="<?php echo html_encode($imagelink); ?> " rel="slideshow"<?php echo $style; ?> title="<?php echo html_encode(strip_tags($imgobj->getTitle())); ?> "><?php echo $linktext; ?> </a> </p> <?php } } } break; } }