mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
various fixes
This commit is contained in:
parent
bf405df4ed
commit
40ab482ada
3 changed files with 21 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 \<a class="zrl" href="xxxxxxxxxx"\> 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 = '<a' . $match[1] . ' href="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"';
|
||||
$replace = '<a' . $match[1] . ' href="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"' . $match[3] . '>';
|
||||
|
||||
$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 = '<img' . $match[1] . ' src="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"';
|
||||
$replace = '<img' . $match[1] . ' src="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"' . $match[3] . '>';
|
||||
|
||||
$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('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);
|
||||
$s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_img_callback',$s);
|
||||
$s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"(.*?)\>/ism','zidify_callback',$s);
|
||||
$s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"(.*?)\>/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 = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||
$replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"' . $match[3] . '>';
|
||||
|
||||
$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 = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||
$replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"' . $match[3] . '>';
|
||||
|
||||
$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('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_text_callback',$s);
|
||||
$s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_text_img_callback',$s);
|
||||
$s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"(.*?)\>/ism','zidify_text_callback',$s);
|
||||
$s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"(.*?)\>/ism','zidify_text_img_callback',$s);
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue