public function readAttachments($connection, $msg) { $attachments = array(); $att = imapRoutine::extractAttachments($connection, $msg); $count = 0; if (!empty($att)) { for ($j = 0; $j < count($att); $j++) { if (isset($att[$j]['is_attachment']) && isset($att[$j]['attachment'])) { if ($att[$j]['is_attachment'] == 'yes' && $att[$j]['attachment'] != '') { ++$count; if (LICENCE_VER == 'locked' && $count <= RESTR_ATTACH) { $attachments[$count]['file'] = $att[$j]['filename']; $attachments[$count]['attachment'] = $att[$j]['attachment']; $attachments[$count]['ext'] = strpos($att[$j]['filename'], '.') !== FALSE ? strrchr(strtolower($att[$j]['filename']), '.') : '.txt'; } else { if (LICENCE_VER == 'unlocked') { $attachments[$count]['file'] = $att[$j]['filename']; $attachments[$count]['attachment'] = $att[$j]['attachment']; $attachments[$count]['ext'] = strpos($att[$j]['filename'], '.') !== FALSE ? strrchr(strtolower($att[$j]['filename']), '.') : '.txt'; } } } } } } return $attachments; }