aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2020-01-25 16:24:14 -0800
committerzotlabs <mike@macgirvin.com>2020-01-25 16:24:14 -0800
commitf123809d29d6cc335251cd4fd8984c1b5ef67e2a (patch)
treec8098e8ba3558cbc9fd516b19d64ad055d3a8d71
parentead56c59e2551f39d00e880a2cdb4b2d02b38705 (diff)
downloadvolse-hubzilla-f123809d29d6cc335251cd4fd8984c1b5ef67e2a.tar.gz
volse-hubzilla-f123809d29d6cc335251cd4fd8984c1b5ef67e2a.tar.bz2
volse-hubzilla-f123809d29d6cc335251cd4fd8984c1b5ef67e2a.zip
more work on zap export
-rw-r--r--include/channel.php11
-rw-r--r--include/text.php15
2 files changed, 25 insertions, 1 deletions
diff --git a/include/channel.php b/include/channel.php
index e7d119b1e..66ab56715 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -922,8 +922,17 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals
$r = q("select * from pconfig where uid = %d",
intval($channel_id)
);
- if($r)
+
+ if($r) {
+ if ($zap_compat) {
+ for($x = 0; $x < count($r); $x ++) {
+ if (preg_match('|^a:[0-9]+:{.*}$|s', $r[$x]['v'])) {
+ $r[$x]['v'] = serialise(unserialize($r[$x]['v']));
+ }
+ }
+ }
$ret['config'] = $r;
+ }
// All other term types will be included in items, if requested.
diff --git a/include/text.php b/include/text.php
index 87ed9f658..1f0af08e3 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3694,3 +3694,18 @@ function svg2bb($s) {
}
return EMPTY_STR;
}
+
+
+
+function serialise($x) {
+ return ((is_array($x)) ? 'json:' . json_encode($x) : $x);
+}
+
+function unserialise($x) {
+ if (is_array($x)) {
+ return $x;
+ }
+ $y = ((substr($x,0,5) === 'json:') ? json_decode(substr($x,5),true) : '');
+ return ((is_array($y)) ? $y : $x);
+}
+