/**
 * Returns the album link url of the current album.
 *
 * @param object $album optional album object
 * @return string
 */
function getAlbumURL($album = NULL)
{
    global $_zp_current_album;
    if (is_null($album)) {
        $album = $_zp_current_album;
    }
    if (in_context(ZP_IMAGE)) {
        $page = getAlbumPage($album);
        if ($page <= 1) {
            $page = 0;
        }
    } else {
        $page = 0;
    }
    return $album->getLink($page);
}
/**
 * Returns the album link url of the current album.
 *
 * @param object $album optional album object
 * @return string
 */
function getAlbumLinkURL($album = NULL)
{
    global $_zp_current_album;
    if (is_null($album)) {
        $album = $_zp_current_album;
    }
    $page = getAlbumPage($album);
    if (in_context(ZP_IMAGE) && $page > 1) {
        // Link to the page the current image belongs to.
        $link = rewrite_path("/" . pathurlencode($album->name) . "/page/" . $page, "/index.php?album=" . pathurlencode($album->name) . "&page=" . $page);
    } else {
        $link = rewrite_path("/" . pathurlencode($album->name) . "/", "/index.php?album=" . pathurlencode($album->name));
    }
    return $link;
}