From 8189408190333b4f6ac45f98623be0d1db8b9462 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 2 Jun 2018 22:11:11 +0200 Subject: finalize filters and forum notifications --- include/features.php | 13 +++++++++++-- include/nav.php | 4 ++-- include/text.php | 54 +++++++++++++++++++++++++++++++++++++++++----------- 3 files changed, 56 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/features.php b/include/features.php index 3d3e41a05..bcdea73e0 100644 --- a/include/features.php +++ b/include/features.php @@ -394,10 +394,19 @@ function get_features($filtered = true, $level = (-1)) { feature_level('order_tab',2), ], + [ + 'forums_tab', + t('Forum Filter'), + t('Ability to display only posts of a specific forum'), + false, + get_config('feature_lock','forums_tab'), + feature_level('forums_tab',1), + ], + [ 'personal_tab', - t('Network Personal Tab'), - t('Enable tab to display only Network posts that you\'ve interacted on'), + t('Personal Posts Filter'), + t('Ability to display only Network posts that you\'ve interacted on'), false, get_config('feature_lock','personal_tab'), feature_level('personal_tab',1), diff --git a/include/nav.php b/include/nav.php index d83337481..27a8ced0f 100644 --- a/include/nav.php +++ b/include/nav.php @@ -91,10 +91,10 @@ function nav($template = 'default') { if(local_channel()) { if(! $_SESSION['delegate']) { - $nav['manage'] = array('manage', t('Manage Channels'), "", t('Manage your channels'),'manage_nav_btn'); + $nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage your channels'),'manage_nav_btn'); } - $nav['group'] = array('group', t('Manage Privacy Groups'),"", t('Add and edit privacy groups'),'group_nav_btn'); + $nav['group'] = array('group', t('Privacy Groups'),"", t('Manage your privacy groups'),'group_nav_btn'); $nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn'); 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; } -- cgit v1.2.3