$MSIMAP->log(count($attachments) . ' attachment(s) found'); if (!empty($attachments) && LICENCE_VER == 'locked' && count($attachments) > RESTR_ATTACH) { $countOfBoxes = RESTR_ATTACH; } if (!empty($attachments)) { $restrictions = array('Rename' => ucfirst($SETTINGS->rename), 'FileTypes' => $SETTINGS->filetypes ? $SETTINGS->filetypes : 'No Restrictions (Not recommended)', 'MaxSize' => $SETTINGS->maxsize > 0 ? mswFileSizeConversion($SETTINGS->maxsize) : 'No Limits'); $MSIMAP->log('Restrictions Imposed: {nl}{nl}' . print_r($restrictions, true)); $MSIMAP->log('Preparing to loop and check attachment(s)'); for ($j = 0; $j < (isset($countOfBoxes) ? $countOfBoxes : count($attachments)); $j++) { ++$aCount; $MSIMAP->log('Check Attachment: ' . $attachments[$aCount]['file']); // Check for valid file type.. if ($MSTICKET->type($attachments[$aCount]['file'])) { $n = $SETTINGS->rename == 'yes' ? $MSTICKET->rename($attachments[$aCount]['file'], $ID, $replyID, $j + 1) : $attachments[$aCount]['file']; // At this point we must upload the file to get file size.. $folder = $MSIMAP->uploadEmailAttachment($n, $attachments[$aCount]['attachment']); // If file upload now exists, check file size.. if ($folder && file_exists($SETTINGS->attachpath . '/' . $folder . $n)) { $fSize = filesize($SETTINGS->attachpath . '/' . $folder . $n); if ($fSize > 0) { if (!$MSTICKET->size($fSize)) { $MSIMAP->log('Size (' . mswFileSizeConversion($fSize) . ') too big and attachment ignored/deleted'); @unlink($SETTINGS->attachpath . '/' . $folder . $n); } else { // Try and determine mime type.. $mime = $DL->mime($attachments[$aCount]['file'], ''); $MSIMAP->log('Mime type determined as ' . $mime); // Add attachment data to database.. $atID = $MSIMAP->addAttachmentToDB($ID, $replyID, $n, $fSize, $mime); if ($atID > 0) { $pipes[3] = ++$pipes[3];