Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merged branches/duergner/Create-Email-Address-Patch to trunk, adding …

…an alternative way of sending the password while creating email-accounts

git-svn-id: file:///var/svn/trunk/syscp@1337 45fdb5c4-e40b-0410-b369-9aab4fe9a275
  • Loading branch information...
commit 9d00763bf944692d378907d524e7c37971b045c3 1 parent 9fcd2bf
Florian Aders authored
View
7 admin_settings.php
@@ -332,6 +332,12 @@
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='" . $db->escape($value) . "' WHERE `settinggroup`='system' AND `varname`='mailpwcleartext'");
}
+ if($_POST['panel_sendalternativemail'] != $settings['panel']['sendalternativemail'])
+ {
+ $value = ($_POST['panel_sendalternativemail'] == '1' ? '1' : '0');
+ $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='" . $db->escape($value) . "' WHERE `settinggroup`='panel' AND `varname`='sendalternativemail'");
+ }
+
if($_POST['panel_adminmail'] != $settings['panel']['adminmail'])
{
$value = $idna_convert->encode($_POST['panel_adminmail']);
@@ -558,6 +564,7 @@
$natsorting = makeyesno('panel_natsorting', '1', '0', $settings['panel']['natsorting']);
$mailpwcleartext = makeyesno('system_mailpwcleartext', '1', '0', $settings['system']['mailpwcleartext']);
+ $panel_sendalternativemail = makeyesno('panel_sendalternativemail', '1', '0', $settings['panel']['sendalternativemail']);
$ftpatdomain = makeyesno('customer_ftpatdomain', '1', '0', $settings['customer']['ftpatdomain']);
$system_modlogsql = makeyesno('system_modlogsql', '1', '0', $settings['system']['mod_log_sql']);
$system_modfcgid = makeyesno('system_modfcgid', '1', '0', $settings['system']['mod_fcgid']);
View
11 admin_templates.php
@@ -44,6 +44,12 @@
'pop_success',
'trafficninetypercent',
);
+
+ if($settings['panel']['sendalternativemail'] == 1)
+ {
+ $available_templates[] = 'pop_success_alternative';
+ }
+
$templates_array = array();
$result = $db->query("SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='mails' ORDER BY `language`, `varname`");
@@ -122,6 +128,11 @@
'trafficninetypercent',
);
+ if($settings['panel']['sendalternativemail'] == 1)
+ {
+ $available_templates[] = 'pop_success_alternative';
+ }
+
if(isset($_POST['prepare'])
&& $_POST['prepare'] == 'prepare')
{
View
18 customer_email.php
@@ -369,6 +369,7 @@
$email_full = $result['email_full'];
$username = $idna_convert->decode($email_full);
$password = validate($_POST['email_password'], 'password');
+ $alternative_email = $idna_convert->encode( validate( $_POST['alternative_email'], 'alternative_email' ) );
if($email_full == '')
{
@@ -377,7 +378,7 @@
'emailadd'
));
}
- elseif($password == '')
+ elseif($password == '' && !($settings['panel']['sendalternativemail'] == 1 && validateEmail($alternative_email)))
{
standard_error(array(
'stringisempty',
@@ -386,6 +387,10 @@
}
else
{
+ if($password == '')
+ {
+ $password = substr( md5( uniqid( microtime(), 1 ) ), 12, 6 );
+ }
$db->query("INSERT INTO `" . TABLE_MAIL_USERS . "` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($email_full) . "', '" . $db->escape($username) . "', " . ($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "'," : '') . " ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_full . '/') . "', '" . (int)$settings['system']['vmail_uid'] . "', '" . (int)$settings['system']['vmail_gid'] . "', '" . (int)$result['domainid'] . "', 'y')");
$popaccountid = $db->insert_id();
$result['destination'].= ' ' . $email_full;
@@ -393,7 +398,8 @@
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used`=`email_accounts_used`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$replace_arr = array(
'EMAIL' => $email_full,
- 'USERNAME' => $username
+ 'USERNAME' => $username,
+ 'PASSWORD' => $password
);
$admin = $db->query_first('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\'');
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_subject\'');
@@ -401,6 +407,14 @@
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_mailbody\'');
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success']['mailbody']), $replace_arr));
mail($email_full,$mail_subject,$mail_body,'From: '.str_replace(array("\r", "\n"), '', $admin['name'].' <'.$admin['email']).'>');
+ if(validateEmail($alternative_email) && $settings['panel']['sendalternativemail'] == 1)
+ {
+ $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\''.(int)$userinfo['adminid'].'\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_alternative_subject\'');
+ $mail_subject = replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success_alternative']['subject']), $replace_arr);
+ $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\''.(int)$userinfo['adminid'].'\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_alternative_mailbody\'');
+ $mail_body = replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success_alternative']['mailbody']), $replace_arr);
+ mail($alternative_email, $mail_subject, $mail_body, 'From: ' . str_replace(array("\r", "\n"), '', $admin['name'] . ' <' . $admin['email']) . '>');
+ }
redirectTo($filename, Array(
'page' => 'emails',
'action' => 'edit',
View
7 lng/english.lng.php
@@ -545,5 +545,12 @@
$lng['serversettings']['mod_log_sql']['description'] = 'Use <a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> to save webrequests temporarily<br /><b>This needs a special apache-configuration!</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'Include PHP via mod_fcgid/suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.<br/><b>This needs a special apache-configuration!</b>';
+$lng['serversettings']['sendalternativemail']['title'] = 'Use alternative email-address';
+$lng['serversettings']['sendalternativemail']['description'] = 'Send the password-email to a different address during email-account-creation';
+$lng['emails']['alternative_emailaddress'] = 'Alternative e-mail-address';
+$lng['mails']['pop_success_alternative']['mailbody'] = 'Hello,\n\nyour Mail account {EMAIL}\nwas set up successfully.\nYour password is {PASSWORD}.\n\nThis is an automatically created\ne-mail, please do not answer!\n\nYours sincerely, the SysCP-Team';
+$lng['mails']['pop_success_alternative']['subject'] = 'Mail account set up successfully';
+$lng['admin']['templates']['pop_success_alternative'] = 'Welcome mail for new email accounts sent to alternative address';
+$lng['admin']['templates']['EMAIL_PASSWORD'] = 'Replaced with the POP3/IMAP account password.';
?>
View
7 lng/german.lng.php
@@ -544,5 +544,12 @@
$lng['serversettings']['mod_log_sql']['description'] = '<a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> benutzen um die Webzugriffe tempor&auml;r zu speichern<br /><b>Dies ben&ouml;tigt eine spezielle Apache-Konfiguration</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'PHP &uuml;ber mod_fcgid/suexec einbinden';
$lng['serversettings']['mod_fcgid']['description'] = 'mod_fcgid/suexec/libnss_mysql benutzen um PHP unter dem jeweiligen Useraccount laufen zu lassen<br /><b>Dies ben&ouml;tigt eine spezielle Apache-Konfiguration</b>';
+$lng['serversettings']['sendalternativemail']['title'] = 'Alternative E-Mail-Adresse benutzen';
+$lng['serversettings']['sendalternativemail']['description'] = 'W&auml;hrend dem erstellen eines Accounts das Passwort an eine andere E-Mail-Adresse senden';
+$lng['emails']['alternative_emailaddress'] = 'Alternative E-Mail-Adresse';
+$lng['mails']['pop_success_alternative']['mailbody'] = 'Hallo,\n\nihr E-Mail-Konto {USERNAME}\nwurde erfolgreich eingerichtet.\nIhr Passwort lautet {PASSWORD}.\n\nDies ist eine automatisch generierte\neMail, bitte antworten Sie nicht auf\ndiese Mitteilung.\n\nIhr SysCP-Team';
+$lng['mails']['pop_success_alternative']['subject'] = 'E-Mail-Konto erfolgreich eingerichtet';
+$lng['admin']['templates']['pop_success_alternative'] = 'Willkommensmail f&uuml;r neue E-Mail Konten f&uuml;r die alternative Email Addresse';
+$lng['admin']['templates']['PASSWORD'] = 'Wird mit dem Passwort des neuen POP3/IMAP Kontos ersetzt.';
?>
View
4 templates/admin/settings/settings.tpl
@@ -170,6 +170,10 @@ $header
<td class="main_field_display" nowrap="nowrap">{$mailpwcleartext}</td>
</tr>
<tr>
+ <td class="main_field_name"><b>{$lng['serversettings']['sendalternativemail']['title']}:</b><br />{$lng['serversettings']['sendalternativemail']['description']}</td>
+ <td class="main_field_display" nowrap="nowrap">{$panel_sendalternativemail}</td>
+ </tr>
+ <tr>
<td class="maintitle_apply_left">
<b><img src="images/title.gif" alt="" />&nbsp;{$lng['admin']['nameserversettings']}</b>
</td>
View
13 templates/admin/templates/templates_add_2.tpl
@@ -59,6 +59,19 @@ $header
<td class="field_name_border_left"><i>{EMAIL}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['EMAIL']}</td>
</tr>
+ <if $settings['panel']['sendalternativemail'] == 1>
+ <tr>
+ <td class="field_display_border_left" colspan="2"><b>{$lng['admin']['templates']['pop_success_alternative']}</b></td>
+ </tr>
+ <tr>
+ <td class="field_name_border_left"><i>{EMAIL}</i>:</td>
+ <td class="field_name">{$lng['admin']['templates']['EMAIL']}</td>
+ </tr>
+ <tr>
+ <td class="field_name_border_left"><i>{PASSWORD}</i>:</td>
+ <td class="field_name">{$lng['admin']['templates']['EMAIL_PASSWORD']}</td>
+ </tr>
+ </if>
<tr>
<td class="field_display_border_left" colspan="2"><b>{$lng['admin']['templates']['trafficninetypercent']}</b></td>
</tr>
View
10 templates/customer/email/account_add.tpl
@@ -15,8 +15,14 @@ $header
<tr>
<td class="main_field_name">{$lng['login']['password']}:</td>
<td class="main_field_display" nowrap="nowrap"><input type="password" name="email_password" maxlength="50" /></td>
- </tr>
- <tr>
+ </tr>
+ <if $settings['panel']['sendalternativemail'] == 1>
+ <tr>
+ <td class="main_field_name">{$lng['emails']['alternative_emailaddress']}:</td>
+ <td class="main_field_display" nowrap="nowrap"><input type="text" name="alternative_email" maxlength="255" /></td>
+ </tr>
+ </if>
+ <tr>
<td class="main_field_confirm" colspan="2"><input type="hidden" name="send" value="send" /><input type="submit" class="bottom" value="{$lng['emails']['account_add']}" /></td>
</tr>
</table>
Please sign in to comment.
Something went wrong with that request. Please try again.