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

@@ -1,4 +1,4 @@
<?php
<?php
/**
* This file is part of the Froxlor project.
@@ -43,7 +43,7 @@ if ($page == 'overview') {
'm.destination' => $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()
@@ -221,14 +221,15 @@ if ($page == 'overview') {
$iscatchall = '0';
$email = $email_part . '@' . $domain;
}
$disablegreylist = isset($_POST['disablegreylist']) ? $_POST['disablegreylist'] : Settings::Get('mail.greylist_disabled_default');
$email_full = $email_part . '@' . $domain;
if (!validateEmail($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
OR `email_full` = :emailfull )
AND `customerid`= :cid"
@@ -252,15 +253,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);
@@ -306,7 +308,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`)
@@ -403,6 +405,32 @@ if ($page == 'overview') {
} else {
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') {
if ($action == 'add' && $id != 0) {