diff options
author | Thomas Willingham <beardyunixer@beardyunixer.com> | 2014-09-18 18:07:38 +0100 |
---|---|---|
committer | Thomas Willingham <beardyunixer@beardyunixer.com> | 2014-09-18 18:07:38 +0100 |
commit | bdfe2c77868afd59716103091b0dfa05060252d5 (patch) | |
tree | 83bb1d5522e2c12ea778c84879f269ab56d712c0 /include/items.php | |
parent | 68ecc673b109be50dc04cf72af8ce2296c70b86b (diff) | |
parent | 595be9919b0ce85087937985444477189381976c (diff) | |
download | volse-hubzilla-bdfe2c77868afd59716103091b0dfa05060252d5.tar.gz volse-hubzilla-bdfe2c77868afd59716103091b0dfa05060252d5.tar.bz2 volse-hubzilla-bdfe2c77868afd59716103091b0dfa05060252d5.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/include/items.php b/include/items.php index beec65d8a..1fa833eb2 100755 --- a/include/items.php +++ b/include/items.php @@ -1007,8 +1007,7 @@ function import_author_unknown($x) { } - -function encode_item($item) { +function encode_item($item,$mirror = false) { $x = array(); $x['type'] = 'activity'; $x['encoding'] = 'zot'; @@ -1030,14 +1029,37 @@ function encode_item($item) { $c_scope = map_scope($comment_scope); + $key = get_config('system','prvkey'); + if(array_key_exists('item_flags',$item) && ($item['item_flags'] & ITEM_OBSCURED)) { - $key = get_config('system','prvkey'); if($item['title']) $item['title'] = crypto_unencapsulate(json_decode_plus($item['title']),$key); if($item['body']) $item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key); } + // If we're trying to backup an item so that it's recoverable or for export/imprt, + // add all the attributes we need to recover it + + if($mirror) { + $x['id'] = $item['id']; + $x['parent'] = $item['parent']; + $x['uid'] = $item['uid']; + $x['allow_cid'] = $item['allow_cid']; + $x['allow_gid'] = $item['allow_gid']; + $x['deny_cid'] = $item['deny_cid']; + $x['deny_gid'] = $item['deny_gid']; + $x['revision'] = $item['revision']; + $x['layout_mid'] = $item['layout_mid']; + $x['postopts'] = $item['postopts']; + $x['resource_id'] = $item['resource_id']; + $x['resource_type'] = $item['resource_type']; + $x['item_restrict'] = $item['item_restrict']; + $x['item_flags'] = $item['item_flags']; + $x['diaspora_meta'] = crypto_unencapsulate(json_decode($item['diaspora_meta'],true),$key); + $x['attach'] = $item['attach']; + } + $x['message_id'] = $item['mid']; $x['message_top'] = $item['parent_mid']; |