--- /dev/null
+<?php
+/**
+ * read_headers.tpl
+ *
+ * Template to display the envelope headers when viewing a message.
+ *
+ * The following variables are available in this template:
+ *
+ * $headers_to_display - Array containing the list of all elements that need
+ * to be displayed. The index of each element is the
+ * translated name of the field to be displayed. The
+ * value of each element is the value to be displayed
+ * for that field. Many values can be controled through
+ * additional templates.
+ *
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id: read_headers.tpl 11998 2006-12-10 21:06:24Z pdontthink $
+ * @package squirrelmail
+ * @subpackage templates
+ */
+
+/** add required includes **/
+
+/** extract template variables **/
+extract($t);
+
+/** Begin template **/
+?>
+<div class="readHeaders">
+<table cellspacing="0" class="spacer">
+ <tr>
+ <td>
+ </td>
+ </tr>
+</table>
+<table cellspacing="0" class="table2">
+ <?php
+
+ // detect if we want to show reduced header or regular (expanded) header list
+ // default is to show the reduced header when the preview pane is turned on
+ //
+ // note that this is an example of a template page making use of its own
+ // value placed on the page's query string; we like to keep things like
+ // that in the core, but for template-specific add-on functionalities, this
+ // kind of thing is perfectly acceptable
+ //
+ global $data_dir, $username, $PHP_SELF;
+ $use_previewPane = getPref($data_dir, $username, 'use_previewPane', 0);
+ $show_preview_pane = checkForJavascript() && $use_previewPane;
+ if (!sqGetGlobalVar('expand_header', $expand_header, SQ_FORM, 0))
+ if (!$show_preview_pane)
+ $expand_header = 1;
+
+ // show reduced (collapsed) header
+ if (!$expand_header) {
+
+ $subject = (!empty($headers_to_display['Subject'])
+ ? $headers_to_display['Subject'] : _("(no subject)"));
+ $date = (!empty($headers_to_display['Date'])
+ ? $headers_to_display['Date'] : _("Unknown date"));
+ $from = (!empty($headers_to_display['From'])
+ ? $headers_to_display['From'] : _("Unknown sender"));
+ // if available, print "real" name instead of email addr
+ if (strpos($from,"<") !== FALSE) {
+ list($from, $ignore) = $parts = explode('<', $from);
+ $from = trim($from);
+ $from = preg_replace('/^( )+|( )+$/', '', $from);
+ $from = preg_replace('/^(")+|(")+$/', '', $from);
+ $from = preg_replace('/"$/', '', trim($from));
+ }
+ $reduced_header = sprintf(_("<b>%s</b> From <b>%s</b> On <b>%s</b>"), $subject, $from, $date);
+ $expand_link = str_replace('&expand_header=0', '', $PHP_SELF) . '&expand_header=1';
+
+ echo '<tr><td colspan="2" align="center" valign="top">'
+ . '<a href="' . $expand_link . '">'
+ . getIcon($icon_theme_path, 'plus.png', '-', _("Expand Header"))
+ . '</a> '
+ . $reduced_header
+ . '</td></tr>';
+
+ // show normal/full/expanded header listing
+ } else {
+
+ $collapse_link = str_replace('&expand_header=1', '', $PHP_SELF) . '&expand_header=0';
+ $first_time = TRUE;
+ foreach ($headers_to_display as $field_name=>$value) {
+ if (empty($value)) {
+ # Skip enpty headers
+ continue;
+ }
+ ?>
+ <tr>
+ <td class="fieldName">
+<?php
+ if ($first_time)
+ echo '<a href="' . $collapse_link . '">'
+ . getIcon($icon_theme_path, 'minus.png', '-', _("Collapse Header"))
+ . '</a> ';
+ echo $field_name . ':';
+ $first_time = FALSE;
+?>
+ </td>
+ <td class="fieldValue">
+ <?php echo $value; ?>
+ </td>
+ </tr>
+<?php
+ }
+ }
+ if (!empty($plugin_output['read_body_header'])) echo $plugin_output['read_body_header'];
+?>
+</table>
+<table cellspacing="0" class="spacer">
+ <tr>
+ <td>
+ </td>
+ </tr>
+</table>
+</div>