update dependencies

Cette révision appartient à :
Daniel Seifert 2023-12-08 15:16:48 +01:00
Parent 23066e7a1d
révision 7b2d9cf296
Signé par: DanielS
ID de la clé GPG: 8A7C4C6ED1915C6F
4 fichiers modifiés avec 124 ajouts et 3 suppressions

Voir le fichier

@ -0,0 +1,110 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\SmtpChecker\Application\Controller\Admin;
use Assert\Assert;
use Assert\InvalidArgumentException;
use Net_SMTP;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\Eshop\Core\Registry;
use PEAR;
class SmtpChecker extends AdminDetailsController
{
protected bool $debug = true;
protected string $host;
protected Net_SMTP $smtp;
public function __construct()
{
parent::__construct();
/** @var Shop $activeShop */
$activeShop = Registry::getConfig()->getActiveShop();
$this->host = Registry::getRequest()->getRequestEscapedParameter('') ?? $activeShop->getFieldData('oxsmtp');
$this->checkDataAreSet();
$this->hostIsAvailable();
/*
//$host = 'cloud1-vm279.de-nserver.de:587';
$from = 'mail@ds.data-develop.de';
$rcpt = array('test@ds.data-develop.de', 'test@daniel-seifert.com', 'recipient2@example.com');
//$rcpt = array('test@ds.data-develop.de');
$rcpt = array('test@daniel-seifert.com');
$subj = "Subject: Test Message\n";
$body = "Body Line 1\nBody Line 2";
if ( PEAR::isError( $e = $smtp->connect())) {
dumpvar(__METHOD__.__LINE__.PHP_EOL);
die($e->getMessage() . "\n");
}
if ( PEAR::isError( $smtp->mailFrom( $from))) {
die("Unable to set sender to $from\n");
}
foreach ($rcpt as $to) {
dumpvar($to.PHP_EOL);
if ( PEAR::isError( $res = $smtp->rcptTo( $to))) {
die("Unable to add recipient $to: " . $res->getMessage() . "\n");
}
}
/* Set the body of the message. */
/*
if ( PEAR::isError( $res = $smtp->data( $subj . "\r\n" . $body))) {
dumpvar($res->getMessage());
die("Unable to send data\n");
}
/* Disconnect from the SMTP server. */
/*
$smtp->disconnect();
*/
}
protected function checkDataAreSet()
{
}
/**
* @throws InvalidArgumentException
* @return void
*/
protected function hostIsAvailable()
{
$this->host = 'test.example.dev';
Assert::that(( $this->smtp = new Net_SMTP( $this->host ) ))->true('Unable to instantiate SMTP object');
$this->smtp->setDebug($this->debug);
}
protected function foo()
{
PEAR::isError( $e = $this->smtp->connect());
dumpvar(get_class($e));
die();
Assert::that(PEAR::isError( $e = $this->smtp->connect()))->false($e->getMessage());
{
dumpvar(__METHOD__.__LINE__.PHP_EOL);
die($e->getMessage() . "\n");
}
}
}

Voir le fichier

@ -27,7 +27,8 @@
"require": {
"php": ">=7.3",
"oxid-esales/oxideshop-ce": "6.8 - 6.14",
"pear/net_smtp": "^1.11"
"pear/net_smtp": "^1.11",
"beberlei/assert": "^3.3"
},
"require-dev": {
"php": "^7.4",
@ -50,7 +51,7 @@
},
"autoload": {
"psr-4": {
"D3\\SMTPChecker\\": "../../../source/modules/d3/smtpchecker"
"D3\\SmtpChecker\\": "../../../source/modules/d3/smtpchecker"
}
},
"scripts": {

8
menu.xml Fichier normal
Voir le fichier

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<OX>
<OXMENU id="NAVIGATION_ESHOPADMIN">
<MAINMENU id="mxservice">
<SUBMENU id="MXSMTPCHECKER" cl="d3smtpchecker" />
</MAINMENU>
</OXMENU>
</OX>

Voir le fichier

@ -13,6 +13,8 @@
declare(strict_types=1);
use D3\SmtpChecker\Application\Controller\Admin\SmtpChecker;
$sMetadataVersion = '2.1';
$sModuleId = 'd3smtpchecker';
@ -34,7 +36,7 @@ $aModule = [
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
'controllers' => [
// 'd3ControllerAlias' => D3\ThisModule\Application\Controller\Admin\d3Controller::class,
'd3smtpchecker' => SmtpChecker::class,
],
'extend' => [
// \OxidEsales\Eshop\Core\ShopControl::class => \D3\ThisModule\Modules\Core\ShopControl_MyModule::class