* $Id$
*/
-require_once('../functions/imap.php');
-require_once('../functions/attachment_common.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/attachment_common.php');
/* --------------------------------------------------------------------------------- */
/* MIME DECODING */
/* Isolate the body structure and remove beginning and end parenthesis. */
$read = trim(substr ($bodystructure, strpos(strtolower($bodystructure), 'bodystructure') + 13));
$read = trim(substr ($read, 0, -1));
- $msg =& new Message();
- $res = $msg->parseStructure($read);
- $msg = $res[0];
+ $i = 0;
+ $msg = Message::parseStructure($read,$i);
if (!is_object($msg)) {
- include_once( '../functions/display_messages.php' );
+ include_once(SM_PATH . 'functions/display_messages.php');
global $color, $mailbox;
displayPageHeader( $color, urldecode($mailbox) );
echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n\n" .
'<CENTER>';
- $errormessage = _("Squirrelmail could not decode the bodystructure of the message");
+ $errormessage = _("SquirrelMail could not decode the bodystructure of the message");
$errormessage .= '<BR>'._("the provided bodystructure by your imap-server").':<BR><BR>';
$errormessage .= '<table><tr><td>' . htmlspecialchars($read) . '</td></tr></table>';
plain_error_message( $errormessage, $color );
return $msg;
}
+
+
/* This starts the parsing of a particular structure. It is called recursively,
* so it can be passed different structures. It returns an object of type
* $message.
echo '<tt><br>' .
'<table width="80%"><tr>' .
'<tr><td colspan=2>' .
- _("Body retrieval error. The reason for this is most probably that the message is malformed. Please help us making future versions better by submitting this message to the developers knowledgebase!") .
- " <A HREF=\"../src/retrievalerror.php?$par\"><br>" .
- _("Submit message") . '</A><BR> ' .
+ _("Body retrieval error. The reason for this is most probably that the message is malformed.") .
'</td></tr>' .
- '<td><b>' . _("Command:") . "</td><td>$cmd</td></tr>" .
- '<td><b>' . _("Response:") . "</td><td>$response</td></tr>" .
- '<td><b>' . _("Message:") . "</td><td>$message</td></tr>" .
- '<td><b>' . _("FETCH line:") . "</td><td>$topline</td></tr>" .
+ '<tr><td><b>' . _("Command:") . "</td><td>$cmd</td></tr>" .
+ '<tr><td><b>' . _("Response:") . "</td><td>$response</td></tr>" .
+ '<tr><td><b>' . _("Message:") . "</td><td>$message</td></tr>" .
+ '<tr><td><b>' . _("FETCH line:") . "</td><td>$topline</td></tr>" .
"</table><BR></tt></font><hr>";
$data = sqimap_run_command ($imap_stream, "FETCH $passed_id BODY[]", true, $response, $message, $uid_support);
global $where, $what; /* from searching */
global $color; /* color theme */
- require_once('../functions/url_parser.php');
+ require_once(SM_PATH . 'functions/url_parser.php');
$body_ary = explode("\n", $body);
for ($i=0; $i < count($body_ary); $i++) {
* order that is their priority.
*/
global $startMessage, $username, $key, $imapServerAddress, $imapPort,
- $show_html_default, $has_unsafe_images, $view_unsafe_images, $sort;
+ $show_html_default, $sort, $has_unsafe_images;
+
+ if ( !check_php_version(4,1) ) {
+ global $_GET;
+ }
+ if(isset($_GET['view_unsafe_images'])) {
+ $view_unsafe_images = $_GET['view_unsafe_images'];
+ } else {
+ $view_unsafe_images = false;
+ }
- $has_unsafe_images= 0;
$body = '';
$urlmailbox = urlencode($mailbox);
$body_message = getEntity($message, $ent_num);
$body_message->header->getParameter('charset'));
}
- if ($has_unsafe_images) {
- if ($view_unsafe_images) {
- $untext = '">' . _("Hide Unsafe Images");
- } else {
- $untext = '&view_unsafe_images=1">' . _("View Unsafe Images");
- }
- $body .= '<center><small><a href="read_body.php?passed_id=' . $id .
- '&passed_ent_id=' . $message->entity_id . '&mailbox=' . $urlmailbox .
- '&sort=' . $sort . '&startMessage=' . $startMessage . '&show_more=0' .
- $untext . '</a></small></center><br>' . "\n";
+ if ($view_unsafe_images) {
+ $untext = '">' . _("Hide Unsafe Images");
+ } else {
+ if (isset($has_unsafe_images) && $has_unsafe_images) {
+ $untext = '&view_unsafe_images=1">' . _("View Unsafe Images");
+ } else {
+ $untext = '';
+ }
}
+ $body .= '<center><small><a href="read_body.php?passed_id=' . $id .
+ '&passed_ent_id=' . $message->entity_id . '&mailbox=' . $urlmailbox .
+ '&sort=' . $sort . '&startMessage=' . $startMessage . '&show_more=0' .
+ $untext . '</a></small></center><br>' . "\n";
+
}
return $body;
}
$default_page = '../src/read_body.php';
$rfc822_header = $att->rfc822_header;
$filename = decodeHeader($rfc822_header->subject);
-
+ if (trim( $filename ) == '') {
+ $filename = 'untitled-[' . $ent . ']' ;
+ }
$from_o = $rfc822_header->from;
if (is_object($from_o)) {
$from_name = $from_o->getAddress(false);
}
$defaultlink = $default_page . "?startMessage=$startMessage"
. "&passed_id=$id&mailbox=$urlMailbox"
- . '&ent_id='.$ent.$passed_ent_id_link;
+ . '&ent_id='.$ent.$passed_ent_id_link.'&absolute_dl=true';
if ($where && $what) {
- $defaultlink = '&where='. urlencode($where).'&what='.urlencode($what);
+ $defaultlink .= '&where='. urlencode($where).'&what='.urlencode($what);
}
/* This executes the attachment hook with a specific MIME-type.
* If that doesn't have results, it tries if there's a rule
}
/* This function trys to locate the entity_id of a specific mime element */
-
function find_ent_id($id, $message) {
- $ret = '';
- for ($i = 0; $ret == '' && $i < count($message->entities); $i++) {
- if ($message->entities[$i]->header->type0 != 'multipart') {
+ for ($i = 0, $ret = ''; $ret == '' && $i < count($message->entities); $i++) {
+ if ($message->entities[$i]->header->type0 == 'multipart') {
$ret = find_ent_id($id, $message->entities[$i]);
} else {
if (strcasecmp($message->entities[$i]->header->id, $id) == 0) {
- if (sq_check_save_extension($message->entities[$i])) {
- $ret = $message->entities[$i]->entity_id;
- }
+// if (sq_check_save_extension($message->entities[$i])) {
+ return $message->entities[$i]->entity_id;
+// }
}
}
}
* @param $id the id of the message
* @return a string with html safe to display in the browser.
*/
-function magicHTML($body, $id, $message, $mailbox = 'INBOX'){
+function magicHTML($body, $id, $message, $mailbox = 'INBOX') {
global $attachment_common_show_images, $view_unsafe_images,
$has_unsafe_images;
/**
"html",
"head",
"base",
- "link"
+ "link",
+ "frame",
+ "iframe"
);
$rm_tags_with_content = Array(
)
)
);
+ if(isset($_GET['view_unsafe_images'])) {
+ $view_unsafe_images = $_GET['view_unsafe_images'];
+ } else {
+ $view_unsafe_images = false;
+ }
if (!$view_unsafe_images){
/**
* Remove any references to http/https if view_unsafe_images set