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; }
function printPagedThumbsNav($imagesperpage = '', $counter = '', $prev = '', $next = '', $width = NULL, $height = NULL, $crop = false) { global $_zp_current_album, $_zp_current_image; // in case someone wants to override the options by parameter if (empty($imagesperpage)) { $imagesperpage = getOption("pagedthumbs_imagesperpage"); } if (empty($width)) { $width = getOption("pagedthumbs_width"); } else { $width = sanitize_numeric($width); } if (empty($height)) { $height = getOption("pagedthumbs_height"); } else { $height = sanitize_numeric($height); } if (empty($prev)) { $prev = getOption("pagedthumbs_prevtext"); } if (empty($next)) { $next = getOption("pagedthumbs_nexttext"); } if (empty($counter)) { $counter = getOption("pagedthumbs_counter"); } // get the image of current album $images = $_zp_current_album->getImages(); $totalimages = getNumImages(); $totalpages = ceil($totalimages / $imagesperpage); $currentimgnr = imageNumber(); for ($nr = 1; $nr <= $totalpages; $nr++) { $startimg[$nr] = $nr * $imagesperpage - ($imagesperpage - 1); // get start image number for thumb pagination $endimg[$nr] = $nr * $imagesperpage; // get end image number for thumb pagination } // get current page number for ($nr = 1; $nr <= $totalpages; $nr++) { if ($startimg[$nr] <= $currentimgnr) { $currentpage = $nr; } if ($endimg[$nr] >= $currentimgnr) { $currentpage = $nr; break; } } echo "<div id=\"pagedthumbsnav\">\n"; echo "<div class=\"pagedthumbsnav-prev\">\n"; // Prev thumbnails - show only if there is a prev page if ($totalpages > 1) { $prevpageimagenr = $currentpage * $imagesperpage - ($imagesperpage + 1); if ($currentpage > 1) { $prevpageimage = newImage($_zp_current_album, $images[$prevpageimagenr]); echo "<a href=\"" . $prevpageimage->getImageLink() . "\" title=\"" . gettext("previous thumbs") . "\">" . $prev . "</a>\n"; } } echo "</div>\n"; // the thumbnails $number = $startimg[$currentpage] - 2; for ($nr = 1; $nr <= $imagesperpage; $nr++) { $number++; if ($number == $totalimages) { break; } $image = newImage($_zp_current_album, $images[$number]); if ($image->id === getImageID()) { $css = " id='pagedthumbsnav-active' "; } else { $css = ""; } echo "<a {$css} href=\"" . $image->getImageLink() . "\" title=\"" . strip_tags($image->getTitle()) . "\">"; if (getOption("pagedthumbs_crop") or $crop) { echo "<img src='" . $image->getCustomImage(null, $width, $height, $width, $height, null, null, true) . "' alt=\"" . strip_tags($image->getTitle()) . "\" width='" . $width . "' height='" . $height . "' />"; } else { $_zp_current_image = $image; printCustomSizedImageThumbMaxSpace(strip_tags($image->getTitle()), $width, $height); } echo "</a>\n"; if ($number == $endimg[$currentpage]) { break; } } // next thumbnails - show only if there is a next page echo "<div class=\"pagedthumbsnav-next\">\n"; if ($totalpages > 1) { if ($currentpage < $totalpages) { $nextpageimagenr = $currentpage * $imagesperpage; $nextpageimage = newImage($_zp_current_album, $images[$nextpageimagenr]); echo "<a href=\"" . $nextpageimage->getImageLink() . "\" title=\"" . gettext("next thumbs") . "\">" . $next . "</a>\n"; } } //first if echo "</div>\n"; // image counter if ($counter) { $fromimage = $startimg[$currentpage]; if ($totalimages < $endimg[$currentpage]) { $toimage = $totalimages; } else { $toimage = $endimg[$currentpage]; } echo "<p id=\"pagedthumbsnav-counter\">" . sprintf(gettext('Images %1$u-%2$u of %3$u (%4$u/%5$u)'), $fromimage, $toimage, $totalimages, $currentpage, $totalpages) . "</p>\n"; } echo "</div>\n"; }
/** * Prints the thumbnails * */ function printThumbs() { global $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_gallery; echo "<div id='pagedthumbsimages'>"; $thumbs = $this->getThumbs(); //$thcount = count($thumbs); echo "thcount:".$thcount; $number = 0; foreach ($thumbs as $image) { if ($image->id === getImageID()) { $css = " id='pagedthumbsnav-active' "; } else { $css = ""; } echo "<a {$css} href=\"" . html_encode($image->getImageLink()) . "\" title=\"" . strip_tags($image->getTitle()) . "\">"; if ($this->crop) { $html = "<img src='" . html_encode($image->getCustomImage(null, $this->width, $this->height, $this->width, $this->height, null, null, true)) . "' alt=\"" . strip_tags($image->getTitle()) . "\" width='" . $this->width . "' height='" . $this->height . "' />"; } else { $maxwidth = $this->width; // needed because otherwise getMaxSpaceContainer will use the values of the first image for all others, too $maxheight = $this->height; getMaxSpaceContainer($maxwidth, $maxheight, $image, true); $html = "<img src=\"" . html_encode($image->getCustomImage(NULL, $maxwidth, $maxheight, NULL, NULL, NULL, NULL, true)) . "\" alt=\"" . strip_tags($image->getTitle()) . "\" />"; } echo zp_apply_filter('custom_image_html', $html, true); echo "</a>\n"; $number++; } if ($this->placeholders) { if ($number != $this->imagesperpage) { $placeholdernr = $this->imagesperpage - $number; for ($nr2 = 1; $nr2 <= $placeholdernr; $nr2++) { echo "<span class=\"placeholder\" style=\"width:" . $this->width . "px;height:" . $this->height . "px\"></span>"; } } } echo "</div>"; }
/** * @deprecated * @since 1.4.3 */ function printImageID() { deprecated_functions::notify(gettext('Use echo “image_”.$_zp_current_image->getID().')); if (!in_context(ZP_IMAGE)) { return false; } global $_zp_current_image; echo "image_" . getImageID(); }
/** * 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"; } } }
/** * 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]; }