diff options
Diffstat (limited to 'include/Contact.php')
-rw-r--r-- | include/Contact.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/Contact.php b/include/Contact.php index 2dab62fd8..9883c598d 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -52,24 +52,27 @@ function abook_self($channel_id) { } function channelx_by_nick($nick) { - return q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and not ( channel_pageflags & %d ) LIMIT 1", + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and not ( channel_pageflags & %d ) LIMIT 1", dbesc($nick), intval(PAGE_REMOVED) ); + return(($r) ? $r[0] : false); } function channelx_by_hash($hash) { - return q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and not ( channel_pageflags & %d ) LIMIT 1", + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and not ( channel_pageflags & %d ) LIMIT 1", dbesc($hash), intval(PAGE_REMOVED) ); + return(($r) ? $r[0] : false); } function channelx_by_n($id) { - return q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and not ( channel_pageflags & %d ) LIMIT 1", + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and not ( channel_pageflags & %d ) LIMIT 1", dbesc($id), intval(PAGE_REMOVED) ); + return(($r) ? $r[0] : false); } @@ -81,7 +84,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { if($a->poi) { $xchan = $a->poi; } - elseif($a->profile['channel_hash']) { + elseif(is_array($a->profile) && $a->profile['channel_hash']) { $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($a->profile['channel_hash']) ); @@ -114,7 +117,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { return replace_macros(get_markup_template('xchan_vcard.tpl'),array( '$name' => $xchan['xchan_name'], - '$photo' => ((array_key_exists('photo',$a->profile)) ? $a->profile['photo'] : $xchan['xchan_photo_l']), + '$photo' => ((is_array($a->profile) && array_key_exists('photo',$a->profile)) ? $a->profile['photo'] : $xchan['xchan_photo_l']), '$follow' => $xchan['xchan_addr'], '$connect' => $connect, '$newwin' => (($mode === 'chanview') ? t('New window') : ''), |