make compatible with outdated dependency packages
This commit is contained in:
parent
e72a3da5d7
commit
9830416f64
@ -18,6 +18,7 @@ namespace D3\MailConfigChecker\Application\Controller\Admin;
|
||||
use Assert\Assert;
|
||||
use Assert\InvalidArgumentException;
|
||||
use D3\MailConfigChecker\Application\Model\Exception\d3TranslatableLazyAssertionException;
|
||||
use ErrorException;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
||||
use OxidEsales\Eshop\Application\Model\Shop;
|
||||
@ -70,16 +71,23 @@ class MailConfigCheck extends AdminDetailsController
|
||||
$this->getCurrentMailer();
|
||||
}
|
||||
|
||||
function exceptions_error_handler($severity, $message, $filename, $lineno) {
|
||||
throw new ErrorException($message, 0, $severity, $filename, $lineno);
|
||||
}
|
||||
|
||||
protected function getCurrentMailer()
|
||||
{
|
||||
try {
|
||||
$mail = oxNew(Email::class);
|
||||
$mail->setRecipient($this->testMailAddress);
|
||||
$mail->setBody('.');
|
||||
set_error_handler([$this, 'exceptions_error_handler']);
|
||||
$mail->send();
|
||||
$this->addTplParam('mailer', $mail->getMailer());
|
||||
} catch (Exception $e) {
|
||||
Registry::getUtilsView()->addErrorToDisplay($e);
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,7 @@ namespace D3\MailConfigChecker\Application\Controller\Admin;
|
||||
|
||||
use Assert\InvalidArgumentException;
|
||||
use D3\MailConfigChecker\Application\Model\SpfResult;
|
||||
use Mika56\SPFCheck\DNS\DNSRecordGetter;
|
||||
use Mika56\SPFCheck\Model\Query;
|
||||
use Mika56\SPFCheck\Model\Result;
|
||||
use Mika56\SPFCheck\DNSRecordGetter;
|
||||
use Mika56\SPFCheck\SPFCheck;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
||||
use OxidEsales\Eshop\Application\Model\Shop;
|
||||
@ -84,25 +82,23 @@ class SpfChecker extends AdminDetailsController
|
||||
protected function checkSpfByDomain($domain, &$summarize)
|
||||
{
|
||||
$checker = new SPFCheck(new DNSRecordGetter());
|
||||
$query = new Query('', $domain);
|
||||
|
||||
$result = $checker->getResult($query);
|
||||
switch ($result->getResult()) {
|
||||
case Result::FAIL:
|
||||
case Result::NEUTRAL:
|
||||
case Result::PASS:
|
||||
case Result::SOFTFAIL:
|
||||
switch ($checker->isIPAllowed(gethostbyname($domain), $domain)) {
|
||||
case SPFCheck::RESULT_FAIL:
|
||||
case SPFCheck::RESULT_NEUTRAL:
|
||||
case SPFCheck::RESULT_PASS:
|
||||
case SPFCheck::RESULT_SOFTFAIL:
|
||||
$status = SpfResult::SET;
|
||||
break;
|
||||
case Result::NONE:
|
||||
case SPFCheck::RESULT_NONE:
|
||||
$status = SpfResult::MISSING;
|
||||
break;
|
||||
default:
|
||||
$status = SpfResult::ERROR;
|
||||
}
|
||||
|
||||
$rawRecord = ($record = $result->getRecord()) ?
|
||||
$record->getRawRecord() :
|
||||
$rawRecord = ($record = (new DNSRecordGetter())->getSPFRecordForDomain($domain)) ?
|
||||
implode(', ', $record) :
|
||||
null;
|
||||
|
||||
$summarize[$domain] = oxNew(SpfResult::class, $status, $rawRecord);
|
||||
|
Loading…
Reference in New Issue
Block a user