diff --git a/customer_email.php b/customer_email.php
index 0d55e561..24993341 100644
--- a/customer_email.php
+++ b/customer_email.php
@@ -447,7 +447,7 @@ elseif($page == 'accounts')
if ($_mailerror) {
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
- standard_error('errorsendingmail', $email);
+ standard_error('errorsendingmail', $email_full);
}
$mail->ClearAddresses();
diff --git a/customer_mysql.php b/customer_mysql.php
index 96a92357..e0830f9a 100644
--- a/customer_mysql.php
+++ b/customer_mysql.php
@@ -141,6 +141,12 @@ elseif($page == 'mysqls')
$password = validate($_POST['mysql_password'], 'password');
$password = validatePassword($password);
+ $sendinfomail = intval($_POST['sendinfomail']);
+ if($sendinfomail != 1)
+ {
+ $sendinfomail = 0;
+ }
+
if($password == '')
{
standard_error(array('stringisempty', 'mypassword'));
@@ -185,6 +191,49 @@ elseif($page == 'mysqls')
$databasedescription = validate($_POST['description'], 'description');
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($username) . '", "' . $db->escape($databasedescription) . '", "' . $db->escape($dbserver) . '")');
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
+
+ if($sendinfomail == 1)
+ {
+ $pma = '';
+ if($settings['panel']['phpmyadmin_url'] != '')
+ {
+ $r_arr = array('URI' => $settings['panel']['phpmyadmin_url']);
+ $pma = replace_variables($lng['customer']['mysql_add']['infomail_body']['pma'], $r_arr);
+ }
+
+ $replace_arr = array(
+ 'CUST_NAME' => getCorrectUserSalutation($userinfo),
+ 'DB_NAME' => $username,
+ 'DB_PASS' => $password,
+ 'DB_DESC' => $databasedescription,
+ 'PMA_URI' => $pma
+ );
+
+ $mail_body = replace_variables($lng['customer']['mysql_add']['infomail_body']['main'], $replace_arr);
+
+ $_mailerror = false;
+ try {
+ $mail->Subject = $lng['customer']['mysql_add']['infomail_subject'];
+ $mail->AltBody = $mail_body;
+ $mail->MsgHTML(str_replace("\n", "
", $mail_body));
+ $mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
+ $mail->Send();
+ } catch(phpmailerException $e) {
+ $mailerr_msg = $e->errorMessage();
+ $_mailerror = true;
+ } catch (Exception $e) {
+ $mailerr_msg = $e->getMessage();
+ $_mailerror = true;
+ }
+
+ if ($_mailerror) {
+ $log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
+ standard_error('errorsendingmail', $userinfo['email']);
+ }
+
+ $mail->ClearAddresses();
+ }
+
redirectTo($filename, Array('page' => $page, 's' => $s));
}
}
@@ -197,6 +246,8 @@ elseif($page == 'mysqls')
$mysql_servers .= makeoption($mysql_server_details['caption'], $mysql_server);
}
+ $sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
+
eval("echo \"" . getTemplate("mysql/mysqls_add") . "\";");
}
}
diff --git a/lng/english.lng.php b/lng/english.lng.php
index 425e18cd..de0d4848 100644
--- a/lng/english.lng.php
+++ b/lng/english.lng.php
@@ -1350,5 +1350,9 @@ $lng['serversettings']['stdsubdomainhost']['description'] = 'What hostname shoul
// ADDED IN FROXLOR 0.9.4-1
$lng['ftp']['account_edit'] = 'Edit ftp account';
$lng['ftp']['editpassdescription'] = 'Set new password or leave blank for no change.';
+$lng['mysql']['sendinfomail'] = 'Send data via email to me';
+$lng['customer']['mysql_add']['infomail_subject'] = '[Froxlor] New database created';
+$lng['customer']['mysql_add']['infomail_body']['pma'] = "\nYou can access your databases using phpMyAdmin via {URI}\n";
+$lng['customer']['mysql_add']['infomail_body']['main'] = "Hello {CUST_NAME},\n\nyou have just added a new database. Here is the entered information:\n\nDatabasename: {DB_NAME}\nPassword: {DB_PASS}\nDescription: {DB_DESC}\n{PMA_URI}\nYours sincerely, the Froxlor-Team";
?>
diff --git a/lng/german.lng.php b/lng/german.lng.php
index d8e96f07..47700d52 100644
--- a/lng/german.lng.php
+++ b/lng/german.lng.php
@@ -1331,5 +1331,8 @@ $lng['serversettings']['stdsubdomainhost']['description'] = 'Welcher Hostname so
// ADDED IN FROXLOR 0.9.4-1
$lng['ftp']['account_edit'] = 'FTP Konto bearbeiten';
$lng['ftp']['editpassdescription'] = 'Neues Passwort setzen oder leer für keine Änderung.';
-
+$lng['mysql']['sendinfomail'] = 'Send data via email to me';
+$lng['customer']['mysql_add']['infomail_subject'] = '[Froxlor] Neue Datenbank erstellt';
+$lng['customer']['mysql_add']['infomail_body']['pma'] = "\nDie Datenbank kann mit phpMyAdmin via {URI} verwaltet werden.\n";
+$lng['customer']['mysql_add']['infomail_body']['main'] = "Hallo {CUST_NAME},\n\ndu hast gerade eine neue Datenbank angelegt. Hier die angegebenen Informationen:\n\nDatenbankname: {DB_NAME}\nPasswort: {DB_PASS}\nBeschreibung: {DB_DESC}\n{PMA_URI}\nVielen Dank, das Froxlor-Team";
?>
diff --git a/templates/customer/mysql/mysqls_add.tpl b/templates/customer/mysql/mysqls_add.tpl
index 16ef1610..319d41ac 100644
--- a/templates/customer/mysql/mysqls_add.tpl
+++ b/templates/customer/mysql/mysqls_add.tpl
@@ -21,6 +21,10 @@ $header