mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:55:19 +00:00
some basic collections/pages support
This commit is contained in:
parent
054e27fc75
commit
0e7cc08276
6 changed files with 120 additions and 9 deletions
|
@ -77,6 +77,35 @@ class PermissionRoles {
|
||||||
$ret['limits'] = PermissionLimits::Std_Limits();
|
$ret['limits'] = PermissionLimits::Std_Limits();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'collection':
|
||||||
|
$ret['perms_auto'] = true;
|
||||||
|
$ret['default_collection'] = false;
|
||||||
|
$ret['directory_publish'] = true;
|
||||||
|
$ret['online'] = false;
|
||||||
|
$ret['perms_connect'] = [
|
||||||
|
'view_stream', 'view_profile', 'view_contacts', 'view_storage',
|
||||||
|
'view_pages', 'post_comments'
|
||||||
|
];
|
||||||
|
$ret['limits'] = PermissionLimits::Std_Limits();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'collection_restricted':
|
||||||
|
$ret['perms_auto'] = false;
|
||||||
|
$ret['default_collection'] = true;
|
||||||
|
$ret['directory_publish'] = true;
|
||||||
|
$ret['online'] = false;
|
||||||
|
$ret['perms_connect'] = [
|
||||||
|
'view_stream', 'view_profile', 'view_contacts', 'view_storage',
|
||||||
|
'view_pages', 'post_comments'
|
||||||
|
];
|
||||||
|
$ret['limits'] = PermissionLimits::Std_Limits();
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case 'feed':
|
case 'feed':
|
||||||
$ret['perms_auto'] = true;
|
$ret['perms_auto'] = true;
|
||||||
$ret['default_collection'] = false;
|
$ret['default_collection'] = false;
|
||||||
|
@ -133,6 +162,11 @@ class PermissionRoles {
|
||||||
'forum_restricted' => t('Group - Restricted')
|
'forum_restricted' => t('Group - Restricted')
|
||||||
],
|
],
|
||||||
|
|
||||||
|
t('Collection') => [
|
||||||
|
'collection' => t('Collection - Normal'),
|
||||||
|
'collection_restricted' => t('Collection - Restricted')
|
||||||
|
],
|
||||||
|
|
||||||
t('Feed Republish') => [
|
t('Feed Republish') => [
|
||||||
'feed' => t('Feed Republish')
|
'feed' => t('Feed Republish')
|
||||||
]
|
]
|
||||||
|
|
|
@ -693,8 +693,27 @@ class Libzot {
|
||||||
$adult_changed = 1;
|
$adult_changed = 1;
|
||||||
if(intval($r[0]['xchan_deleted']) != intval($arr['deleted']))
|
if(intval($r[0]['xchan_deleted']) != intval($arr['deleted']))
|
||||||
$deleted_changed = 1;
|
$deleted_changed = 1;
|
||||||
if(intval($r[0]['xchan_pubforum']) != intval($arr['public_forum']))
|
|
||||||
|
$pf = intval($r[0]['xchan_pubforum']);
|
||||||
|
if($pf == 2 && ! intval($arr['collection'])) {
|
||||||
$pubforum_changed = 1;
|
$pubforum_changed = 1;
|
||||||
|
$px = 0;
|
||||||
|
}
|
||||||
|
if($pf == 1 && ! intval($arr['public_forum'])) {
|
||||||
|
$pubforum_changed = 1;
|
||||||
|
$px = 0;
|
||||||
|
}
|
||||||
|
if($pf == 0 && intval($arr['public_forum'])) {
|
||||||
|
$pubforum_changed = 1;
|
||||||
|
$px = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($pf == 0 && intval($arr['collection'])) {
|
||||||
|
$pubforum_changed = 1;
|
||||||
|
$px = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($arr['protocols']) {
|
if($arr['protocols']) {
|
||||||
$protocols = implode(',',$arr['protocols']);
|
$protocols = implode(',',$arr['protocols']);
|
||||||
|
@ -724,7 +743,7 @@ class Libzot {
|
||||||
intval(1 - intval($arr['searchable'])),
|
intval(1 - intval($arr['searchable'])),
|
||||||
intval($arr['adult_content']),
|
intval($arr['adult_content']),
|
||||||
intval($arr['deleted']),
|
intval($arr['deleted']),
|
||||||
intval($arr['public_forum']),
|
intval($px),
|
||||||
dbesc(escape_tags($arr['primary_location']['address'])),
|
dbesc(escape_tags($arr['primary_location']['address'])),
|
||||||
dbesc(escape_tags($arr['primary_location']['url'])),
|
dbesc(escape_tags($arr['primary_location']['url'])),
|
||||||
dbesc($xchan_hash)
|
dbesc($xchan_hash)
|
||||||
|
@ -744,6 +763,14 @@ class Libzot {
|
||||||
&& ($arr['site']['url'] != z_root()))
|
&& ($arr['site']['url'] != z_root()))
|
||||||
$arr['searchable'] = false;
|
$arr['searchable'] = false;
|
||||||
|
|
||||||
|
$channel_type = 0;
|
||||||
|
if($arr['public_forum']) {
|
||||||
|
$channel_type = 1;
|
||||||
|
}
|
||||||
|
if($arr['collection']) {
|
||||||
|
$channel_type = 2;
|
||||||
|
}
|
||||||
|
|
||||||
$x = xchan_store_lowlevel(
|
$x = xchan_store_lowlevel(
|
||||||
[
|
[
|
||||||
'xchan_hash' => $xchan_hash,
|
'xchan_hash' => $xchan_hash,
|
||||||
|
@ -764,10 +791,12 @@ class Libzot {
|
||||||
'xchan_hidden' => intval(1 - intval($arr['searchable'])),
|
'xchan_hidden' => intval(1 - intval($arr['searchable'])),
|
||||||
'xchan_selfcensored' => $arr['adult_content'],
|
'xchan_selfcensored' => $arr['adult_content'],
|
||||||
'xchan_deleted' => $arr['deleted'],
|
'xchan_deleted' => $arr['deleted'],
|
||||||
'xchan_pubforum' => $arr['public_forum']
|
'xchan_pubforum' => $channel_type;
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$what .= 'new_xchan';
|
$what .= 'new_xchan';
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
@ -2791,11 +2820,15 @@ class Libzot {
|
||||||
// and has nothing to do with accessibility.
|
// and has nothing to do with accessibility.
|
||||||
|
|
||||||
$public_forum = false;
|
$public_forum = false;
|
||||||
|
$collection = false;
|
||||||
|
|
||||||
$role = get_pconfig($e['channel_id'],'system','permissions_role');
|
$role = get_pconfig($e['channel_id'],'system','permissions_role');
|
||||||
if(in_array($role, ['forum','forum_restricted','repository'])) {
|
if(in_array($role, ['forum','forum_restricted','repository'])) {
|
||||||
$public_forum = true;
|
$public_forum = true;
|
||||||
}
|
}
|
||||||
|
if(in_array($role, ['collection','collection_restricted'])) {
|
||||||
|
$collection = true;
|
||||||
|
}
|
||||||
|
|
||||||
// This is for birthdays and keywords, but must check access permissions
|
// This is for birthdays and keywords, but must check access permissions
|
||||||
$p = q("select * from profile where uid = %d and is_default = 1",
|
$p = q("select * from profile where uid = %d and is_default = 1",
|
||||||
|
@ -2869,6 +2902,7 @@ class Libzot {
|
||||||
$ret['searchable'] = $searchable;
|
$ret['searchable'] = $searchable;
|
||||||
$ret['adult_content'] = $adult_channel;
|
$ret['adult_content'] = $adult_channel;
|
||||||
$ret['public_forum'] = $public_forum;
|
$ret['public_forum'] = $public_forum;
|
||||||
|
$ret['collection'] = $collection;
|
||||||
|
|
||||||
$ret['comments'] = map_scope(PermissionLimits::Get($e['channel_id'],'post_comments'));
|
$ret['comments'] = map_scope(PermissionLimits::Get($e['channel_id'],'post_comments'));
|
||||||
$ret['mail'] = map_scope(PermissionLimits::Get($e['channel_id'],'post_mail'));
|
$ret['mail'] = map_scope(PermissionLimits::Get($e['channel_id'],'post_mail'));
|
||||||
|
|
|
@ -291,7 +291,8 @@ class Connections extends \Zotlabs\Web\Controller {
|
||||||
'webbie' => $rr['xchan_addr'],
|
'webbie' => $rr['xchan_addr'],
|
||||||
'network_label' => t('Network'),
|
'network_label' => t('Network'),
|
||||||
'network' => network_to_name($rr['xchan_network']),
|
'network' => network_to_name($rr['xchan_network']),
|
||||||
'public_forum' => ((intval($rr['xchan_pubforum'])) ? true : false),
|
'public_forum' => ((intval($rr['xchan_pubforum']) === 1) ? true : false),
|
||||||
|
'public_collection' => ((intval($rr['xchan_pubforum']) === 2) ? true : false),
|
||||||
'call' => t('Call'),
|
'call' => t('Call'),
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
'status_label' => t('Status'),
|
'status_label' => t('Status'),
|
||||||
|
|
|
@ -77,6 +77,7 @@ class Dirsearch extends \Zotlabs\Web\Controller {
|
||||||
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
|
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
|
||||||
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
|
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
|
||||||
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0);
|
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0);
|
||||||
|
$collections = ((array_key_exists('collections',$_REQUEST)) ? intval($_REQUEST['collections']) : 0);
|
||||||
|
|
||||||
if(get_config('system','disable_directory_keywords'))
|
if(get_config('system','disable_directory_keywords'))
|
||||||
$kw = 0;
|
$kw = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ class Activity_filter {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$forums = get_forum_channels(local_channel());
|
$forums = get_forum_channels(local_channel(),1);
|
||||||
|
|
||||||
if($forums) {
|
if($forums) {
|
||||||
foreach($forums as $f) {
|
foreach($forums as $f) {
|
||||||
|
@ -86,7 +86,7 @@ class Activity_filter {
|
||||||
'img' => $f['xchan_photo_s'],
|
'img' => $f['xchan_photo_s'],
|
||||||
'url' => z_root() . '/' . $cmd . '/?f=&pf=1&cid=' . $f['abook_id'],
|
'url' => z_root() . '/' . $cmd . '/?f=&pf=1&cid=' . $f['abook_id'],
|
||||||
'sel' => $forum_active,
|
'sel' => $forum_active,
|
||||||
'title' => t('Show posts to this forum'),
|
'title' => t('Show posts to this group'),
|
||||||
'lock' => (($f['private_forum']) ? 'lock' : ''),
|
'lock' => (($f['private_forum']) ? 'lock' : ''),
|
||||||
'edit' => t('New post'),
|
'edit' => t('New post'),
|
||||||
'edit_url' => $f['xchan_url']
|
'edit_url' => $f['xchan_url']
|
||||||
|
@ -104,6 +104,39 @@ class Activity_filter {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$forums = get_forum_channels(local_channel(),2);
|
||||||
|
|
||||||
|
if($forums) {
|
||||||
|
foreach($forums as $f) {
|
||||||
|
if(x($_GET,'pf') && x($_GET,'cid')) {
|
||||||
|
$forum_active = ((x($_GET,'pf') && $_GET['cid'] == $f['abook_id']) ? 'active' : '');
|
||||||
|
$filter_active = 'forums';
|
||||||
|
}
|
||||||
|
$fsub[] = [
|
||||||
|
'label' => $f['xchan_name'],
|
||||||
|
'img' => $f['xchan_photo_s'],
|
||||||
|
'url' => z_root() . '/' . $cmd . '/?f=&pf=1&cid=' . $f['abook_id'],
|
||||||
|
'sel' => $forum_active,
|
||||||
|
'title' => t('Show posts to this collection'),
|
||||||
|
'lock' => (($f['private_forum']) ? 'lock' : ''),
|
||||||
|
'edit' => t('New post'),
|
||||||
|
'edit_url' => $f['xchan_url']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$tabs[] = [
|
||||||
|
'id' => 'collections',
|
||||||
|
'label' => t('Collections'),
|
||||||
|
'icon' => 'comments-o',
|
||||||
|
'url' => '#',
|
||||||
|
'sel' => (($filter_active == 'collections') ? true : false),
|
||||||
|
'title' => t('Show collections'),
|
||||||
|
'sub' => $fsub
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(feature_enabled(local_channel(),'filing')) {
|
if(feature_enabled(local_channel(),'filing')) {
|
||||||
$terms = q("select distinct term from term where uid = %d and ttype = %d order by term asc",
|
$terms = q("select distinct term from term where uid = %d and ttype = %d order by term asc",
|
||||||
|
|
|
@ -3459,13 +3459,21 @@ function array_path_exists($str,$arr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_forum_channels($uid) {
|
function get_forum_channels($uid,$collections = 0) {
|
||||||
|
|
||||||
if(! $uid)
|
if(! $uid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$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 and abook_archived = 0 and xchan_pubforum = 1 order by xchan_name",
|
if($collections) {
|
||||||
intval($uid)
|
$pagetype = $collections;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$pagetype = 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 and abook_archived = 0 and xchan_pubforum = %d order by xchan_name",
|
||||||
|
intval($uid),
|
||||||
|
intval($pagetype)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
|
|
Loading…
Reference in a new issue