Example #1
0
 /**
  * Gets news articles and images of a gallery to show them together on the news section
  *
  * NOTE: This function does not exclude articles that are password protected via a category
  *
  * @param int $articles_per_page The number of articles to get
  * @param string $mode 	"latestimages-thumbnail"
  * 											"latestimages-thumbnail-customcrop"
  * 											"latestimages-sizedimage"
  * 											"latestalbums-thumbnail"
  * 		 									"latestalbums-thumbnail-customcrop"
  * 		 									"latestalbums-sizedimage"
  * 		 									"latestimagesbyalbum-thumbnail"
  * 		 									"latestimagesbyalbum-thumbnail-customcrop"
  * 		 									"latestimagesbyalbum-sizedimage"
  * 		 									"latestupdatedalbums-thumbnail" (for RSS and getLatestNews() used only)
  * 		 									"latestupdatedalbums-thumbnail-customcrop" (for RSS and getLatestNews() used only)
  * 		 									"latestupdatedalbums-sizedimage" (for RSS and getLatestNews() used only)
  * 	NOTE: The "latestupdatedalbums" variants do NOT support pagination as required on the news loop!
  *
  * @param string $published "published" for published articles,
  * 													"unpublished" for un-published articles,
  * 													"all" for all articles
  * @param string $sortorder 	id, date or mtime, only for latestimages-... modes
  * @param bool $sticky set to true to place "sticky" articles at the front of the list.
  * @param string $direction 	"desc" or "asc"
  * @return array
  * @deprecated since version 1.4.6
  */
 protected function getCombiNews($articles_per_page = '', $mode = '', $published = NULL, $sortorder = NULL, $sticky = true, $sortdirection = 'desc')
 {
     global $_zp_combiNews_cache, $_zp_gallery;
     if (is_null($published)) {
         if (zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS)) {
             $published = "all";
         } else {
             $published = "published";
         }
     }
     if (empty($mode)) {
         $mode = getOption('zenpage_combinews_mode');
     }
     if (isset($_zp_combiNews_cache[$published . $mode . $sticky . $sortorder . $sortdirection])) {
         return $_zp_combiNews_cache[$published . $mode . $sticky . $sortorder . $sortdirection];
     }
     if ($published == "published") {
         $show = " WHERE `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'";
         $imagesshow = " AND images.show = 1 ";
     } else {
         $show = "";
         $imagesshow = "";
     }
     getAllAccessibleAlbums($_zp_gallery, $albumlist, false);
     if (empty($albumlist)) {
         $albumWhere = 'albums.`id` is NULL';
     } else {
         $albumWhere = 'albums.`id` in (' . implode(',', $albumlist) . ')';
     }
     if ($articles_per_page) {
         $offset = self::getOffset($articles_per_page);
     } else {
         $offset = 0;
     }
     if (empty($sortorder)) {
         $combinews_sortorder = getOption("zenpage_combinews_sortorder");
     } else {
         $combinews_sortorder = $sortorder;
     }
     $stickyorder = '';
     if ($sticky) {
         $stickyorder = 'sticky DESC,';
     }
     switch (strtolower($sortdirection)) {
         case 'desc':
         default:
             $sortdir = 'DESC';
             break;
         case 'asc':
             $sortdir = 'ASC';
             break;
     }
     $type3 = query("SET @type3:='0'");
     switch ($mode) {
         case "latestimages-thumbnail":
         case "latestimages-thumbnail-customcrop":
         case "latestimages-sizedimage":
         case "latestimages-sizedimage-maxspace":
         case "latestimages-fullimage":
             $albumWhere = ' AND ' . $albumWhere;
             $sortorder = $combinews_sortorder;
             $type1 = query("SET @type1:='news'");
             $type2 = query("SET @type2:='images'");
             switch ($combinews_sortorder) {
                 case 'id':
                 case 'date':
                     $imagequery = "(SELECT albums.folder, images.filename, images.date, @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                     break;
                 case 'publishdate':
                     $imagequery = "(SELECT albums.folder, images.filename, IFNULL(images.publishdate,images.date), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                 case 'mtime':
                     $imagequery = "(SELECT albums.folder, images.filename, FROM_UNIXTIME(images.mtime), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                     break;
             }
             $result = $this->siftResults("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date " . $sortdir, $offset, $articles_per_page);
             break;
         case "latestalbums-thumbnail":
         case "latestalbums-thumbnail-customcrop":
         case "latestalbums-sizedimage":
         case "latestalbums-sizedimage-maxspace":
         case "latestalbums-fullimage":
         default:
             if (empty($show)) {
                 $albumWhere = ' WHERE ' . $albumWhere;
             } else {
                 $albumWhere = ' AND ' . $albumWhere;
             }
             $sortorder = $combinews_sortorder;
             $type1 = query("SET @type1:='news'");
             $type2 = query("SET @type2:='albums'");
             switch ($combinews_sortorder) {
                 case 'id':
                 case 'date':
                     $albumquery = "(SELECT albums.folder, albums.title, albums.date, @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")";
                     break;
                 case 'publishdate':
                     $albumquery = "(SELECT albums.folder, albums.title, IFNULL(albums.publishdate,albums.date), @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . $show . $albumWhere . ")";
                     break;
                 case 'mtime':
                 default:
                     $albumquery = "(SELECT albums.folder, albums.title, FROM_UNIXTIME(albums.mtime), @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")";
                     break;
             }
             $result = $this->siftResults("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $albumquery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date " . $sortdir, $offset, $articles_per_page);
             break;
         case "latestimagesbyalbum-thumbnail":
         case "latestimagesbyalbum-thumbnail-customcrop":
         case "latestimagesbyalbum-sizedimage":
         case "latestimagesbyalbum-sizedimage-maxspace":
         case "latestimagesbyalbum-fullimage":
             $albumWhere = ' AND ' . $albumWhere;
             $type1 = query("SET @type1:='news'");
             $type2 = query("SET @type2:='albums'");
             if (empty($combinews_sortorder) || $combinews_sortorder != "date" || $combinews_sortorder != "mtime" || $combinews_sortorder != "publishdate") {
                 $combinews_sortorder = "date";
             }
             $sortorder = "images." . $combinews_sortorder;
             switch ($combinews_sortorder) {
                 case "date":
                     $imagequery = "(SELECT DISTINCT DATE_FORMAT(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.date,'%Y-%m-%d'), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                     break;
                 case "mtime":
                     $imagequery = "(SELECT DISTINCT FROM_UNIXTIME(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.mtime,'%Y-%m-%d'), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                 case "publishdate":
                     $imagequery = "(SELECT DISTINCT FROM_UNIXTIME(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.publishdate,'%Y-%m-%d'), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                     break;
             }
             $result = $this->siftResults("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER By {$stickyorder} date " . $sortdir, $offset, $articles_per_page);
             break;
         case "latestupdatedalbums-thumbnail":
         case "latestupdatedalbums-thumbnail-customcrop":
         case "latestupdatedalbums-sizedimage":
         case "latestupdatedalbums-sizedimage-maxspace":
         case "latestupdatedalbums-fullimage":
             $latest = $this->getArticles($articles_per_page, NULL, true, 'date', $sortdirection);
             $counter = '';
             foreach ($latest as $news) {
                 $article = new ZenpageNews($news['titlelink']);
                 if ($article->checkAccess()) {
                     $counter++;
                     $latestnews[$counter] = array("albumname" => $article->getTitle(), "titlelink" => $article->getTitlelink(), "date" => $article->getDateTime(), "type" => "news");
                 }
             }
             $albums = getAlbumStatistic($articles_per_page, "latestupdated", '', $sortdirection);
             $latestalbums = array();
             $counter = "";
             foreach ($albums as $album) {
                 $counter++;
                 $tempalbum = $album;
                 $tempalbumthumb = $tempalbum->getAlbumThumbImage();
                 $timestamp = $tempalbum->get('mtime');
                 if ($timestamp == 0) {
                     $albumdate = $tempalbum->getDateTime();
                 } else {
                     $albumdate = strftime('%Y-%m-%d %H:%M:%S', $timestamp);
                 }
                 $latestalbums[$counter] = array("albumname" => $tempalbum->getFileName(), "titlelink" => $tempalbum->getTitle(), "date" => $albumdate, "type" => 'albums');
             }
             //$latestalbums = array_merge($latestalbums, $item);
             $latest = array_merge($latestnews, $latestalbums);
             $result = sortMultiArray($latest, "date", $sortdirection != 'asc');
             if (count($result) > $articles_per_page) {
                 $result = array_slice($result, 0, $articles_per_page);
             }
             break;
     }
     $_zp_combiNews_cache[$published . $mode . $sticky . $sortorder . $sortdirection] = $result;
     return $result;
 }
Example #2
0
/**
 * Prints an image or album statistic slideshow using the {@link http://galleria.io/  jQuery plugin Galleria}
 *
 * See readme/documentation for usage:
 * Call directly in a template file or codeblock.
 *
 * NOTE: movie and audio files not supported.
 *
 * @param string $type return statistics of either 'images' or 'albums'
 * @param integer $number the number of items to get (images or albums, depending on $type set)
 * @param string $option
 *  	"popular" for the most popular
 *		"latest" for the latest uploaded by id (Discovery)
 * 		"latest-date" for the latest by date
 * 		"latest-mtime" for the latest by mtime
 *   	"latest-publishdate" for the latest by publishdate
 *      "mostrated" for the most voted
 *		"toprated" for the best voted
 *		"latestupdated" for the latest updated
 *		"random" for random order (yes, strictly no statistical order...)
 * @param string $albumfolder foldername of a specific album to pull items from
 * @param bool $collection only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums
 * @param bool $linkslides true to link to image or album on slide, else click advances slideshow instead
 * @param mixed $autoplay true to autoplay slideshow with interval set in options, false to start with slideshow stopped.  Set integer in milliseconds to autoplay at that interval (Ex. 4000), overriding plugin option set.
 * @param integer $threshold the minimum number of ratings an image must have to be included in the list. (Default 0)
 *
 */
function printGslideshowStatistic($type, $number, $option, $albumfolder = '', $collection = false, $linkslides = true, $autoplay = true, $threshold = 0)
{
    save_context();
    $data = 'data';
    $embedded = true;
    $forceheight = true;
    $imagenumber = 0;
    $albumtitle = '';
    $returnpath = '';
    require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
    if ($type == 'album' || $type == 'albums') {
        $albums = getAlbumStatistic($number, $option, $albumfolder);
    } else {
        $images = getImageStatistic($number, $option, $albumfolder, $collection, $threshold);
    }
    ?>

			<script>
				var data = [

	<?php 
    if ($type == 'album' || $type == 'albums') {
        $c = 1;
        foreach ($albums as $album) {
            $tempalbum = newAlbum($album['folder']);
            $albumpath = html_encode(rewrite_path("/" . pathurlencode($tempalbum->name), "index.php?album=" . pathurlencode($tempalbum->name)));
            $albumthumb = $tempalbum->getAlbumThumbImage();
            $image = newImage($tempalbum, $albumthumb->filename);
            $ext = isImagePhoto($image);
            if ($ext) {
                makeImageCurrent($image);
                echo '{' . "\n";
                echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
                echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
                echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
                echo 'title: \'' . html_encode($tempalbum->getTitle()) . '\',' . "\n";
                $desc = $tempalbum->getDesc();
                $desc = str_replace("\r\n", '<br />', $desc);
                $desc = str_replace("\r", '<br />', $desc);
                echo 'description: \'' . js_encode($desc) . '\',' . "\n";
                echo 'link: \'' . $albumpath . '\'' . "\n";
                if ($c == $number) {
                    echo '}' . "\n";
                } else {
                    echo '},' . "\n";
                }
            }
            $c++;
        }
        echo "\n";
    } else {
        $c = 1;
        foreach ($images as $image) {
            $ext = isImagePhoto($image);
            if ($ext) {
                makeImageCurrent($image);
                echo '{' . "\n";
                echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
                echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
                echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
                echo 'title: \'' . html_encode($image->getTitle()) . '\',' . "\n";
                $desc = $image->getDesc();
                $desc = str_replace("\r\n", '<br />', $desc);
                $desc = str_replace("\r", '<br />', $desc);
                echo 'description: \'' . js_encode($desc) . '\',' . "\n";
                echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n";
                if ($c == $number) {
                    echo '}' . "\n";
                } else {
                    echo '},' . "\n";
                }
            }
            $c++;
        }
        echo "\n";
    }
    ?>
				];
			</script>
			<?php 
    printGalleriaRun($data, $linkslides, $autoplay, $embedded, $forceheight, $imagenumber, $albumtitle, $returnpath);
    restore_context();
    // needed if the slideshow is for example called directly via album object before the next_album loop on index.php
}
Example #3
0
 /**
  * Gets the feed items
  *
  * @return array
  */
 public function getitems()
 {
     global $_zp_CMS;
     switch ($this->feedtype) {
         case 'gallery':
             if ($this->mode == "albums") {
                 $items = getAlbumStatistic($this->itemnumber, $this->sortorder, $this->albumfolder, 0, $this->sortdirection);
             } else {
                 $items = getImageStatistic($this->itemnumber, $this->sortorder, $this->albumfolder, $this->collection, 0, $this->sortdirection);
             }
             break;
         case 'news':
             switch ($this->newsoption) {
                 case "category":
                     if ($this->sortorder) {
                         $items = getZenpageStatistic($this->itemnumber, 'categories', $this->sortorder, $this->sortdirection);
                     } else {
                         $items = getLatestNews($this->itemnumber, $this->catlink, false, $this->sortdirection);
                     }
                     break;
                 default:
                 case "news":
                     if ($this->sortorder) {
                         $items = getZenpageStatistic($this->itemnumber, 'news', $this->sortorder, $this->sortdirection);
                     } else {
                         // Needed baceause type variable "news" is used by the feed item method and not set by the class method getArticles!
                         $items = getLatestNews($this->itemnumber, '', false, $this->sortdirection);
                     }
                     break;
             }
             break;
         case "pages":
             if ($this->sortorder) {
                 $items = getZenpageStatistic($this->itemnumber, 'pages', $this->sortorder, $this->sortdirection);
             } else {
                 $items = $_zp_CMS->getPages(NULL, false, $this->itemnumber);
             }
             break;
         case 'comments':
             switch ($type = $this->commentfeedtype) {
                 case 'gallery':
                     $items = getLatestComments($this->itemnumber, 'all');
                     break;
                 case 'album':
                     $items = getLatestComments($this->itemnumber, 'album', $this->id);
                     break;
                 case 'image':
                     $items = getLatestComments($this->itemnumber, 'image', $this->id);
                     break;
                 case 'zenpage':
                     $type = 'all';
                 case 'news':
                 case 'page':
                     if (function_exists('getLatestZenpageComments')) {
                         $items = getLatestZenpageComments($this->itemnumber, $type, $this->id);
                     }
                     break;
                 case 'allcomments':
                     $items = getLatestComments($this->itemnumber, 'all');
                     $items_zenpage = array();
                     if (function_exists('getLatestZenpageComments')) {
                         $items_zenpage = getLatestZenpageComments($this->itemnumber, 'all', $this->id);
                         $items = array_merge($items, $items_zenpage);
                         $items = sortMultiArray($items, 'date', true);
                         $items = array_slice($items, 0, $this->itemnumber);
                     }
                     break;
             }
             break;
     }
     if (isset($items)) {
         return $items;
     }
     if (TEST_RELEASE) {
         zp_error(gettext('Bad ' . $this->feed . ' feed:' . $this->feedtype), E_USER_WARNING);
     }
     return NULL;
 }
/**
 * 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>";
}
/**
 * Gets news articles and images of a gallery to show them together on the news section
 *
 * NOTE: This function does not exclude articles that are password protected via a category
 *
 * @param int $articles_per_page The number of articles to get
 * @param string $mode 	"latestimages-thumbnail"
 *											"latestimages-thumbnail-customcrop"
 *											"latestimages-sizedimage"
 *											"latestalbums-thumbnail"
 *		 									"latestalbums-thumbnail-customcrop"
 *		 									"latestalbums-sizedimage"
 *		 									"latestimagesbyalbum-thumbnail"
 *		 									"latestimagesbyalbum-thumbnail-customcrop"
 *		 									"latestimagesbyalbum-sizedimage"
 *		 									"latestupdatedalbums-thumbnail" (for RSS and getLatestNews() used only)
 *		 									"latestupdatedalbums-thumbnail-customcrop" (for RSS and getLatestNews() used only)
 *		 									"latestupdatedalbums-sizedimage" (for RSS and getLatestNews() used only)
 *	NOTE: The "latestupdatedalbums" variants do NOT support pagination as required on the news loop!
 *
 * @param string $published "published" for published articles,
 * 													"unpublished" for un-published articles,
 * 													"all" for all articles
 * @param string $sortorder 	id, date or mtime, only for latestimages-... modes
 * @param bool $sticky set to true to place "sticky" articles at the front of the list.
 * @return array
 */
function getCombiNews($articles_per_page = '', $mode = '', $published = NULL, $sortorder = '', $sticky = true)
{
    deprecated_function_notify(gettext('Use the Zenpage class method instead.'));
    global $_zp_gallery, $_zp_flash_player;
    processExpired('news');
    if (is_null($published)) {
        if (zp_loggedin(ZENPAGE_NEWS_RIGHTS)) {
            $published = "all";
        } else {
            $published = "published";
        }
    }
    if (empty($mode)) {
        $mode = getOption("zenpage_combinews_mode");
    }
    if ($published == "published") {
        $show = " WHERE `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'";
        $imagesshow = " AND images.show = 1 ";
    } else {
        $show = "";
        $imagesshow = "";
    }
    $passwordcheck = "";
    if (zp_loggedin(ZENPAGE_NEWS_RIGHTS)) {
        $albumWhere = "";
        $passwordcheck = "";
    } else {
        $albumscheck = query_full_array("SELECT * FROM " . prefix('albums') . " ORDER BY title");
        foreach ($albumscheck as $albumcheck) {
            if (!checkAlbumPassword($albumcheck['folder'])) {
                $albumpasswordcheck = " AND albums.id != " . $albumcheck['id'];
                $passwordcheck = $passwordcheck . $albumpasswordcheck;
            }
        }
        $albumWhere = "AND albums.show=1" . $passwordcheck;
    }
    $limit = getLimitAndOffset($articles_per_page);
    if (empty($sortorder)) {
        $combinews_sortorder = getOption("zenpage_combinews_sortorder");
    } else {
        $combinews_sortorder = $sortorder;
    }
    $stickyorder = '';
    if ($sticky) {
        $stickyorder = 'sticky DESC,';
    }
    $type3 = query("SET @type3:='0'");
    switch ($mode) {
        case "latestimages-thumbnail":
        case "latestimages-thumbnail-customcrop":
        case "latestimages-sizedimage":
            $sortorder = "images." . $combinews_sortorder;
            $type1 = query("SET @type1:='news'");
            $type2 = query("SET @type2:='images'");
            switch ($combinews_sortorder) {
                case 'id':
                case 'date':
                    $imagequery = "(SELECT albums.folder, images.filename, images.date, @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                    break;
                case 'mtime':
                    $imagequery = "(SELECT albums.folder, images.filename, FROM_UNIXTIME(images.mtime), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                    break;
            }
            $result = query_full_array("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date DESC {$limit}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
            break;
        case "latestalbums-thumbnail":
        case "latestalbums-thumbnail-customcrop":
        case "latestalbums-sizedimage":
            $sortorder = $combinews_sortorder;
            $type1 = query("SET @type1:='news'");
            $type2 = query("SET @type2:='albums'");
            switch ($combinews_sortorder) {
                case 'id':
                case 'date':
                    $albumquery = "(SELECT albums.folder, albums.title, albums.date, @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")";
                    break;
                case 'mtime':
                    $albumquery = "(SELECT albums.folder, albums.title, FROM_UNIXTIME(albums.mtime), @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")";
                    break;
            }
            $result = query_full_array("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $albumquery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date DESC {$limit}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
            break;
        case "latestimagesbyalbum-thumbnail":
        case "latestimagesbyalbum-thumbnail-customcrop":
        case "latestimagesbyalbum-sizedimage":
            $type1 = query("SET @type1:='news'");
            $type2 = query("SET @type2:='albums'");
            if (empty($combinews_sortorder) || $combinews_sortorder != "date" || $combinews_sortorder != "mtime") {
                $combinews_sortorder = "date";
            }
            $combinews_sortorder = "date";
            $sortorder = "images." . $combinews_sortorder;
            switch ($combinews_sortorder) {
                case "date":
                    $imagequery = "(SELECT DISTINCT DATE_FORMAT(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.`date`,'%Y-%m-%d'), @type2 FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                    break;
                case "mtime":
                    $imagequery = "(SELECT DISTINCT FROM_UNIXTIME(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.`mtime`,'%Y-%m-%d'), @type2 FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")";
                    break;
            }
            $result = query_full_array("(SELECT title as albumname, titlelink, date, @type1 as type FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER By date DESC {$limit}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
            //echo "<pre>"; print_r($result); echo "</pre>";
            //$result = "";
            break;
        case "latestupdatedalbums-thumbnail":
        case "latestupdatedalbums-thumbnail-customcrop":
        case "latestupdatedalbums-sizedimage":
            $latest = getNewsArticles($articles_per_page, '', NULL, true);
            $counter = '';
            foreach ($latest as $news) {
                $article = new ZenpageNews($news['titlelink']);
                if ($article->checkAccess($hint, $show)) {
                    $counter++;
                    $latestnews[$counter] = array("albumname" => $article->getTitle(), "titlelink" => $article->getTitlelink(), "date" => $article->getDateTime(), "type" => "news");
                }
            }
            $albums = getAlbumStatistic($articles_per_page, "latestupdated");
            $latestalbums = array();
            $counter = "";
            foreach ($albums as $album) {
                $counter++;
                $tempalbum = new Album($_zp_gallery, $album['folder']);
                $tempalbumthumb = $tempalbum->getAlbumThumbImage();
                $timestamp = $tempalbum->get('mtime');
                if ($timestamp == 0) {
                    $albumdate = $tempalbum->getDateTime();
                } else {
                    $albumdate = strftime('%Y-%m-%d %H:%M:%S', $timestamp);
                }
                $latestalbums[$counter] = array("albumname" => $tempalbum->getFolder(), "titlelink" => $tempalbum->getTitle(), "date" => $albumdate, "type" => 'albums');
            }
            //$latestalbums = array_merge($latestalbums, $item);
            $latest = array_merge($latestnews, $latestalbums);
            $result = sortMultiArray($latest, "date", true);
            if (count($result) > $articles_per_page) {
                $result = array_slice($result, 0, 10);
            }
            break;
    }
    //$result = "";
    return $result;
}
Example #6
0
		
		<?php 
if (is_numeric(getOption('libratus_stats_number'))) {
    $number = getOption('libratus_stats_number');
} else {
    $number = 30;
}
?>
		
		<div id="main" class="wrap clearfix">
			<div class="inner">
				<div class="gallery pad">
				
					<?php 
if ($stat_type == 'albums') {
    $albums = getAlbumStatistic($number, $stat_option, '', 1);
    ?>

					<div class="gallery-thumbs-large">
						<?php 
    if ($albums) {
        foreach ($albums as $album) {
            $albumthumb = $album->getAlbumThumbImage();
            ?>
						<div>
							<a href="<?php 
            echo html_encode($album->getLink());
            ?>
" title="<?php 
            echo html_encode($album->getTitle());
            ?>
/**
 * Prints album statistic according to $option as an unordered HTML list
 * A css id is attached by default named '$option_album'
 *
 * @param string $number the number of albums to get
 * @param string $option
 * 		"popular" for the most popular albums,
 * 		"latest" for the latest uploaded by id (Discovery)
 * 		"latest-date" for the latest by date
 * 		"latest-mtime" for the latest by mtime
 *   	"latest-publishdate" for the latest by publishdate
 *    "mostrated" for the most voted,
 * 		"toprated" for the best voted
 * 		"latestupdated" for the latest updated
 * 		"random" for random order (yes, strictly no statistical order...)
 * @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 integer $threshold the minimum number of ratings (for rating options) or hits (for popular option) an album must have to be included in the list. (Default 0)
 * @param bool $collection only if $albumfolder is set: true if you want to get statistics to include all subalbum levels
 */
function printAlbumStatistic($number, $option, $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = NULL, $height = NULL, $crop = NULL, $albumfolder = '', $firstimglink = false, $threshold = 0, $collection = false)
{
    $albums = getAlbumStatistic($number, $option, $albumfolder, $threshold, $collection);
    echo "\n<div id=\"" . $option . "_album\">\n";
    echo "<ul>";
    foreach ($albums as $album) {
        printAlbumStatisticItem($album, $option, $showtitle, $showdate, $showdesc, $desclength, $showstatistic, $width, $height, $crop, $firstimglink);
    }
    echo "</ul></div>\n";
}
Example #8
0
        ?>
							<?php 
        if (getOption('libratus_stats_albums_latestupdated')) {
            ?>
&nbsp;<a class="stats-more" title="<?php 
            echo gettext('More');
            ?>
" href="<?php 
            echo getCustomPageURL('archive') . '?set=latestupdatedalbums';
            ?>
"><i class="fa fa-caret-right"></i></a><?php 
        }
        ?>
						</h5>
						<?php 
        $items = getAlbumStatistic($number, 'latestupdated', '', false, 1);
        ?>
						<div class="gallery-thumbs">
						<?php 
        foreach ($items as $item) {
            $image = $item->getAlbumThumbImage();
            ?>
							<a href="<?php 
            echo html_encode($item->getLink());
            ?>
" title="<?php 
            echo html_encode($item->getTitle());
            ?>
">
								<?php 
            echo '<img src="' . html_encode(pathurlencode($image->getCustomImage(null, 140, 140, 140, 140, null, null, true))) . '" alt="' . html_encode($item->getTitle()) . "\" />\n<br />";
Example #9
0
echo $validlocale;
?>
</language>
<pubDate><?php 
echo date("r", time());
?>
</pubDate>
<lastBuildDate><?php 
echo date("r", time());
?>
</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>ZenPhoto RSS Generator</generator>
	<?php 
if ($rssmode == "albums") {
    $result = getAlbumStatistic($items, getOption("feed_sortorder_albums"), $albumfolder);
} else {
    $result = getImageStatistic($items, getOption("feed_sortorder"), $albumfolder, $collection);
}
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 {
/**
 * Prints album statistic according to $option as an unordered HTML list
 * A css id is attached by default named '$option_album'
 *
 * @param string $number the number of albums to get
 * @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
 */
function printAlbumStatistic($number, $option, $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = 85, $height = 85, $crop = true)
{
    $albums = getAlbumStatistic($number, $option);
    echo "\n<div id=\"" . $option . "_album\">\n";
    echo "<ul>";
    foreach ($albums as $album) {
        printAlbumStatisticItem($album, $option, $showtitle, $showdate, $showdesc, $desclength, $showstatistic, $width, $height, $crop);
    }
    echo "</ul></div>\n";
}