more integration of vcard and profiles
This commit is contained in:
parent
d7080defd3
commit
c32bc9dda4
@ -319,10 +319,38 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$orig_vcard = (($orig[0]['profile_vcard']) ? \Sabre\VObject\Reader::read($orig[0]['profile_vcard']) : null);
|
$orig_vcard = (($orig[0]['profile_vcard']) ? \Sabre\VObject\Reader::read($orig[0]['profile_vcard']) : null);
|
||||||
|
|
||||||
$_REQUEST['fn'] = $name;
|
$channel = \App::get_channel();
|
||||||
$_REQUEST['title'] = $pdesc;
|
|
||||||
|
|
||||||
$profile_vcard = update_vcard($_REQUEST,$orig_vcard);
|
$default_vcard_cat = ((defined('DEFAULT_VCARD_CAT')) ? DEFAULT_VCARD_CAT : 'HOME');
|
||||||
|
|
||||||
|
$defcard = [
|
||||||
|
'fn' => $name,
|
||||||
|
'title' => $pdesc,
|
||||||
|
'photo' => $channel['xchan_photo_l'],
|
||||||
|
'adr' => [],
|
||||||
|
'adr_type' => [ $default_vcard_cat ],
|
||||||
|
'tel' => [],
|
||||||
|
'tel_type' => [ $default_vcard_cat ],
|
||||||
|
'email' => [],
|
||||||
|
'email_type' => [ $default_vcard_cat ],
|
||||||
|
'impp' => [],
|
||||||
|
'impp_type' => [ $default_vcard_cat ],
|
||||||
|
'url' => [],
|
||||||
|
'url_type' => [ $default_vcard_cat ]
|
||||||
|
];
|
||||||
|
|
||||||
|
$defcard['adr'][] = [
|
||||||
|
0 => '',
|
||||||
|
1 => '',
|
||||||
|
2 => $address,
|
||||||
|
3 => $locality,
|
||||||
|
4 => $region,
|
||||||
|
5 => $postal_code,
|
||||||
|
6 => $country_name
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$profile_vcard = update_vcard($defcard,$orig_vcard);
|
||||||
|
|
||||||
|
|
||||||
require_once('include/text.php');
|
require_once('include/text.php');
|
||||||
|
@ -632,6 +632,9 @@ function random_profile() {
|
|||||||
|
|
||||||
function update_vcard($arr,$vcard = null) {
|
function update_vcard($arr,$vcard = null) {
|
||||||
|
|
||||||
|
|
||||||
|
// logger('update_vcard: ' . print_r($arr,true));
|
||||||
|
|
||||||
$fn = $arr['fn'];
|
$fn = $arr['fn'];
|
||||||
|
|
||||||
|
|
||||||
@ -816,8 +819,10 @@ function get_vcard_array($vc,$id) {
|
|||||||
$type = (($adr['TYPE']) ? vcard_translate_type((string)$adr['TYPE']) : '');
|
$type = (($adr['TYPE']) ? vcard_translate_type((string)$adr['TYPE']) : '');
|
||||||
$adrs[] = [
|
$adrs[] = [
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'address' => escape_tags($adr->getParts())
|
'address' => $adr->getParts()
|
||||||
];
|
];
|
||||||
|
$last_entry = end($adrs);
|
||||||
|
array_walk($adrs[$last_entry],'array_escape_tags');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3128,4 +3128,8 @@ function cleanup_bbcode($body) {
|
|||||||
|
|
||||||
function array_trim(&$v,$k) {
|
function array_trim(&$v,$k) {
|
||||||
$v = trim($v);
|
$v = trim($v);
|
||||||
|
}
|
||||||
|
|
||||||
|
function array_escape_tags(&$v,$k) {
|
||||||
|
$v = escape_tags($v);
|
||||||
}
|
}
|
Reference in New Issue
Block a user