channel export with items
This commit is contained in:
parent
171719a774
commit
5f9c326ad7
@ -396,7 +396,7 @@ function set_default_login_identity($account_id,$channel_id,$force = true) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function identity_basic_export($channel_id) {
|
function identity_basic_export($channel_id, $items = false) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Red basic channel export
|
* Red basic channel export
|
||||||
@ -468,8 +468,42 @@ function identity_basic_export($channel_id) {
|
|||||||
$ret['photo'] = array('type' => $r[0]['type'], 'data' => base64url_encode($r[0]['data']));
|
$ret['photo'] = array('type' => $r[0]['type'], 'data' => base64url_encode($r[0]['data']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! $items)
|
||||||
|
return $ret;
|
||||||
|
|
||||||
|
|
||||||
|
$r = q("select * from item_id where uid = %d",
|
||||||
|
intval($channel_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
if($r)
|
||||||
|
$ret['item_id'] = $r;
|
||||||
|
|
||||||
|
$key = get_config('system','prvkey');
|
||||||
|
|
||||||
|
// warning: this may run into memory limits on smaller systems
|
||||||
|
|
||||||
|
$r = q("select * from item where (item_flags & %d) and not (item_restrict & %d) and uid = %d",
|
||||||
|
intval(ITEM_WALL),
|
||||||
|
intval(ITEM_DELETED),
|
||||||
|
intval($channel_id)
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
for($x = 0; $x < count($r); $x ++) {
|
||||||
|
if($r[$x]['diaspora_meta'])
|
||||||
|
$r[$x]['diaspora_meta'] = crypto_unencapsulate(json_decode($r[$x]['diaspora_meta'],true),$key);
|
||||||
|
if($r[$x]['item_flags'] & ITEM_OBSCURED) {
|
||||||
|
$r[$x]['item_flags'] = $r[$x]['item_flags'] ^ ITEM_OBSCURED;
|
||||||
|
if($r[$x]['title'])
|
||||||
|
$r[$x]['title'] = crypto_unencapsulate(json_decode($r[$x]['title'],true),$key);
|
||||||
|
if($r[$x]['body'])
|
||||||
|
$r[$x]['body'] = crypto_unencapsulate(json_decode($r[$x]['body'],true),$key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ret['item'] = $r;
|
||||||
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,11 +481,11 @@ function widget_settings_menu($arr) {
|
|||||||
'selected' => ''
|
'selected' => ''
|
||||||
),
|
),
|
||||||
|
|
||||||
// array(
|
array(
|
||||||
// 'label' => t('Export account'),
|
'label' => t('Export content'),
|
||||||
// 'url' => $a->get_baseurl(true) . '/uexport/complete',
|
'url' => $a->get_baseurl(true) . '/uexport/complete',
|
||||||
// 'selected' => ''
|
'selected' => ''
|
||||||
// ),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'label' => t('Automatic Permissions (Advanced)'),
|
'label' => t('Automatic Permissions (Advanced)'),
|
||||||
|
@ -376,6 +376,12 @@ function import_post(&$a) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME just a note here for when folks want to import content - be very careful to unset ITEM_ORIGIN on all imported content. Or you could end up with a nasty routing loop when somebody tries to reply to one of those posts.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME - ensure we have a self entry if somebody is trying to pull a fast one
|
// FIXME - ensure we have a self entry if somebody is trying to pull a fast one
|
||||||
|
|
||||||
if($seize) {
|
if($seize) {
|
||||||
|
@ -18,7 +18,7 @@ function uexport_init(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(argc() > 1 && argv(1) === 'complete') {
|
if(argc() > 1 && argv(1) === 'complete') {
|
||||||
echo json_encode('not yet implemented');
|
echo json_encode(identity_basic_export(local_user(),true));
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user