From c50bfa07ca3a456d69d73988f42e58e3282879e9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 3 Aug 2016 21:16:57 +0200 Subject: multiple acl work --- include/conversation.php | 6 ++++++ include/text.php | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 1efca37f3..f68d538dc 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1213,6 +1213,8 @@ function status_editor($a, $x, $popup = false) { call_hooks('jot_tool', $jotplugins); + //print_r(acl2json($x['permissions']['allow_gid'])); killme(); + $o .= replace_macros($tpl, array( '$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : App::$query_string), '$action' => z_root() . '/item', @@ -1253,6 +1255,10 @@ function status_editor($a, $x, $popup = false) { '$visitor' => $x['visitor'], '$lockstate' => $x['lockstate'], '$acl' => $x['acl'], + '$allow_cid' => acl2json($x['permissions']['allow_cid']), + '$allow_gid' => acl2json($x['permissions']['allow_gid']), + '$deny_cid' => acl2json($x['permissions']['deny_cid']), + '$deny_gid' => acl2json($x['permissions']['deny_gid']), '$mimeselect' => $mimeselect, '$layoutselect' => $layoutselect, '$showacl' => ((array_key_exists('showacl', $x)) ? $x['showacl'] : true), diff --git a/include/text.php b/include/text.php index 1eec2ba0a..6d7d0ed8d 100644 --- a/include/text.php +++ b/include/text.php @@ -2796,6 +2796,12 @@ function expand_acl($s) { return $ret; } +function acl2json($s) { + $s = expand_acl($s); + $s = json_encode($s); + return $s; +} + // When editing a webpage - a dropdown is needed to select a page layout // On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in -- cgit v1.2.3 From 908e15bc9041f757217ba8d3635a8d83a5544c46 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 3 Aug 2016 23:57:41 +0200 Subject: multi acl: port events --- include/conversation.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index f68d538dc..6bcd968f4 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1213,8 +1213,6 @@ function status_editor($a, $x, $popup = false) { call_hooks('jot_tool', $jotplugins); - //print_r(acl2json($x['permissions']['allow_gid'])); killme(); - $o .= replace_macros($tpl, array( '$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : App::$query_string), '$action' => z_root() . '/item', -- cgit v1.2.3 From 05a9f0aa1473e155c7f0ac27ef733bf174e49abd Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Wed, 3 Aug 2016 20:53:51 -0400 Subject: Convert select bbcode tags including [observer], [baseurl], [sitename] --- include/wiki.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include') diff --git a/include/wiki.php b/include/wiki.php index 424b2d9a0..494ff835e 100644 --- a/include/wiki.php +++ b/include/wiki.php @@ -505,6 +505,39 @@ function wiki_generate_toc($s) { return $s; } +/** + * Converts a select set of bbcode tags. Much of the code is copied from include/bbcode.php + * @param string $s + * @return string + */ +function wiki_bbcode($s) { + + $s = str_replace(array('[baseurl]', '[sitename]'), array(z_root(), get_config('system', 'sitename')), $s); + + $observer = App::get_observer(); + if ($observer) { + $s1 = ''; + $s2 = ''; + $obsBaseURL = $observer['xchan_connurl']; + $obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL); + $s = str_replace('[observer.baseurl]', $obsBaseURL, $s); + $s = str_replace('[observer.url]', $observer['xchan_url'], $s); + $s = str_replace('[observer.name]', $s1 . $observer['xchan_name'] . $s2, $s); + $s = str_replace('[observer.address]', $s1 . $observer['xchan_addr'] . $s2, $s); + $s = str_replace('[observer.webname]', substr($observer['xchan_addr'], 0, strpos($observer['xchan_addr'], '@')), $s); + $s = str_replace('[observer.photo]', '', $s); + } else { + $s = str_replace('[observer.baseurl]', '', $s); + $s = str_replace('[observer.url]', '', $s); + $s = str_replace('[observer.name]', '', $s); + $s = str_replace('[observer.address]', '', $s); + $s = str_replace('[observer.webname]', '', $s); + $s = str_replace('[observer.photo]', '', $s); + } + + return $s; +} + // This function is derived from // http://stackoverflow.com/questions/32068537/generate-table-of-contents-from-markdown-in-php function wiki_toc($content) { -- cgit v1.2.3 From 6a82ff871f56233756c2036d307e5cfffbfab325 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Thu, 4 Aug 2016 19:45:35 -0400 Subject: Parse bbcode when page loads --- include/wiki.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/wiki.php b/include/wiki.php index 494ff835e..d52308b08 100644 --- a/include/wiki.php +++ b/include/wiki.php @@ -495,6 +495,12 @@ function wiki_convert_links($s, $wikiURL) { return $s; } +/** + * Replace the instances of the string [toc] with a list element that will be populated by + * a table of contents by the JavaScript library + * @param string $s + * @return string + */ function wiki_generate_toc($s) { if (strpos($s,'[toc]') !== false) { -- cgit v1.2.3