hedera-web/rest/edi/lib/method.php

38 lines
688 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(
2019-05-24 13:30:48 +00:00
'SELECT host, user, pass, successFolder, errorFolder FROM imapConfig');
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());
}
}