tdb->getMessages($folder); if (!isset($ix) && !isset($uidl)) { $TLN->redirectAndExit('index.php?err=3', true); } elseif (!isset($uidl)) { $uidl = $msgs[$ix]['uidl']; } $msg = $TLN->tdb->getMessage($uidl, $folder); $ix = $msg['idx']; $is_attached = false; $arAttachment = array(); if (!($TLN->mailRetrMsg($msg, false))) { $TLN->redirectAndExit('messages.php?err=2&folder='.urlencode($folder)."&refr=true"); } if ($msg['unread']) { if (!$TLN->mailSetFlag($msg, 'seen', '+')) { $TLN->triggerError('Could not set SEEN flag', I_AM_TELAEN, __LINE__); } //$msg['unread'] = false; //$TLN->tdb->updateFolderField($folder, 'unread', $folders[$folder]['unread'] - 1); //$TLN->tdb->doMessage($msg, ['unread']); } $TLN->parseBody($msg); $TLN->tdb->syncMessages(); if ($ix > 0) { $smHavePrevious = 1; $smPreviousSubject = $msgs[($ix-1)]['subject']; $smPreviousLink = 'readmsg.php?folder='.urlencode($folder)."&ix=".($ix-1).""; $smarty->assign('smHavePrevious', $smHavePrevious); $smarty->assign('smPreviousSubject', $smPreviousSubject); $smarty->assign('smPreviousLink', $smPreviousLink); } if ($ix < (count($msgs)-1)) { $smHaveNext = 1; $smNextSubject = $msgs[($ix+1)]['subject']; $smNextLink = 'readmsg.php?folder='.urlencode($folder)."&ix=".($ix+1).""; $smarty->assign('smHaveNext', $smHaveNext); $smarty->assign('smNextSubject', $smNextSubject); $smarty->assign('smNextLink', $smNextLink); } // message download JS and links $smarty->assign('pageMetas', $pmetas); $smarty->assign('downloadLink', 'download.php?folder='.urlencode($folder).'&uidl='.$uidl); $redir_path = 'redir.php'; // why not just relative?? Now is relative (due to problems on https servers)! $body = ""; $smarty->assign('smMessageBody', $body); // look if the msg needs a receipt if ($email['receipt-to']) { $smarty->assign('receiptRequired', true); } $ARFrom = $TLN->getNames($msg['headers']['from']); $useremail = $auth['email']; // from $name = $ARFrom[0]['name']; $thismail = $ARFrom[0]['mail']; $ARFrom[0]['link'] = 'newmsg.php?nameto='.urlencode($name)."&mailto=$thismail"; $ARFrom[0]['title'] = "$name <$thismail>"; $smarty->assign('smFromList', $ARFrom); // To $ARTo = $TLN->getNames($msg['headers']['to']); for ($i = 0;$iassign('smTOList', $ARTo); } // CC $ARCC = $TLN->getNames($msg['headers']['cc']); if (count($ARCC) > 0) { $smarty->assign('smHaveCC', 1); for ($i = 0;$iassign('smCCList', $ARCC); } $smarty->assign('smCCList', $TLN->convertCharset($msg['subject'], $TLN->ucharset)); eval('$jssource = "' . $commonJS . '";'); $jssource .= " "; $smDeleteForm = " "; $smReplyForm = "
"; $smarty->assign('smDeleteForm', $smDeleteForm); $smarty->assign('smReplyForm', $smReplyForm); $smarty->assign('smJS', $jssource); $smarty->assign('smSubject', $msg['subject']); $smarty->assign('smDate', $msg['date']); $anexos = $TLN->tdb->getAttachments($msg); $haveattachs = count($anexos); if ($haveattachs) { $attachAr = []; for ($i = 0; $i < $haveattachs; $i++) { $link1 = "download.php?folder=".urlencode($folder)."&uidl={$msg['uidl']}&name=".urlencode($anexos[$i]['name']).""; $link2 = "$link1&down=1"; if ($anexos[$i]['disposition'] != 'inline') { if ($attachAr[$i]['content-type'] == 'message/rfc822') { $attachAr[$i]['normlink'] = ""; } else { $attachAr[$i]['normlink'] = ""; } $attachAr[$i]['name'] = $anexos[$i]['name']; $attachAr[$i]['downlink'] = ""; $attachAr[$i]['size'] = $TLN->bytes2bkmg($anexos[$i]['size']); $attachAr[$i]['type'] = $anexos[$i]['type'].'/'.$anexos[$i]['subtype']; } } $smarty->assign('smHaveAttachments', $haveattachs); $smarty->assign('smAttachList', $attachAr); } $avalfolders = []; reset($folders); foreach ($folders as $a) { if ($a['name'] != $folder && ($TLN->mail_protocol == IMAP || ($a['name'] != 'inbox'))) { $entry = $TLN->fixPrefix($a['name'], 0); $display = extended_name($entry); $avalfolders[] = array('path' => $entry, 'display' => $display); } } $smarty->assign('smAvalFolders', $avalfolders); if ($is_attached) { $smarty->display("$themez/readmsg_popup.tpl"); } else { $smarty->display("$themez/readmsg.tpl"); }