diff options
author | zotlabs <mike@macgirvin.com> | 2020-02-09 16:32:18 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2020-02-09 16:32:18 -0800 |
commit | bbcb237f5b996e94af37611152105b2e965ea493 (patch) | |
tree | 042ea69cfc8eb90f0588b9c71edb8e4ef164390b /Zotlabs/Module/Item.php | |
parent | fc9e6d289acf30f89da0051a90cbf16f0bc006fb (diff) | |
download | volse-hubzilla-bbcb237f5b996e94af37611152105b2e965ea493.tar.gz volse-hubzilla-bbcb237f5b996e94af37611152105b2e965ea493.tar.bz2 volse-hubzilla-bbcb237f5b996e94af37611152105b2e965ea493.zip |
poll updates
Diffstat (limited to 'Zotlabs/Module/Item.php')
-rw-r--r-- | Zotlabs/Module/Item.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 21d59fbc1..e55192c7f 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -719,14 +719,6 @@ class Item extends Controller { // and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.) // we may need virtual or template classes to implement the possible alternatives - $obj = $this->extract_poll_data($body); - if ($obj) { - $datarray['obj'] = $obj; - $obj_type = 'Question'; - } - - - if(strpos($body,'[/summary]') !== false) { $match = ''; $cnt = preg_match("/\[summary\](.*?)\[\/summary\]/ism",$body,$match); @@ -928,6 +920,13 @@ class Item extends Controller { $mid = z_root() . '/item/' . $uuid; } + $obj = $this->extract_poll_data($body,[ 'item_private' => $private, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_contact_deny ]); + if ($obj) { + $obj['url'] = $mid; + $obj['attributedTo'] = channel_url($channel); + $datarray['obj'] = $obj; + $obj_type = 'Question'; + } if(! $parent_mid) { $parent_mid = $mid; @@ -1394,7 +1393,7 @@ class Item extends Controller { return $ret; } - function extract_poll_data(&$body) { + function extract_poll_data(&$body,$item) { $multiple = false; @@ -1438,7 +1437,15 @@ class Item extends Controller { if (preg_match('/\[ends\](.*?)\[\/ends\]/',$body,$matches)) { $obj['endTime'] = datetime_convert(date_default_timezone_get(),'UTC', $matches[1],ATOM_TIME); - $body = str_replace('[ends]' . $match[1] . '[/ends]', EMPTY_STR, $body); + $body = str_replace('[ends]' . $matches[1] . '[/ends]', EMPTY_STR, $body); + } + + + if ($item['item_private']) { + $obj['to'] = Activity::map_acl($item); + } + else { + $obj['to'] = [ ACTIVITY_PUBLIC_INBOX ]; } return $obj; |