$a['name'] = $part->d_parameters['filename']; $a['body'] = $part->body; $a['mime'] = $part->ctype_primary . '/' . $part->ctype_secondary; $a['summary'] = ''; $attachments[] = $a; } else { if ($part->ctype_secondary == 'plain') { $body .= $wmsg->formatBody($part->body); } else { $body .= $part->body; } } } } // - if M{id} is valid $res = $wmsg->get($message_id, false); if (!$res) { echo 'no such message (' . $message_id . ')' . NEWLINE; info($res, true); continue; } if (preg_match('/<([^>]+)>/', $decoded->headers['from'], $regs)) { $from = $regs[1]; } else { $from = $decoded->headers['from']; } // - recipient list based on original message $list = $wmsg->getRecipients($message_id); if (!is_array($list)) { $list = array(); }
<?php global $cgi; loader_import('cms.Workspace.Message'); $msg = new WorkspaceMessage(); $res = $msg->get($cgi->message_id); if (!$res) { echo '<script language="javascript" type="text/javascript"> window.close (); </script>'; exit; } $attachment = false; foreach ($res->attachments as $a) { if ($a->id == $cgi->id) { $attachment =& $a; } } if (!$attachment) { echo '<script language="javascript" type="text/javascript"> window.close (); </script>'; exit; } if ($cgi->save == 'true') { header('Content-Type: application/x-octet-stream'); header('Content-Disposition: attachment; filename=' . $attachment->name); } else { header('Content-Type: ' . $attachment->mimetype); } echo $attachment->body; exit;
<?php global $cgi; loader_import('cms.Workspace.Message'); $msg = new WorkspaceMessage(); if ($cgi->item) { $cgi->id = $cgi->item; } if ($cgi->category == 'Sent') { $res = $msg->getSent($cgi->id); } else { $res = $msg->get($cgi->id); } if (!$res) { page_title(intl_get('Reading Message')); echo '<p>Error: ' . $msg->error . '</p>'; return; } if ($cgi->category == 'Sent') { $res->category = 'Sent'; } elseif ($cgi->category == 'Trash') { $res->category = 'Trash'; } elseif ($res->category == '') { $res->category = 'Inbox'; } page_title(intl_get('Reading Message') . ': ' . $res->subject); $res->response_subject = Workspace::createResponseSubject($res->subject); $list = $msg->getRecipients($cgi->id); if (!$list) { $user_list = array(); $recipients = array(session_username());
if (!$thread) { continue; } // now figure out: // - type of message (M, T, or C), for now handle only M switch (substr($thread, 0, 1)) { case 'M': $msg_id = str_replace('M', '', $thread); break; case 'T': case 'C': default: continue; } // - if M{id} is valid $res = $m->get($msg_id, false); if (!$res) { echo 'no such message (' . $msg_id . ')' . NEWLINE; info($res, true); continue; } $from = $j->GetInfoFromMessageFrom($message); $body = $j->GetInfoFromMessageBody($message); $from = preg_replace('/@([^\\/]+)\\/.*$/', '@\\1', $from); // - recipient list based on original message $list = $m->getRecipients($msg_id); $_list = array($res->from_user); foreach ($list as $obj) { if (!$obj->user) { $_list[] = $obj->email; } else {