diff options
author | git-marijus <mario@mariovavti.com> | 2017-08-28 23:45:03 +0200 |
---|---|---|
committer | git-marijus <mario@mariovavti.com> | 2017-08-28 23:45:03 +0200 |
commit | 8517e7e7982acde8d0683edb93e465c68d338d92 (patch) | |
tree | eebad52c08198ac979bc907e21473c27e36eb30c | |
parent | e70bf975084ee44662bc2c1c19d2fe6aa0268dee (diff) | |
parent | 6385d11b5489d3d3cf0c8200e689276824af148e (diff) | |
download | volse-hubzilla-8517e7e7982acde8d0683edb93e465c68d338d92.tar.gz volse-hubzilla-8517e7e7982acde8d0683edb93e465c68d338d92.tar.bz2 volse-hubzilla-8517e7e7982acde8d0683edb93e465c68d338d92.zip |
Merge remote-tracking branch 'mike/master' into dev
-rw-r--r-- | Zotlabs/Lib/ActivityStreams.php | 43 | ||||
-rw-r--r-- | Zotlabs/Widget/Categories.php | 2 | ||||
-rw-r--r-- | view/js/main.js | 4 |
3 files changed, 46 insertions, 3 deletions
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index 3bbe3b190..686f4a140 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -14,6 +14,8 @@ class ActivityStreams { public $origin = null; public $owner = null; + public $recips = null; + function __construct($string) { $this->data = json_decode($string,true); @@ -28,7 +30,7 @@ class ActivityStreams { $this->obj = $this->get_compound_property('object'); $this->tgt = $this->get_compound_property('target'); $this->origin = $this->get_compound_property('origin'); - $this->owner = $this->get_compound_property('owner','','http://purl.org/zot/protocol'); + $this->recips = $this->collect_recips(); if(($this->type === 'Note') && (! $this->obj)) { $this->obj = $this->data; @@ -41,6 +43,45 @@ class ActivityStreams { return $this->valid; } + function collect_recips($base = '',$namespace = 'https://www.w3.org/ns/activitystreams') { + $x = []; + $fields = [ 'to','cc','bto','bcc','audience']; + foreach($fields as $f) { + $y = $this->get_compound_property($f,$base,$namespace); + if($y) + $x = array_merge($x,$y); + } +// not yet ready for prime time +// $x = $this->expand($x,$base,$namespace); + return $x; + } + + function expand($arr,$base = '',$namespace = 'https://www.w3.org/ns/activitystreams') { + $ret = []; + + // right now use a hardwired recursion depth of 5 + + for($z = 0; $z < 5; $z ++) { + if(is_array($arr) && $arr) { + foreach($arr as $a) { + if(is_array($a)) { + $ret[] = $a; + } + else { + $x = $this->get_compound_property($a,$base,$namespace); + if($x) { + $ret = array_merge($ret,$x); + } + } + } + } + } + + // @fixme de-duplicate + + return $ret; + } + function get_namespace($base,$namespace) { $key = null; diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index 84deb03d6..305869706 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -19,7 +19,7 @@ class Categories { } $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : ''); - $srchurl = \App::$query_string; + $srchurl = (($cards) ? \App::$argv[0] . '/' . \App::$argv[1] : \App::$query_string); $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); diff --git a/view/js/main.js b/view/js/main.js index 109b864a2..41be3da59 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1128,8 +1128,10 @@ function post_comment(id) { $("#comment-edit-wrapper-" + id).hide(); $("#comment-edit-text-" + id).val(''); var tarea = document.getElementById("comment-edit-text-" + id); - if(tarea) + if(tarea) { commentClose(tarea, id); + $(document).unbind( "click.commentOpen"); + } if(timer) clearTimeout(timer); timer = setTimeout(NavUpdate,1500); } |