1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +01:00

Merge branch 'develop-ascraeus' into develop

This commit is contained in:
Joas Schilling 2014-11-21 20:20:45 +01:00
commit a191708601
4 changed files with 78 additions and 14 deletions

View File

@ -615,7 +615,15 @@ class acp_board
{ {
add_log('admin', 'LOG_CONFIG_' . strtoupper($mode)); add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); $message = $user->lang('CONFIG_UPDATED');
$message_type = E_USER_NOTICE;
if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) &&
in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)))
{
$message .= '<br /><br />' . $user->lang('ACC_ACTIVATION_WARNING');
$message_type = E_USER_WARNING;
}
trigger_error($message . adm_back_link($this->u_action), $message_type);
} }
$this->tpl_name = 'acp_board'; $this->tpl_name = 'acp_board';
@ -792,20 +800,19 @@ class acp_board
global $user, $config; global $user, $config;
$act_ary = array( $act_ary = array(
'ACC_DISABLE' => USER_ACTIVATION_DISABLE, 'ACC_DISABLE' => array(true, USER_ACTIVATION_DISABLE),
'ACC_NONE' => USER_ACTIVATION_NONE, 'ACC_NONE' => array(true, USER_ACTIVATION_NONE),
'ACC_USER' => array($config['email_enable'], USER_ACTIVATION_SELF),
'ACC_ADMIN' => array($config['email_enable'], USER_ACTIVATION_ADMIN),
); );
if ($config['email_enable'])
{
$act_ary['ACC_USER'] = USER_ACTIVATION_SELF;
$act_ary['ACC_ADMIN'] = USER_ACTIVATION_ADMIN;
}
$act_options = '';
foreach ($act_ary as $key => $value) $act_options = '';
foreach ($act_ary as $key => $data)
{ {
list($available, $value) = $data;
$selected = ($selected_value == $value) ? ' selected="selected"' : ''; $selected = ($selected_value == $value) ? ' selected="selected"' : '';
$act_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$key] . '</option>'; $class = (!$available) ? ' class="disabled-option"' : '';
$act_options .= '<option value="' . $value . '"' . $selected . $class . '>' . $user->lang($key) . '</option>';
} }
return $act_options; return $act_options;

View File

@ -33,7 +33,8 @@ class ucp_register
global $request, $phpbb_container; global $request, $phpbb_container;
// //
if ($config['require_activation'] == USER_ACTIVATION_DISABLE) if ($config['require_activation'] == USER_ACTIVATION_DISABLE ||
(in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)) && !$config['email_enable']))
{ {
trigger_error('UCP_REGISTER_DISABLE'); trigger_error('UCP_REGISTER_DISABLE');
} }

View File

@ -221,7 +221,8 @@ $lang = array_merge($lang, array(
'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.', 'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.',
'ACC_ACTIVATION' => 'Account activation', 'ACC_ACTIVATION' => 'Account activation',
'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. “Board-wide email” must be enabled in order to use user or admin activation.', 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. <em>“Board-wide email” must be enabled in order to use user or admin activation.</em>',
'ACC_ACTIVATION_WARNING' => 'Please note that the currently selected activation method requires emails to be enabled, otherwise registration will be disabled. We recommend to either select a different activation method or reenable emails.',
'NEW_MEMBER_POST_LIMIT' => 'New member post limit', 'NEW_MEMBER_POST_LIMIT' => 'New member post limit',
'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the <em>Newly Registered Users</em> group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. <strong>A value of 0 disables this feature.</strong>', 'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the <em>Newly Registered Users</em> group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. <strong>A value of 0 disables this feature.</strong>',
'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default', 'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default',
@ -556,7 +557,7 @@ $lang = array_merge($lang, array(
'EMAIL_SIG' => 'Email signature', 'EMAIL_SIG' => 'Email signature',
'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.', 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.',
'ENABLE_EMAIL' => 'Enable board-wide emails', 'ENABLE_EMAIL' => 'Enable board-wide emails',
'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. <em>Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will require no activation of new accounts.</em>', 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. <em>Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will disable registration.</em>',
'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP',
'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.',
'SMTP_CRAM_MD5' => 'CRAM-MD5', 'SMTP_CRAM_MD5' => 'CRAM-MD5',

View File

@ -0,0 +1,55 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
/**
* @group functional
*/
class phpbb_functional_acp_registration_test extends phpbb_functional_test_case
{
protected function set_email_enable($db, $status)
{
$sql = "UPDATE phpbb_config
SET config_value = '" . (($status) ? '1' : '0') . "'
WHERE config_name = 'email_enable'";
$db->sql_query($sql);
$this->purge_cache();
}
public function test_submitting_activation_method()
{
$db = $this->get_db();
$this->set_email_enable($db, false);
$this->add_lang('acp/board');
$this->login();
$this->admin_login();
$crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid);
$this->assertContainsLang('ACP_REGISTER_SETTINGS_EXPLAIN', $this->get_content());
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$form['config[require_activation]']->select(USER_ACTIVATION_ADMIN);
$crawler = self::submit($form);
$this->assertContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid);
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$form['config[require_activation]']->select(USER_ACTIVATION_NONE);
$crawler = self::submit($form);
$this->assertNotContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
$this->set_email_enable($db, true);
}
}