Move code to enterprise section

This commit is contained in:
Arturo Gonzalez 2017-04-20 11:36:40 +02:00
parent e26dfcd466
commit df80304a80
4 changed files with 5 additions and 91 deletions

View File

@ -1,21 +0,0 @@
<?php
// ______ __ _______ _______ _______
//| __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
//| __/| _ | | _ || _ | _| _ | | ___| |__ |
//|___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2010 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
//Please setup your config to send emails
$email_from = array('pandora@pandorafms.org' => 'Pandora FMS');
$email_smtpServer = '127.0.0.1';
$email_smtpPort = 25;
$email_username = '';
$email_password = '';
?>

View File

@ -2731,46 +2731,4 @@ function remove_right_zeros ($value) {
}
}
function send_email_to_user ($to, $body, $subject) {
global $config;
require_once($config['homedir'] . '/include/swiftmailer/swift_required.php');
require_once($config['homedir'] . '/include/email_config_user.php');
$result = false;
try {
$transport = Swift_SmtpTransport::newInstance($email_smtpServer, $email_smtpPort);
$transport->setUsername($email_username);
$transport->setPassword($email_password);
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($subject);
$message->setFrom($email_from);
$to = trim($to);
$message->setTo(array($to => $to));
$message->setBody($body, 'text/html');
ini_restore ('sendmail_from');
$result = $mailer->send($message);
}
catch (Exception $e) {
error_log($e->getMessage());
db_pandora_audit("Pandora mail", $e->getMessage());
}
return $result;
}
function send_token_to_db ($id_user, $cod_hash) {
db_process_sql_delete('treset_pass', array('id_user' => $id_user));
$values = array();
$values['id_user'] = $id_user;
$values['cod_hash'] = $cod_hash;
$values['reset_time'] = time();
db_process_sql_insert('treset_pass', $values);
}
?>

View File

@ -892,30 +892,4 @@ function users_get_strict_mode_groups($id_user, $return_group_all) {
return $return_user_groups;
}
function check_user_id ($id_user) {
global $config;
$exists = db_get_value ('id_user', 'tusuario', 'id_user', $id_user);
if ($exists) {
return true;
}
else {
return false;
}
}
function check_user_have_mail ($id_user) {
global $config;
$exists_mail = db_get_value ('email', 'tusuario', 'id_user', $id_user);
if ($exists_mail) {
return $exists_mail;
}
else {
return false;
}
}
?>

View File

@ -585,11 +585,11 @@ if (! isset ($config['id_user'])) {
if ($db_reset_pass_entry) {
if (($db_reset_pass_entry + SECONDS_2HOUR) < time()) {
$process_error_message = __('This user has not requested a password change');
db_process_sql_delete('treset_pass', array('id_user' => $id_user));
delete_reset_pass_entry($id_user);
require_once ('general/login_page.php');
}
else {
db_process_sql_delete('treset_pass', array('id_user' => $id_user));
delete_reset_pass_entry($id_user);
require_once ('enterprise/include/process_reset_pass.php');
}
}
@ -599,6 +599,9 @@ 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');
}