From 3d811a17feb9b3d0fd4dc09023e3b7b5fe1623ac Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 20 Dec 2016 23:26:31 -0800 Subject: provide call button on connections list if mobile|tablet and a phone number exists --- include/connections.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include/connections.php') diff --git a/include/connections.php b/include/connections.php index b85be33b2..44003bc93 100644 --- a/include/connections.php +++ b/include/connections.php @@ -858,3 +858,33 @@ function vcard_translate_type($type) { return [$type, t('Other') . ' (' . $type . ')']; } } + + +function vcard_query(&$r) { + + $arr = []; + + if($r && is_array($r) && count($r)) { + $uid = $r[0]['abook_channel']; + foreach($r as $rv) { + if($rv['abook_xchan'] && (! in_array("'" . dbesc($rv['abook_xchan']) . "'",$arr))) + $arr[] = "'" . dbesc($rv['abook_xchan']) . "'"; + } + } + + if($arr) { + $a = q("select * from abconfig where chan = %d and xchan in (" . protect_sprintf(implode(',', $arr)) . ") and cat = 'system' and k = 'vcard'", + intval($uid) + ); + if($a) { + foreach($a as $av) { + for($x = 0; $x < count($r); $x ++) { + if($r[$x]['abook_xchan'] == $av['xchan']) { + $vctmp = \Sabre\VObject\Reader::read($av['v']); + $r[$x]['vcard'] = (($vctmp) ? get_vcard_array($vctmp,$r[$x]['abook_id']) : [] ); + } + } + } + } + } +} \ No newline at end of file -- cgit v1.2.3