Exemplo n.º 1
0
 public function parseEmails()
 {
     require_once DISCUSS_CLASSES . '/mailbox.php';
     $config = DiscussHelper::getConfig();
     // Default email parser
     $mailer = new DiscussMailer();
     $state = $mailer->connect($config->get('main_email_parser_username'), $config->get('main_email_parser_password'));
     if ($state) {
         self::processEmails($mailer);
     }
     // Category email parser
     $model = DiscussHelper::getModel('Categories', true);
     $cats = $model->getAllCategories();
     if (is_array($cats)) {
         foreach ($cats as $cat) {
             $category = DiscussHelper::getTable('Category');
             $category->load($cat->id);
             $enable = explode(',', $category->getParam('cat_email_parser_switch'));
             if ($enable[0]) {
                 $catMail = explode(',', $category->getParam('cat_email_parser'));
                 $catPass = explode(',', $category->getParam('cat_email_parser_password'));
                 $mailer = new DiscussMailer();
                 $state = $mailer->connect($catMail[0], $catPass[0]);
                 if ($state) {
                     self::processEmails($mailer, $category);
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 2
0
 public function testParser($server, $port, $service, $ssl, $user, $pass, $validate)
 {
     $ajax = new Disjax();
     // variable check
     if ($server == '' || $port == '' || $user == '' || $pass == '') {
         $result = 'Credentials incomplete.';
         $ajax->assign('test-result', JText::_('Please complete the information'));
         return $ajax->send();
     }
     require_once DISCUSS_CLASSES . '/mailbox.php';
     $result = DiscussMailer::testConnect($server, $port, $service, $ssl, 'INBOX', $user, $pass);
     $ajax->assign('test-result', $result);
     return $ajax->send();
 }