aboutsummaryrefslogtreecommitdiffstats
path: root/mod/uexport.php
blob: 6304115c870e4400b86fb460a3925b7108ab796f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

function uexport_init(&$a) {
	if(! local_user())
		killme();

	$channel = $a->get_channel();

	require_once('include/identity.php');

	header('content-type: application/octet_stream');
	header('content-disposition: attachment; filename="' . $channel['channel_address'] . '.json"' );


	if(argc() > 1 && argv(1) === 'basic') {
		echo json_encode(identity_basic_export(local_user()));
		killme();
	}

	if(argc() > 1 && argv(1) === 'complete') {
		echo json_encode(identity_basic_export(local_user(),true));
		killme();
	}
	
}