aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPaolo Tacconi <p.tacconi@giunti.it>2014-09-26 14:40:22 +0200
committerPaolo Tacconi <p.tacconi@giunti.it>2014-09-26 14:40:22 +0200
commiteaf96f987a5f22a54fdbb4cedef52b0159a37ad0 (patch)
treef1fce3898b757e3a29e928cc1afe724edb620471 /include
parent6324a07dd8b17db5da0ce66c99fb69e2f3ec49e1 (diff)
parent574c4845b711c9ebf53efb2a0fe846f5aea46e87 (diff)
downloadvolse-hubzilla-eaf96f987a5f22a54fdbb4cedef52b0159a37ad0.tar.gz
volse-hubzilla-eaf96f987a5f22a54fdbb4cedef52b0159a37ad0.tar.bz2
volse-hubzilla-eaf96f987a5f22a54fdbb4cedef52b0159a37ad0.zip
Rebase from upstream
Diffstat (limited to 'include')
-rw-r--r--include/api.php4
-rw-r--r--include/identity.php7
-rwxr-xr-xinclude/items.php26
3 files changed, 30 insertions, 7 deletions
diff --git a/include/api.php b/include/api.php
index 47de945db..2505def4c 100644
--- a/include/api.php
+++ b/include/api.php
@@ -546,8 +546,8 @@ require_once('include/items.php');
}
require_once('include/identity.php');
-
- json_return_and_die(identity_basic_export(api_user()));
+
+ json_return_and_die(identity_basic_export(api_user(),(($_REQUEST['posts']) ? intval($_REQUEST['posts']) : 0 )));
}
api_register_func('api/export/basic','api_export_basic', true);
api_register_func('api/red/channel/export/basic','api_export_basic', true);
diff --git a/include/identity.php b/include/identity.php
index 50c5d13b9..eaeb9f07f 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -431,14 +431,15 @@ 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)
* Create an array representing the important channel information
* which would be necessary to create a nomadic identity clone. This includes
* most channel resources and connection information with the exception of content.
*
* @param int $channel_id
* Channel_id to export
- *
+ * @param boolean $items
+ * Include channel posts (wall items), default false
*
* @returns array
* See function for details
@@ -521,7 +522,7 @@ function identity_basic_export($channel_id, $items = false) {
return $ret;
- $r = q("select * from item_id where uid = %d",
+ $r = q("select item_id.*, item.mid from item_id left join item on item_id.iid = item.id where item_id.uid = %d",
intval($channel_id)
);
diff --git a/include/items.php b/include/items.php
index 4d89606da..ac960258c 100755
--- a/include/items.php
+++ b/include/items.php
@@ -865,15 +865,37 @@ function get_item_elements($x) {
// We have to do that here because we need to cleanse the input and prevent bad stuff from getting in,
// and we need plaintext to do that.
+ $key = get_config('system','pubkey');
+
+
if(intval($arr['item_private'])) {
$arr['item_flags'] = $arr['item_flags'] | ITEM_OBSCURED;
- $key = get_config('system','pubkey');
if($arr['title'])
$arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key));
if($arr['body'])
$arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key));
}
+
+ if(array_key_exists('revision',$x)) {
+ // extended export encoding
+
+ $arr['revision'] = $x['revision'];
+ $arr['allow_cid'] = $x['allow_cid'];
+ $arr['allow_gid'] = $x['allow_gid'];
+ $arr['deny_cid'] = $x['deny_cid'];
+ $arr['deny_gid'] = $x['deny_gid'];
+ $arr['layout_mid'] = $x['layout_mid'];
+ $arr['postopts'] = $x['postopts'];
+ $arr['resource_id'] = $x['resource_id'];
+ $arr['resource_type'] = $x['resource_type'];
+ $arr['item_restrict'] = $x['item_restrict'];
+ $arr['item_flags'] = $x['item_flags'];
+ $arr['diaspora_meta'] = (($x['diaspora_meta']) ? json_encode(crypto_encapsulate($x['diaspora_meta'],$key)) : '');
+ $arr['attach'] = $x['attach'];
+
+ }
+
return $arr;
}
@@ -3357,7 +3379,7 @@ function consume_feed($xml,$importer,&$contact,$pass = 0) {
$datarray['author_xchan'] = '';
if($author['author_link'] != $contact['xchan_url']) {
- $x = import_author_unkown(array('name' => $author['author_name'],'url' => $author['author_link'],'photo' => array('src' => $author['author_photo'])));
+ $x = import_author_unknown(array('name' => $author['author_name'],'url' => $author['author_link'],'photo' => array('src' => $author['author_photo'])));
if($x)
$datarray['author_xchan'] = $x;