function uexport_init(&$a) { if (!local_channel()) { killme(); } if (argc() > 1) { $channel = App::get_channel(); require_once 'include/identity.php'; if (argc() > 1 && intval(argv(1)) > 1900) { $year = intval(argv(1)); } if (argc() > 2 && intval(argv(2)) > 0 && intval(argv(2)) <= 12) { $month = intval(argv(2)); } header('content-type: application/octet_stream'); header('content-disposition: attachment; filename="' . $channel['channel_address'] . ($year ? '-' . $year : '') . ($month ? '-' . $month : '') . '.json"'); if ($year) { echo json_encode(identity_export_year(local_channel(), $year, $month)); killme(); } if (argc() > 1 && argv(1) === 'basic') { echo json_encode(identity_basic_export(local_channel())); killme(); } // FIXME - this basically doesn't work in the wild with a channel more than a few months old due to memory and execution time limits. // It probably needs to be built at the CLI and offered to download as a tarball. Maybe stored in the members dav. if (argc() > 1 && argv(1) === 'complete') { echo json_encode(identity_basic_export(local_channel(), true)); killme(); } } }
function export_identity(&$a, $channel_hash) { if ($channel_hash == '') { json_error_die(422, 'Unprocessable Entity', 'Must supply channel_hash parameter.'); } json_return_and_die(identity_basic_export(get_channel_id($channel_hash), $_REQUEST['posts'] ? intval($_REQUEST['posts']) : 0)); }
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('not yet implemented'); killme(); } }
function api_export_basic(&$a, $type) { if (api_user() === false) { logger('api_export_basic: no user'); return false; } require_once 'include/identity.php'; json_return_and_die(identity_basic_export(api_user(), $_REQUEST['posts'] ? intval($_REQUEST['posts']) : 0)); }
function api_export_basic(&$a, $type) { if (api_user() === false) { logger('api_export_basic: no user'); return false; } require_once 'include/identity.php'; json_return_and_die(identity_basic_export(api_user())); }