aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php4
-rw-r--r--include/text.php6
-rw-r--r--include/wiki.php39
3 files changed, 49 insertions, 0 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 1efca37f3..6bcd968f4 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1253,6 +1253,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 d508f8ab3..d283bb41f 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2824,6 +2824,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
diff --git a/include/wiki.php b/include/wiki.php
index 424b2d9a0..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) {
@@ -505,6 +511,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 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">';
+ $s2 = '</span>';
+ $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) {