This blob has been accessed 380 times via Git panel.
- <?php
- require_once("core.php");
- if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber")) {
- exit;
- }
- if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])) {
- $msgno = trim(strip_tags($_POST['msg']));
- $header = imap_headerinfo($mbox, $msgno);
- $header_subject = $header->subject;
- $header_fromaddress = $header->senderaddress;
- $header_date = $header->date;
- $header_toaddress = $header->toaddress;
- $header_ccaddress = $header->ccaddress;
- $reply_quote = trim(get_part($mbox, $msgno, "TEXT/PLAIN"));
- if ($_POST['rep'] != 2) {
- $reply_quote = wordwrap($reply_quote,75,"\r\n");
- }
- $reply_quote_lines = explode("\n",$reply_quote);
- if (count($reply_quote_lines) < 10) {
- $reply_quote_rows = "10";
- }
- else {
- $reply_quote_rows = count($reply_quote_lines) + 1;
- }
- $reply_from = "\"$usr_name\" <{$_SESSION['logged_uid']}>";
- $reply_to = $header->reply_toaddress;
- if ($reply_to != "") {
- $reply_to = $header->reply_toaddress;
- }
- else {
- $reply_to = $header->fromaddress;
- }
- if (($_POST['rep'] == 3) and strpos($header->toaddress,",")) {
- $reply_to = $reply_to . ", " . $header->toaddress;
- }
- if (($_POST['rep'] == 2) or ($_POST['rep'] == 4)) {
- $reply_cc ="";
- }
- else {
- $reply_cc = $header->ccaddress;
- }
- $reply_subject = $header->subject;
- if (($_POST['rep'] == 2) or ($_POST['rep'] == 4)) {
- $redirect_from = htmlentities($reply_to,ENT_QUOTES);
- $reply_to = "";
- if ($_POST['rep'] == 2) {
- $reply_subject = "Fwd: " . $reply_subject;
- }
- $reply_subject = str_replace("Fwd: Fwd: ","Fwd: ",$reply_subject);
- }
- else {
- $reply_subject = "Re: " . $reply_subject;
- $reply_subject = str_replace("Re: Re: ","Re: ",$reply_subject);
- }
- $reply_from = htmlentities($reply_from,ENT_QUOTES);
- $reply_to = htmlentities($reply_to,ENT_QUOTES);
- $reply_subject = htmlentities($reply_subject,ENT_QUOTES);
- $reply_cc = htmlentities($reply_cc,ENT_QUOTES);
- $header_fetch = imap_fetchheader($mbox,$msgno);
- $header_raw_lines = explode("\r\n",$header_fetch);
- foreach ($header_raw_lines as $header_raw_line) {
- $header_tos[] = str_replace("X-Original-To: ","",$header_raw_line);
- }
- /*
- if (strstr($header_raw_line,"Delivered-To:")) {
- $header_tos[] = str_replace("Delivered-To: ","",$header_raw_line);
- }
- */
- }
- $header_tos = array_values(array_unique($header_tos));
- $send_alias_query = mysql_query("select domains.id, aliases.id from aliases, domains where aliases.alias='{$_SESSION['logged_uid']}' and aliases.mode='1' and aliases.domain=domains.id and domains.mode='1' order by aliases.domain, aliases.id");
- echo "<title>Kartero - $folder - $reply_subject</title>";
- echo "<table border=\"0\" cellspacing=\"0\" callpadding=\"0\" width=\"800\"><tr><td valign=\"top\">";
- echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\">";
- echo "<form method=\"post\">";
- if (($_POST['rep'] == 1) or ($_POST['rep'] == 3)) {
- echo "<input type=\"hidden\" name=\"ack\" value=\"1\">";
- }
- echo "<tr><td width=\"50\"><b>From:</b></td><td rowspan=\"7\" width=\"5\"></td><td>";
- if ($_POST['rep'] == 4) {
- echo "<input type=\"hidden\" name=\"redirect\" value=\"1\">";
- echo "<input class=\"input\" type=\"text\" name=\"reply_from\" value=\"$redirect_from\" readonly>";
- }
- else {
- if (mysql_num_rows($send_alias_query) > 0) {
- echo "<select class=\"input\" name=\"reply_from\">";
- echo "<option>$reply_from</option>";
- while ($row = mysql_fetch_assoc($send_alias_query)) {
- echo "<option";
- if ($row[id] == $header_tos[0]) {
- echo " selected";
- }
- echo ">\"$usr_name\" <$row[id]>";
- echo "</option>";
- }
- echo "</select>";
- }
- else {
- echo "<input class=\"input\" type=\"text\" name=\"reply_from\" value=\"$reply_from\" readonly>";
- }
- }
- echo "</td></tr>";
- mysql_free_result($send_alias_query);
- echo "<tr><td><b>To:</b></td><td><input required class=\"input\" type=\"text\" name=\"reply_to\" value=\"$reply_to\" required></td></tr>";
- echo "<tr><td><b>Cc:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_cc\" value=\"$reply_cc\"></td></tr>";
- echo "<tr><td><b>Bcc:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_bcc\"></td></tr>";
- echo "<tr><td><b>Subject:</b></td><td><input required class=\"input\" type=\"text\" name=\"reply_subj\" value=\"$reply_subject\" required";
- if ($_POST['rep'] == 4) {
- echo " readonly";
- }
- echo "></td></tr>";
- echo "<tr><td></td><td><textarea required class=\"input\" name=\"reply_body\" rows=\"$reply_quote_rows\"";
- if ($_POST['rep'] == 4) {
- echo " readonly=\"yes\"";
- }
- echo ">";
- if (($_POST['rep'] == 2) or ($_POST['rep'] == 4)) {
- if ($_POST['rep'] == 2) {
- echo "---------------------------------------- Begin Forwarded Message ----------------------------------------\r\n";
- }
- echo $reply_quote;
- $do_fromaddress = extract_emails_from($header->fromaddress);
- $do_toaddress = extract_emails_from($header->toaddress);
- $filePath = $_SERVER['SERVER_NAME'] . $do_fromaddress[0] . $do_toaddress[0] . $header->subject;
- $filePath = "filedrop/" . sha1($filePath);
- if (file_exists("$filePath")) {
- $fileNames = glob("$filePath/*");
- if (count($fileNames) > 0) {
- foreach ($fileNames as $fileName) {
- echo "\r\n\r\n" . str_replace("$filePath/","",$fileName) . " (" . HumanReadableFilesize(filesize($fileName)) . ")\r\n";
- echo "http://" . $_SERVER['SERVER_NAME'] . "/$fileName";
- }
- }
- }
- }
- else {
- $reply_personal = $header->fromaddress;
- echo "On $header_date, $reply_personal wrote:\r\n";
- foreach ($reply_quote_lines as $reply_quote_line) {
- $reply_quote_line = "> $reply_quote_line";
- $reply_quote_line = preg_replace("/(^> >)/",">>",$reply_quote_line);
- echo $reply_quote_line;
- }
- }
- echo "</textarea></td></tr>";
- echo "<input type=\"hidden\" name=\"mbox_min\" value=\"$mbox_min\">";
- echo "<input type=\"hidden\" name=\"box\" value=\"$folder\">";
- echo "<input type=\"hidden\" name=\"msg\" value=\"$msgno\">";
- echo "<input type=\"hidden\" name=\"filedrop_box\" value=\"$filedrop_box\">";
- if (isset($_POST['imap_search_query']) and !empty($_POST['imap_search_query']) and isset($_POST['imap_search_where']) and !empty($_POST['imap_search_where'])) {
- echo "<input type=\"hidden\" name=\"imap_search_query\" value=\"{$_POST['imap_search_query']}\">";
- echo "<input type=\"hidden\" name=\"imap_search_where\" value=\"{$_POST['imap_search_where']}\">";
- }
- echo "<tr><td></td><td align=\"right\"><div class=\"label\"><input type=\"image\" src=\"images/mail-reply.png\" onclick=\"if (confirm('Send message?')) {return true;} else {return false;}\"></div><div class=\"label\">send</div></td></tr>";
- echo "</table>";
- echo "</form>";
- echo "</td></tr>";
- echo "</table>";
- }
- ?>
- <table border="0" cellspacing="0" cellpadding="0">
- <form name="filedrop_form" enctype="multipart/form-data" action="filedrop.php" method="post" target="filedrop" onsubmit="this.elements['filedrop_submit'].disabled = true;document.getElementById('filedrop_wait').innerHTML = '<img src=images/ajax-loader.gif border=0 width=16 height=16 hspace=5>';">
- <tr><td>
- <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
- <input type="hidden" name="filedrop_box" value="<?php echo $filedrop_box; ?>">
- <?php
- if ($_POST['rep'] == 4) {
- echo "<input type=\"file\" name=\"filedrop_obj\" disabled>";
- }
- else {
- echo "<input type=\"file\" name=\"filedrop_obj\">";
- }
- ?>
- <input type="submit" name="filedrop_submit" value="Upload">
- </td>
- <td>
- </td></tr>
- </form>
- </table>
- </div>
- <iframe id="filedrop" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>