| 1126 |
return form($output); |
return form($output); |
| 1127 |
} |
} |
| 1128 |
|
|
|
function mail_archive_message_delete($lid, $mid) { |
|
|
echo "<pre>\n"; |
|
|
$message = db_fetch_object(db_query('SELECT mid, lid, path, attachments FROM {mail_archive_message_index} WHERE lid = %d AND mid = %d', $lid, $mid)); |
|
|
|
|
|
if (user_access('administer mail archive')) { |
|
|
if ($output = mail_archive_retrieve_message($message->path, $mid .'.0')) { |
|
|
echo htmlspecialchars($output); |
|
|
} |
|
|
else { |
|
|
echo "\n". t('[this message has no headers]') ."\n"; |
|
|
} |
|
|
} |
|
|
|
|
|
// display body of message |
|
|
if ($output = mail_archive_retrieve_message($message->path, $mid .'.1')) { |
|
|
echo htmlspecialchars($output); |
|
|
} |
|
|
else { |
|
|
echo "\n". t('[this message has no body]') ."\n"; |
|
|
} |
|
|
|
|
|
if ($message->attachments) { |
|
|
$attachments = mail_archive_get_attachments($mid); |
|
|
for ($i = 0; $i < $message->attachments; $i++) { |
|
|
$part = $i + 2; |
|
|
if ($attachments[$part]->type == 0) { // text |
|
|
echo "\n\n--Multipart\n"; |
|
|
$subtype = $attachments[$part]->subtype; |
|
|
echo t("Content-Type: %type\n", array('%type' => "TEXT/$subtype")); |
|
|
$filename = $attachments[$part]->filename; |
|
|
echo t(" filename=\"%name\"\n\n", array('%name' => "$filename")); |
|
|
if ($output = mail_archive_retrieve_message($message->path, "$mid.". $part)) { |
|
|
echo htmlspecialchars($output); |
|
|
} |
|
|
else { |
|
|
echo "\n". t('[failed to load attachment]') ."\n"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// don't return, we simply displayed it to the screen. |
|
|
echo "</pre>\n"; |
|
|
} |
|
|
|
|
| 1129 |
function mail_archive_get_attachments($mid) { |
function mail_archive_get_attachments($mid) { |
| 1130 |
$result = db_query('SELECT mid, created, filename, bytes, type, subtype, encoding, part FROM {mail_archive_attachments_index WHERE mid = %d', $mid); |
$result = db_query('SELECT mid, created, filename, bytes, type, subtype, encoding, part FROM {mail_archive_attachments_index WHERE mid = %d', $mid); |
| 1131 |
while ($attachment = db_fetch_object($result)) { |
while ($attachment = db_fetch_object($result)) { |