provide easy access to the autoperms setting for forum and repository channels. This may be needed in the future to protect an existing forum from assault by spammers with changing identities. The forum can quickly be turned into membership by approval and either left that way permanently or hopefully reversed at a later date. Previously this would require switching to expert mode or setting a pconfig manually.
This commit is contained in:
parent
6bf5eea646
commit
459ec78a5e
@ -146,6 +146,7 @@ class Channel {
|
|||||||
$unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0);
|
$unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0);
|
||||||
$cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0);
|
$cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0);
|
||||||
$suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0);
|
$suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0);
|
||||||
|
$autoperms = ((x($_POST,'autoperms')) ? intval($_POST['autoperms']) : 0);
|
||||||
|
|
||||||
$post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0);
|
$post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0);
|
||||||
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
|
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
|
||||||
@ -252,6 +253,7 @@ class Channel {
|
|||||||
set_pconfig(local_channel(),'system','default_permcat',$defpermcat);
|
set_pconfig(local_channel(),'system','default_permcat',$defpermcat);
|
||||||
set_pconfig(local_channel(),'system','email_notify_host',$mailhost);
|
set_pconfig(local_channel(),'system','email_notify_host',$mailhost);
|
||||||
set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
|
set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
|
||||||
|
set_pconfig(local_channel(),'system','autoperms',$autoperms);
|
||||||
|
|
||||||
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
|
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
|
||||||
dbesc($username),
|
dbesc($username),
|
||||||
@ -479,6 +481,11 @@ class Channel {
|
|||||||
if($permissions_role === 'social_party')
|
if($permissions_role === 'social_party')
|
||||||
$permissions_role = 'social_federation';
|
$permissions_role = 'social_federation';
|
||||||
|
|
||||||
|
if(in_array($permissions_role,['forum','repository']))
|
||||||
|
$autoperms = replace_macros(get_markup_template('field_checkbox.tpl'), [
|
||||||
|
'$field' => [ 'autoperms',t('Automatic membership approval'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('If enabled, connection requests will be approved without your interaction'), $yes_no ]]);
|
||||||
|
else
|
||||||
|
$autoperms = '<input type="hidden" name="autoperms" value="' . intval(get_pconfig(local_channel(),'system','autoperms')) . '" />';
|
||||||
|
|
||||||
$permissions_set = (($permissions_role != 'custom') ? true : false);
|
$permissions_set = (($permissions_role != 'custom') ? true : false);
|
||||||
|
|
||||||
@ -486,6 +493,9 @@ class Channel {
|
|||||||
if((get_account_techlevel() < 4) && $permissions_role !== 'custom')
|
if((get_account_techlevel() < 4) && $permissions_role !== 'custom')
|
||||||
unset($perm_roles[t('Other')]);
|
unset($perm_roles[t('Other')]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$vnotify = get_pconfig(local_channel(),'system','vnotify');
|
$vnotify = get_pconfig(local_channel(),'system','vnotify');
|
||||||
$always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices');
|
$always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices');
|
||||||
if($vnotify === false)
|
if($vnotify === false)
|
||||||
@ -497,6 +507,7 @@ class Channel {
|
|||||||
$disable_discover_tab = intval(get_config('system','disable_discover_tab',1)) == 1;
|
$disable_discover_tab = intval(get_config('system','disable_discover_tab',1)) == 1;
|
||||||
$site_firehose = intval(get_config('system','site_firehose',0)) == 1;
|
$site_firehose = intval(get_config('system','site_firehose',0)) == 1;
|
||||||
|
|
||||||
|
|
||||||
$o .= replace_macros($stpl,array(
|
$o .= replace_macros($stpl,array(
|
||||||
'$ptitle' => t('Channel Settings'),
|
'$ptitle' => t('Channel Settings'),
|
||||||
|
|
||||||
@ -553,7 +564,7 @@ class Channel {
|
|||||||
'$unkmail' => $unkmail,
|
'$unkmail' => $unkmail,
|
||||||
'$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), intval($channel['channel_max_anon_mail']) ,t("Useful to reduce spamming")),
|
'$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), intval($channel['channel_max_anon_mail']) ,t("Useful to reduce spamming")),
|
||||||
|
|
||||||
|
'$autoperms' => $autoperms,
|
||||||
'$h_not' => t('Notification Settings'),
|
'$h_not' => t('Notification Settings'),
|
||||||
'$activity_options' => t('By default post a status message when:'),
|
'$activity_options' => t('By default post a status message when:'),
|
||||||
'$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, '', $yes_no),
|
'$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, '', $yes_no),
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
<div id="privacy-settings-collapse" class="collapse" role="tabpanel" aria-labelledby="privacy-settings" data-parent="#settings">
|
<div id="privacy-settings-collapse" class="collapse" role="tabpanel" aria-labelledby="privacy-settings" data-parent="#settings">
|
||||||
<div class="section-content-tools-wrapper">
|
<div class="section-content-tools-wrapper">
|
||||||
{{include file="field_select_grouped.tpl" field=$role}}
|
{{include file="field_select_grouped.tpl" field=$role}}
|
||||||
|
{{$autoperms}}
|
||||||
<div id="advanced-perm" style="display:{{if $permissions_set}}none{{else}}block{{/if}};">
|
<div id="advanced-perm" style="display:{{if $permissions_set}}none{{else}}block{{/if}};">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="button" class="btn btn-outline-secondary" data-toggle="modal" data-target="#apsModal">{{$lbl_p2macro}}</button>
|
<button type="button" class="btn btn-outline-secondary" data-toggle="modal" data-target="#apsModal">{{$lbl_p2macro}}</button>
|
||||||
|
Reference in New Issue
Block a user