go-mailzu/templates/viewmail.template.php

250 lines
7.3 KiB
PHP
Raw Permalink Normal View History

2008-12-10 14:33:43 +01:00
<?php
/**
* This file provides output functions for ctrlpnl.php
* No data manipulation is done in this file
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @author Adam Moore
* @author David Poole <David.Poole@fccc.edu>
* @version 03-11-05
* @package Templates
*
* Copyright (C) 2003 - 2005 phpScheduleIt
* License: GPL, see LICENSE
*/
/**
* MailMime class
*/
include_once('lib/MailMime.class.php');
function startMessage() {
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="vertical-align:top; width:16%; border:solid 2px #0F93DF; background-color:#FFFFFF;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="tableTitle" style="background-color:#0F93DF;">
<?php echo translate('Message'); ?>
2008-12-10 14:33:43 +01:00
</td>
<td class="tableTitle" style="background-color:#0F93DF;">
<div align="right"
<a href="javascript: help('msg_view');" class="" style="color: #FFFFFF" onmouseover="javascript: window.status='Help - Message View'; return true;" onmouseout="javascript: window.status=''; return true;">?</a>
</div>
</td>
</tr>
</table>
<?php
2008-12-10 14:33:43 +01:00
}
function endMessage() {
?>
</td>
</tr>
</table>
<?php
2008-12-10 14:33:43 +01:00
}
/**
* Print row of message header (From,To,Subject,etc)
* $param The mime structure object and the specific header name
*/
function MsgPrintHeader($struct,$hdr_list) {
foreach ($hdr_list as $hdr) {
if (!array_key_exists(strtolower($hdr), $struct->headers)) {
continue;
}
2008-12-10 14:33:43 +01:00
$header_value = $struct->headers[strtolower($hdr)];
if (is_array($header_value)) {
$value_array = $header_value;
$count = count($value_array);
for ($i=0; $i < $count; $i++) {
$header_value = $value_array[$i];
$displayed_value = $header_value ? htmlspecialchars(trim($header_value)) : '(none)';
echo ' <tr>' . "\n"
. ' <td class="headerName"><nobr>' . translate($hdr) , ":</nobr></td>" . "\n"
. ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
. ' </tr>' . "\n";
}
} else {
$displayed_value = $header_value ? htmlspecialchars(trim($header_value)) : '(none)';
echo ' <tr>' . "\n"
. ' <td class="headerName"><nobr>' . translate($hdr) . ":</nobr></td>" . "\n"
. ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
. ' </tr>' . "\n";
}
}
}
/**
* Print row of optional message headers
* $param The mime structure object and the specific header name
*/
function MsgPrintHeaderFull($struct,$hdr_list) {
foreach ($hdr_list as $hdr) {
if (!array_key_exists(strtolower($hdr), $struct->headers)) {
continue;
}
2008-12-10 14:33:43 +01:00
$header_value = $struct->headers[strtolower($hdr)];
if (!$header_value) {
continue;
}
2008-12-10 14:33:43 +01:00
if (is_array($header_value)) {
$value_array = $header_value;
$count = count($value_array);
for ($i=0; $i < $count; $i++) {
$header_value = $value_array[$i];
$displayed_value = $header_value ? htmlspecialchars(trim($header_value)) : '(none)';
echo ' <tr class="' . getShowHideHeaders('headers') . '">' . "\n"
. ' <td class="headerName"><nobr>' . "$hdr:</nobr></td>" . "\n"
. ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
. ' </tr>' . "\n";
}
} else {
$displayed_value = $header_value ? htmlspecialchars(trim($header_value)) : '(none)';
echo ' <tr class="' . getShowHideHeaders('headers') . '">' . "\n"
. ' <td class="headerName"><nobr>' . "$hdr:</nobr></td>" . "\n"
. ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
. ' </tr>' . "\n";
}
}
}
/**
* Print table of message options (Toggle Header, Back to Messages, etc..)
* $param none
*/
function MsgDisplayOptions($mail_id, $recip_email) {
// Double encode needed for javascript pass-through
$enc_mail_id = urlencode(urlencode($mail_id));
$enc_recip_email = urlencode(urlencode($recip_email));
?>
<table class="stdFont" width="100%">
<tr>
<td align="left">
<a href="javascript: history.back();">&#8249;&#8249; <?php echo translate('BackMessageIndex'); ?> </a>
2008-12-10 14:33:43 +01:00
</td>
<td align="right">
<a href="javascript: ViewOriginal('<?php echo $enc_mail_id ?>','<?php echo $enc_recip_email ?>');"> <?php echo translate('ViewOriginal'); ?></a>
2008-12-10 14:33:43 +01:00
|
<a href="javascript: void(1);" onclick="showHideFullHeaders('headers');">
<?php echo translate('ToggleHeaders'); ?></a>
2008-12-10 14:33:43 +01:00
</td>
</tr>
</table>
<?php
2008-12-10 14:33:43 +01:00
}
/**
* Print row of original message options (Print, Close, etc..)
* $param none
*/
function MsgOriginalOptions() {
?>
<table width="100%">
<tr>
<td class="stdFont" align="right">
<a href="javascript: window.print();"> <?php echo translate('Print'); ?></a>
2008-12-10 14:33:43 +01:00
|
<a href="javascript: window.close();"> <?php echo translate('CloseWindow'); ?> </a>
2008-12-10 14:33:43 +01:00
</td>
</tr>
<tr>
<td class="stdFont" bgcolor="#FAFAFA">
<?php
2008-12-10 14:33:43 +01:00
}
/**
* Print table of message headers (From,To,Subject,etc)
* $param The mime structure object
*/
function MsgDisplayHeaders($struct) {
$headers = array ('From',
'To',
'Date',
'Subject'
);
$headers_full = array ("Received",
"Message-ID",
"X-Spam-Status",
"X-Amavis-Alert"
);
echo '<table id="headers" width="100%" border="0" cellspacing="0" cellpadding="1" align="center" style="border-collapse:collapse">' . "\n";
MsgPrintHeader($struct,$headers);
MsgPrintHeaderFull($struct,$headers_full);
echo '</table>' . "\n";
}
/**
* Print table of message body
* $param The mime structure object
*/
function MsgDisplayBody($struct) {
echo '<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">';
echo ' <tr>';
echo ' <td class="stdFont">';
MsgParseBody($struct);
echo ' <br>';
echo ' </td>';
echo ' </tr>';
echo '</table>';
MsgDisplayFooter();
}
/**
* Print text of text/plain MIME entity
* $param The body of a mime structure object
*/
function MsgBodyPlainText($text) {
// echo nl2br(htmlspecialchars($text));
echo "<pre>";
echo htmlspecialchars($text);
echo "</pre>";
2008-12-10 14:33:43 +01:00
}
/**
* Print HTML of text/html MIME entity
* $param The body of a mime structure object
*/
function MsgBodyHtmlText($text) {
echo sanitizeHTML($text);
}
/**
* Print list of attachments
* $param The body of a mime structure object
*/
function MsgDisplayFooter() {
// Globals read from MailMime.class.php
global $filelist;
global $errors;
if ( $filelist || $errors ) {
// Space before attachment or warning list
echo '<br>';
echo '<hr>';
echo '<table class="stdFont" width="100%" border="0" cellspacing="0" cellpadding="1" align="center">';
echo '<tr>';
echo ' <td>';
if ($filelist) {
echo '--Attachments--<br>';
foreach ($filelist as $file) {
echo $file . '<br>';
}
}
if ($errors) {
echo '<br>--warnings--<br>';
foreach (array_keys($errors) as $errmsg) {
echo $errmsg . '<br>';
}
}
echo ' </td>';
echo '</tr>';
echo '</table>';
}
}