From f4aca35a889753be85cb0db5fbfb19824b882fdb Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 31 Jan 2017 16:01:47 -0800 Subject: move diaspora account import to the diaspora plugin --- include/Import/import_diaspora.php | 148 ------------------------------------- 1 file changed, 148 deletions(-) delete mode 100644 include/Import/import_diaspora.php (limited to 'include') diff --git a/include/Import/import_diaspora.php b/include/Import/import_diaspora.php deleted file mode 100644 index c6dae0117..000000000 --- a/include/Import/import_diaspora.php +++ /dev/null @@ -1,148 +0,0 @@ - escape_tags($data['user']['name']), - 'nickname' => $address, - 'account_id' => $account['account_id'], - 'permissions_role' => 'social' - )); - - if(! $c['success']) - return; - - $channel_id = $c['channel']['channel_id']; - - // Hubzilla only: Turn on the Diaspora protocol so that follow requests will be sent. - - set_pconfig($channel_id,'system','diaspora_allowed','1'); - - // todo - add auto follow settings, (and strip exif in hubzilla) - - $location = escape_tags($data['user']['profile']['location']); - if(! $location) - $location = ''; - - - q("update channel set channel_location = '%s' where channel_id = %d", - dbesc($location), - intval($channel_id) - ); - - if($data['user']['profile']['nsfw']) { - q("update channel set channel_pageflags = (channel_pageflags | %d) where channel_id = %d", - intval(PAGE_ADULT), - intval($channel_id) - ); - } - - if($data['user']['profile']['image_url']) { - $p = z_fetch_url($data['user']['profile']['image_url'],true); - if($p['success']) { - $rawbytes = $p['body']; - $type = guess_image_type('dummyfile',$p['header']); - import_channel_photo($rawbytes,$type,$c['channel']['channel_account_id'],$channel_id); - } - } - - $gender = escape_tags($data['user']['profile']['gender']); - $about = markdown_to_bb($data['user']['profile']['bio']); - $publish = intval($data['user']['profile']['searchable']); - if($data['user']['profile']['birthday']) - $dob = datetime_convert('UTC','UTC',$data['user']['profile']['birthday'],'Y-m-d'); - else - $dob = '0000-00-00'; - - // we're relying on the fact that this channel was just created and will only - // have the default profile currently - - $r = q("update profile set gender = '%s', about = '%s', dob = '%s', publish = %d where uid = %d", - dbesc($gender), - dbesc($about), - dbesc($dob), - dbesc($publish), - intval($channel_id) - ); - - if($data['user']['aspects']) { - foreach($data['user']['aspects'] as $aspect) { - group_add($channel_id,escape_tags($aspect['name']),intval($aspect['contacts_visible'])); - } - } - - // now add connections and send friend requests - - - if($data['user']['contacts']) { - foreach($data['user']['contacts'] as $contact) { - $result = new_contact($channel_id, $contact['person_diaspora_handle'], $c['channel']); - if($result['success']) { - if($contact['aspects']) { - foreach($contact['aspects'] as $aspect) { - group_add_member($channel_id,$aspect['name'],$result['abook']['xchan_hash']); - } - } - } - } - } - - - // Then add items - note this can't be done until Diaspora adds guids to exported - // items and comments - - - - // This will indirectly perform a refresh_all *and* update the directory - - proc_run('php', 'include/directory.php', $channel_id); - - notice( t('Import completed.') . EOL); - - change_channel($channel_id); - - goaway(z_root() . '/network' ); - -} \ No newline at end of file -- cgit v1.2.3