From e5662dc89367dc70f6a07282c807807261503726 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 15 Jan 2017 21:23:43 -0800 Subject: vcard export from profile --- Zotlabs/Module/Profile.php | 13 ++++++++++++- include/channel.php | 4 ++++ view/tpl/profile_advanced.tpl | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index 9e868db92..0bc23952b 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -60,7 +60,9 @@ class Profile extends \Zotlabs\Web\Controller { } $groups = array(); - + + + $tab = 'profile'; $o = ''; @@ -69,6 +71,15 @@ class Profile extends \Zotlabs\Web\Controller { return; } + + + if(argc() > 2 && argv(2) === 'vcard') { + header('Content-type: text/vcard'); + header('content-disposition: attachment; filename="' . t('vcard') . '-' . $profile['channel_address'] . '.vcf"' ); + echo \App::$profile['profile_vcard']; + killme(); + } + $is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false); diff --git a/include/channel.php b/include/channel.php index 5d92b4769..83f48f361 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1278,10 +1278,14 @@ function advanced_profile(&$a) { // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); + $exportlink = ((App::$profile['profile_vcard']) ? zid(z_root() . '/profile/' . App::$profile['channel_address'] . '/vcard') : ''); + return replace_macros($tpl, array( '$title' => t('Profile'), '$canlike' => (($profile['canlike'])? true : false), '$likethis' => t('Like this thing'), + '$export' => t('Export'), + '$exportlink' => $exportlink, '$profile' => $profile, '$fields' => $clean_fields, '$editmenu' => profile_edit_menu(App::$profile['profile_uid']), diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl index 59490ccc1..4000f39d6 100755 --- a/view/tpl/profile_advanced.tpl +++ b/view/tpl/profile_advanced.tpl @@ -34,6 +34,11 @@  {{$editmenu.edit.3}} {{/if}} + {{if $exportlink}} +
+  {{$export}} +
+ {{/if}}

{{$title}}

-- cgit v1.2.3