aboutsummaryrefslogtreecommitdiffstats
path: root/include/connections.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-12-20 23:26:31 -0800
committerzotlabs <mike@macgirvin.com>2016-12-20 23:26:31 -0800
commit3d811a17feb9b3d0fd4dc09023e3b7b5fe1623ac (patch)
treebf33cc99db4ce8e8048a5c6c1a8682d26d267a28 /include/connections.php
parentf3ec818a66e7909bcb744868cfef43c3481c4e43 (diff)
downloadvolse-hubzilla-3d811a17feb9b3d0fd4dc09023e3b7b5fe1623ac.tar.gz
volse-hubzilla-3d811a17feb9b3d0fd4dc09023e3b7b5fe1623ac.tar.bz2
volse-hubzilla-3d811a17feb9b3d0fd4dc09023e3b7b5fe1623ac.zip
provide call button on connections list if mobile|tablet and a phone number exists
Diffstat (limited to 'include/connections.php')
-rw-r--r--include/connections.php30
1 files changed, 30 insertions, 0 deletions
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