aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-09-15 21:31:32 -0700
committerfriendica <info@friendica.com>2014-09-15 21:31:32 -0700
commit5f9c326ad7b7ba4a4c84ff2582898414f76267ca (patch)
tree2baf4934e8dd8e084c30c3c2631ae1a8e3abdeba /include
parent171719a774f9dc1ea81d11f15b121222bd30a898 (diff)
downloadvolse-hubzilla-5f9c326ad7b7ba4a4c84ff2582898414f76267ca.tar.gz
volse-hubzilla-5f9c326ad7b7ba4a4c84ff2582898414f76267ca.tar.bz2
volse-hubzilla-5f9c326ad7b7ba4a4c84ff2582898414f76267ca.zip
channel export with items
Diffstat (limited to 'include')
-rw-r--r--include/identity.php36
-rw-r--r--include/widgets.php10
2 files changed, 40 insertions, 6 deletions
diff --git a/include/identity.php b/include/identity.php
index d8f59e56c..1078ff082 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -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
@@ -468,8 +468,42 @@ function identity_basic_export($channel_id) {
$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;
+
}
diff --git a/include/widgets.php b/include/widgets.php
index 1aa018fb6..f1c9ceada 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -481,11 +481,11 @@ function widget_settings_menu($arr) {
'selected' => ''
),
-// array(
-// 'label' => t('Export account'),
-// 'url' => $a->get_baseurl(true) . '/uexport/complete',
-// 'selected' => ''
-// ),
+ array(
+ 'label' => t('Export content'),
+ 'url' => $a->get_baseurl(true) . '/uexport/complete',
+ 'selected' => ''
+ ),
array(
'label' => t('Automatic Permissions (Advanced)'),