本文整理汇总了PHP中Album::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::getTitle方法的具体用法?PHP Album::getTitle怎么用?PHP Album::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::getTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRSSAlbumTitle
/**
* Returns the title from the feed's url for latest albums or a specific album rss
*
* @return string
*/
function getRSSAlbumTitle()
{
global $_zp_gallery;
$rssmode = getRSSAlbumsmode();
if (isset($_GET['albumtitle'])) {
$albumname = ' - ' . html_encode(sanitize(urldecode($_GET['albumtitle']))) . ' (' . gettext('latest images') . ')';
} elseif ($rssmode == "albums" && !isset($_GET['folder'])) {
$albumname = ' (' . gettext('latest albums') . ')';
} elseif ($rssmode == 'albums' && isset($_GET['folder'])) {
$folder = sanitize(urldecode($_GET['folder']));
$albobj = new Album($_zp_gallery, $folder);
$albumname = ' - ' . html_encode(strip_tags($albobj->getTitle())) . ' (' . gettext('latest albums') . ')';
} else {
$albumname = ' (' . gettext('latest images') . ')';
}
return $albumname;
}
示例2: getCombiNews
//.........这里部分代码省略.........
$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;
}
示例3: printSlideShow
static function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "")
{
if (!isset($_POST['albumid']) and !is_object($albumobj)) {
echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
echo "</div></body></html>";
exit;
}
global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
//getting the image to start with
if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
$imagenumber = $_POST['imagenumber'] - 1;
// slideshows starts with 0, but zp with 1.
} elseif (is_object($imageobj)) {
makeImageCurrent($imageobj);
$imagenumber = imageNumber() - 1;
} else {
$imagenumber = 0;
}
// set pagenumber to 0 if not called via POST link
if (isset($_POST['pagenr'])) {
$pagenumber = sanitize_numeric($_POST['pagenr']);
} else {
$pagenumber = 0;
}
// getting the number of images
if (!empty($_POST['numberofimages'])) {
$numberofimages = sanitize_numeric($_POST['numberofimages']);
} elseif (is_object($albumobj)) {
$numberofimages = $albumobj->getNumImages();
}
//getting the album to show
if (!empty($_POST['albumid']) and !is_object($albumobj)) {
$albumid = sanitize_numeric($_POST['albumid']);
} elseif (is_object($albumobj)) {
$albumid = $albumobj->id;
} else {
$albumid = -1;
}
// setting the image size
if (!empty($width) and !empty($height)) {
$width = sanitize_numeric($width);
$height = sanitize_numeric($height);
} else {
$width = getOption("slideshow_width");
$height = getOption("slideshow_height");
}
$option = getOption("slideshow_mode");
// jQuery Cycle slideshow config
// get slideshow data
$gallery = new Gallery();
if ($albumid <= 0) {
// search page
$dynamic = 2;
$search = new SearchEngine();
$params = $_POST['preserve_search_params'];
$search->setSearchParams($params);
$images = $search->getImages(0);
$searchwords = $search->words;
$searchdate = $search->dates;
$searchfields = $search->fields;
$page = $search->page;
if (empty($_POST['imagenumber'])) {
$albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
$album = new Album($gallery, $albumq['folder']);
$returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
//$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
} else {
$returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
}
$albumtitle = gettext('Search');
} else {
$albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
$album = new Album($gallery, $albumq['folder']);
$albumtitle = $album->getTitle();
if (!checkAlbumPassword($albumq['folder'], $hint)) {
echo gettext("This album is password protected!");
exit;
}
$dynamic = $album->isDynamic();
$images = $album->getImages(0);
// return path to get back to the page we called the slideshow from
if (empty($_POST['imagenumber'])) {
$returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
} else {
$returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode($_POST['imagefile']) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
}
}
// slideshow display section
switch ($option) {
case "jQuery":
$validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
?>
<script type="text/javascript">
$(document).ready(function(){
$(function() {
var ThisGallery = '<?php
echo html_encode($albumtitle);
?>
';
var ImageList = new Array();
//.........这里部分代码省略.........
示例4: printBarGraph
//.........这里部分代码省略.........
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')) {
示例5: printLogoAndLinks
$album->setSortDirection('image', 0);
$album->save();
}
// Layout the page
printLogoAndLinks();
?>
<div id="main"><?php
printTabs('edit');
?>
<div id="content">
<h1>Sort Album: <?php
echo $album->getTitle();
?>
</h1>
<p><?php
printAlbumEditLinks('', "« " . gettext("back to the album list"), gettext("Back to the list of albums"));
?>
| <?php
printAlbumEditLinks("&album=" . urlencode($album->getFolder()), gettext("edit album"), gettext("Edit Album"));
?>
| <?php
printViewLink($album, gettext("view album"), gettext("View Album"));
?>
</p>
<?php
示例6: printLatestNews
/**
* Prints the latest news either only news articles or with the latest images or albums as a unordered html list
*
* NOTE: Latest images and albums require the image_album_statistic plugin
*
* @param int $number The number of news items to get
* @param string $option "none" for only news articles
* "with_latest_images" for news articles with the latest images by id
* "with_latest_images_date" for news articles with the latest images by date
* "with_latest_images_mtime" for news articles with the latest images by mtime (upload date)
* "with_latest_albums" for news articles with the latest albums by id
* "with_latestupdated_albums" for news articles with the latest updated albums
* @param string $category Optional news articles by category (only "none" option"
* @param bool $showdate If the date should be shown
* @param bool $showcontent If the content should be shown
* @param int $contentlength The lengths of the content
* @param bool $showcat If the categories should be shown
* @param string $readmore Text for the read more link, if empty the option value for "zenpage_readmore" is used
* @return string
*/
function printLatestNews($number = 5, $option = 'with_latest_images', $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true, $readmore = NULL)
{
global $_zp_gallery, $_zp_current_zenpage_news;
//trigger_error(gettext('printLatestNews is deprecated. Use printLatestCombiNews().'), E_USER_NOTICE);
$latest = getLatestNews($number, $option, $category);
echo "\n<ul id=\"latestnews\">\n";
$count = "";
foreach ($latest as $item) {
$count++;
$category = "";
$categories = "";
switch ($item['type']) {
case 'news':
$obj = new ZenpageNews($item['titlelink']);
$title = html_encode($obj->getTitle());
$link = html_encode(getNewsURL($item['titlelink']));
$count2 = 0;
$category = $obj->getCategories();
foreach ($category as $cat) {
$catobj = new ZenpageCategory($cat['titlelink']);
$count2++;
if ($count2 != 1) {
$categories = $categories . ", ";
}
$categories = $categories . $catobj->getTitle();
}
$thumb = "";
$content = $obj->getContent();
$date = zpFormattedDate(DATE_FORMAT, strtotime($item['date']));
$type = 'news';
break;
case 'images':
$obj = newImage(new Album($_zp_gallery, $item['albumname']), $item['titlelink']);
$categories = $item['albumname'];
$title = $obj->getTitle();
$link = html_encode($obj->getImageLink());
$content = $obj->getDesc();
if ($option == "with_latest_image_date") {
$date = zpFormattedDate(DATE_FORMAT, $item['date']);
} else {
$date = zpFormattedDate(DATE_FORMAT, strtotime($item['date']));
}
$thumb = "<a href=\"" . $link . "\" title=\"" . html_encode(strip_tags($title)) . "\"><img src=\"" . html_encode($obj->getThumb()) . "\" alt=\"" . html_encode(strip_tags($title)) . "\" /></a>\n";
$type = "image";
break;
case 'albums':
$obj = new Album($_zp_gallery, $item['albumname']);
$title = $obj->getTitle();
$categories = "";
$link = html_encode($obj->getAlbumLink());
$thumb = "<a href=\"" . $link . "\" title=\"" . $title . "\"><img src=\"" . html_encode($obj->getAlbumThumb()) . "\" alt=\"" . strip_tags($title) . "\" /></a>\n";
$content = $obj->getDesc();
$date = zpFormattedDate(DATE_FORMAT, strtotime($item['date']));
$type = "album";
break;
}
echo "<li>";
if (!empty($thumb)) {
echo $thumb;
}
echo "<h3><a href=\"" . $link . "\" title=\"" . strip_tags(html_encode($title)) . "\">" . $title . "</a></h3>\n";
if ($showdate) {
echo "<span class=\"latestnews-date\">" . $date . "</span>\n";
}
if ($showcontent) {
echo "<span class=\"latestnews-desc\">" . getContentShorten($content, $contentlength, '', $readmore, $link) . "</span>\n";
}
if ($showcat and $type != "album" && !empty($categories)) {
echo "<span class=\"latestnews-cats\">(" . html_encode($categories) . ")</span>\n";
}
echo "</li>\n";
if ($count == $number) {
break;
}
}
echo "</ul>\n";
}
示例7: printAlbumsSelector
/**
* Prints all albums of the Zenphoto gallery as a partial drop down menu (<option></option> parts).
*
* @return string
*/
function printAlbumsSelector()
{
global $_zp_gallery;
$albumlist;
genAlbumUploadList($albumlist);
?>
<select id="albumselector" name="albumselect">
<?php
foreach ($albumlist as $key => $value) {
$albumobj = new Album($_zp_gallery, $key);
$albumname = $albumobj->name;
$level = substr_count($albumname, "/");
$arrow = "";
for ($count = 1; $count <= $level; $count++) {
$arrow .= "» ";
}
echo "<option value='" . html_encode($albumobj->name) . "'>";
echo $arrow . $albumobj->getTitle() . unpublishedZenphotoItemCheck($albumobj) . "</option>";
}
?>
</select>
<?php
}
示例8: printAlbumMenuListAlbum
/**
* Handles an album for printAlbumMenuList
*
* @param array $albums albums array
* @param string $path for createAlbumMenuLink
* @param string $folder
* @param string $option see printAlbumMenuList
* @param string $showcount see printAlbumMenuList
* @param int $showsubs see printAlbumMenuList
* @param string $css_class see printAlbumMenuList
* @param string $css_class_topactive see printAlbumMenuList
* @param string $css_class_active see printAlbumMenuList
* @param bool $firstimagelink If set to TRUE and if the album has images the link will point to page of the first image instead the album thumbnail page
* @param bool $keeptopactive If set to TRUE the toplevel album entry will stay marked as active if within its subalbums ("list" only)
* @param int $limit truncation of display text
*/
function printAlbumMenuListAlbum($albums, $path, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, $keeptopactive, $limit = NULL)
{
global $_zp_gallery, $_zp_current_album;
if (is_null($limit)) {
$limit = MENU_TRUNCATE_STRING;
}
if (is_null($showcount)) {
$showcount = ALBUM_MENU_COUNT;
}
if (is_null($showsubs)) {
$showsubs = ALBUM_MENU_SHOWSUBS;
}
if ($showsubs && !is_numeric($showsubs)) {
$showsubs = 9999999999.0;
}
if (empty($keeptopactive)) {
$keeptopactive = false;
}
$pagelevel = count(explode('/', $folder));
$currenturalbumname = "";
foreach ($albums as $album) {
$level = count(explode('/', $album));
$process = $level < $showsubs && $option == "list" || $option != 'list-top' && strpos($folder, $album) === 0 && $level <= $pagelevel;
$topalbum = new Album($_zp_gallery, $album, true);
if ($level > 1 || $option != 'omit-top') {
// listing current level album
if ($level == 1) {
$css_class_t = $css_class_topactive;
} else {
$css_class_t = $css_class_active;
}
if ($keeptopactive) {
if (isset($_zp_current_album) && is_object($_zp_current_album)) {
$currenturalbum = getUrAlbum($_zp_current_album);
$currenturalbumname = $currenturalbum->name;
}
}
$count = "";
if ($showcount) {
$toplevelsubalbums = $topalbum->getAlbums();
$toplevelsubalbums = count($toplevelsubalbums);
$topalbumnumimages = $topalbum->getNumImages();
$count = ' <span style="white-space:nowrap;"><small>(';
if ($toplevelsubalbums > 0) {
$count .= sprintf(ngettext('%u album', '%u albums', $toplevelsubalbums), $toplevelsubalbums);
}
if ($topalbumnumimages > 0) {
if ($toplevelsubalbums) {
$count .= ' ';
}
$count .= sprintf(ngettext('%u image', '%u images', $topalbumnumimages), $topalbumnumimages);
}
$count .= ')</small></span>';
}
if (in_context(ZP_ALBUM) && !in_context(ZP_SEARCH_LINKED) && (getAlbumID() == $topalbum->getAlbumID() || $topalbum->name == $currenturalbumname)) {
$current = $css_class_t . ' ';
} else {
$current = "";
}
$title = $topalbum->getTitle();
if ($limit) {
$display = shortenContent($title, $limit, MENU_TRUNCATE_INDICATOR);
} else {
$display = $title;
}
if ($firstimagelink && $topalbum->getNumImages() != 0) {
$imgurl = getFirstImageOfAlbum($topalbum);
$link = "<li><a " . $current . "href='" . $imgurl . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count;
} else {
$link = "<li><a " . $current . "href='" . html_encode($path . pathurlencode($topalbum->name)) . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count;
}
echo $link;
}
if ($process) {
// listing subalbums
$subalbums = $topalbum->getAlbums();
if (!empty($subalbums)) {
echo "\n<ul" . $css_class . ">\n";
printAlbumMenuListAlbum($subalbums, $path, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, false, $limit);
echo "\n</ul>\n";
}
}
if ($option == 'list' || $option == 'list-top' || $level > 1) {
// close the LI
//.........这里部分代码省略.........
示例9: urldecode
if (!empty($_REQUEST['themealbum'])) {
$alb = urldecode(sanitize_path($_REQUEST['themealbum']));
$album = new Album($gallery, $alb);
$albumtitle = $album->getTitle();
$themename = $album->getAlbumTheme();
} else {
foreach ($themelist as $albumtitle => $alb) {
break;
}
if (empty($alb)) {
$themename = $gallery->getCurrentTheme();
$album = NULL;
} else {
$alb = sanitize_path($alb);
$album = new Album($gallery, $alb);
$albumtitle = $album->getTitle();
$themename = $album->getAlbumTheme();
}
}
?>
<form action="?action=saveoptions" method="post" AUTOCOMPLETE=OFF>
<input type="hidden" name="savethemeoptions" value="yes" />
<table class='bordered'>
<?php
if (count($themelist) == 0) {
?>
<th>
<br />
<div class="errorbox" id="no_themes">
<h2><?php
echo gettext("There are no themes for which you have rights to administer.");
示例10: printAlbumStatisticItem
/**
* 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, "&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>";
}
示例11: printBarGraph
/**
* 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 {
//.........这里部分代码省略.........
示例12: printAlbumMenuJumpAlbum
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;
}
}
示例13: printImageslist
/**
* Prints the images and/or albums as thumbnails of the selected album
*
* @param $number int The number of images per page
*
* @return string
*/
function printImageslist($number)
{
global $_zp_gallery, $host;
if (isset($_GET['album']) and !empty($_GET['album'])) {
$album = urldecode(sanitize($_GET['album']));
$albumobj = new Album($_zp_gallery, $album);
echo "<h3 style='margin-bottom:10px'>" . gettext("Album:") . " <em>" . html_encode($albumobj->getTitle()) . unpublishedZenphotoItemCheck($albumobj, false) . "</em> / " . gettext("Album folder:") . " <em>" . html_encode($albumobj->name) . "</em><br /><small>" . gettext("(Click on image to include)") . "</small></h3>";
// album thumb display;
$albumthumb = $albumobj->getAlbumThumbImage();
$albumthumbalbum = $albumthumb->getAlbum();
$albumdesc = '';
$albumdesc = $albumobj->getDesc();
$imagedesc = $albumthumb->getDesc();
$imgurl = $host . WEBPATH . '/' . ZENFOLDER . "/i.php?a=" . urlencode(pathurlencode($albumthumbalbum->name)) . "&i=" . urlencode(urlencode($albumthumb->filename));
$fullimage = pathurlencode($albumthumb->getFullImage());
$videocheck = checkIfImageVideo($albumthumb);
if (get_class($albumthumb) == '_Image') {
$video = '';
$backgroundcss = 'border: 1px solid gray; padding: 1px;';
$imgurl = $host . WEBPATH . '/' . ZENFOLDER . "/i.php?a=" . urlencode(pathurlencode($albumthumbalbum->name)) . "&i=" . urlencode(urlencode($albumthumb->filename));
} else {
$backgroundcss = 'border: 1px solid orange; padding: 1px;background-color: orange';
$video = $videocheck;
$imgurl = $albumthumb->getThumb();
}
$imgsizeurl = $albumthumb->getCustomImage(85, NULL, NULL, 85, 85, NULL, NULL, TRUE);
echo "<div class='albumthumb' style='width: 85px; height: 100px; float: left; margin: 10px 10px 10px 13px'>";
echo "<a href=\"javascript:ZenpageDialog.insert('" . $imgurl . "','" . urlencode($albumthumb->filename) . "','" . html_encode($albumthumb->getTitle()) . "','" . html_encode($albumobj->getTitle()) . "','" . $fullimage . "','zenphoto','" . html_encode(getWatermarkParam($albumthumb, WATERMARK_THUMB)) . "','" . html_encode(getWatermarkParam($albumthumb, WATERMARK_IMAGE)) . "','" . $video . "','" . html_encode($imagedesc) . "','" . html_encode($albumdesc) . "');\"" . " title='" . html_encode($albumthumb->getTitle()) . " (" . html_encode($albumthumb->filename) . ")'><img src='" . $imgsizeurl . "' style='" . $backgroundcss . "' /></a>\n";
echo "<a href='zoom.php?image=" . urlencode($albumthumb->filename) . "&album=" . pathurlencode($albumthumbalbum->name) . "' title='Zoom' rel='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a> " . gettext('<em>Albumthumb</em>') . unpublishedZenphotoItemCheck($albumthumb, false);
echo "</div>";
$images = $albumobj->getImages();
if ($albumobj->getNumImages() != 0) {
$images_per_page = $number;
if (isset($_GET['page'])) {
$currentpage = sanitize_numeric($_GET['page']);
} else {
$currentpage = 1;
}
$imagecount = $albumobj->getNumImages();
$pagestotal = ceil($imagecount / $images_per_page);
for ($nr = 1; $nr <= $pagestotal; $nr++) {
$startimage[$nr] = $nr * $images_per_page - $images_per_page;
// get start image number
$endimage[$nr] = $nr * $images_per_page - 1;
// get end image number
}
$number = $startimage[$currentpage];
printTinyPageNav($pagestotal, $currentpage, 'images');
for ($nr = $number; $nr <= $images_per_page * $currentpage; $nr++) {
if ($nr === $imagecount) {
break;
}
if ($albumobj->isDynamic()) {
$linkalbumobj = new Album($_zp_gallery, $images[$nr]['folder']);
$imageobj = newImage($linkalbumobj, $images[$nr]['filename']);
} else {
$linkalbumobj = $albumobj;
$imageobj = newImage($albumobj, $images[$nr]);
}
$imagedesc = '';
$imagedesc = $imageobj->getDesc();
$albumdesc = '';
$albumdesc = $linkalbumobj->getDesc();
$fullimage = pathurlencode($imageobj->getFullImage());
$videocheck = checkIfImageVideo($imageobj);
if (get_class($imageobj) == '_Image') {
$video = '';
$backgroundcss = 'border: 1px solid gray; padding: 1px;';
$imgurl = $host . WEBPATH . '/' . ZENFOLDER . "/i.php?a=" . urlencode(pathurlencode($linkalbumobj->name)) . "&i=" . urlencode(urlencode($imageobj->filename));
} else {
if (get_class($imageobj) == 'TextObject' || get_parent_class($imageobj) == 'TextObject') {
$video = 'textobject';
$imgurl = $imageobj->getThumb();
$fullimage = html_encode($imageobj->getBody());
} else {
$backgroundcss = 'border: 1px solid orange; padding: 1px;background-color: orange';
$video = $videocheck;
$imgurl = $imageobj->getThumb();
}
}
$imgsizeurl = $imageobj->getCustomImage(85, NULL, NULL, 85, 85, NULL, NULL, TRUE);
echo "<div style='width: 85px; height: 100px; float: left; margin: 10px 10px 10px 13px'>\n";
echo "<a href=\"javascript:ZenpageDialog.insert('" . $imgurl . "','" . urlencode($imageobj->filename) . "','" . html_encode($imageobj->getTitle()) . "','" . html_encode($linkalbumobj->getTitle()) . "','" . $fullimage . "','zenphoto','" . html_encode(getWatermarkParam($imageobj, WATERMARK_THUMB)) . "','" . html_encode(getWatermarkParam($imageobj, WATERMARK_IMAGE)) . "','" . $video . "','" . html_encode($imagedesc) . "','" . html_encode($albumdesc) . "');\"" . " title='" . html_encode($imageobj->getTitle()) . " (" . html_encode($imageobj->filename) . ")'><img src='" . $imgsizeurl . "' style='" . $backgroundcss . "' /></a>\n";
echo "<a href='zoom.php?image=" . urlencode($imageobj->filename) . "&album=" . pathurlencode($linkalbumobj->name) . "' title='Zoom' rel='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a> " . html_encode(shortentitle($imageobj->getTitle(), 8)) . unpublishedZenphotoItemCheck($imageobj, false);
echo "</div>\n";
if ($nr === $endimage[$currentpage]) {
break;
}
}
// for end
} else {
echo "<p style='margin-left: 8px'>" . gettext("<strong>Note:</strong> This album does not contain any images.") . "</p>";
}
//.........这里部分代码省略.........
示例14: genAlbumUploadList
function genAlbumUploadList(&$list, $curAlbum = NULL)
{
$gallery = new Gallery();
$albums = array();
if (is_null($curAlbum)) {
$albumsprime = $gallery->getAlbums(0);
foreach ($albumsprime as $album) {
// check for rights
$albumobj = new Album($gallery, $album);
if ($albumobj->isMyItem(UPLOAD_RIGHTS)) {
$albums[] = $album;
}
}
} else {
$albums = $curAlbum->getAlbums(0);
}
if (is_array($albums)) {
foreach ($albums as $folder) {
$album = new Album($gallery, $folder);
if (!$album->isDynamic()) {
$list[$album->getFolder()] = $album->getTitle();
genAlbumUploadList($list, $album);
/* generate for subalbums */
}
}
}
}
示例15: printAlbumStatisticItem
/**
* 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
*/
function printAlbumStatisticItem($album, $option, $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = 85, $height = 85, $crop = true)
{
global $_zp_gallery;
$albumpath = rewrite_path("/", "index.php?album=");
$tempalbum = new Album($_zp_gallery, $album['folder']);
echo "<li><a href=\"" . $albumpath . pathurlencode($tempalbum->name) . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n";
$albumthumb = $tempalbum->getAlbumThumbImage();
$thumb = newImage($tempalbum, $albumthumb->filename);
if ($crop) {
echo "<img src=\"" . $thumb->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE) . "\" alt=\"" . html_encode($thumb->getTitle()) . "\" /></a>\n<br />";
} else {
echo "<img src=\"" . $thumb->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE) . "\" alt=\"" . html_encode($thumb->getTitle()) . "\" /></a>\n<br />";
}
if ($showtitle) {
echo "<h3><a href=\"" . $albumpath . pathurlencode($tempalbum->name) . "\" title=\"" . html_encode($tempalbum->getTitle()) . "\">\n";
echo $tempalbum->getTitle() . "</a></h3>\n";
}
if ($showdate) {
if ($option === "latestupdated") {
$filechangedate = filectime(getAlbumFolder() . UTF8ToFilesystem($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 = mysql_fetch_row($lastuploaded);
$count = $row[0];
echo "<p>" . sprintf(gettext("Last update: %s"), zpFormattedDate(getOption('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(getOption('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 "<p>" . truncate_string($tempalbum->getDesc(), $desclength) . "</p>";
}
echo "</li>";
}