forked from verdnatura/hedera-web
40 lines
766 B
PHP
40 lines
766 B
PHP
<?php
|
|
|
|
namespace Edi;
|
|
|
|
abstract class Method extends \Vn\Lib\Method {
|
|
protected $imap;
|
|
protected $imapConf;
|
|
protected $mailbox;
|
|
|
|
abstract function ediRun($db);
|
|
|
|
function run($db) {
|
|
$db->selectDb('edi');
|
|
|
|
$imapConf = $db->getRow(
|
|
"SELECT ic.host, ic.user, ic.pass, ic.successFolder, ic.errorFolder
|
|
FROM imapConfig ic
|
|
JOIN util.config c ON c.environment = ic.environment");
|
|
|
|
$this->mailbox = sprintf('{%s/imap/ssl/novalidate-cert}',
|
|
$imapConf['host']);
|
|
|
|
$imap = imap_open($this->mailbox
|
|
,$imapConf['user']
|
|
,base64_decode($imapConf['pass'])
|
|
);
|
|
|
|
$this->imap = $imap;
|
|
$this->imapConf = $imapConf;
|
|
|
|
if ($imap) {
|
|
$this->ediRun($db);
|
|
imap_expunge($imap);
|
|
imap_close($imap);
|
|
} else
|
|
error_log(imap_last_error());
|
|
}
|
|
}
|
|
|