diff --git a/customer_email.php b/customer_email.php index 45c0e3fc..7fb0d615 100644 --- a/customer_email.php +++ b/customer_email.php @@ -1,4 +1,4 @@ - $lng['emails']['forwarders'] ); $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_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`) WHERE `m`.`customerid`= :customerid ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() @@ -227,7 +227,7 @@ if ($page == 'overview') { 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 OR `email_full` = :emailfull ) AND `customerid`= :cid" @@ -251,15 +251,16 @@ if ($page == 'overview') { standard_error('youhavealreadyacatchallforthisdomain'); } else { $stmt = Database::prepare("INSERT INTO `" . TABLE_MAIL_VIRTUAL . "` - (`customerid`, `email`, `email_full`, `iscatchall`, `domainid`) - VALUES (:cid, :email, :email_full, :iscatchall, :domainid)" + (`customerid`, `email`, `email_full`, `iscatchall`, `domainid`, `disablegreylist`) + VALUES (:cid, :email, :email_full, :iscatchall, :domainid, :disablegreylist)" ); $params = array( "cid" => $userinfo['customerid'], "email" => $email, "email_full" => $email_full, "iscatchall" => $iscatchall, - "domainid" => $domain_check['id'] + "domainid" => $domain_check['id'], + "disablegreylist" => $disablegreylist, ); Database::pexecute($stmt, $params); @@ -305,7 +306,7 @@ if ($page == 'overview') { standard_error('allresourcesused'); } } 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` LEFT JOIN `" . TABLE_MAIL_USERS . "` `u` ON(`v`.`popaccountid` = `u`.`id`) @@ -402,6 +403,32 @@ if ($page == 'overview') { } else { standard_error(array('operationnotpermitted', 'featureisdisabled'), 'Catchall'); } + } elseif ($action == 'togglegreylist' && $id != 0) { + //if (Settings::Get('catchall.catchall_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') { if ($action == 'add' && $id != 0) { diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index c71cd9fe..16dbb67d 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -3415,3 +3415,9 @@ if (isFroxlorVersion('0.9.37-rc1')) { showUpdateStep("Updating from 0.9.37-rc1 to 0.9.37 final", false); updateToVersion('0.9.37'); } + +if(isFroxlorVersion('0.9.37')) { + Database::query("ALTER TABLE `".TABLE_MAIL_VIRTUAL."` ADD disablegreylist TINYINT(1)"); + showUpdateStep("Updating from 0.9.37 to 0.9.37 greylist", false); + updateToVersion('0.9.37-greylist'); +} diff --git a/lib/formfields/customer/email/formfield.emails_add.php b/lib/formfields/customer/email/formfield.emails_add.php index 83510f6a..31bd18fc 100644 --- a/lib/formfields/customer/email/formfield.emails_add.php +++ b/lib/formfields/customer/email/formfield.emails_add.php @@ -43,6 +43,14 @@ return array( array ('label' => $lng['panel']['yes'], 'value' => '1') ), 'value' => array() + ), + 'disablegreylist' => array( + 'label' => $lng['emails']['greylist'], + 'type' => 'checkbox', + 'values' => array( + array ('label' => $lng['panel']['yes'], 'value' => '1') + ), + 'value' => array() ) ) ) diff --git a/lib/formfields/customer/email/formfield.emails_edit.php b/lib/formfields/customer/email/formfield.emails_edit.php index f87af846..f3c0c6ca 100644 --- a/lib/formfields/customer/email/formfield.emails_edit.php +++ b/lib/formfields/customer/email/formfield.emails_edit.php @@ -53,6 +53,11 @@ return array( 'type' => 'label', 'value' => ($result['iscatchall'] == 0 ? $lng['panel']['no'] : $lng['panel']['yes']).' ['.$lng['panel']['toggle'].']' ), + 'mail_greylist' => array( + 'label' => $lng['emails']['greylist'], + 'type' => 'label', + 'value' => ($result['disablegreylist'] == 0 ? $lng['panel']['no'] : $lng['panel']['yes']).' ['.$lng['panel']['toggle'].']' + ), 'mail_fwds' => array( 'label' => $lng['emails']['forwarders'].' ('.$forwarders_count.')', 'type' => 'label', diff --git a/lng/english.lng.php b/lng/english.lng.php index 4d51f0bd..eeed559b 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -141,6 +141,7 @@ $lng['emails']['from'] = 'Source'; $lng['emails']['to'] = 'Destination'; $lng['emails']['forwarders'] = 'Forwarders'; $lng['emails']['forwarder_add'] = 'Create forwarder'; +$lng['emails']['greylist'] = 'Disable greylisting'; /** * FTP diff --git a/lng/german.lng.php b/lng/german.lng.php index d1f50438..aa270a0f 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -140,6 +140,7 @@ $lng['emails']['from'] = 'Von'; $lng['emails']['to'] = 'Nach'; $lng['emails']['forwarders'] = 'Weiterleitungen'; $lng['emails']['forwarder_add'] = 'Weiterleitung hinzufügen'; +$lng['emails']['greylist'] = 'Greylisting ausschalten'; /** * FTP