aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-06-02 22:11:11 +0200
committerMario Vavti <mario@mariovavti.com>2018-06-02 22:11:11 +0200
commit8189408190333b4f6ac45f98623be0d1db8b9462 (patch)
treeeb10d322eb63456bc7685c33db3ca627abf1cecf /include/text.php
parentdb0a3a753420e8722776094334759dd4ff61fc77 (diff)
downloadvolse-hubzilla-8189408190333b4f6ac45f98623be0d1db8b9462.tar.gz
volse-hubzilla-8189408190333b4f6ac45f98623be0d1db8b9462.tar.bz2
volse-hubzilla-8189408190333b4f6ac45f98623be0d1db8b9462.zip
finalize filters and forum notifications
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php54
1 files changed, 43 insertions, 11 deletions
diff --git a/include/text.php b/include/text.php
index 319de67a8..7c519eb64 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3335,22 +3335,54 @@ function unique_multidim_array($array, $key) {
return $temp_array;
}
-function network_qstring($req) {
+function get_forum_channels($uid) {
- $ret = '?f=';
+ if(! $uid)
+ return;
+
+ $perms_sql = item_permissions_sql($uid) . item_normal();
- if(x($req, 'cid'))
- $ret .= '&cid=' . $req['cid'];
+ $xf = false;
- if(x($req, 'gid'))
- $ret .= '&gid=' . $req['gid'];
+ $x1 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'send_stream' and v = '0'",
+ intval($uid)
+ );
+ if($x1) {
+ $xc = ids_to_querystr($x1,'xchan',true);
- if(x($req, 'star'))
- $ret .= '&star=' . $req['star'];
+ $x2 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'tag_deliver' and v = '1' and xchan in (" . $xc . ") ",
+ intval($uid)
+ );
- if(x($req, 'conv'))
- $ret .= '&conv=' . $req['conv'];
+ if($x2) {
+ $xf = ids_to_querystr($x2,'xchan',true);
- return $ret;
+ // private forums
+ $x3 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'post_wall' and v = '1' and xchan in (" . $xc . ") and not xchan in (" . $xf . ") ",
+ intval(local_channel())
+ );
+ if($x3) {
+ $xf = ids_to_querystr(array_merge($x2,$x3),'xchan',true);
+ }
+ }
+ }
+
+ $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 $sql_extra order by xchan_name",
+ intval($uid)
+ );
+
+ for($x = 0; $x < count($r); $x ++) {
+ if($x3) {
+ foreach($x3 as $xx) {
+ if($r[$x]['xchan_hash'] == $xx['xchan']) {
+ $r[$x]['private_forum'] = 1;
+ }
+ }
+ }
+ }
+
+ return $r;
}