aboutsummaryrefslogtreecommitdiffstats
path: root/include/photos.php
diff options
context:
space:
mode:
authorThomas Willingham <beardyunixer@beardyunixer.com>2014-06-22 18:00:23 +0100
committerThomas Willingham <beardyunixer@beardyunixer.com>2014-06-22 18:00:23 +0100
commit388872949ed0de4cf036e546fafb3f4b4bd04fee (patch)
tree2fcefc5c8f2398166b8e7003033fe160cb3325fc /include/photos.php
parentb47ff712deafdb8617599b0af4403b9563c9be93 (diff)
parent301c7cdb89b13c4fc7c502795f121e13c1f9441d (diff)
downloadvolse-hubzilla-388872949ed0de4cf036e546fafb3f4b4bd04fee.tar.gz
volse-hubzilla-388872949ed0de4cf036e546fafb3f4b4bd04fee.tar.bz2
volse-hubzilla-388872949ed0de4cf036e546fafb3f4b4bd04fee.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'include/photos.php')
-rw-r--r--include/photos.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/photos.php b/include/photos.php
index 65532e6c2..9819c7ef2 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -264,7 +264,7 @@ function photos_albums_list($channel,$observer) {
$sql_extra = permissions_sql($channel_id);
- $albums = q("SELECT distinct album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra order by created desc",
+ $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra group by album order by created desc",
intval($channel_id),
intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE)
@@ -277,13 +277,15 @@ function photos_albums_list($channel,$observer) {
if($albums) {
$ret['success'] = true;
+ $ret['albums'] = array();
foreach($albums as $k => $album) {
$entry = array(
- 'text' => $album['album'],
+ 'text' => $album['album'],
+ 'total' => $album['total'],
'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']),
'urlencode' => urlencode($album['album']),
'bin2hex' => bin2hex($album['album']));
- $ret[] = $entry;
+ $ret['albums'][] = $entry;
}
}
return $ret;
@@ -305,11 +307,11 @@ function photos_album_widget($channelx,$observer,$albums = null) {
$albums = photos_albums_list($channelx,$observer);
}
- if($albums) {
+ if($albums['success']) {
$o = replace_macros(get_markup_template('photo_albums.tpl'),array(
'$nick' => $channelx['channel_address'],
'$title' => t('Photo Albums'),
- '$albums' => $albums,
+ '$albums' => $albums['albums'],
'$baseurl' => z_root(),
'$upload' => ((perm_is_allowed($channelx['channel_id'],(($observer) ? $observer['xchan_hash'] : ''),'post_photos'))
? t('Upload New Photos') : '')