assign('msg', tra("This feature is disabled")); $smarty->display("styles/$style_base/error.tpl"); die; } if ($tiki_p_use_webmail != 'y') { $smarty->assign('msg', tra("Permission denied to use this feature")); $smarty->display("styles/$style_base/error.tpl"); die; } require_once ("lib/webmail/pop3.php"); require_once ("lib/webmail/mimeDecode.php"); include_once ("lib/webmail/class.rc4crypt.php"); include_once ("lib/webmail/htmlMimeMail.php"); function parse_output(&$obj, &$parts, $i) { if (!empty($obj->parts)) { for ($i = 0; $i < count($obj->parts); $i++) parse_output($obj->parts[$i], $parts, $i); } else { $ctype = $obj->ctype_primary . '/' . $obj->ctype_secondary; switch ($ctype) { case 'text/plain': if (!empty($obj->disposition)AND $obj->disposition == 'attachment') { $names = split(';', $obj->headers["content-disposition"]); $names = split('=', $names[1]); $aux['name'] = $names[1]; $aux['content-type'] = $obj->headers["content-type"]; $aux['part'] = $i; $parts['attachments'][] = $aux; } else { $parts['text'][] = $obj->body; } break; case 'text/html': if (!empty($obj->disposition)AND $obj->disposition == 'attachment') { $names = split(';', $obj->headers["content-disposition"]); $names = split('=', $names[1]); $aux['name'] = $names[1]; $aux['content-type'] = $obj->headers["content-type"]; $aux['part'] = $i; $parts['attachments'][] = $aux; } else { $parts['html'][] = $obj->body; } break; default: $names = split(';', $obj->headers["content-disposition"]); $names = split('=', $names[1]); $aux['name'] = $names[1]; $aux['content-type'] = $obj->headers["content-type"]; $aux['part'] = $i; $parts['attachments'][] = $aux; } } } if (!$user) { $smarty->assign('msg', tra("You are not logged in")); $smarty->display("styles/$style_base/error.tpl"); die; } if (!isset($_REQUEST["section"])) { $_REQUEST["section"] = 'mailbox'; } $smarty->assign('section', $_REQUEST["section"]); // Search if we have to add some contacts if (isset($_REQUEST["add_contacts"])) { if (isset($_REQUEST["add"])) { foreach (array_keys($_REQUEST["add"])as $i) { $webmaillib->replace_contact(0, $_REQUEST["addFirstName"][$i], $_REQUEST["addLastName"][$i], $_REQUEST["addemail"][$i], $_REQUEST["addNickname"][$i], $user); } } } /*************** Read an Email **************************************************************************************/ if ($_REQUEST["section"] == 'read') { if (isset($_REQUEST["fullheaders"])) { $smarty->assign('fullheaders', 'y'); } else { $smarty->assign('fullheaders', 'n'); } $current = $webmaillib->get_current_webmail_account($user); $smarty->assign('current', $current); $pop3 = new POP3($current["pop"], $current["username"], $current["pass"]); $pop3->Open(); if (isset($_REQUEST["delete_one"])) { $realmsgid = $pop3->GetMessageID($_REQUEST["msgdel"]); $webmaillib->remove_webmail_message($current["accountId"], $user, $realmsgid); $pop3->DeleteMessage($_REQUEST["msgdel"]); } $message = $pop3->GetMessage($_REQUEST["msgid"]); $realmsgid = $pop3->GetMessageID($_REQUEST["msgid"]); $smarty->assign('msgid', $_REQUEST["msgid"]); $smarty->assign('realmsgid', $realmsgid); $webmaillib->set_mail_flag($current["accountId"], $user, $realmsgid, 'isRead', 'y'); $s = $pop3->Stats(); $mailsum = $s["message"]; $numshow = $current["msgs"]; if ($_REQUEST["msgid"] == $mailsum) { $smarty->assign('next', ''); } else { $smarty->assign('next', $_REQUEST["msgid"] + 1); } if ($_REQUEST["msgid"] > 1) { $smarty->assign('prev', $_REQUEST["msgid"] - 1); } else { $smarty->assign('prev', ''); } $body = $message["body"]; $header = $message["header"]; $full = $message["full"]; $pop3->Close(); $params = array( 'input' => $full, 'crlf' => "\r\n", 'include_bodies' => TRUE, 'decode_headers' => TRUE, 'decode_bodies' => TRUE ); $output = Mail_mimeDecode::decode($params); parse_output($output, $parts, 0); if (isset($parts["html"])) { $bodies = $parts["html"]; } else { $bodies = $parts["text"]; } for ($i = 0; $i < count($bodies); $i++) { $bodies[$i] = strip_tags( $bodies[$i], "