0
1
Fork 0
hedera-web-mindshore/rest/edi/lib/method.php

40 lines
766 B
PHP
Raw Normal View History

<?php
2016-08-31 11:53:46 +00:00
namespace Edi;
2018-05-23 10:14:20 +00:00
abstract class Method extends \Vn\Lib\Method {
protected $imap;
protected $imapConf;
protected $mailbox;
2018-05-23 10:14:20 +00:00
abstract function ediRun($db);
2018-05-23 10:14:20 +00:00
function run($db) {
$db->selectDb('edi');
2018-05-23 10:14:20 +00:00
$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");
2018-05-23 10:14:20 +00:00
$this->mailbox = sprintf('{%s/imap/ssl/novalidate-cert}',
$imapConf['host']);
2018-05-23 10:14:20 +00:00
$imap = imap_open($this->mailbox
,$imapConf['user']
2018-05-23 10:14:20 +00:00
,base64_decode($imapConf['pass'])
);
$this->imap = $imap;
$this->imapConf = $imapConf;
2018-05-23 10:14:20 +00:00
if ($imap) {
$this->ediRun($db);
imap_expunge($imap);
imap_close($imap);
2018-05-23 11:09:55 +00:00
} else
2018-05-23 10:14:20 +00:00
error_log(imap_last_error());
}
}