From a1f23af142dea33eff4efbc6919fa5887b0ea5c8 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 20 Apr 2017 12:15:45 +0200 Subject: [PATCH] Added new setup menu to mail --- pandora_console/godmode/menu.php | 1 + pandora_console/include/functions_config.php | 40 ++++++++++++++++++- .../help/clippy/extension_cron_send_email.php | 3 +- pandora_console/index.php | 7 ++-- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 1bd5773822..0a0652655d 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -249,6 +249,7 @@ if (check_acl ($config['id_user'], 0, "PM")) { enterprise_hook ('enterprise_submenu'); enterprise_hook ('historydb_submenu'); enterprise_hook ('log_collector_submenu'); + enterprise_hook ('mail_submenu'); $sub2["godmode/setup/setup&section=auth"]["text"] = __('Authentication'); $sub2["godmode/setup/setup&section=auth"]["refr"] = 0; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 6fea6906b4..576cf5e3ac 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -708,6 +708,20 @@ function config_update_config () { if (!config_update_value ('history_db_delay', get_parameter ('history_db_delay'))) $error_update[] = __('Delay'); break; + case 'mail': + 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_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 'ehorus': if (!config_update_value('ehorus_enabled', (int) get_parameter('ehorus_enabled', $config['ehorus_enabled']))) $error_update[] = __('Enable eHorus'); @@ -1187,7 +1201,31 @@ function config_process_config () { if (!isset ($config['history_db_delay'])) { config_update_value ( 'history_db_delay', 0); } - + + if (!isset ($config['email_from_dir'])) { + config_update_value ( 'email_from_dir', "pandora@pandorafms.org"); + } + + if (!isset ($config['email_from_name'])) { + config_update_value ( 'email_from_name', "Pandora FMS"); + } + + if (!isset ($config['email_smtpServer'])) { + config_update_value ( 'email_smtpServer', "127.0.0.1"); + } + + if (!isset ($config['email_smtpPort'])) { + config_update_value ( 'email_smtpPort', 25); + } + + if (!isset ($config['email_username'])) { + config_update_value ( 'email_username', ""); + } + + if (!isset ($config['email_password'])) { + config_update_value ( 'email_password', ""); + } + if (!isset ($config['activate_gis'])) { config_update_value ( 'activate_gis', 0); } diff --git a/pandora_console/include/help/clippy/extension_cron_send_email.php b/pandora_console/include/help/clippy/extension_cron_send_email.php index cd6cf216d4..6a4eb64b43 100755 --- a/pandora_console/include/help/clippy/extension_cron_send_email.php +++ b/pandora_console/include/help/clippy/extension_cron_send_email.php @@ -36,8 +36,7 @@ function clippy_extension_cron_send_email() { 'intro' => '' . '' . '' . '' . diff --git a/pandora_console/index.php b/pandora_console/index.php index 83108a60a5..dda5f86077 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -547,6 +547,10 @@ if (! isset ($config['id_user'])) { } // There is no user connected else { + if ($config['enterprise_installed']) { + enterprise_include_once ('include/functions_reset_pass.php'); + } + $correct_pass_change = (boolean)get_parameter('correct_pass_change', 0); $reset = (boolean)get_parameter('reset', 0); $first = (boolean)get_parameter('first', 0); @@ -599,9 +603,6 @@ if (! isset ($config['id_user'])) { } } else { - if ($config['enterprise_installed']) { - enterprise_include_once ('include/functions_reset_pass.php'); - } if (!$reset) { require_once ('general/login_page.php'); }
' . - __('The configuration of email for the task email is in the file:') . '
' . - '<www>/pandora_console/enterprise/extensions/cron/email_config.php
' . + __('The configuration of email for the task email is in the mail setup:') . '
' . __('Please check if the email configuration is correct.') . '