diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index ecfdae8ee..ac7319607 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -72,7 +72,7 @@ class ActivityStreams { if($this->is_valid()) { $this->id = $this->get_property_obj('id'); $this->type = $this->get_primary_type(); - $this->actor = $this->get_compound_property('actor'); + $this->actor = $this->get_compound_property('actor','','',true); $this->obj = $this->get_compound_property('object'); $this->tgt = $this->get_compound_property('target'); $this->origin = $this->get_compound_property('origin'); @@ -87,9 +87,9 @@ class ActivityStreams { } if($this->obj && $this->obj['actor']) - $this->obj['actor'] = $this->get_compound_property('actor',$this->obj); + $this->obj['actor'] = $this->get_compound_property('actor',$this->obj,'',true); if($this->tgt && $this->tgt['actor']) - $this->tgt['actor'] = $this->get_compound_property('actor',$this->tgt); + $this->tgt['actor'] = $this->get_compound_property('actor',$this->tgt,'',true); @@ -262,9 +262,10 @@ class ActivityStreams { * @param string $property * @param array $base * @param string $namespace (optional) default empty + * @param boolean $first (optional) default false, if true and result is a sequential array return only the first element * @return NULL|mixed */ - function get_compound_property($property, $base = '', $namespace = '') { + function get_compound_property($property, $base = '', $namespace = '', $first = false) { $x = $this->get_property_obj($property, $base, $namespace); if($this->is_url($x)) { $x = $this->fetch_property($x); @@ -287,6 +288,9 @@ class ActivityStreams { } } } + if($first && array_key_exists(0,$x,true)) { + return $x[0]; + } return $x; } diff --git a/include/text.php b/include/text.php index ae7e499dd..e1db23ae1 100644 --- a/include/text.php +++ b/include/text.php @@ -3430,6 +3430,8 @@ function get_forum_channels($uid) { if(! $uid) return; + + $xf = false; $x1 = q("select xchan from abconfig where chan = %d and cat = 'system' and k = 'their_perms' and not v like '%s'", @@ -3459,7 +3461,6 @@ function get_forum_channels($uid) { $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 "); - $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 "); $r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 and abook_archived = 0 $sql_extra order by xchan_name", intval($uid) diff --git a/include/zid.php b/include/zid.php index fe06948ba..cbb609744 100644 --- a/include/zid.php +++ b/include/zid.php @@ -125,18 +125,17 @@ function clean_query_string($s = '') { * because the latter is used for general purpose conversions and the former is used only when preparing text for * immediate display. * - * @TODO Issues: Currently the order of HTML parameters in the text is somewhat rigid and inflexible. - * We assume it looks like \ and will not work if zrl and href appear in a different order. * * @param array $match * @return string */ + function zidify_callback($match) { - $arr = [ 'zid' => ((strpos($match[1],'zrl')) ? true : false), 'url' => $match[2] ]; + $arr = [ 'zid' => ((strpos($match[1],'zrl') || strpos($match[3],'zrl')) ? true : false), 'url' => $match[2] ]; call_hooks('zidify', $arr); - $replace = ''; $x = str_replace($match[0], $replace, $match[0]); @@ -145,10 +144,10 @@ function zidify_callback($match) { function zidify_img_callback($match) { - $arr = [ 'zid' => ((strpos($match[1],'zrl')) ? true : false), 'url' => $match[2] ]; + $arr = [ 'zid' => ((strpos($match[1],'zrl') || strpos($match[3],'zrl')) ? true : false), 'url' => $match[2] ]; call_hooks('zidify', $arr); - $replace = ''; $x = str_replace($match[0], $replace, $match[0]); @@ -157,8 +156,8 @@ function zidify_img_callback($match) { function zidify_links($s) { - $s = preg_replace_callback('/\/ism','zidify_callback',$s); + $s = preg_replace_callback('/\/ism','zidify_img_callback',$s); return $s; } @@ -166,7 +165,7 @@ function zidify_links($s) { function zidify_text_callback($match) { $is_zid = is_matrix_url($match[2]); - $replace = ''; $x = str_replace($match[0], $replace, $match[0]); @@ -175,7 +174,7 @@ function zidify_text_callback($match) { function zidify_text_img_callback($match) { $is_zid = is_matrix_url($match[2]); - $replace = ''; $x = str_replace($match[0], $replace, $match[0]); @@ -184,8 +183,8 @@ function zidify_text_img_callback($match) { function zidify_text($s) { - $s = preg_replace_callback('/\/ism','zidify_text_callback',$s); + $s = preg_replace_callback('/\/ism','zidify_text_img_callback',$s); return $s; }