diff options
author | friendica <info@friendica.com> | 2013-01-26 02:24:07 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-01-26 02:24:07 -0800 |
commit | 91126d8dd33bdfa86ab1013561833b0c3c224a14 (patch) | |
tree | 6f8b1a86dccd7f753015270156ddf2b89614f1ea /mod | |
parent | 70aa8421b37a6ad7318172ef515bbb56e2d33917 (diff) | |
download | volse-hubzilla-91126d8dd33bdfa86ab1013561833b0c3c224a14.tar.gz volse-hubzilla-91126d8dd33bdfa86ab1013561833b0c3c224a14.tar.bz2 volse-hubzilla-91126d8dd33bdfa86ab1013561833b0c3c224a14.zip |
more photo backend stuff
Diffstat (limited to 'mod')
-rw-r--r-- | mod/photos.php | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/mod/photos.php b/mod/photos.php index 00985ab9b..68b1bcb6b 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -18,62 +18,32 @@ function photos_init(&$a) { if(argc() > 1) { $nick = argv(1); - $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' LIMIT 1", - dbesc($nick) - ); + $channelx = channelx_by_nick($nick); - if(! $r) + if(! $channelx) return; - $a->data['channel'] = $r[0]; + $a->data['channel'] = $channelx[0]; $observer = $a->get_observer(); $a->data['observer'] = $observer; $observer_xchan = (($observer) ? $observer['xchan_hash'] : ''); - $a->data['perms'] = get_all_perms($r[0]['channel_id'],$observer_xchan); - - $o .= vcard_from_xchan($a->data['channel'],$observer_xchan); - - $albums = photos_albums_list($a->data['channel'],$observer); + $a->data['perms'] = get_all_perms($channelx[0]['channel_id'],$observer_xchan); - if($albums) { - $a->data['albums'] = $albums; -// FIXME - $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true); + $a->set_widget('vcard',vcard_from_xchan($a->data['channel'],$observer)); - if($albums_visible) { - $o .= '<div id="side-bar-photos-albums" class="widget">'; - $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '">' . t('Photo Albums') . '</a></h3>'; - - $o .= '<ul>'; - foreach($albums as $album) { + if($a->data['perms']['view_photos']) { - // don't show contact photos. We once translated this name, but then you could still access it under - // a different language setting. Now we store the name in English and check in English (and translated for legacy albums). + $a->data['albums'] = photos_albums_list($a->data['channel'],$observer); - if((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) - continue; - $o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>'; - } - $o .= '</ul>'; - } - if(local_user() && $a->data['channel']['channel_id'] == local_user()) { - $o .= '<div id="photo-albums-upload-link"><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload" >' .t('Upload New Photos') . '</a></div>'; - } + $a->set_widget('photo_albums',photos_album_widget($a->data['channel'],$observer,$a->data['albums'])); - $o .= '</div>'; } - if(! x($a->page,'aside')) - $a->page['aside'] = ''; - $a->page['aside'] .= $o; - - $a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "';</script>" ; - } return; |