static function printAlbumMenuJumpAlbum($albums, $option, $albumpath, $level = 1)
 {
     global $_zp_gallery;
     foreach ($albums as $album) {
         $subalbum = new Album($_zp_gallery, $album, true);
         if ($option === "count" and $subalbum->getNumImages() > 0) {
             $count = " (" . $subalbum->getNumImages() . ")";
         } else {
             $count = "";
         }
         $arrow = str_replace(':', '» ', str_pad("", $level - 1, ":"));
         $selected = self::checkSelectedAlbum($subalbum->name, "album");
         $link = "<option {$selected} value='" . htmlspecialchars($albumpath . pathurlencode($subalbum->name)) . "'>" . $arrow . strip_tags($subalbum->getTitle()) . $count . "</option>";
         echo $link;
     }
 }
/**
 * Prints a table with a bar graph of the values.
 *
 * @param string $sortorder "popular", "mostrated","toprated","mostcommented" or - only if $type = "albums"! - "mostimages"
 * @param string_type $type "albums", "images", "pages", "news", "tags"
 * @param int $limit Number of entries to show
 */
function printBarGraph($sortorder = "mostimages", $type = "albums", $from_number = 0, $to_number = 10)
{
    global $gallery, $webpath;
    $limit = $from_number . "," . $to_number;
    $bargraphmaxsize = 400;
    switch ($type) {
        case "albums":
            $typename = gettext("Albums");
            $dbquery = "SELECT * FROM " . prefix('albums');
            break;
        case "images":
            $typename = gettext("Images");
            $dbquery = "SELECT * FROM " . prefix('images');
            break;
        case "pages":
            $typename = gettext("Pages");
            $dbquery = "SELECT * FROM " . prefix('pages');
            break;
        case "news":
            $typename = gettext("News Articles");
            $dbquery = "SELECT * FROM " . prefix('news');
            break;
        case "newscategories":
            $typename = gettext("News Categories");
            $dbquery = "SELECT * FROM " . prefix('news_categories');
            break;
        case "tags":
            $typename = gettext("Tags");
            break;
        case "rss":
            $typename = gettext("rss");
            break;
    }
    switch ($sortorder) {
        case "mostused":
            switch ($type) {
                case "tags":
                    $itemssorted = query_full_array("SELECT tagobj.tagid, count(*) as tagcount, tags.* FROM " . prefix('obj_to_tag') . " AS tagobj, " . prefix('tags') . " AS tags WHERE tags.id=tagobj.tagid GROUP BY tags.id ORDER BY tagcount DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['tagcount'];
                    }
                    break;
                case "newscategories":
                    $itemssorted = query_full_array("SELECT news2cat.cat_id, count(*) as catcount, cats.* FROM " . prefix('news2cat') . " AS news2cat, " . prefix('news_categories') . " AS cats WHERE cats.id=news2cat.cat_id GROUP BY news2cat.cat_id ORDER BY catcount DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['catcount'];
                    }
                    break;
            }
            $headline = $typename . " - " . gettext("most used");
            break;
        case "popular":
            switch ($type) {
                case 'rss':
                    $itemssorted = query_full_array("SELECT `type`,`aux`, `data` FROM " . prefix('plugin_storage') . " WHERE `type` = 'rsshitcounter' ORDER BY CONVERT(data,UNSIGNED) DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['data'];
                    }
                    break;
                default:
                    $itemssorted = query_full_array($dbquery . " ORDER BY hitcounter DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['hitcounter'];
                    }
                    break;
            }
            $headline = $typename . " - " . gettext("most viewed");
            break;
        case "mostrated":
            $itemssorted = query_full_array($dbquery . " ORDER BY total_votes DESC LIMIT " . $limit);
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['total_votes'];
            }
            $headline = $typename . " - " . gettext("most rated");
            break;
        case "toprated":
            $itemssorted = query_full_array($dbquery . " ORDER BY (total_value/total_votes) DESC LIMIT {$limit}");
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                if ($itemssorted[0]['total_votes'] != 0) {
                    $maxvalue = $itemssorted[0]['total_value'] / $itemssorted[0]['total_votes'];
                } else {
                    $maxvalue = 0;
                }
            }
            $headline = $typename . " - " . gettext("top rated");
            break;
        case "mostcommented":
            switch ($type) {
                case "albums":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, albums.* FROM " . prefix('comments') . " AS comments, " . prefix('albums') . " AS albums WHERE albums.id=comments.ownerid AND type = 'albums' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
                case "images":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, images.* FROM " . prefix('comments') . " AS comments, " . prefix('images') . " AS images WHERE images.id=comments.ownerid AND type = 'images' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
                case "pages":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, pages.* FROM " . prefix('comments') . " AS comments, " . prefix('pages') . " AS pages WHERE pages.id=comments.ownerid AND type = 'page' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
                case "news":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, news.* FROM " . prefix('comments') . " AS comments, " . prefix('news') . " AS news WHERE news.id=comments.ownerid AND type = 'news' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
            }
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['commentcount'];
            }
            $headline = $typename . " - " . gettext("most commented");
            break;
        case "mostimages":
            $itemssorted = query_full_array("SELECT images.albumid, count(*) as imagenumber, albums.* FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums WHERE albums.id=images.albumid GROUP BY images.albumid ORDER BY imagenumber DESC LIMIT " . $limit);
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['imagenumber'];
            }
            $headline = $typename . " - " . gettext("most images");
            break;
        case "latest":
            switch ($type) {
                case "albums":
                    $allalbums = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit);
                    $albums = array();
                    foreach ($allalbums as $album) {
                        $albumobj = new Album($gallery, $album['folder']);
                        $albumentry = array("id" => $albumobj->get('id'), "title" => $albumobj->getTitle(), "folder" => $albumobj->name, "imagenumber" => $albumobj->getNumImages(), "show" => $albumobj->get("show"));
                        array_unshift($albums, $albumentry);
                    }
                    $maxvalue = 1;
                    $itemssorted = sortMultiArray($albums, 'id', true, true);
                    // The items are originally sorted by id;
                    $headline = $typename . " - " . gettext("latest");
                    break;
                case "images":
                    $itemssorted = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit);
                    $barsize = 0;
                    $maxvalue = 1;
                    $headline = $typename . " - " . gettext("latest");
                    break;
            }
            break;
        case "latestupdated":
            $albums = getAlbumStatistic($to_number, 'latestupdated', '');
            $maxvalue = 1;
            if (!empty($albums)) {
                foreach ($albums as $key => $album) {
                    $albumobj = new Album($gallery, $album['folder']);
                    $albums[$key]['imagenumber'] = $albumobj->getNumImages();
                }
            }
            $itemssorted = $albums;
            $headline = $typename . " - " . gettext("latest updated");
            break;
    }
    if ($maxvalue == 0 || empty($itemssorted)) {
        $maxvalue = 1;
        $no_hitcount_enabled_msg = '';
        if ($sortorder == 'popular' && $type != 'rss' && !getOption('zp_plugin_hitcounter')) {
            $no_hitcount_enabled_msg = gettext("(The hitcounter plugin is not enabled.)");
        }
        $no_statistic_message = "<tr><td><em>" . gettext("No statistic available.") . $no_hitcount_enabled_msg . "</em></td><td></td><td></td><td></td></tr>";
    } else {
        $no_statistic_message = "";
        if ($sortorder == 'popular' && $type != 'rss' && !getOption('zp_plugin_hitcounter')) {
            $no_statistic_message = "<tr><td colspan='4'><em>" . gettext("Note: The hitcounter plugin is not enabled, therefore any existing values will not get updated.") . "</em></td><td></td><td></td><td></td></tr>";
        }
    }
    if ($from_number <= 1) {
        $count = 1;
    } else {
        $count = $from_number;
    }
    $countlines = 0;
    echo "<table class='bordered'>";
    echo "<tr><th colspan='4'><strong>" . $headline . "</strong>";
    if (isset($_GET['stats'])) {
        echo "<a href='gallery_statistics.php'> | " . gettext("Back to the top 10 lists") . "</a>";
    } else {
        if (empty($no_statistic_message)) {
            echo "<a href='gallery_statistics.php?stats=" . $sortorder . "&amp;type=" . $type . "'> | " . gettext("View more") . "</a>";
        }
        echo "<a href='#top'> | " . gettext("top") . "</a>";
    }
    echo "</th></tr>";
    echo $no_statistic_message;
    foreach ($itemssorted as $item) {
        if (array_key_exists("filename", $item)) {
            $name = $item['filename'];
        } else {
            if (array_key_exists("folder", $item)) {
                $name = $item['folder'];
            } else {
                if ($type === "pages" or $type === "news") {
                    $name = $item['titlelink'];
                } else {
                    if ($type === "newscategories") {
                        $name = $item['title'];
                    } else {
                        if ($type === "tags") {
                            $name = "";
                        }
                    }
                }
            }
        }
        switch ($sortorder) {
            case "popular":
                switch ($type) {
                    case 'rss':
                        $barsize = round($item['data'] / $maxvalue * $bargraphmaxsize);
                        $value = $item['data'];
                        break;
                    default:
                        $barsize = round($item['hitcounter'] / $maxvalue * $bargraphmaxsize);
                        $value = $item['hitcounter'];
                        break;
                }
                break;
            case "mostrated":
                if ($item['total_votes'] != 0) {
                    $barsize = round($item['total_votes'] / $maxvalue * $bargraphmaxsize);
                } else {
                    $barsize = 0;
                }
                $value = $item['total_votes'];
                break;
            case "toprated":
                if ($item['total_votes'] != 0) {
                    $barsize = round($item['total_value'] / $item['total_votes'] / $maxvalue * $bargraphmaxsize);
                    $value = round($item['total_value'] / $item['total_votes']);
                } else {
                    $barsize = 0;
                    $value = 0;
                }
                break;
            case "mostcommented":
                if ($maxvalue != 0) {
                    $barsize = round($item['commentcount'] / $maxvalue * $bargraphmaxsize);
                } else {
                    $barsize = 0;
                }
                $value = $item['commentcount'];
                break;
            case "mostimages":
                $barsize = round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                $value = $item['imagenumber'];
                break;
            case "latest":
                switch ($type) {
                    case "albums":
                        $barsize = 0;
                        //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                        $value = sprintf(gettext("%s images"), $item['imagenumber']);
                        break;
                    case "images":
                        $barsize = 0;
                        $value = "";
                        break;
                }
                break;
            case "latestupdated":
                $barsize = 0;
                //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                $value = sprintf(gettext("%s images"), $item['imagenumber']);
                break;
            case "mostused":
                switch ($type) {
                    case "tags":
                        if ($maxvalue != 0) {
                            $barsize = round($item['tagcount'] / $maxvalue * $bargraphmaxsize);
                        } else {
                            $barsize = 0;
                        }
                        $value = $item['tagcount'];
                        break;
                    case "newscategories":
                        if ($maxvalue != 0) {
                            $barsize = round($item['catcount'] / $maxvalue * $bargraphmaxsize);
                        } else {
                            $barsize = 0;
                        }
                        $value = $item['catcount'];
                        break;
                }
                break;
        }
        // counter to have a gray background of every second line
        if ($countlines === 1) {
            $style = " style='background-color: #f4f4f4'";
            // a little ugly but the already attached class for the table is so easiest overriden...
            $countlines = 0;
        } else {
            $style = "";
            $countlines++;
        }
        switch ($type) {
            case "albums":
                $editurl = $webpath . "/admin-edit.php?page=edit&amp;album=" . $name;
                $viewurl = WEBPATH . "/index.php?album=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "images":
                $getalbumfolder = query_single_row("SELECT title, folder, `show` from " . prefix("albums") . " WHERE id = " . $item['albumid']);
                if ($sortorder === "latest") {
                    $value = "<span";
                    if ($getalbumfolder['show'] != "1") {
                        $value = $value . " class='unpublished_item'";
                    }
                    $value = $value . ">" . get_language_string($getalbumfolder['title']) . "</span> (" . $getalbumfolder['folder'] . ")";
                }
                $editurl = $webpath . "/admin-edit.php?page=edit&amp;album=" . $getalbumfolder['folder'] . "&amp;image=" . $item['filename'] . "&amp;tab=imageinfo#IT";
                $viewurl = WEBPATH . "/index.php?album=" . $getalbumfolder['folder'] . "&amp;image=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "pages":
                $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?page&amp;titlelink=" . $name;
                $viewurl = WEBPATH . "/index.php?p=pages&amp;title=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "news":
                $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?news&amp;titlelink=" . $name;
                $viewurl = WEBPATH . "/index.php?p=news&amp;title=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "newscategories":
                $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-categories.php?edit&amp;id=" . $item['id'];
                $viewurl = WEBPATH . "/index.php?p=news&amp;category=" . $name;
                $title = get_language_string($item['titlelink']);
                break;
            case "tags":
                $editurl = $webpath . "/admin-tags.php";
                $viewurl = WEBPATH . "/index.php?p=search&amp;searchfields=tags&amp;words=" . $item['name'];
                $title = get_language_string($item['name']);
                break;
            case "rss":
                $editurl = '';
                $viewurl = WEBPATH . "/index.php?" . html_encode(strrchr($item['aux'], 'rss'));
                $title = html_encode(strrchr($item['aux'], 'rss'));
                break;
        }
        if (isset($item['show'])) {
            if ($item['show'] != "1") {
                $show = " class='unpublished_item'";
            } else {
                $show = "";
            }
        } else {
            $show = "";
        }
        if ($value != 0 or $sortorder === "latest") {
            if (empty($name)) {
                $name = "";
            } else {
                $name = "(" . $name . ")";
            }
            ?>
		<tr class="statistic_wrapper">
		<td class="statistic_counter" <?php 
            echo $style;
            ?>
>
		<?php 
            echo $count;
            ?>
		</td>
		<td class="statistic_title" <?php 
            echo $style;
            ?>
>
		<strong<?php 
            echo $show;
            ?>
><?php 
            echo $title;
            ?>
</strong> <?php 
            echo $name;
            ?>
		</td>
		<td class="statistic_graphwrap" <?php 
            echo $style;
            ?>
>
		<div class="statistic_bargraph" style="width: <?php 
            echo $barsize;
            ?>
px"></div>
		<div class="statistic_value"><?php 
            echo $value;
            ?>
</div>
		</td>
		<td class="statistic_link" <?php 
            echo $style;
            ?>
>
		<?php 
            switch ($type) {
                case 'rss':
                    echo "<a href='" . $viewurl . "' title='" . $name . "'>" . gettext("View") . "</a></td>";
                    break;
                default:
                    echo "<a href='" . $editurl . "' title='" . $name . "'>" . gettext("Edit") . "</a> | <a href='" . $viewurl . "' title='" . $name . "'>" . gettext("View") . "</a></td>";
                    break;
            }
            echo "</tr>";
            $count++;
            if ($count === $limit) {
                break;
            }
        }
    }
    // foreach end
    echo "</table>";
}
/**
 * Handles a single album level for printAlbumMenuJump
 *
 * @param array $albums list of album names
 * @param string $showcount see printAlbumMenuJump
 * @param string $albumpath path of the page album
 * @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 int $level current level
 */
function printAlbumMenuJumpAlbum($albums, $option, $albumpath, $firstimagelink, $level = 1)
{
    global $_zp_gallery;
    foreach ($albums as $album) {
        $subalbum = new Album($_zp_gallery, $album, true);
        if ($option === "count" and $subalbum->getNumImages() > 0) {
            $count = " (" . $subalbum->getNumImages() . ")";
        } else {
            $count = "";
        }
        $arrow = str_replace(':', '&raquo; ', str_pad("", $level - 1, ":"));
        $selected = checkSelectedAlbum($subalbum->name, "album");
        if ($firstimagelink && $subalbum->getNumImages() != 0) {
            $imgurl = getFirstImageOfAlbum($subalbum);
            $link = "<option {$selected} value='" . $imgurl . "'>" . $arrow . strip_tags($subalbum->getTitle()) . $count . "</option>";
        } else {
            $link = "<option {$selected} value='" . html_encode($albumpath . pathurlencode($subalbum->name)) . "'>" . $arrow . strip_tags($subalbum->getTitle()) . $count . "</option>";
        }
        echo $link;
        $subalbums = $subalbum->getAlbums();
        if (!empty($subalbums)) {
            printAlbumMenuJumpAlbum($subalbums, $option, $albumpath, $firstimagelink, $level + 1);
        }
    }
}
/**
 * Prints a table with a bar graph of the values.
 *
 * @param string $sortorder "popular", "mostrated","toprated","mostcommented" or - only if $type = "albums"! - "mostimages" 
 * @param string_type $type "albums" or "images"
 * @param int $limit Number of entries to show
 */
function printBarGraph($sortorder = "mostimages", $type = "albums", $from_number = 0, $to_number = 10)
{
    global $gallery, $webpath;
    $limit = $from_number . "," . $to_number;
    $bargraphmaxsize = 400;
    switch ($type) {
        case "albums":
            $typename = gettext("Albums");
            $dbquery = "SELECT id, title, folder, hitcounter, total_votes, total_value, `show` FROM " . prefix('albums');
            break;
        case "images":
            $typename = gettext("Images");
            $dbquery = "SELECT id, title, filename, albumid, hitcounter, total_votes, total_value, `show` FROM " . prefix('images');
            break;
    }
    switch ($sortorder) {
        case "popular":
            $itemssorted = query_full_array($dbquery . " ORDER BY hitcounter DESC LIMIT " . $limit);
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['hitcounter'];
            }
            $headline = $typename . " - " . gettext("most viewed");
            break;
        case "mostrated":
            $itemssorted = query_full_array($dbquery . " ORDER BY total_votes DESC LIMIT " . $limit);
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['total_votes'];
            }
            $headline = $typename . " - " . gettext("most rated");
            break;
        case "toprated":
            switch ($type) {
                case "albums":
                    $itemssorted = query_full_array("SELECT * FROM " . prefix('albums') . " ORDER BY (total_value/total_votes) DESC LIMIT {$limit}");
                    break;
                case "images":
                    $itemssorted = query_full_array("SELECT * FROM " . prefix('images') . " ORDER BY (total_value/total_votes) DESC LIMIT {$limit}");
                    break;
            }
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                if ($itemssorted[0]['total_votes'] != 0) {
                    $maxvalue = $itemssorted[0]['total_value'] / $itemssorted[0]['total_votes'];
                } else {
                    $maxvalue = 0;
                }
            }
            $headline = $typename . " - " . gettext("top rated");
            break;
        case "mostcommented":
            switch ($type) {
                case "albums":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, albums.* FROM " . prefix('comments') . " AS comments, " . prefix('albums') . " AS albums WHERE albums.id=comments.ownerid AND type = 'albums' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
                case "images":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, images.* FROM " . prefix('comments') . " AS comments, " . prefix('images') . " AS images WHERE images.id=comments.ownerid AND type = 'images' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
            }
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['commentcount'];
            }
            $headline = $typename . " - " . gettext("most commented");
            break;
        case "mostimages":
            $itemssorted = query_full_array("SELECT images.albumid, count(*) as imagenumber, albums.* FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums WHERE albums.id=images.albumid GROUP BY images.albumid ORDER BY imagenumber DESC LIMIT " . $limit);
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['imagenumber'];
            }
            $headline = $typename . " - " . gettext("most images");
            break;
        case "latest":
            switch ($type) {
                case "albums":
                    $allalbums = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit);
                    $albums = array();
                    foreach ($allalbums as $album) {
                        $albumobj = new Album($gallery, $album['folder']);
                        $albumentry = array("id" => $albumobj->get('id'), "title" => $albumobj->getTitle(), "folder" => $albumobj->name, "imagenumber" => $albumobj->getNumImages(), "show" => $albumobj->get("show"));
                        array_unshift($albums, $albumentry);
                    }
                    $maxvalue = 0;
                    if (empty($albums)) {
                        $itemssorted = array();
                    } else {
                        foreach ($albums as $entry) {
                            if (array_key_exists('imagenumber', $entry)) {
                                $v = $entry['imagenumber'];
                                if ($v > $maxvalue) {
                                    $maxvalue = $v;
                                }
                            }
                        }
                        $itemssorted = $albums;
                        // The items are originally sorted by id;
                    }
                    $headline = $typename . " - " . gettext("latest");
                    break;
                case "images":
                    $itemssorted = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit);
                    $barsize = 0;
                    $maxvalue = 1;
                    $headline = $typename . " - " . gettext("latest");
                    break;
            }
            break;
        case "latestupdated":
            // part taken from the image_albums_statistics - could probably be optimized regarding queries...
            // get all albums
            $allalbums = query_full_array("SELECT id, title, folder, `show` FROM " . prefix('albums'));
            $albums = array();
            $latestimages = array();
            foreach ($allalbums as $album) {
                $albumobj = new Album($gallery, $album['folder']);
                $albumentry = array("id" => $albumobj->get('id'), "title" => $albumobj->getTitle(), "folder" => $albumobj->name, "imagenumber" => $albumobj->getNumImages(), "show" => $albumobj->get("show"));
                array_unshift($albums, $albumentry);
            }
            // get latest images of each album
            $count = 0;
            foreach ($albums as $album) {
                $count++;
                $image = query_single_row("SELECT id, albumid, mtime FROM " . prefix('images') . " WHERE albumid = " . $album['id'] . " ORDER BY id DESC LIMIT 1");
                if (is_array($image)) {
                    array_push($latestimages, $image);
                }
                if ($count === $to_number) {
                    break;
                }
            }
            // sort latest image by mtime
            $latestimages = sortMultiArray($latestimages, "mtime", "desc", false, false);
            //echo "<pre>"; print_r($albums); echo "</pre>";
            $itemssorted = array();
            $count = 0;
            foreach ($latestimages as $latestimage) {
                $count++;
                foreach ($allalbums as $album) {
                    if ($album['id'] === $latestimage['albumid']) {
                        array_push($albums, $album);
                    }
                }
                if ($count === $to_number) {
                    break;
                }
            }
            if ($to_number < 1) {
                $stopelement = 1;
            } else {
                $stopelement = $to_number;
            }
            $albums = array_slice($albums, 0, $stopelement);
            // clear unnessesary items fron array
            $maxvalue = 0;
            if (empty($albums)) {
                $itemssorted = array();
            } else {
                foreach ($albums as $key => $entry) {
                    if (array_key_exists('imagenumber', $entry)) {
                        $v = $entry['imagenumber'];
                        if ($v > $maxvalue) {
                            $maxvalue = $v;
                        }
                    } else {
                        unset($albums[$key]);
                        // if it has no imagenumber it must not be a valid entry!
                    }
                }
                $itemssorted = $albums;
                // The items are originally sorted by id;
            }
            $headline = $typename . " - " . gettext("latest updated");
            //echo "<pre>"; print_r($albums); echo "</pre>";
            break;
    }
    if ($maxvalue == 0 or empty($itemssorted)) {
        $maxvalue = 1;
        $no_statistic_message = "<tr><td><em>" . gettext("No statistic available") . "</em></td><td></td><td></td><td></td></tr>";
    } else {
        $no_statistic_message = "";
    }
    if ($from_number <= 1) {
        $count = 1;
    } else {
        $count = $from_number;
    }
    $countlines = 0;
    echo "<table class='bordered'>";
    echo "<tr><th colspan='4'><strong>" . $headline . "</strong>";
    if (isset($_GET['stats'])) {
        echo "<a href='gallery_statistics.php'> | " . gettext("Back to the top 10 lists") . "</a>";
    } else {
        if (empty($no_statistic_message)) {
            echo "<a href='gallery_statistics.php?stats=" . $sortorder . "&amp;type=" . $type . "'> | " . gettext("View more") . "</a>";
        }
        echo "<a href='#top'> | " . gettext("top") . "</a>";
    }
    echo "</th></tr>";
    echo $no_statistic_message;
    foreach ($itemssorted as $item) {
        if (array_key_exists("filename", $item)) {
            $name = $item['filename'];
        } else {
            if (array_key_exists("folder", $item)) {
                $name = $item['folder'];
            }
        }
        switch ($sortorder) {
            case "popular":
                $barsize = round($item['hitcounter'] / $maxvalue * $bargraphmaxsize);
                $value = $item['hitcounter'];
                break;
            case "mostrated":
                if ($item['total_votes'] != 0) {
                    $barsize = round($item['total_votes'] / $maxvalue * $bargraphmaxsize);
                } else {
                    $barsize = 0;
                }
                $value = $item['total_votes'];
                break;
            case "toprated":
                if ($item['total_votes'] != 0) {
                    $barsize = round($item['total_value'] / $item['total_votes'] / $maxvalue * $bargraphmaxsize);
                    $value = round($item['total_value'] / $item['total_votes']);
                } else {
                    $barsize = 0;
                    $value = 0;
                }
                break;
            case "mostcommented":
                if ($maxvalue != 0) {
                    $barsize = round($item['commentcount'] / $maxvalue * $bargraphmaxsize);
                } else {
                    $barsize = 0;
                }
                $value = $item['commentcount'];
                break;
            case "mostimages":
                $barsize = round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                $value = $item['imagenumber'];
                break;
            case "latest":
                switch ($type) {
                    case "albums":
                        $barsize = 0;
                        //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                        $value = sprintf(gettext("%s images"), $item['imagenumber']);
                        break;
                    case "images":
                        $barsize = 0;
                        $value = "";
                        break;
                }
                break;
            case "latestupdated":
                $barsize = 0;
                //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                $value = sprintf(gettext("%s images"), $item['imagenumber']);
                break;
        }
        // counter to have a gray background of every second line
        if ($countlines === 1) {
            $style = "style='background-color: #f4f4f4'";
            // a little ugly but the already attached class for the table is so easiest overriden...
            $countlines = 0;
        } else {
            $style = "";
            $countlines++;
        }
        switch ($type) {
            case "albums":
                $editurl = $webpath . "/admin.php?page=edit&amp;album=" . $name;
                $viewurl = WEBPATH . "/index.php?album=" . $name;
                break;
            case "images":
                $getalbumfolder = query_single_row("SELECT title, folder, `show` from " . prefix("albums") . " WHERE id = " . $item['albumid']);
                if ($sortorder === "latest") {
                    $value = "<span";
                    if ($getalbumfolder['show'] != "1") {
                        $value = $value . " class='unpublished_item'";
                    }
                    $value = $value . ">" . get_language_string($getalbumfolder['title']) . "</span> (" . $getalbumfolder['folder'] . ")";
                }
                $editurl = $webpath . "/admin.php?page=edit&amp;album=" . $getalbumfolder['folder'] . "&amp;image=" . $item['filename'] . "&amp;tab=imageinfo#IT";
                $viewurl = WEBPATH . "/index.php?album=" . $getalbumfolder['folder'] . "&amp;image=" . $name;
                break;
        }
        if ($item['show'] != "1") {
            $show = " class='unpublished_item'";
        } else {
            $show = "";
        }
        if ($value != 0 or $sortorder === "latest") {
            ?>
		<tr class="statistic_wrapper">
		<td class="statistic_counter" <?php 
            echo $style;
            ?>
><?php 
            echo $count;
            ?>
</td>
		<td class="statistic_title" <?php 
            echo $style;
            ?>
><strong<?php 
            echo $show;
            ?>
><?php 
            echo get_language_string($item['title']);
            ?>
</strong> (<?php 
            echo $name;
            ?>
)</td>
		<td class="statistic_graphwrap" <?php 
            echo $style;
            ?>
><div class="statistic_bargraph" style="width: <?php 
            echo $barsize;
            ?>
px"></div><div class="statistic_value"><?php 
            echo $value;
            ?>
</div></td>
		<td class="statistic_link" <?php 
            echo $style;
            ?>
>
		<?php 
            echo "<a href='" . $editurl . "' title='" . $name . "'>" . gettext("Edit") . "</a> | <a href='" . $viewurl . "' title='" . $name . "'>" . gettext("View") . "</a></td";
            echo "</tr>";
            $count++;
            if ($count === $limit) {
                break;
            }
        }
    }
    // foreach end
    echo "</table>";
}
/**
 * A helper function that only prints a item of the loop within printAlbumStatistic()
 * Not for standalone use.
 *
 * @param array $album the array that getAlbumsStatistic() submitted
 * @param string $option "popular" for the most popular albums,
 *                  "latest" for the latest uploaded,
 *                  "mostrated" for the most voted,
 *                  "toprated" for the best voted
 * 									"latestupdated" for the latest updated
 * @param bool $showtitle if the album title should be shown
 * @param bool $showdate if the album date should be shown
 * @param bool $showdesc if the album description should be shown
 * @param integer $desclength the length of the description to be shown
 * @param string $showstatistic "hitcounter" for showing the hitcounter (views),
 * 															"rating" for rating,
 * 															"rating+hitcounter" for both.
 * @param integer $width the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px)
 * @param integer $height the height/cropheight of the thumb if crop=true else not used.  (Default 85px)
 * @param bool $crop 'true' (default) if the thumb should be cropped, 'false' if not
 * @param bool $firstimglink 'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images
 */
function printAlbumStatisticItem($album, $option, $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = 85, $height = 85, $crop = true, $firstimglink = false)
{
    global $_zp_gallery;
    $tempalbum = new Album($_zp_gallery, $album['folder']);
    if ($firstimglink && $tempalbum->getNumImages() != 0) {
        $firstimage = $tempalbum->getImages(1);
        // need only the first so don't get all
        $firstimage = $firstimage[0];
        $modrewritesuffix = getOption('mod_rewrite_image_suffix');
        $imagepath = html_encode(rewrite_path("/" . $firstimage . $modrewritesuffix, "&amp;image=" . $firstimage, false));
    } else {
        $imagepath = "";
    }
    $albumpath = html_encode(rewrite_path("/" . pathurlencode($tempalbum->name) . $imagepath, "index.php?album=" . pathurlencode($tempalbum->name) . $imagepath));
    echo "<li><a href=\"" . $albumpath . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n";
    $albumthumb = $tempalbum->getAlbumThumbImage();
    $thumb = newImage($tempalbum, $albumthumb->filename);
    if ($crop) {
        echo "<img src=\"" . html_encode($albumthumb->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($albumthumb->getTitle()) . "\" /></a>\n<br />";
    } else {
        echo "<img src=\"" . html_encode($albumthumb->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($albumthumb->getTitle()) . "\" /></a>\n<br />";
    }
    if ($showtitle) {
        echo "<h3><a href=\"" . $albumpath . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n";
        echo $tempalbum->getTitle() . "</a></h3>\n";
    }
    if ($showdate) {
        if ($option === "latestupdated") {
            $filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($tempalbum->name));
            $latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $tempalbum->getAlbumID() . " AND `show` = 1 ORDER BY id DESC");
            $lastuploaded = query("SELECT COUNT(*) FROM " . prefix('images') . " WHERE albumid = " . $tempalbum->getAlbumID() . " AND mtime = " . $latestimage['mtime']);
            $row = db_fetch_row($lastuploaded);
            $count = $row[0];
            echo "<p>" . sprintf(gettext("Last update: %s"), zpFormattedDate(DATE_FORMAT, $filechangedate)) . "</p>";
            if ($count <= 1) {
                $image = gettext("image");
            } else {
                $image = gettext("images");
            }
            echo "<span>" . sprintf(gettext('%1$u new %2$s'), $count, $image) . "</span>";
        } else {
            echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($tempalbum->getDateTime())) . "</p>";
        }
    }
    if ($showstatistic === "rating" or $showstatistic === "rating+hitcounter") {
        $votes = $tempalbum->get("total_votes");
        $value = $tempalbum->get("total_value");
        if ($votes != 0) {
            $rating = round($value / $votes, 1);
        }
        echo "<p>" . sprintf(gettext('Rating: %1$u (Votes: %2$u)'), $rating, $tempalbum->get("total_votes")) . "</p>";
    }
    if ($showstatistic === "hitcounter" or $showstatistic === "rating+hitcounter") {
        $hitcounter = $tempalbum->get("hitcounter");
        if (empty($hitcounter)) {
            $hitcounter = "0";
        }
        echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>";
    }
    if ($showdesc) {
        echo shortenContent($tempalbum->getDesc(), $desclength, ' (...)');
    }
    echo "</li>";
}
Example #6
0
}
foreach ($result as $item) {
    if ($rssmode != "albums") {
        $ext = strtolower(strrchr($item->filename, "."));
        $albumobj = $item->getAlbum();
        $itemlink = $host . WEBPATH . $albumpath . pathurlencode($albumobj->name) . $imagepath . pathurlencode($item->filename) . $modrewritesuffix;
        $fullimagelink = $host . WEBPATH . "/albums/" . pathurlencode($albumobj->name) . "/" . $item->filename;
        $imagefile = "albums/" . $albumobj->name . "/" . $item->filename;
        $thumburl = '<img border="0" src="' . $protocol . '://' . $host . $item->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, TRUE) . '" alt="' . get_language_string(get_language_string($item->get("title"), $locale)) . '" />';
        $itemcontent = '<![CDATA[<a title="' . html_encode(get_language_string($item->get("title"), $locale)) . ' in ' . html_encode(get_language_string($albumobj->get("title"), $locale)) . '" href="' . $protocol . '://' . $itemlink . '">' . $thumburl . '</a>' . get_language_string(get_language_string($item->get("desc"), $locale)) . ']]>';
        $videocontent = '<![CDATA[<a title="' . html_encode(get_language_string($item->get("title"), $locale)) . ' in ' . html_encode(get_language_string($albumobj->getTitle(), $locale)) . '" href="' . $protocol . '://' . $itemlink . '"><img src="' . $protocol . '://' . $host . $item->getThumb() . '" alt="' . get_language_string(get_language_string($item->get("title"), $locale)) . '" /></a>' . get_language_string(get_language_string($item->get("desc"), $locale)) . ']]>';
        $datecontent = '<![CDATA[Date: ' . zpFormattedDate(DATE_FORMAT, $item->get('mtime')) . ']]>';
    } else {
        $galleryobj = new Gallery();
        $albumitem = new Album($galleryobj, $item['folder']);
        $totalimages = $albumitem->getNumImages();
        $itemlink = $host . WEBPATH . $albumpath . pathurlencode($albumitem->name);
        $thumb = $albumitem->getAlbumThumbImage();
        $thumburl = '<img border="0" src="' . $thumb->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, TRUE) . '" alt="' . html_encode(get_language_string($albumitem->get("title"), $locale)) . '" />';
        $title = get_language_string($albumitem->get("title"), $locale);
        if (true || getOption("feed_sortorder_albums") == "latestupdated") {
            $filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($albumitem->name));
            $latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $albumitem->getAlbumID() . " AND `show` = 1 ORDER BY id DESC");
            $lastuploaded = query("SELECT COUNT(*) FROM " . prefix('images') . " WHERE albumid = " . $albumitem->getAlbumID() . " AND mtime = " . $latestimage['mtime']);
            $row = db_fetch_row($lastuploaded);
            $count = $row[0];
            if ($count == 1) {
                $imagenumber = sprintf(gettext('%s (1 new image)'), $title);
            } else {
                $imagenumber = sprintf(gettext('%1$s (%2$s new images)'), $title, $count);
            }
function getUploadImagesInAlbum($albumlist)
{
    $numbers = array();
    foreach ($albumlist as $key => $value) {
        $obj = new Album($gallery, $key);
        $numbers[] = $obj->getNumImages();
    }
    $numimages = count($numbers);
    $content = $count = '';
    foreach ($numbers as $number) {
        $content .= "'";
        $count++;
        $content .= $number;
        if ($count < $numimages) {
            $content .= "',";
            // js array entry end
        } else {
            $content .= "'";
            // js array end
        }
    }
    return $content;
}
Example #8
0
        echo "<h2>" . gettext("Hitcounters have been reset") . "</h2>";
        echo '</div>';
    }
    ?>
<h1><?php 
    echo gettext("Edit Album:");
    ?>
 <em><?php 
    echo $album->name;
    ?>
</em></h1>
<p><?php 
    printAlbumEditLinks('' . $albumdir, "&laquo; " . gettext("Back"), gettext("Back to the list of albums (go up one level)"));
    ?>
 | <?php 
    if (!$album->isDynamic() && $album->getNumImages() > 1) {
        printSortLink($album, gettext("Sort Album"), gettext("Sort Album"));
        echo ' | ';
    }
    printViewLink($album, gettext("View Album"), gettext("View Album"));
    ?>
</p>


	<?php 
    displayDeleted();
    /* Display a message if needed. Fade out and hide after 2 seconds. */
    ?>
	<?php 
    if (isset($_GET['saved'])) {
        if (isset($_GET['mismatch'])) {
/**
 * Checks if an album has images for display on the form
 *
 * @return bool
 */
function checkAlbumForImages()
{
    global $_zp_gallery;
    if (isset($_GET['album']) and !empty($_GET['album'])) {
        $album = urldecode(sanitize($_GET['album']));
        if ($album == 'gallery') {
            return FALSE;
        }
        $albumobj = new Album($_zp_gallery, $album);
        if ($albumobj->getNumImages() != 0) {
            return TRUE;
        } else {
            return FALSE;
        }
    } else {
        return TRUE;
    }
}
/**
 * Show the content of an media album with .flv/.mp4/.mp3 movie/audio files only as a playlist or as separate players with Flowplayer 3
 * Important: The Flowplayer 3 plugin needs to be activated to use this plugin. This plugin shares all settings with this plugin, too.
 *
 * You can either show a 'one player window' playlist or show all items as separate players paginated. See the examples below.
 * (set in the settings for thumbs per page) on one page (like on a audio or podcast blog).
 *
 * There are two usage modes:
 *
 * a) 'playlist'
 * 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, although Flowplayer 3 also supports images
 * Replace the entire 'next_image()' loop on album.php with this:
 * <?php flowplayerPlaylist("playlist"); ?>
 *
 * This produces the following html:
 * <div class="wrapper">
 * <a class="up" title="Up"></a>
 * <div class="playlist">
 * <div class="clips">
 * <!-- single playlist entry as an "template" -->
 * <a href="${url}">${title}</a>
 * </div>
 * </div>
 * <a class="down" title="Down"></a>
 * </div>
 * </div>
 * This is styled by the css file 'playlist.css" that is located within the 'zp-core/plugins/flowplayer3_playlist/flowplayer3_playlist.css' by default.
 * Alternatively you can style it specifically for your theme. Just place a css file named "flowplayer3_playlist.css" in your theme's folder.
 *
 * b) 'players'
 * This displays each audio/movie file as a separate player on album.php.
 * If there is no videothumb image for an mp3 file existing only the player control bar is shown.
 * Modify the 'next_image()' loop on album.php like this:
 * <?php
 * while (next_image()):
 * flowplayerPlaylist("players");
 * endwhile;
 * ?>
 * Of course you can add further functions to b) like printImageTitle() etc., too.
 *
 * @param string $option The mode to use "players", "playlist" or "playlist-mp3". "playlist-mp3" is the same as "playlist" except that only the controlbar is shown (if you are too lazy for custom video thumbs and don't like the empty screen)
 * @param string $albumfolder For "playlist" mode only: To show a playlist of an specific album directly on another page (for example on index.php). Note: Currently it is not possible to have several playlists on one page
 */
function flowplayerPlaylist($option = "playlist", $albumfolder = "")
{
    global $_zp_current_image, $_zp_current_album, $_zp_flash_player;
    $curdir = getcwd();
    chdir(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/flowplayer3');
    $filelist = safe_glob('flowplayer-*.swf');
    $swf = array_shift($filelist);
    $filelist = safe_glob('flowplayer.audio-*.swf');
    $audio = array_shift($filelist);
    $filelist = safe_glob('flowplayer.controls-*.swf');
    $controls = array_shift($filelist);
    chdir($curdir);
    $playlistwidth = getOption('flow_player3_playlistwidth');
    $playlistheight = getOption('flow_player3_playlistheight');
    switch ($option) {
        case 'playlist':
        case 'playlist-mp3':
            $splashimage = getOption('flow_player3_playlistsplashimage');
            if ($option == 'playlist-mp3') {
                $playlistheight = FLOW_PLAYER_MP3_HEIGHT;
                $splashimage = 'none';
            }
            if (empty($albumfolder)) {
                $albumname = $_zp_current_album->name;
            } else {
                $albumname = $albumfolder;
            }
            $album = new Album(new Gallery(), $albumname);
            if (getOption("flow_player3_playlistautoplay") == 1) {
                $autoplay = 'true';
            } else {
                $autoplay = 'false';
            }
            $playlist = $album->getImages();
            // slash image fetching
            $videoobj = new Video($album, $playlist[0]);
            $albumfolder = $album->name;
            $splashimagerwidth = $playlistwidth;
            $splashimageheight = $playlistheight;
            $videoThumbImg = '';
            if ($splashimage != 'none') {
                switch ($splashimage) {
                    case 'albumthumb':
                        $albumthumbobj = $album->getAlbumThumbImage();
                        getMaxSpaceContainer($splashimagerwidth, $splashimageheight, $albumthumbobj, true);
                        $albumthumb = $albumthumbobj->getCustomImage(null, $splashimagerwidth, $splashimageheight, null, null, null, null, true);
                        $videoThumbImg = '<img src="' . pathurlencode($albumthumb) . '" alt="" />';
                        break;
                    case 'firstentry':
                        getMaxSpaceContainer($splashimagerwidth, $splashimageheight, $videoobj, true);
                        $videoThumb = $videoobj->getCustomImage(null, $splashimagerwidth, $splashimageheight, null, null, null, null, true);
                        $videoThumbImg = '<img src="' . pathurlencode($videoThumb) . '" alt="" />';
                        break;
                }
            }
            if ($album->getNumImages() != 0) {
                if (getOption('flow_player3_playlistnumbered')) {
                    $liststyle = 'ol';
                } else {
                    $liststyle = 'div';
                }
                echo '<div class="flowplayer3_playlistwrapper">
			<a id="player' . $album->get('id') . '" class="flowplayer3_playlist" style="display:block; width: ' . $playlistwidth . 'px; height: ' . $playlistheight . 'px;">
			' . $videoThumbImg . '
			</a>
			<script type="text/javascript">
			// <!-- <![CDATA[
			$(function() {

			$("div.playlist").scrollable({
				items:"' . $liststyle . '.clips' . $album->get('id') . '",
				vertical:true,
				next:"a.down",
				prev:"a.up",
				mousewheel: true
			});
			flowplayer("player' . $album->get('id') . '","' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/flowplayer3/' . $swf . '", {
			plugins: {
				audio: {
					url: "' . $audio . '"
				},
				controls: {
					url: "' . $controls . '",
					backgroundColor: "' . getOption('flow_player3_controlsbackgroundcolor') . '",
					autoHide: "' . getOption('flow_player3_playlistautohide') . '",
					timeColor:"' . getOption('flow_player3_controlstimecolor') . '",
					durationColor: "' . getOption('flow_player3_controlsdurationcolor') . '",
					progressColor: "' . getOption('flow_player3_controlsprogresscolor') . '",
					progressGradient: "' . getOption('flow_player3_controlsprogressgradient') . '",
					bufferColor: "' . getOption('flow_player3_controlsbuffercolor') . '",
					bufferGradient:	 "' . getOption('fflow_player3_controlsbuffergradient') . '",
					sliderColor: "' . getOption('flow_player3_controlsslidercolor') . '",
					sliderGradient: "' . getOption('flow_player3_controlsslidergradient') . '",
					buttonColor: "' . getOption('flow_player3_controlsbuttoncolor') . '",
					buttonOverColor: "' . getOption('flow_player3_controlsbuttonovercolor') . '",
					scaling: "' . getOption('flow_player3_scaling') . '",
					playlist: true
				}
			},
			canvas: {
				backgroundColor: "' . getOption('flow_player3_backgroundcolor') . '",
				backgroundGradient: "' . getOption('flow_player3_backgroundcolorgradient') . '"
			},';
                $list = '';
                foreach ($playlist as $item) {
                    $image = newImage($album, $item);
                    $coverimagerwidth = getOption('flow_player3_playlistwidth');
                    $coverimageheight = getOption('flow_player3_playlistheight');
                    getMaxSpaceContainer($coverimagerwidth, $coverimageheight, $image, true);
                    $cover = $image->getCustomImage(null, $coverimagerwidth, $coverimageheight, null, null, null, null, true);
                    $ext = strtolower(strrchr($item, "."));
                    if ($ext == ".flv" || $ext == ".mp3" || $ext == ".mp4") {
                        $list .= '{
					url:"' . ALBUM_FOLDER_WEBPATH . $album->name . '/' . $item . '",
					autoPlay: ' . $autoplay . ',
					title: "' . $image->getTitle() . ' <small>(' . $ext . ')</small>",
					autoBuffering: ' . $autoplay . ',
					coverImage: {
						url: "' . urlencode($cover) . '",
						scaling: "fit"
					}
				},';
                    }
                    // if ext end
                }
                // foreach end
                echo 'playlist: [' . substr($list, 0, -1) . ']
			});
			flowplayer("player' . $album->get('id') . '").playlist("' . $liststyle . '.clips' . $album->get('id') . ':first", {loop:true});
			});
			// ]]> -->
			</script>';
                ?>
		<div class="wrapper">
					<a class="up" title="Up"></a>

			<div class="playlist playlist<?php 
                echo $album->get('id');
                ?>
">
				<<?php 
                echo $liststyle;
                ?>
 class="clips clips<?php 
                echo $album->get('id');
                ?>
">
					<!-- single playlist entry as an "template" -->
					<?php 
                if ($liststyle == 'ol') {
                    ?>
 <li> <?php 
                }
                ?>
					<a href="${url}">${title}</a>
					<?php 
                if ($liststyle == 'ol') {
                    ?>
 </li> <?php 
                }
                ?>
				</<?php 
                echo $liststyle;
                ?>
>
			</div>
		<a class="down" title="Down"></a>
</div>
</div><!-- flowplayer3_playlist wrapper end -->
<?php 
            }
            // check if there are images end
            break;
        case 'players':
            $_zp_flash_player->printPlayerConfig('', '', imageNumber());
            break;
    }
    // switch end
}