moved mail server setup to general setup

This commit is contained in:
alejandro-campos 2019-06-10 09:43:27 +02:00
parent 7883fc5f96
commit 89ff40e2b9
2 changed files with 70 additions and 28 deletions

View File

@ -32,6 +32,12 @@ $table->size[0] = '30%';
$table->style[0] = 'font-weight:bold';
$table->size[1] = '70%';
$table_mail_conf = new stdClass();
$table_mail_conf->width = '100%';
$table_mail_conf->class = 'databox filters';
$table_mail_conf->data = [];
$table_mail_conf->style[0] = 'font-weight: bold';
// Current config["language"] could be set by user, not taken from global setup !
switch ($config['dbtype']) {
case 'mysql':
@ -296,6 +302,42 @@ echo '<legend>'.__('General options').'</legend>';
html_print_input_hidden('update_config', 1);
html_print_table($table);
$encryption = [
'ssl' => 'SSL/TLS',
'sslv2' => 'SSLv2',
'sslv3' => 'SSLv3',
'tls' => 'STARTTLS',
];
echo '</fieldset>';
echo '<fieldset>';
echo '<legend>'.__('Mail configuration').'</legend>';
$table_mail_conf->data[0][0] = __('From dir');
$table_mail_conf->data[0][1] = html_print_input_text('email_from_dir', $config['email_from_dir'], '', 30, 100, true);
$table_mail_conf->data[1][0] = __('From name');
$table_mail_conf->data[1][2] = html_print_input_text('email_from_name', $config['email_from_name'], '', 30, 100, true);
$table_mail_conf->data[2][0] = __('Server SMTP');
$table_mail_conf->data[2][1] = html_print_input_text('email_smtpServer', $config['email_smtpServer'], '', 30, 100, true);
$table_mail_conf->data[3][0] = __('Port SMTP');
$table_mail_conf->data[3][1] = html_print_input_text('email_smtpPort', $config['email_smtpPort'], '', 30, 100, true);
$table_mail_conf->data[4][0] = __('Encryption');
$table_mail_conf->data[4][1] = html_print_select($encryption, 'email_encryption', $config['email_encryption'], '', __('none'), 0, true);
$table_mail_conf->data[5][0] = __('Email user');
$table_mail_conf->data[5][1] = html_print_input_text('email_username', $config['email_username'], '', 30, 100, true);
$table_mail_conf->data[6][0] = __('Email password');
$table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true);
html_print_input_hidden('update_config', 1);
html_print_table($table_mail_conf);
echo '</fieldset>';
echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -317,6 +317,34 @@ function config_update_config()
if (!config_update_value('unique_ip', get_parameter('unique_ip'))) {
$error_update[] = __('unique_ip');
}
if (!config_update_value('email_smtpServer', get_parameter('email_smtpServer'))) {
$error_update[] = __('Server SMTP');
}
if (!config_update_value('email_from_dir', get_parameter('email_from_dir'))) {
$error_update[] = __('From dir');
}
if (!config_update_value('email_from_name', get_parameter('email_from_name'))) {
$error_update[] = __('From name');
}
if (!config_update_value('email_smtpPort', (int) get_parameter('email_smtpPort'))) {
$error_update[] = __('Port SMTP');
}
if (!config_update_value('email_encryption', get_parameter('email_encryption'))) {
$error_update[] = __('Encryption');
}
if (!config_update_value('email_username', get_parameter('email_username'))) {
$error_update[] = __('Email user');
}
if (!config_update_value('email_password', get_parameter('email_password'))) {
$error_update[] = __('Email password');
}
break;
case 'enterprise':
@ -407,34 +435,6 @@ function config_update_config()
if (!config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist))) {
$error_update[] = __('Inventory changes blacklist');
}
if (!config_update_value('email_from_dir', get_parameter('email_from_dir'))) {
$error_update[] = __('From dir');
}
if (!config_update_value('email_from_name', get_parameter('email_from_name'))) {
$error_update[] = __('From name');
}
if (!config_update_value('email_smtpServer', get_parameter('email_smtpServer'))) {
$error_update[] = __('Server SMTP');
}
if (!config_update_value('email_smtpPort', (int) get_parameter('email_smtpPort'))) {
$error_update[] = __('Port SMTP');
}
if (!config_update_value('email_encryption', get_parameter('email_encryption'))) {
$error_update[] = __('Encryption');
}
if (!config_update_value('email_username', get_parameter('email_username'))) {
$error_update[] = __('Email user');
}
if (!config_update_value('email_password', get_parameter('email_password'))) {
$error_update[] = __('Email password');
}
}
break;