From 0215043826c2c036c3a2c88fa6e42089138c7c52 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 13 Dec 2013 13:30:33 -0800 Subject: prepare for Comanchification of mod_photos --- include/Contact.php | 13 +++++++++++++ include/photos.php | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/Contact.php b/include/Contact.php index 5725e06f0..20dd04d17 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -77,6 +77,19 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { $a = get_app(); + if(! $xchan) { + if($a->profile['channel_hash']) + $r = q("select * from xchan where xchan_hash = '%s' limit 1", + dbesc($a->profile['channel_hash']) + ); + if($r) + $xchan = $r[0]; + } + + if(! $xchan) + return; + +// FIXME - show connect button to observer if appropriate $connect = false; if(local_user()) { $r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", diff --git a/include/photos.php b/include/photos.php index ea4b494e0..9828140b8 100644 --- a/include/photos.php +++ b/include/photos.php @@ -279,8 +279,16 @@ function photos_album_widget($channelx,$observer,$albums = null) { $o = ''; - if(! $albums) - $albums = photos_albums_list($channelx,$observer); + // If we weren't passed an album list, see if the photos module + // dropped one for us to find in $a->data['albums']. + // If all else fails, load it. + + if(! $albums) { + if(array_key_exists('albums', get_app()->data)) + $albums = get_app()->data['albums']; + else + $albums = photos_albums_list($channelx,$observer); + } if($albums) { $o = replace_macros(get_markup_template('photo_albums.tpl'),array( -- cgit v1.2.3