prepare for Comanchification of mod_photos
This commit is contained in:
parent
94975f8d30
commit
0215043826
@ -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",
|
||||
|
@ -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(
|
||||
|
@ -19,6 +19,9 @@ function photos_init(&$a) {
|
||||
|
||||
if(argc() > 1) {
|
||||
$nick = argv(1);
|
||||
|
||||
profile_load($a,$nick);
|
||||
|
||||
$channelx = channelx_by_nick($nick);
|
||||
|
||||
if(! $channelx)
|
||||
@ -35,7 +38,7 @@ function photos_init(&$a) {
|
||||
|
||||
|
||||
|
||||
$a->set_widget('vcard',vcard_from_xchan($a->data['channel'],$observer));
|
||||
$a->set_widget('vcard',vcard_from_xchan('',$observer));
|
||||
head_set_icon($a->data['channel']['xchan_photo_s']);
|
||||
if($a->data['perms']['view_photos']) {
|
||||
$a->data['albums'] = photos_albums_list($a->data['channel'],$observer);
|
||||
|
Reference in New Issue
Block a user