mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 04:15:12 +00:00
Merge branch 'dev' of ../p3 into dev
This commit is contained in:
commit
e16149dec9
5 changed files with 64 additions and 3 deletions
|
@ -1485,6 +1485,18 @@ class Libzot {
|
|||
}
|
||||
}
|
||||
|
||||
// add channels that are following tags
|
||||
// these will be enumerated and validated in tgroup_check()
|
||||
|
||||
$ft = q("select channel_hash as hash from channel left join pconfig on pconfig.uid = channel_id where cat = 'system' and k = 'followed_tags' and channel_hash != '%s' and channel_removed = 0",
|
||||
dbesc($msg['sender'])
|
||||
);
|
||||
if ($ft ) {
|
||||
foreach ($ft as $t) {
|
||||
$r[] = $t['hash'];
|
||||
}
|
||||
}
|
||||
|
||||
// look for any public mentions on this site
|
||||
// They will get filtered by tgroup_check() so we don't need to check permissions now
|
||||
|
||||
|
|
|
@ -155,6 +155,14 @@ class Inbox extends Controller {
|
|||
$channels = array_merge($channels,$r);
|
||||
}
|
||||
|
||||
// look for channels that are following hashtags. These will be checked in tgroup_check()
|
||||
|
||||
$r = q("select * from channel where channel_id in (select uid from pconfig where cat = 'system' and k = 'followed_tags' and v != '' ) and channel_removed = 0 ");
|
||||
if ($r) {
|
||||
$channels = array_merge($channels,$r);
|
||||
}
|
||||
|
||||
|
||||
if (! $sys_disabled) {
|
||||
$channels[] = get_sys_channel();
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ class Channel {
|
|||
$autoperms = ((x($_POST,'autoperms')) ? intval($_POST['autoperms']) : 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$pageflags = $channel['channel_pageflags'];
|
||||
$existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0);
|
||||
if($adult != $existing_adult)
|
||||
|
@ -259,7 +259,21 @@ class Channel {
|
|||
if(strlen($timezone))
|
||||
date_default_timezone_set($timezone);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$followed_tags = $_POST['followed_tags'];
|
||||
$ntags = [];
|
||||
if ($followed_tags) {
|
||||
$tags = explode(',', $followed_tags);
|
||||
foreach ($tags as $t) {
|
||||
$t = trim($t);
|
||||
if ($t) {
|
||||
$ntags[] = $t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_pconfig(local_channel(),'system','followed_tags',($ntags) ? $ntags : EMPTY_STR);
|
||||
set_pconfig(local_channel(),'system','use_browser_location',$allow_location);
|
||||
set_pconfig(local_channel(),'system','suggestme', $suggestme);
|
||||
set_pconfig(local_channel(),'system','post_newfriend', $post_newfriend);
|
||||
|
@ -552,6 +566,15 @@ class Channel {
|
|||
$disable_discover_tab = intval(get_config('system','disable_discover_tab',1)) == 1;
|
||||
$site_firehose = intval(get_config('system','site_firehose',0)) == 1;
|
||||
|
||||
$ft = get_pconfig(local_channel(),'system','followed_tags','');
|
||||
if ($ft && is_array($ft)) {
|
||||
$followed = implode(',', $ft);
|
||||
}
|
||||
else {
|
||||
$followed = EMPTY_STR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$o .= replace_macros(get_markup_template('settings.tpl'), [
|
||||
'$ptitle' => t('Channel Settings'),
|
||||
|
@ -655,6 +678,7 @@ class Channel {
|
|||
'$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',App::get_hostname()), sprintf( t('If your channel is mirrored to multiple locations, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),App::get_hostname()) ],
|
||||
'$always_show_in_notices' => array('always_show_in_notices', t('Show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
|
||||
'$permit_all_mentions' => [ 'permit_all_mentions', t('Accept messages from strangers which mention me'), get_pconfig(local_channel(),'system','permit_all_mentions'), t('This setting supercedes normal permissions'), $yes_no ],
|
||||
'$followed_tags' => [ 'followed_tags', t('Followed hashtags (comma separated, do not include the #)'),$followed,EMPTY_STR ],
|
||||
'$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),
|
||||
'$basic_addon' => $plugin['basic'],
|
||||
'$sec_addon' => $plugin['security'],
|
||||
|
|
|
@ -2727,7 +2727,23 @@ function tgroup_check($uid, $item) {
|
|||
if (PConfig::Get($uid, 'system','permit_all_mentions') && i_am_mentioned($u,$item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$terms = get_terms_oftype($item['term'],TERM_HASHTAG);
|
||||
if ($terms) {
|
||||
$followed_tags = PConfig::Get($uid,'system','followed_tags');
|
||||
if (! (is_array($followed_tags) && $followed_tags)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($terms as $term) {
|
||||
foreach ($followed_tags as $tag) {
|
||||
if (strcasecmp($term['term'],$tag) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
{{$suggestme}}
|
||||
{{include file="field_input.tpl" field=$expire}}
|
||||
{{include file="field_checkbox.tpl" field=$hyperdrive}}
|
||||
{{include file="field_input.tpl" field=$followed_tags}}
|
||||
</div>
|
||||
{{if $permcat_enable}}
|
||||
{{include file="field_select.tpl" field=$defpermcat}}
|
||||
|
|
Loading…
Reference in a new issue