aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-12-18 12:40:36 +0000
committerMario <mario@mariovavti.com>2020-12-18 12:40:36 +0000
commit801583fd072e8ebe06fa6aeb97d9dd78785a6f39 (patch)
tree7cd2eabc03d451aecf6b29f6a43c55c089d627a5 /include
parent4987534ebaa64a0cc100b185f0f9923a7a1d5566 (diff)
downloadvolse-hubzilla-801583fd072e8ebe06fa6aeb97d9dd78785a6f39.tar.gz
volse-hubzilla-801583fd072e8ebe06fa6aeb97d9dd78785a6f39.tar.bz2
volse-hubzilla-801583fd072e8ebe06fa6aeb97d9dd78785a6f39.zip
flag forums where we do not have post permissions and filter them from the acl selector
Diffstat (limited to 'include')
-rw-r--r--include/acl_selectors.php17
-rw-r--r--include/text.php23
2 files changed, 36 insertions, 4 deletions
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index a3476439a..8da46649c 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -82,7 +82,6 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
$r = q("SELECT id, hash, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval(local_channel())
);
-
if($r) {
$groups .= '<optgroup label = "' . t('Privacy Groups').'">';
foreach($r as $rr) {
@@ -110,13 +109,23 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
if($dialog_description) {
$forums = get_forum_channels(local_channel(),1);
if($forums) {
- $groups .= '<optgroup label = "' . t('Forums').'">';
+ $forums_count = 0;
+ $forum_otions = '';
foreach($forums as $f) {
+ if($f['no_post_perms'])
+ continue;
+
$private = (($f['private_forum']) ? ' (' . t('Private Forum') . ')' : '');
$selected = (($single_group && $f['hash'] === $allow_cid[0]) ? ' selected = "selected" ' : '');
- $groups .= '<option id="^' . $f['abook_id'] . '" value="^' . $f['xchan_hash'] . '"' . $selected . '>' . $f['xchan_name'] . $private . '</option>' . "\r\n";
+ $forum_otions .= '<option id="^' . $f['abook_id'] . '" value="^' . $f['xchan_hash'] . '"' . $selected . '>' . $f['xchan_name'] . $private . '</option>' . "\r\n";
+ $forums_count++;
}
- $groups .= '</optgroup>';
+ if($forums_count) {
+ $groups .= '<optgroup label = "' . t('Forums').'">';
+ $groups .= $forum_otions;
+ $groups .= '</optgroup>';
+ }
+
}
}
diff --git a/include/text.php b/include/text.php
index 3fb17b648..27b8d49a7 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3690,6 +3690,11 @@ function get_forum_channels($uid) {
);
if($x1) {
+
+ $x2 = [];
+ $x3 = [];
+ $x4 = [];
+
$xc = ids_to_querystr($x1,'xchan',true);
$x2 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'tag_deliver' and v = '1' and xchan in (" . $xc . ") ",
@@ -3706,6 +3711,15 @@ function get_forum_channels($uid) {
if($x3) {
$xf = ids_to_querystr(array_merge($x2,$x3),'xchan',true);
}
+
+ // public forums with no permission to post
+ $x4 = q("select xchan from abconfig left join xchan on xchan = xchan_hash where chan = %d and cat = 'their_perms' and k in ('post_wall', 'tag_deliver') and v = '0' and xchan in (" . $xc . ") and xchan_pubforum = 1 $sql_extra ",
+ intval(local_channel())
+ );
+ if($x4) {
+ $xf = ids_to_querystr(array_merge($x2,$x3,$x4),'xchan',true);
+ }
+
}
$sql_extra_1 = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
@@ -3722,6 +3736,15 @@ function get_forum_channels($uid) {
}
}
}
+
+ if($x4) {
+ foreach($x4 as $xx) {
+ if($r[$x]['xchan_hash'] == $xx['xchan']) {
+ $r[$x]['no_post_perms'] = 1;
+ }
+ }
+ }
+
}
App::$data['forum_channels'] = $r;