aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-02-27 10:22:48 +0100
committerMario <mario@mariovavti.com>2020-02-27 10:22:48 +0100
commit7cf73e0533a61270c9bc5036c3da0e4ea4c593c5 (patch)
tree8dc4892673a8703d2191cb2fe1ecf3b0dbd09c81
parent03e9ed71b4d0424c0dec103ada46cbd40d018b45 (diff)
parent85cf25a2a8bfbbfe10de485d4affd54626fbbfa4 (diff)
downloadvolse-hubzilla-7cf73e0533a61270c9bc5036c3da0e4ea4c593c5.tar.gz
volse-hubzilla-7cf73e0533a61270c9bc5036c3da0e4ea4c593c5.tar.bz2
volse-hubzilla-7cf73e0533a61270c9bc5036c3da0e4ea4c593c5.zip
Merge branch 'dev' into 'dev'
add iconfig to zot6 objects See merge request hubzilla/core!1835
-rw-r--r--Zotlabs/Lib/Activity.php52
-rw-r--r--Zotlabs/Module/Apschema.php5
-rwxr-xr-xboot.php2
-rw-r--r--include/channel.php31
4 files changed, 81 insertions, 9 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 5cb111381..2f219af1f 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -504,10 +504,47 @@ class Activity {
}
}
}
+ if ($item['iconfig']) {
+ foreach ($item['iconfig'] as $att) {
+ if ($att['sharing']) {
+ $value = ((preg_match('|^a:[0-9]+:{.*}$|s', $att['v'])) ? unserialize($att['v']) : $att['v']);
+ $ret[] = [ 'type' => 'PropertyValue', 'name' => 'zot.' . $att['cat'] . '.' . $att['k'], 'value' => $value ];
+ }
+ }
+ }
return $ret;
}
+ static function decode_iconfig($item) {
+
+ $ret = [];
+
+ if (is_array($item['attachment']) && $item['attachment']) {
+ $ptr = $item['attachment'];
+ if (! array_key_exists(0,$ptr)) {
+ $ptr = [ $ptr ];
+ }
+ foreach ($ptr as $att) {
+ $entry = [];
+ if ($att['type'] === 'PropertyValue') {
+ if (array_key_exists('name',$att) && $att['name']) {
+ $key = explode('.',$att['name']);
+ if (count($key) === 3 && $key[0] === 'zot') {
+ $entry['cat'] = $key[1];
+ $entry['k'] = $key[2];
+ $entry['v'] = $att['value'];
+ $entry['sharing'] = '1';
+ $ret[] = $entry;
+ }
+ }
+ }
+ }
+ }
+ return $ret;
+ }
+
+
static function decode_attachment($item) {
@@ -1888,17 +1925,22 @@ class Activity {
}
}
- $a = self::decode_attachment($act->obj);
- if($a) {
- $s['attach'] = $a;
- }
+ }
+
+ $a = self::decode_attachment($act->obj);
+ if ($a) {
+ $s['attach'] = $a;
+ }
+
+ $a = self::decode_iconfig($act->obj);
+ if ($a) {
+ $s['iconfig'] = $a;
}
if($act->obj['type'] === 'Note' && $s['attach']) {
$s['body'] .= self::bb_attach($s['attach'],$s['body']);
}
-
if ($act->obj['type'] === 'Question' && in_array($act->type,['Create','Update'])) {
if ($act->obj['endTime']) {
$s['comments_closed'] = datetime_convert('UTC','UTC', $act->obj['endTime']);
diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php
index 756057a8a..6b0325d44 100644
--- a/Zotlabs/Module/Apschema.php
+++ b/Zotlabs/Module/Apschema.php
@@ -29,7 +29,10 @@ class Apschema extends \Zotlabs\Web\Controller {
'emojiReaction' => 'zot:emojiReaction',
'expires' => 'zot:expires',
'directMessage' => 'zot:directMessage',
-
+ 'schema' => 'http://schema.org#',
+ 'PropertyValue' => 'schema:PropertyValue',
+ 'value' => 'schema:value',
+
'magicEnv' => [
'@id' => 'zot:magicEnv',
'@type' => '@id'
diff --git a/boot.php b/boot.php
index 1f8fd6c94..ec96045e9 100755
--- a/boot.php
+++ b/boot.php
@@ -473,7 +473,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' );
define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' );
-define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.8' );
+define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.9' );
/**
* activity stream defines
*/
diff --git a/include/channel.php b/include/channel.php
index 66ab56715..991d4675b 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -878,11 +878,38 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals
$ret['abook'] = $r;
for($x = 0; $x < count($ret['abook']); $x ++) {
+
$xchans[] = $ret['abook'][$x]['abook_xchan'];
+ $my_perms = [];
+ $their_perms = [];
+ $newconfig = [];
$abconfig = load_abconfig($channel_id,$ret['abook'][$x]['abook_xchan']);
- if($abconfig)
- $ret['abook'][$x]['abconfig'] = $abconfig;
+ if($abconfig) {
+ foreach ($abconfig as $abc) {
+
+ if ($abc['cat'] === 'my_perms' && intval($abc['v'])) {
+ $my_perms[] = $abc['k'];
+ continue;
+ }
+ if ($abc['cat'] === 'their_perms' && intval($abc['v'])) {
+ $their_perms[] = $abc['k'];
+ continue;
+ }
+ if ($zap_compat && preg_match('|^a:[0-9]+:{.*}$|s', $abc['v'])) {
+ $abc['v'] = serialise(unserialize($abc['v']));
+ }
+ $newconfig[] = $abc;
+ }
+
+ $ret['abook'][$x]['abconfig'] = $newconfig;
+ if ($zap_compat) {
+ $ret['abook'][$x]['abconfig'][] = [ 'chan' => $channel_id, 'xchan' => $ret['abook'][$x]['abook_chan'], 'cat' => 'system', 'k' => 'my_perms', 'v' => implode(',',$my_perms) ];
+ $ret['abook'][$x]['abconfig'][] = [ 'chan' => $channel_id, 'xchan' => $ret['abook'][$x]['abook_chan'], 'cat' => 'system', 'k' => 'their_perms', 'v' => implode(',',$their_perms) ];
+ }
+ }
+
translate_abook_perms_outbound($ret['abook'][$x]);
+
}
// pick up the zot6 xchan and hublocs also