function flattenParts($messageParts, $flattenedParts = array(), $prefix = '', $index = 1, $fullPrefix = true) { if (!empty($messageParts)) { foreach ($messageParts as $part) { $flattenedParts[$prefix . $index] = $part; if (isset($part->parts)) { if ($part->type == 2) { $flattenedParts = imapRoutine::flattenParts($part->parts, $flattenedParts, $prefix . $index . '.', 0, false); } elseif ($fullPrefix) { $flattenedParts = imapRoutine::flattenParts($part->parts, $flattenedParts, $prefix . $index . '.'); } else { $flattenedParts = imapRoutine::flattenParts($part->parts, $flattenedParts, $prefix); } unset($flattenedParts[$prefix . $index]->parts); } $index++; } } return $flattenedParts; }
if (!isset($DP->manual_assign)) { die($pipeID . ' has not been assigned to any department. Update in set'); } // Is debug enabled? if ($SETTINGS->imap_debug == 'yes') { if (!is_dir(PATH . 'logs') || !is_writeable(PATH . 'logs')) { die('Imap debug enabled in settings, but "logs" folder either doesn`t exist or isn`t writeable. Please update.'); } } // Load download class for mime types.. include PATH . 'control/classes/class.download.php'; $DL = new msDownload(); // Load mailer params.. include PATH . 'control/mail-data.php'; // Read mailbox and run.. $MSIMAP = new imapRoutine($IMDT); $MSIMAP->settings = $SETTINGS; $MSIMAP->datetime = $MSDT; $mailbox = $MSIMAP->connectToMailBox(); // Load spam b8 filter if enabled.. if ($IMDT->im_spam == 'yes') { include PATH . 'control/lib/b8/call_b8.php'; if (isset($b8_err)) { $MSIMAP->log('B8 spam filter fatal error: ' . $b8_err); } else { if (class_exists('b8')) { $MSIMAP->log('B8 spam filter successfully loaded'); define('B8_LOADED', 1); } } }