/usr/share/squirrelmail/plugins/view_as_html/view_as_html.php is in squirrelmail-viewashtml 3.8-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | <?php
/*
* $Id: view_as_html.php,v 1.7 2009/01/24 19:57:46 indiri69 Exp $
*/
function view_as_html_set() {
global $message, $show_html_default;
sqgetGlobalVar('view_as_html', $view_as_html);
sqgetGlobalVar('view_unsafe_images', $view_unsafe_images);
/*
* We only worry if view_unsafe_images is passed from
* a link. Other plugins and options should handle it
* the rest of the time.
*/
if($view_unsafe_images == 1) {
$view_as_html = 1;
}
if(isset($view_as_html)) {
if ($view_as_html == 1) {
$show_html_default = 1;
} else if($view_as_html == 0) {
$show_html_default = 0;
}
}
/* Handle broken emails the have Content-Type w/o Mime-Version */
if ($message->rfc822_header->content_type->type0 == 'text' &&
$message->rfc822_header->content_type->type1 == 'html') {
$message->header->type0 = 'text';
$message->header->type1 = 'html';
$message->type0 = 'text';
$message->type1 = 'html';
if (count($message->rfc822_header->content_type->properties) > 0) {
$message->header->parameters = $message->rfc822_header->content_type->properties;
}
}
}
function view_as_html_link() {
global $message, $show_html_default, $sort;
$vars = array('passed_ent_id', 'show_more', 'override_type0', 'override_type1', 'where', 'what');
sqgetGlobalVar('mailbox', $mailbox);
sqgetGlobalVar('passed_id', $passed_id);
sqgetGlobalVar('startMessage', $startMessage);
sqgetGlobalVar('view_as_html', $view_as_html);
$startMessage = (int)$startMessage;
$passed_id = (int)$passed_id;
$view_as_html = (int)$view_as_html;
$new_link = "read_body.php?passed_id=$passed_id&startMessage=$startMessage" .
"&mailbox=" . urlencode($mailbox);
foreach($vars as $var) {
if(sqgetGlobalVar($var, $$var)) {
$new_link .= '&' . $var . '=' . urlencode($$var);
}
}
$has_html = 0;
if ($message->header->type0 == 'message' && $message->header->type1 == 'rfc822') {
$type0 = $message->rfc822_header->content_type->type0;
$type1 = $message->rfc822_header->content_type->type1;
} else {
$type0 = $message->header->type0;
$type1 = $message->header->type1;
}
if($type0 == 'multipart' &&
($type1 == 'alternative' || $type1 == 'mixed' || $type1 == 'related')) {
if ($message->findDisplayEntity(array(), array('text/html'), true)) {
$has_html = 1;
}
}
/*
* Normal single part message so check its type.
*/
else {
if($type0 == 'text' && $type1 == 'html') {
$has_html = 1;
}
}
if ($has_html == 1) {
sq_change_text_domain('view_as_html');
$link = ' | ';
if($show_html_default == 1) {
$link .= '<a href="' . $new_link . '&view_as_html=0">';
$link .= _("View as plain text");
} else {
$link .= '<a href="' . $new_link . '&view_as_html=1">';
$link .= _("View as HTML");
}
echo $link . "</a>\n";
sq_change_text_domain('squirrelmail');
}
}
|