merged for live

This commit is contained in:
2016-12-16 17:22:28 +01:00
7 changed files with 89 additions and 9 deletions

View File

@@ -93,6 +93,22 @@ return array(
'default' => true, 'default' => true,
'save_method' => 'storeSettingResetCatchall', 'save_method' => 'storeSettingResetCatchall',
), ),
'mail_greylist_enabled' => array(
'label' => $lng['serversettings']['greylist_enabled'],
'settinggroup' => 'mail',
'varname' => 'greylist_enabled',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'mail_greylist_disabled_default' => array(
'label' => $lng['serversettings']['greylist_disabled_default'],
'settinggroup' => 'mail',
'varname' => 'greylist_disabled_default',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_mailtraffic_enabled' => array( 'system_mailtraffic_enabled' => array(
'label' => $lng['serversettings']['mailtraffic_enabled'], 'label' => $lng['serversettings']['mailtraffic_enabled'],
'settinggroup' => 'system', 'settinggroup' => 'system',

View File

@@ -1,4 +1,4 @@
<?php <?php
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
@@ -43,7 +43,7 @@ if ($page == 'overview') {
'm.destination' => $lng['emails']['forwarders'] 'm.destination' => $lng['emails']['forwarders']
); );
$paging = new paging($userinfo, TABLE_MAIL_VIRTUAL, $fields); $paging = new paging($userinfo, TABLE_MAIL_VIRTUAL, $fields);
$result_stmt = Database::prepare('SELECT `m`.`id`, `m`.`domainid`, `m`.`email`, `m`.`email_full`, `m`.`iscatchall`, `u`.`quota`, `m`.`destination`, `m`.`popaccountid`, `d`.`domain`, `u`.`mboxsize` FROM `' . TABLE_MAIL_VIRTUAL . '` `m` $result_stmt = Database::prepare('SELECT `m`.`id`, `m`.`domainid`, `m`.`email`, `m`.`email_full`, `m`.`iscatchall`, `u`.`quota`, `m`.`destination`, `m`.`popaccountid`,`m`.`disablegreylist`, `d`.`domain`, `u`.`mboxsize` FROM `' . TABLE_MAIL_VIRTUAL . '` `m`
LEFT JOIN `' . TABLE_PANEL_DOMAINS . '` `d` ON (`m`.`domainid` = `d`.`id`) LEFT JOIN `' . TABLE_PANEL_DOMAINS . '` `d` ON (`m`.`domainid` = `d`.`id`)
LEFT JOIN `' . TABLE_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`) LEFT JOIN `' . TABLE_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`)
WHERE `m`.`customerid`= :customerid ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() WHERE `m`.`customerid`= :customerid ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
@@ -221,6 +221,7 @@ if ($page == 'overview') {
$iscatchall = '0'; $iscatchall = '0';
$email = $email_part . '@' . $domain; $email = $email_part . '@' . $domain;
} }
$disablegreylist = isset($_POST['disablegreylist']) ? $_POST['disablegreylist'] : Settings::Get('mail.greylist_disabled_default');
$email_full = $email_part . '@' . $domain; $email_full = $email_part . '@' . $domain;
@@ -228,7 +229,7 @@ if ($page == 'overview') {
standard_error('emailiswrong', $email_full); standard_error('emailiswrong', $email_full);
} }
$stmt = Database::prepare("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` $stmt = Database::prepare("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `disablegreylist` FROM `" . TABLE_MAIL_VIRTUAL . "`
WHERE (`email` = :email WHERE (`email` = :email
OR `email_full` = :emailfull ) OR `email_full` = :emailfull )
AND `customerid`= :cid" AND `customerid`= :cid"
@@ -252,15 +253,16 @@ if ($page == 'overview') {
standard_error('youhavealreadyacatchallforthisdomain'); standard_error('youhavealreadyacatchallforthisdomain');
} else { } else {
$stmt = Database::prepare("INSERT INTO `" . TABLE_MAIL_VIRTUAL . "` $stmt = Database::prepare("INSERT INTO `" . TABLE_MAIL_VIRTUAL . "`
(`customerid`, `email`, `email_full`, `iscatchall`, `domainid`) (`customerid`, `email`, `email_full`, `iscatchall`, `domainid`, `disablegreylist`)
VALUES (:cid, :email, :email_full, :iscatchall, :domainid)" VALUES (:cid, :email, :email_full, :iscatchall, :domainid, :disablegreylist)"
); );
$params = array( $params = array(
"cid" => $userinfo['customerid'], "cid" => $userinfo['customerid'],
"email" => $email, "email" => $email,
"email_full" => $email_full, "email_full" => $email_full,
"iscatchall" => $iscatchall, "iscatchall" => $iscatchall,
"domainid" => $domain_check['id'] "domainid" => $domain_check['id'],
"disablegreylist" => $disablegreylist,
); );
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
@@ -306,7 +308,7 @@ if ($page == 'overview') {
standard_error('allresourcesused'); standard_error('allresourcesused');
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
$stmt = Database::prepare("SELECT `v`.`id`, `v`.`email`, `v`.`email_full`, `v`.`iscatchall`, `v`.`destination`, `v`.`customerid`, `v`.`popaccountid`, `u`.`quota` $stmt = Database::prepare("SELECT `v`.`id`, `v`.`email`, `v`.`email_full`, `v`.`iscatchall`, `v`.`destination`, `v`.`customerid`, `v`.`popaccountid`, `v`.`disablegreylist`, `u`.`quota`
FROM `" . TABLE_MAIL_VIRTUAL . "` `v` FROM `" . TABLE_MAIL_VIRTUAL . "` `v`
LEFT JOIN `" . TABLE_MAIL_USERS . "` `u` LEFT JOIN `" . TABLE_MAIL_USERS . "` `u`
ON(`v`.`popaccountid` = `u`.`id`) ON(`v`.`popaccountid` = `u`.`id`)
@@ -403,6 +405,32 @@ if ($page == 'overview') {
} else { } else {
standard_error(array('operationnotpermitted', 'featureisdisabled'), 'Catchall'); standard_error(array('operationnotpermitted', 'featureisdisabled'), 'Catchall');
} }
} elseif ($action == 'togglegreylist' && $id != 0) {
if (Settings::Get('mail.greylist_enabled') == '1') {
$stmt = Database::prepare("SELECT `id`, `email`, `email_full`, `destination`, `customerid`, `popaccountid`, `disablegreylist` FROM `" . TABLE_MAIL_VIRTUAL . "`
WHERE `customerid`= :cid
AND `id`= :id"
);
$result = Database::pexecute_first($stmt, array("cid" => $userinfo['customerid'], "id" => $id));
$gr_val = $result['disablegreylist'] == 0 ? 1 : 0;
if (isset($result['email']) && $result['email'] != '') {
$stmt = Database::prepare("UPDATE `" . TABLE_MAIL_VIRTUAL . "`
SET `email` = :email, `disablegreylist` = :gr_val
WHERE `customerid`= :cid
AND `id`= :id"
);
$params = array(
"email" => $result['email_full'],
"cid" => $userinfo['customerid'],
"id" => $id,
"gr_val" => $gr_val,
);
Database::pexecute($stmt, $params);
redirectTo($filename, array('page' => $page, 'action' => 'edit', 'id' => $id, 's' => $s));
}
} else {
standard_error(array('operationnotpermitted', 'featureisdisabled'), 'Greylisting');
}
} }
} elseif ($page == 'accounts') { } elseif ($page == 'accounts') {
if ($action == 'add' && $id != 0) { if ($action == 'add' && $id != 0) {

View File

@@ -3416,6 +3416,7 @@ if (isFroxlorVersion('0.9.37-rc1')) {
updateToVersion('0.9.37'); updateToVersion('0.9.37');
} }
<<<<<<< HEAD
if (isDatabaseVersion('201607210')) { if (isDatabaseVersion('201607210')) {
showUpdateStep("Adding new settings for customer shell option"); showUpdateStep("Adding new settings for customer shell option");
@@ -3551,4 +3552,16 @@ if (isFroxlorVersion('0.9.38.3')) {
showUpdateStep("Updating from 0.9.38.3 to 0.9.38.4", false); showUpdateStep("Updating from 0.9.38.3 to 0.9.38.4", false);
updateToVersion('0.9.38.4'); updateToVersion('0.9.38.4');
if(isFroxlorVersion('0.9.37')) {
showUpdateStep("Adding Database column for greylisting",false);
Database::query("ALTER TABLE `".TABLE_MAIL_VIRTUAL."` ADD COLUMN IF NOT EXISTS disablegreylist TINYINT(1) DEFAULT 0");
updateToVersion('0.9.37-greylist');
}
if(isFroxlorVersion('0.9.37-greylist')) {
showUpdateStep("Adding new settings (greylisting enabled by default)", false);
Settings::AddNew("mail.greylist_enabled", "1");
Settings::AddNew("mail.greylist_disabled_default", "0");
updateToVersion('0.9.37-greylist2');
} }

View File

@@ -43,6 +43,15 @@ return array(
array ('label' => $lng['panel']['yes'], 'value' => '1') array ('label' => $lng['panel']['yes'], 'value' => '1')
), ),
'value' => array() 'value' => array()
),
'disablegreylist' => array(
'label' => $lng['emails']['greylist'],
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'visible' => (Settings::Get('mail.greylist_enabled') == '1' ? true : false),
'value' => array(Settings::Get('mail.greylist_disabled_default'))
) )
) )
) )

View File

@@ -53,6 +53,11 @@ return array(
'type' => 'label', 'type' => 'label',
'value' => ($result['iscatchall'] == 0 ? $lng['panel']['no'] : $lng['panel']['yes']).' [<a href="'.$filename.'?page='.$page.'&amp;action=togglecatchall&amp;id='.$result['id'].'&amp;s='.$s.'">'.$lng['panel']['toggle'].'</a>]' 'value' => ($result['iscatchall'] == 0 ? $lng['panel']['no'] : $lng['panel']['yes']).' [<a href="'.$filename.'?page='.$page.'&amp;action=togglecatchall&amp;id='.$result['id'].'&amp;s='.$s.'">'.$lng['panel']['toggle'].'</a>]'
), ),
'mail_greylist' => array(
'label' => $lng['emails']['greylist'],
'type' => 'label',
'value' => ($result['disablegreylist'] == 0 ? $lng['panel']['no'] : $lng['panel']['yes']).' [<a href="'.$filename.'?page='.$page.'&amp;action=togglegreylist&amp;id='.$result['id'].'&amp;s='.$s.'">'.$lng['panel']['toggle'].'</a>]'
),
'mail_fwds' => array( 'mail_fwds' => array(
'label' => $lng['emails']['forwarders'].' ('.$forwarders_count.')', 'label' => $lng['emails']['forwarders'].' ('.$forwarders_count.')',
'type' => 'label', 'type' => 'label',

View File

@@ -142,6 +142,7 @@ $lng['emails']['from'] = 'Source';
$lng['emails']['to'] = 'Destination'; $lng['emails']['to'] = 'Destination';
$lng['emails']['forwarders'] = 'Forwarders'; $lng['emails']['forwarders'] = 'Forwarders';
$lng['emails']['forwarder_add'] = 'Create forwarder'; $lng['emails']['forwarder_add'] = 'Create forwarder';
$lng['emails']['greylist'] = 'Disable greylisting';
/** /**
* FTP * FTP
@@ -374,7 +375,10 @@ $lng['serversettings']['nameservers']['title'] = 'Nameservers';
$lng['serversettings']['nameservers']['description'] = 'A comma separated list containing the hostnames of all nameservers. The first one will be the primary one.'; $lng['serversettings']['nameservers']['description'] = 'A comma separated list containing the hostnames of all nameservers. The first one will be the primary one.';
$lng['serversettings']['mxservers']['title'] = 'MX servers'; $lng['serversettings']['mxservers']['title'] = 'MX servers';
$lng['serversettings']['mxservers']['description'] = 'A comma separated list containing a pair of a number and a hostname separated by whitespace (e.g. \'10 mx.example.com\') containing the mx servers.'; $lng['serversettings']['mxservers']['description'] = 'A comma separated list containing a pair of a number and a hostname separated by whitespace (e.g. \'10 mx.example.com\') containing the mx servers.';
$lng['serversettings']['greylist_enabled']['title'] = 'Activate greylisting';
$lng['serversettings']['greylist_enabled']['description'] = 'Does the Mailserver implement greylisting?';
$lng['serversettings']['greylist_disabled_default']['title'] = 'Disable Greylisting initially';
$lng['serversettings']['greylist_disabled_default']['description'] = 'When new accounts are created, should greylisting be disabled?';
/** /**
* CHANGED BETWEEN 1.2.12 and 1.2.13 * CHANGED BETWEEN 1.2.12 and 1.2.13
*/ */

View File

@@ -140,6 +140,7 @@ $lng['emails']['from'] = 'Von';
$lng['emails']['to'] = 'Nach'; $lng['emails']['to'] = 'Nach';
$lng['emails']['forwarders'] = 'Weiterleitungen'; $lng['emails']['forwarders'] = 'Weiterleitungen';
$lng['emails']['forwarder_add'] = 'Weiterleitung hinzufügen'; $lng['emails']['forwarder_add'] = 'Weiterleitung hinzufügen';
$lng['emails']['greylist'] = 'Greylisting ausschalten';
/** /**
* FTP * FTP
@@ -370,6 +371,10 @@ $lng['serversettings']['nameservers']['title'] = 'Nameserver';
$lng['serversettings']['nameservers']['description'] = 'Eine durch Komma getrennte Liste mit den Hostnamen aller Nameserver. Der Erste ist der Primäre.'; $lng['serversettings']['nameservers']['description'] = 'Eine durch Komma getrennte Liste mit den Hostnamen aller Nameserver. Der Erste ist der Primäre.';
$lng['serversettings']['mxservers']['title'] = 'MX-Server'; $lng['serversettings']['mxservers']['title'] = 'MX-Server';
$lng['serversettings']['mxservers']['description'] = 'Eine durch Komma getrenne Liste, die ein Paar mit einer Nummer und den Hostnamen einen MX-Servers, getrennt durch ein Leerzeichen, enthält (z. B. \'10 mx.example.tld\').'; $lng['serversettings']['mxservers']['description'] = 'Eine durch Komma getrenne Liste, die ein Paar mit einer Nummer und den Hostnamen einen MX-Servers, getrennt durch ein Leerzeichen, enthält (z. B. \'10 mx.example.tld\').';
$lng['serversettings']['greylist_enabled']['title'] = 'Greylisting aktivieren';
$lng['serversettings']['greylist_enabled']['description'] = 'Greylisting aktivieren?';
$lng['serversettings']['greylist_disabled_default']['title'] = 'Greylisting standardmaessig aus?';
$lng['serversettings']['greylist_disabled_default']['description'] = 'Default Wert beim Erstellen neuer Accounts';
/** /**
* CHANGED BETWEEN 1.2.12 and 1.2.13 * CHANGED BETWEEN 1.2.12 and 1.2.13