This commit has been accessed 591 times via Git panel.
commit 554e8fb513483e27040e5647036978997b04f37e
tree a591f4b7d4cdafe6a9e5a93ac852dbb175b1bf50
parent 439c3878901839454ad2490052a0d276c99c2b9e
author Engels Antonio <engels@majcms.org> 1343662383 +0800
committer Engels Antonio <engels@majcms.org> 1343662383 +0800
Move settings to conf.php
diff --git a/conf.php b/conf.php
new file mode 100644
index 0000000..57708b8
--- /dev/null
+++ b/conf.php
@@ -0,0 +1,15 @@
+<?php
+
+/* modify the values of $db_host, $db_name, $db_user, $db_pass, $imap_host, $mail_root, and $mail_home for basic configuration */
+
+$db_host = "localhost";
+$db_name = "kartero";
+$db_user = "kartero";
+$db_pass = "fr1ng3!";
+
+$imap_host = "{127.0.0.1:143/imap/notls/norsh}";
+
+$mail_root = "/kartero/mail";
+$mail_home = "/kartero/home";
+
+?>
diff --git a/core.php b/core.php
index ad550b2..04994c5 100644
--- a/core.php
+++ b/core.php
@@ -38,6 +38,39 @@ else {
$mbox_max = $mbox_min + $mbox_ppg;
+function rmdirr($recurse_dirname) {
+
+ if (!file_exists($recurse_dirname)) {
+ return false;
+ }
+
+ if (is_file($recurse_dirname)) {
+ return unlink($recurse_dirname);
+ }
+
+ $recurse_dir = dir($recurse_dirname);
+
+ while (false !== $recurse_entry = $recurse_dir->read()) {
+
+ if ($recurse_entry == '.' || $recurse_entry == '..') {
+ continue;
+ }
+
+ rmdirr("$recurse_dirname/$recurse_entry");
+ }
+
+ $recurse_dir->close();
+ return rmdir($recurse_dirname);
+}
+
+function ack($ack_string) {
+ echo "<table width=\"100%\"><tr></td><div class=\"ack\">$ack_string</div></td></tr></table>";
+}
+
+function nak($nak_string) {
+ echo "<table width=\"100%\"><tr></td><div class=\"nak\">$nak_string</div></td></tr></table>";
+}
+
function time_elapsed_string($ptime) {
$etime = time() - $ptime;
diff --git a/css.php b/css.php
index c58c339..51dee72 100644
--- a/css.php
+++ b/css.php
@@ -125,3 +125,32 @@ a,a:link,a:visited,a:hover,a:active {
.hide {
display: none;
}
+
+@-webkit-keyframes strength {
+ 0% {
+ width: 0;
+ height: 11px;
+ }
+}
+
+@-moz-keyframes strength {
+ 0% {
+ width: 0;
+ height: 11px;
+ }
+}
+
+#mtr {
+ width: 0;
+ height: 11px;
+ padding: 0;
+ margin: 0;
+ -webkit-animation-name: strength;
+ -moz-animation-name: strength;
+ -webkit-animation-duration: 1s;
+ -moz-animation-duration: 1s;
+ -webkit-animation-iteration-count: 1;
+ -moz-animation-iteration-count: 1;
+ -webkit-animation-timing-function: ease;
+ -moz-animation-timing-function: ease;
+}
diff --git a/folders.php b/folders.php
index bbd52e5..25f32c3 100644
--- a/folders.php
+++ b/folders.php
@@ -87,7 +87,7 @@ if (!isset($_POST['get']) and !isset($_POST['rep'])) {
if ($folder == "Trash") {
- $trash_status = imap_status($mbox, "{$host}Trash", SA_MESSAGES+SA_UNSEEN);
+ $trash_status = imap_status($mbox, "{$imap_host}Trash", SA_MESSAGES+SA_UNSEEN);
if ($trash_status->messages > 0) {
@@ -123,7 +123,7 @@ if (is_array($quota) and ($quota[limit] > 0)) {
echo "<div style=\"height: 4px;\"></div>";
}
-$get_folders = kartero_sort_folders($host,imap_list($mbox,$host,"*"));
+$get_folders = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
if (is_array($get_folders)) {
@@ -135,7 +135,7 @@ if (is_array($get_folders)) {
$status_folder = "(" . $status->unseen . "/" . $status->messages . ")";
- $get_folder = imap_utf7_decode(trim(str_replace($host,"",$get_folder)));
+ $get_folder = imap_utf7_decode(trim(str_replace($imap_host,"",$get_folder)));
echo "<tr><form method=\"post\"><td align=\"center\"><input type=\"hidden\" name=\"box\" value=\"$get_folder\">";
diff --git a/inbox.php b/inbox.php
index 9355b77..c6c2658 100644
--- a/inbox.php
+++ b/inbox.php
@@ -11,7 +11,7 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$msgno = trim(strip_tags($_POST['msg']));
if ($_POST['del'] == "1") {
- imap_createmailbox($mbox,"{$host}Trash");
+ imap_createmailbox($mbox,"{$imap_host}Trash");
imap_mail_move($mbox,$msgno,"Trash",CP_UID);
imap_expunge($mbox);
}
diff --git a/index.php b/index.php
index cecacc5..f745490 100644
--- a/index.php
+++ b/index.php
@@ -1,51 +1,14 @@
<?php
-/* modify the values of $db_host, $db_name, $db_user, $db_pass, and $mail_root for basic configuration */
-
-$db_host = "localhost";
-$db_name = "kartero";
-$db_user = "kartero";
-$db_pass = "fr1ng3!";
-
-$mail_root = "/kartero/mail";
-$mail_home = "/kartero/home";
-
/* feel free to hack the succeeding code to suit your needs (basic php and mysql skills required) */
-require_once("core.php");
-
-function rmdirr($recurse_dirname) {
-
- if (!file_exists($recurse_dirname)) {
- return false;
- }
-
- if (is_file($recurse_dirname)) {
- return unlink($recurse_dirname);
- }
+ob_start();
- $recurse_dir = dir($recurse_dirname);
+require_once("conf.php");
- while (false !== $recurse_entry = $recurse_dir->read()) {
-
- if ($recurse_entry == '.' || $recurse_entry == '..') {
- continue;
- }
-
- rmdirr("$recurse_dirname/$recurse_entry");
- }
-
- $recurse_dir->close();
- return rmdir($recurse_dirname);
-}
-
-function ack($ack_string) {
- echo "<table width=\"100%\"><tr></td><div class=\"ack\">$ack_string</div></td></tr></table>";
-}
+ob_end_clean();
-function nak($nak_string) {
- echo "<table width=\"100%\"><tr></td><div class=\"nak\">$nak_string</div></td></tr></table>";
-}
+require_once("core.php");
if (file_exists("css.php")) {
@@ -957,7 +920,7 @@ if (isset($_SESSION['logged_uid'])) {
if ($_SESSION['logged_lvl'] == "subscriber") {
- $host = "{127.0.0.1:143/imap/notls/norsh}";
+ //$imap_host = "{127.0.0.1:143/imap/notls/norsh}";
if (!isset($_POST['box']) or empty($_POST['box'])) {
$folder = "INBOX";
@@ -966,7 +929,7 @@ if (isset($_SESSION['logged_uid'])) {
$folder = trim(strip_tags($_POST['box']));
}
- $mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ $mbox = @imap_open("{$imap_host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
if (isset($_POST['move_msg']) and !empty($_POST['move_msg']) and isset($_POST['move_box']) and !empty($_POST['move_box'])) {
@@ -982,7 +945,7 @@ if (isset($_SESSION['logged_uid'])) {
if (isset($_POST['new_box']) and !empty($_POST['new_box'])) {
$new_box = imap_utf7_encode(ucwords(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['new_box'])))));
- imap_createmailbox($mbox,"{$host}$new_box");
+ imap_createmailbox($mbox,"{$imap_host}$new_box");
}
if (isset($_POST['del_box']) and !empty($_POST['del_box'])) {
@@ -991,7 +954,7 @@ if (isset($_SESSION['logged_uid'])) {
$del_siv = $del_box;
if (($del_box != "INBOX") and ($del_box != "Sent") and ($del_box != "Trash")) {
- imap_deletemailbox($mbox,"{$host}$del_box");
+ imap_deletemailbox($mbox,"{$imap_host}$del_box");
}
}
@@ -1096,7 +1059,7 @@ if (isset($_SESSION['logged_uid'])) {
$reply_headers = $reply_headers . "Return-Receipt-To: {$reply_fenv[0]}\n";
}
- imap_createmailbox($mbox,"{$host}Sent");
+ imap_createmailbox($mbox,"{$imap_host}Sent");
$reply_date = date ("d-M-Y H:i:s O");
@@ -1105,7 +1068,7 @@ if (isset($_SESSION['logged_uid'])) {
$reply_headers = preg_replace('#(?<!\r)\n#si', "\n", $reply_headers);
$reply_headers = str_replace("\n\n","\n",$reply_headers);
- imap_append($mbox,"{$host}Sent","To: $reply_to\nSubject: $reply_subj\nDate: $reply_date\n$reply_headers\n\n$reply_body\n");
+ imap_append($mbox,"{$imap_host}Sent","To: $reply_to\nSubject: $reply_subj\nDate: $reply_date\n$reply_headers\n\n$reply_body\n");
mail($reply_to, $reply_subj, $reply_body, $reply_headers, "-f {$reply_fenv[0]}");
@@ -1151,8 +1114,8 @@ if (isset($_SESSION['logged_uid'])) {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
- echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').className ='';document.getElementById('add').className='hide'\"></td>";
- echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').className ='hide';document.getElementById('add').className=''\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').style.display='inline';document.getElementById('add').style.display='none'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').style.display='none';document.getElementById('add').style.display='inline'\"></td>";
echo "</tr>";
echo "<tr><td class=\"label\">list</td><td class=\"label\">add</td></tr>";
@@ -1168,7 +1131,7 @@ echo "</tr>";
echo "<div id=\"add\">";
}
else {
- echo "<div id=\"add\" class=\"hide\">";
+ echo "<div id=\"add\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
@@ -1190,7 +1153,7 @@ echo "</tr>";
echo "<div id=\"list\">";
}
else {
- echo "<div id=\"list\" class=\"hide\">";
+ echo "<div id=\"list\" style=\"display: none;\">";
}
if (mysql_num_rows($addr_query) > 0) {
@@ -1226,8 +1189,6 @@ echo "</tr>";
elseif (isset($_POST['set']) and !empty($_POST['set'])) {
echo "<script type=\"text/javascript\" src=\"core.js\" async></script>";
-
- echo "<style> @-webkit-keyframes strength { 0% { width: 0; height: 11px; } } @-moz-keyframes strength { 0% { width: 0; height: 11px; } } #mtr { width: 0; height: 11px; padding: 0; margin: 0; -webkit-animation-name: strength; -moz-animation-name: strength; -webkit-animation-duration: 1s; -moz-animation-duration: 1s; -webkit-animation-iteration-count: 1; -moz-animation-iteration-count: 1; -webkit-animation-timing-function: ease; -moz-animation-timing-function: ease; } </style>";
echo "<title>Kartero - Settings</title>";
@@ -1237,9 +1198,9 @@ echo "</tr>";
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
- echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='';document.getElementById('folders').className='hide';document.getElementById('filters').className='hide'\"></td>";
- echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='';document.getElementById('filters').className='hide'\"></td>";
- echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='hide';document.getElementById('filters').className=''\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').style.display='inline';document.getElementById('folders').style.display='none';document.getElementById('filters').style.display='none'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').style.display='none';document.getElementById('folders').style.display='inline';document.getElementById('filters').style.display='none'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').style.display='none';document.getElementById('folders').style.display='none';document.getElementById('filters').style.display='inline'\"></td>";
echo "</tr>";
echo "<tr><td class=\"label\">account</td><td class=\"label\">folders</td><td class=\"label\">filters</td></tr>";
@@ -1253,19 +1214,21 @@ echo "</tr>";
echo "<div id=\"account\">";
}
else {
- echo "<div id=\"account\" class=\"hide\">";
+ echo "<div id=\"account\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
+
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
echo "<form method=\"post\">";
echo "<input type=\"hidden\" name=\"set\" value=\"account\">";
echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"text\" name=\"usr_name\" value=\"$usr_name\" autocomplete=\"off\" maxlength=\"128\" required autofocus></td><td>name</td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td><nobr>current password</nobr></td></tr>";
-
- echo "<tr bgcolor=\"#ffffff\"><td><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"100%\"><tr bgcolor=\"#ffffff\"><td height=\"17\"><div id=\"mtr\" style=\"display: none;\"></div></td></tr></table></td><td id=\"ctd\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td><nobr>current password</nobr></td></tr>";
+ echo "</table>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"eval(this.value)\" id=\"usr_pw2\"></td><td id=\"pmc1\"><nobr>new password";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"100%\"><tr bgcolor=\"#ffffff\"><td height=\"17\"><span id=\"mtr\" style=\"display: none;\"></span></td></tr></table></td><td id=\"ctd\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"eval(this.value)\" id=\"usr_pw2\"></td><td id=\"pmc1\"><nobr>new password";
if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw2']) and (strlen($_POST['usr_pw2']) < 8)) {
echo " <font color=\"red\">too short</font>";
@@ -1273,7 +1236,7 @@ echo "</tr>";
echo "</nobr></td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"same(this.value)\" id=\"usr_pw3\"></td><td id=\"pmc2\"><nobr>new password";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"same(this.value)\" id=\"usr_pw3\"></td><td id=\"pmc2\"><nobr>new password";
if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw3']) and (strlen($_POST['usr_pw3']) < 8)) {
echo " <font color=\"red\">too short</font>";
@@ -1281,7 +1244,7 @@ echo "</tr>";
echo "</nobr></td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
echo "</form></table>";
echo "</div>";
@@ -1289,7 +1252,7 @@ echo "</tr>";
echo "<div id=\"folders\">";
}
else {
- echo "<div id=\"folders\" class=\"hide\">";
+ echo "<div id=\"folders\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
@@ -1300,21 +1263,30 @@ echo "</tr>";
echo "<td width=\"197\"><input class=\"button\" type=\"submit\" value=\"create folder\"></td><td></td></tr>";
echo "</form>";
- $usr_box = imap_list($mbox,$host,"*");
- $usr_box = array_diff($usr_box,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+ $usr_box = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
if (count($usr_box) > 0) {
- sort($usr_box);
-
echo "<form method=\"post\">";
echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"del_box\">";
foreach ($usr_box as $del_box) {
-
- $del_box = imap_utf7_decode(str_replace($host,"",$del_box));
+
+ $del_box = imap_utf7_decode(str_replace($imap_host,"",$del_box));
+ if ($del_box == "INBOX") {
+ continue;
+ }
+
+ if ($del_box == "Sent") {
+ continue;
+ }
+
+ if ($del_box == "Trash") {
+ continue;
+ }
+
echo "<option value=\"$del_box\">$del_box</option>";
}
@@ -1430,7 +1402,7 @@ echo "</tr>";
echo "<div id=\"filters\">";
}
else {
- echo "<div id=\"filters\" class=\"hide\">";
+ echo "<div id=\"filters\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
@@ -1449,7 +1421,7 @@ echo "</tr>";
foreach ($usr_box as $sieveF) {
- $sieveF = str_replace($host,"",$sieveF);
+ $sieveF = str_replace($imap_host,"",$sieveF);
echo "<option value=\"$sieveF\">then move to $sieveF</option>";
}
@@ -1568,7 +1540,7 @@ echo "</tr>";
}
else {
// imap_ping() should be doing this, but it's not working:
- $mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ $mbox = @imap_open("{$imap_host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
include("inbox.php");
@@ -1584,7 +1556,7 @@ echo "</tr>";
echo "<td valign=\"top\" width=\"100\">";
// imap_ping() should be doing this, but it's not working:
- $mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ $mbox = @imap_open("{$imap_host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
include("folders.php");
echo "</td>";
diff --git a/rcpt.php b/rcpt.php
index 423f5e0..f0dfae7 100644
--- a/rcpt.php
+++ b/rcpt.php
@@ -1,12 +1,18 @@
<?php
+ob_start();
+
+require_once("conf.php");
+
+ob_end_clean();
+
session_start();
if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber")) {
exit;
}
-if (!isset($_POST['rcpt_mail']) or empty($_POST['rcpt_mail']) or !isset($_POST['rcpt_subj']) or empty($_POST['rcpt_subj']) or !isset($_POST['rcpt_date']) or empty($_POST['rcpt_date']) or !isset($_POST['rcpt_omid']) or empty($_POST['rcpt_omid'])) {
+if (!isset($_POST['rcpt_mail']) or empty($_POST['rcpt_mail']) or !isset($_POST['rcpt_subj']) or empty($_POST['rcpt_subj']) or !isset($_POST['rcpt_date']) or empty($_POST['rcpt_date']) or !isset($_POST['rcpt_omid']) or empty($_POST['rcpt_omid']) or !isset($_POST['rcpt_omno']) or empty($_POST['rcpt_omno'])) {
exit;
}
@@ -15,13 +21,22 @@ $rcpt_mail = strtolower(trim(strip_tags($_POST['rcpt_mail'])));
$rcpt_subj = trim(strip_tags($_POST['rcpt_subj']));
$rcpt_date = trim(strip_tags($_POST['rcpt_date']));
$rcpt_part = md5(microtime(true));
-$rcpt_omid = trim($_POST['rcpt_omid']);
-$rcpt_head = "From: $rcpt_user\nX-Mailer: Kartero/1.0 (PHP/" . phpversion() . ")\nContent-Type: multipart/report;report-type=disposition-notification;boundary=\"$rcpt_part\"";
+$rcpt_omid = trim($_POST['rcpt_omid']);
+$rcpt_omno = trim($_POST['rcpt_omno']);
+$rcpt_head = "From: $rcpt_user\nX-Mailer: Kartero/1.0 (PHP/" . phpversion() . ")\nMIME-Version: 1.0\nContent-Type: multipart/report;report-type=disposition-notification;boundary=\"$rcpt_part\"";
$rcpt_body = "--$rcpt_part\nContent-Type: text/plain; charset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n\nYour message\n\nTo: $rcpt_user\nSubject: $rcpt_subj\nDate: $rcpt_date\n\nWas displayed on " . date("D, j M Y H:i:s O (T)") . "\n\n--$rcpt_part\nContent-Type: message/disposition-notification\nContent-Transfer-Encoding: quoted-printable\n\nReporting-UA : " . $_SERVER['SERVER_NAME'] . " ; Kartero/1.0 (PHP/" . phpversion() . ")\nOriginal-Recipient : $rcpt_mail\nFinal-Recipient : rfc822;\nOriginal-Message-ID : $rcpt_omid\nDisposition: manual-action/MDN-sent-manually; displayed\n--$rcpt_part--";
$rcpt_subj = "Read: $rcpt_subj";
mail($rcpt_mail, $rcpt_subj, $rcpt_body, $rcpt_head, "-f $rcpt_user");
+$mbox = @imap_open($imap_host, $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+
+imap_createmailbox($mbox,"{$imap_host}Sent");
+
+imap_append($mbox,"{$imap_host}Sent","To: $rcpt_mail\nSubject: $rcpt_subj\nDate: $rcpt_date\n$rcpt_head\n\n$rcpt_body\n");
+
+imap_setflag_full($mbox, $rcpt_omno, '\\Answered',ST_UID);
+
//echo "<script>alert('Read receipt sent to $rcpt_mail');</script>";
?>
diff --git a/read.php b/read.php
index 955855d..3dcc037 100644
--- a/read.php
+++ b/read.php
@@ -365,14 +365,9 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
echo "<div class=\"spacer\"></div>";
- $usr_mbox = imap_list($mbox,$host,"*");
- $usr_mbox = array_diff($usr_mbox,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
-
- if ((count($usr_mbox) > 0) and ($folder != "Sent") and ($folder != "Trash")) {
+ $usr_mbox = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
- sort($usr_mbox);
-
- array_unshift($usr_mbox,"{$host}INBOX");
+ if ((count($usr_mbox) > 0) and ($folder != "Sent") and ($folder != "Trash")) {
echo "<div class=\"message\">";
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
@@ -391,12 +386,20 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
foreach ($usr_mbox as $move_box) {
- $move_box = str_replace($host,"",$move_box);
+ $move_box = str_replace($imap_host,"",$move_box);
if ($folder == $move_box) {
continue;
}
+ if ($move_box == "Sent") {
+ continue;
+ }
+
+ if ($move_box == "Trash") {
+ continue;
+ }
+
echo "<option value=\"$move_box\">$move_box</option>";
}
@@ -408,8 +411,6 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
echo "<div class=\"spacer\"></div>";
}
-
-
echo "<div class=\"message\">";
$filePath = "attach/o/$fileUsr/$fileDir";
@@ -556,7 +557,9 @@ if (isset($header_rr) and (strlen($header_rr) > 0)) {
$rcpt_mail = extract_emails_from($header_rr);
$rcpt_mail = $rcpt_mail[0];
- if (strlen($rcpt_mail) > 0) {
+ $header_ov = imap_fetch_overview($mbox,$msgno,FT_UID);
+
+ if ((strlen($rcpt_mail) > 0) and ($folder != "Sent") and ($folder != "Trash") and ($folder != "Spam") and ($folder != "Junk") and ($header_ov[0]->answered == "0")) {
$header_message_id = header_mime2text($header->message_id);
@@ -565,7 +568,8 @@ if (isset($header_rr) and (strlen($header_rr) > 0)) {
echo "<input type=\"hidden\" name=\"rcpt_subj\" value=\"$header_subject\">";
echo "<input type=\"hidden\" name=\"rcpt_date\" value=\"$header_date\">";
echo "<input type=\"hidden\" name=\"rcpt_omid\" value=\"$header_message_id\">";
-
+ echo "<input type=\"hidden\" name=\"rcpt_omno\" value=\"$msgno\">";
+
echo "<iframe id=\"rcpt\" name=\"rcpt\" src=\"rcpt.php\" frameborder=\"0\" scrolling=\"0\" width=\"0\" height=\"0\" style=\"display: none;\"></iframe>";
echo "</form>";
diff --git a/search.php b/search.php
index 57a8e17..3fcecdc 100644
--- a/search.php
+++ b/search.php
@@ -6,7 +6,7 @@ if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset
exit;
}
-$search_folders = kartero_sort_folders($host,imap_list($mbox,$host,"*"));
+$search_folders = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
if (is_array($search_folders)) {
@@ -19,7 +19,7 @@ if (is_array($search_folders)) {
foreach ($search_folders as $search_folder) {
- $search_folder = str_replace($host,"",$search_folder);
+ $search_folder = str_replace($imap_host,"",$search_folder);
if ($folder == $search_folder) {
echo "<option selected>$search_folder</option>";
tree a591f4b7d4cdafe6a9e5a93ac852dbb175b1bf50
parent 439c3878901839454ad2490052a0d276c99c2b9e
author Engels Antonio <engels@majcms.org> 1343662383 +0800
committer Engels Antonio <engels@majcms.org> 1343662383 +0800
Move settings to conf.php
diff --git a/conf.php b/conf.php
new file mode 100644
index 0000000..57708b8
--- /dev/null
+++ b/conf.php
@@ -0,0 +1,15 @@
+<?php
+
+/* modify the values of $db_host, $db_name, $db_user, $db_pass, $imap_host, $mail_root, and $mail_home for basic configuration */
+
+$db_host = "localhost";
+$db_name = "kartero";
+$db_user = "kartero";
+$db_pass = "fr1ng3!";
+
+$imap_host = "{127.0.0.1:143/imap/notls/norsh}";
+
+$mail_root = "/kartero/mail";
+$mail_home = "/kartero/home";
+
+?>
diff --git a/core.php b/core.php
index ad550b2..04994c5 100644
--- a/core.php
+++ b/core.php
@@ -38,6 +38,39 @@ else {
$mbox_max = $mbox_min + $mbox_ppg;
+function rmdirr($recurse_dirname) {
+
+ if (!file_exists($recurse_dirname)) {
+ return false;
+ }
+
+ if (is_file($recurse_dirname)) {
+ return unlink($recurse_dirname);
+ }
+
+ $recurse_dir = dir($recurse_dirname);
+
+ while (false !== $recurse_entry = $recurse_dir->read()) {
+
+ if ($recurse_entry == '.' || $recurse_entry == '..') {
+ continue;
+ }
+
+ rmdirr("$recurse_dirname/$recurse_entry");
+ }
+
+ $recurse_dir->close();
+ return rmdir($recurse_dirname);
+}
+
+function ack($ack_string) {
+ echo "<table width=\"100%\"><tr></td><div class=\"ack\">$ack_string</div></td></tr></table>";
+}
+
+function nak($nak_string) {
+ echo "<table width=\"100%\"><tr></td><div class=\"nak\">$nak_string</div></td></tr></table>";
+}
+
function time_elapsed_string($ptime) {
$etime = time() - $ptime;
diff --git a/css.php b/css.php
index c58c339..51dee72 100644
--- a/css.php
+++ b/css.php
@@ -125,3 +125,32 @@ a,a:link,a:visited,a:hover,a:active {
.hide {
display: none;
}
+
+@-webkit-keyframes strength {
+ 0% {
+ width: 0;
+ height: 11px;
+ }
+}
+
+@-moz-keyframes strength {
+ 0% {
+ width: 0;
+ height: 11px;
+ }
+}
+
+#mtr {
+ width: 0;
+ height: 11px;
+ padding: 0;
+ margin: 0;
+ -webkit-animation-name: strength;
+ -moz-animation-name: strength;
+ -webkit-animation-duration: 1s;
+ -moz-animation-duration: 1s;
+ -webkit-animation-iteration-count: 1;
+ -moz-animation-iteration-count: 1;
+ -webkit-animation-timing-function: ease;
+ -moz-animation-timing-function: ease;
+}
diff --git a/folders.php b/folders.php
index bbd52e5..25f32c3 100644
--- a/folders.php
+++ b/folders.php
@@ -87,7 +87,7 @@ if (!isset($_POST['get']) and !isset($_POST['rep'])) {
if ($folder == "Trash") {
- $trash_status = imap_status($mbox, "{$host}Trash", SA_MESSAGES+SA_UNSEEN);
+ $trash_status = imap_status($mbox, "{$imap_host}Trash", SA_MESSAGES+SA_UNSEEN);
if ($trash_status->messages > 0) {
@@ -123,7 +123,7 @@ if (is_array($quota) and ($quota[limit] > 0)) {
echo "<div style=\"height: 4px;\"></div>";
}
-$get_folders = kartero_sort_folders($host,imap_list($mbox,$host,"*"));
+$get_folders = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
if (is_array($get_folders)) {
@@ -135,7 +135,7 @@ if (is_array($get_folders)) {
$status_folder = "(" . $status->unseen . "/" . $status->messages . ")";
- $get_folder = imap_utf7_decode(trim(str_replace($host,"",$get_folder)));
+ $get_folder = imap_utf7_decode(trim(str_replace($imap_host,"",$get_folder)));
echo "<tr><form method=\"post\"><td align=\"center\"><input type=\"hidden\" name=\"box\" value=\"$get_folder\">";
diff --git a/inbox.php b/inbox.php
index 9355b77..c6c2658 100644
--- a/inbox.php
+++ b/inbox.php
@@ -11,7 +11,7 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$msgno = trim(strip_tags($_POST['msg']));
if ($_POST['del'] == "1") {
- imap_createmailbox($mbox,"{$host}Trash");
+ imap_createmailbox($mbox,"{$imap_host}Trash");
imap_mail_move($mbox,$msgno,"Trash",CP_UID);
imap_expunge($mbox);
}
diff --git a/index.php b/index.php
index cecacc5..f745490 100644
--- a/index.php
+++ b/index.php
@@ -1,51 +1,14 @@
<?php
-/* modify the values of $db_host, $db_name, $db_user, $db_pass, and $mail_root for basic configuration */
-
-$db_host = "localhost";
-$db_name = "kartero";
-$db_user = "kartero";
-$db_pass = "fr1ng3!";
-
-$mail_root = "/kartero/mail";
-$mail_home = "/kartero/home";
-
/* feel free to hack the succeeding code to suit your needs (basic php and mysql skills required) */
-require_once("core.php");
-
-function rmdirr($recurse_dirname) {
-
- if (!file_exists($recurse_dirname)) {
- return false;
- }
-
- if (is_file($recurse_dirname)) {
- return unlink($recurse_dirname);
- }
+ob_start();
- $recurse_dir = dir($recurse_dirname);
+require_once("conf.php");
- while (false !== $recurse_entry = $recurse_dir->read()) {
-
- if ($recurse_entry == '.' || $recurse_entry == '..') {
- continue;
- }
-
- rmdirr("$recurse_dirname/$recurse_entry");
- }
-
- $recurse_dir->close();
- return rmdir($recurse_dirname);
-}
-
-function ack($ack_string) {
- echo "<table width=\"100%\"><tr></td><div class=\"ack\">$ack_string</div></td></tr></table>";
-}
+ob_end_clean();
-function nak($nak_string) {
- echo "<table width=\"100%\"><tr></td><div class=\"nak\">$nak_string</div></td></tr></table>";
-}
+require_once("core.php");
if (file_exists("css.php")) {
@@ -957,7 +920,7 @@ if (isset($_SESSION['logged_uid'])) {
if ($_SESSION['logged_lvl'] == "subscriber") {
- $host = "{127.0.0.1:143/imap/notls/norsh}";
+ //$imap_host = "{127.0.0.1:143/imap/notls/norsh}";
if (!isset($_POST['box']) or empty($_POST['box'])) {
$folder = "INBOX";
@@ -966,7 +929,7 @@ if (isset($_SESSION['logged_uid'])) {
$folder = trim(strip_tags($_POST['box']));
}
- $mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ $mbox = @imap_open("{$imap_host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
if (isset($_POST['move_msg']) and !empty($_POST['move_msg']) and isset($_POST['move_box']) and !empty($_POST['move_box'])) {
@@ -982,7 +945,7 @@ if (isset($_SESSION['logged_uid'])) {
if (isset($_POST['new_box']) and !empty($_POST['new_box'])) {
$new_box = imap_utf7_encode(ucwords(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['new_box'])))));
- imap_createmailbox($mbox,"{$host}$new_box");
+ imap_createmailbox($mbox,"{$imap_host}$new_box");
}
if (isset($_POST['del_box']) and !empty($_POST['del_box'])) {
@@ -991,7 +954,7 @@ if (isset($_SESSION['logged_uid'])) {
$del_siv = $del_box;
if (($del_box != "INBOX") and ($del_box != "Sent") and ($del_box != "Trash")) {
- imap_deletemailbox($mbox,"{$host}$del_box");
+ imap_deletemailbox($mbox,"{$imap_host}$del_box");
}
}
@@ -1096,7 +1059,7 @@ if (isset($_SESSION['logged_uid'])) {
$reply_headers = $reply_headers . "Return-Receipt-To: {$reply_fenv[0]}\n";
}
- imap_createmailbox($mbox,"{$host}Sent");
+ imap_createmailbox($mbox,"{$imap_host}Sent");
$reply_date = date ("d-M-Y H:i:s O");
@@ -1105,7 +1068,7 @@ if (isset($_SESSION['logged_uid'])) {
$reply_headers = preg_replace('#(?<!\r)\n#si', "\n", $reply_headers);
$reply_headers = str_replace("\n\n","\n",$reply_headers);
- imap_append($mbox,"{$host}Sent","To: $reply_to\nSubject: $reply_subj\nDate: $reply_date\n$reply_headers\n\n$reply_body\n");
+ imap_append($mbox,"{$imap_host}Sent","To: $reply_to\nSubject: $reply_subj\nDate: $reply_date\n$reply_headers\n\n$reply_body\n");
mail($reply_to, $reply_subj, $reply_body, $reply_headers, "-f {$reply_fenv[0]}");
@@ -1151,8 +1114,8 @@ if (isset($_SESSION['logged_uid'])) {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
- echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').className ='';document.getElementById('add').className='hide'\"></td>";
- echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').className ='hide';document.getElementById('add').className=''\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').style.display='inline';document.getElementById('add').style.display='none'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-contacts.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('list').style.display='none';document.getElementById('add').style.display='inline'\"></td>";
echo "</tr>";
echo "<tr><td class=\"label\">list</td><td class=\"label\">add</td></tr>";
@@ -1168,7 +1131,7 @@ echo "</tr>";
echo "<div id=\"add\">";
}
else {
- echo "<div id=\"add\" class=\"hide\">";
+ echo "<div id=\"add\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
@@ -1190,7 +1153,7 @@ echo "</tr>";
echo "<div id=\"list\">";
}
else {
- echo "<div id=\"list\" class=\"hide\">";
+ echo "<div id=\"list\" style=\"display: none;\">";
}
if (mysql_num_rows($addr_query) > 0) {
@@ -1226,8 +1189,6 @@ echo "</tr>";
elseif (isset($_POST['set']) and !empty($_POST['set'])) {
echo "<script type=\"text/javascript\" src=\"core.js\" async></script>";
-
- echo "<style> @-webkit-keyframes strength { 0% { width: 0; height: 11px; } } @-moz-keyframes strength { 0% { width: 0; height: 11px; } } #mtr { width: 0; height: 11px; padding: 0; margin: 0; -webkit-animation-name: strength; -moz-animation-name: strength; -webkit-animation-duration: 1s; -moz-animation-duration: 1s; -webkit-animation-iteration-count: 1; -moz-animation-iteration-count: 1; -webkit-animation-timing-function: ease; -moz-animation-timing-function: ease; } </style>";
echo "<title>Kartero - Settings</title>";
@@ -1237,9 +1198,9 @@ echo "</tr>";
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
- echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='';document.getElementById('folders').className='hide';document.getElementById('filters').className='hide'\"></td>";
- echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='';document.getElementById('filters').className='hide'\"></td>";
- echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='hide';document.getElementById('filters').className=''\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').style.display='inline';document.getElementById('folders').style.display='none';document.getElementById('filters').style.display='none'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').style.display='none';document.getElementById('folders').style.display='inline';document.getElementById('filters').style.display='none'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').style.display='none';document.getElementById('folders').style.display='none';document.getElementById('filters').style.display='inline'\"></td>";
echo "</tr>";
echo "<tr><td class=\"label\">account</td><td class=\"label\">folders</td><td class=\"label\">filters</td></tr>";
@@ -1253,19 +1214,21 @@ echo "</tr>";
echo "<div id=\"account\">";
}
else {
- echo "<div id=\"account\" class=\"hide\">";
+ echo "<div id=\"account\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
+
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
echo "<form method=\"post\">";
echo "<input type=\"hidden\" name=\"set\" value=\"account\">";
echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"text\" name=\"usr_name\" value=\"$usr_name\" autocomplete=\"off\" maxlength=\"128\" required autofocus></td><td>name</td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td><nobr>current password</nobr></td></tr>";
-
- echo "<tr bgcolor=\"#ffffff\"><td><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"100%\"><tr bgcolor=\"#ffffff\"><td height=\"17\"><div id=\"mtr\" style=\"display: none;\"></div></td></tr></table></td><td id=\"ctd\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td><nobr>current password</nobr></td></tr>";
+ echo "</table>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"eval(this.value)\" id=\"usr_pw2\"></td><td id=\"pmc1\"><nobr>new password";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"100%\"><tr bgcolor=\"#ffffff\"><td height=\"17\"><span id=\"mtr\" style=\"display: none;\"></span></td></tr></table></td><td id=\"ctd\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"eval(this.value)\" id=\"usr_pw2\"></td><td id=\"pmc1\"><nobr>new password";
if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw2']) and (strlen($_POST['usr_pw2']) < 8)) {
echo " <font color=\"red\">too short</font>";
@@ -1273,7 +1236,7 @@ echo "</tr>";
echo "</nobr></td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"same(this.value)\" id=\"usr_pw3\"></td><td id=\"pmc2\"><nobr>new password";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\" onkeyup=\"same(this.value)\" id=\"usr_pw3\"></td><td id=\"pmc2\"><nobr>new password";
if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw3']) and (strlen($_POST['usr_pw3']) < 8)) {
echo " <font color=\"red\">too short</font>";
@@ -1281,7 +1244,7 @@ echo "</tr>";
echo "</nobr></td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
echo "</form></table>";
echo "</div>";
@@ -1289,7 +1252,7 @@ echo "</tr>";
echo "<div id=\"folders\">";
}
else {
- echo "<div id=\"folders\" class=\"hide\">";
+ echo "<div id=\"folders\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
@@ -1300,21 +1263,30 @@ echo "</tr>";
echo "<td width=\"197\"><input class=\"button\" type=\"submit\" value=\"create folder\"></td><td></td></tr>";
echo "</form>";
- $usr_box = imap_list($mbox,$host,"*");
- $usr_box = array_diff($usr_box,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+ $usr_box = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
if (count($usr_box) > 0) {
- sort($usr_box);
-
echo "<form method=\"post\">";
echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"del_box\">";
foreach ($usr_box as $del_box) {
-
- $del_box = imap_utf7_decode(str_replace($host,"",$del_box));
+
+ $del_box = imap_utf7_decode(str_replace($imap_host,"",$del_box));
+ if ($del_box == "INBOX") {
+ continue;
+ }
+
+ if ($del_box == "Sent") {
+ continue;
+ }
+
+ if ($del_box == "Trash") {
+ continue;
+ }
+
echo "<option value=\"$del_box\">$del_box</option>";
}
@@ -1430,7 +1402,7 @@ echo "</tr>";
echo "<div id=\"filters\">";
}
else {
- echo "<div id=\"filters\" class=\"hide\">";
+ echo "<div id=\"filters\" style=\"display: none;\">";
}
echo "<div class=\"spacer\"></div>";
@@ -1449,7 +1421,7 @@ echo "</tr>";
foreach ($usr_box as $sieveF) {
- $sieveF = str_replace($host,"",$sieveF);
+ $sieveF = str_replace($imap_host,"",$sieveF);
echo "<option value=\"$sieveF\">then move to $sieveF</option>";
}
@@ -1568,7 +1540,7 @@ echo "</tr>";
}
else {
// imap_ping() should be doing this, but it's not working:
- $mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ $mbox = @imap_open("{$imap_host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
include("inbox.php");
@@ -1584,7 +1556,7 @@ echo "</tr>";
echo "<td valign=\"top\" width=\"100\">";
// imap_ping() should be doing this, but it's not working:
- $mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ $mbox = @imap_open("{$imap_host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
include("folders.php");
echo "</td>";
diff --git a/rcpt.php b/rcpt.php
index 423f5e0..f0dfae7 100644
--- a/rcpt.php
+++ b/rcpt.php
@@ -1,12 +1,18 @@
<?php
+ob_start();
+
+require_once("conf.php");
+
+ob_end_clean();
+
session_start();
if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber")) {
exit;
}
-if (!isset($_POST['rcpt_mail']) or empty($_POST['rcpt_mail']) or !isset($_POST['rcpt_subj']) or empty($_POST['rcpt_subj']) or !isset($_POST['rcpt_date']) or empty($_POST['rcpt_date']) or !isset($_POST['rcpt_omid']) or empty($_POST['rcpt_omid'])) {
+if (!isset($_POST['rcpt_mail']) or empty($_POST['rcpt_mail']) or !isset($_POST['rcpt_subj']) or empty($_POST['rcpt_subj']) or !isset($_POST['rcpt_date']) or empty($_POST['rcpt_date']) or !isset($_POST['rcpt_omid']) or empty($_POST['rcpt_omid']) or !isset($_POST['rcpt_omno']) or empty($_POST['rcpt_omno'])) {
exit;
}
@@ -15,13 +21,22 @@ $rcpt_mail = strtolower(trim(strip_tags($_POST['rcpt_mail'])));
$rcpt_subj = trim(strip_tags($_POST['rcpt_subj']));
$rcpt_date = trim(strip_tags($_POST['rcpt_date']));
$rcpt_part = md5(microtime(true));
-$rcpt_omid = trim($_POST['rcpt_omid']);
-$rcpt_head = "From: $rcpt_user\nX-Mailer: Kartero/1.0 (PHP/" . phpversion() . ")\nContent-Type: multipart/report;report-type=disposition-notification;boundary=\"$rcpt_part\"";
+$rcpt_omid = trim($_POST['rcpt_omid']);
+$rcpt_omno = trim($_POST['rcpt_omno']);
+$rcpt_head = "From: $rcpt_user\nX-Mailer: Kartero/1.0 (PHP/" . phpversion() . ")\nMIME-Version: 1.0\nContent-Type: multipart/report;report-type=disposition-notification;boundary=\"$rcpt_part\"";
$rcpt_body = "--$rcpt_part\nContent-Type: text/plain; charset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n\nYour message\n\nTo: $rcpt_user\nSubject: $rcpt_subj\nDate: $rcpt_date\n\nWas displayed on " . date("D, j M Y H:i:s O (T)") . "\n\n--$rcpt_part\nContent-Type: message/disposition-notification\nContent-Transfer-Encoding: quoted-printable\n\nReporting-UA : " . $_SERVER['SERVER_NAME'] . " ; Kartero/1.0 (PHP/" . phpversion() . ")\nOriginal-Recipient : $rcpt_mail\nFinal-Recipient : rfc822;\nOriginal-Message-ID : $rcpt_omid\nDisposition: manual-action/MDN-sent-manually; displayed\n--$rcpt_part--";
$rcpt_subj = "Read: $rcpt_subj";
mail($rcpt_mail, $rcpt_subj, $rcpt_body, $rcpt_head, "-f $rcpt_user");
+$mbox = @imap_open($imap_host, $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+
+imap_createmailbox($mbox,"{$imap_host}Sent");
+
+imap_append($mbox,"{$imap_host}Sent","To: $rcpt_mail\nSubject: $rcpt_subj\nDate: $rcpt_date\n$rcpt_head\n\n$rcpt_body\n");
+
+imap_setflag_full($mbox, $rcpt_omno, '\\Answered',ST_UID);
+
//echo "<script>alert('Read receipt sent to $rcpt_mail');</script>";
?>
diff --git a/read.php b/read.php
index 955855d..3dcc037 100644
--- a/read.php
+++ b/read.php
@@ -365,14 +365,9 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
echo "<div class=\"spacer\"></div>";
- $usr_mbox = imap_list($mbox,$host,"*");
- $usr_mbox = array_diff($usr_mbox,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
-
- if ((count($usr_mbox) > 0) and ($folder != "Sent") and ($folder != "Trash")) {
+ $usr_mbox = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
- sort($usr_mbox);
-
- array_unshift($usr_mbox,"{$host}INBOX");
+ if ((count($usr_mbox) > 0) and ($folder != "Sent") and ($folder != "Trash")) {
echo "<div class=\"message\">";
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
@@ -391,12 +386,20 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
foreach ($usr_mbox as $move_box) {
- $move_box = str_replace($host,"",$move_box);
+ $move_box = str_replace($imap_host,"",$move_box);
if ($folder == $move_box) {
continue;
}
+ if ($move_box == "Sent") {
+ continue;
+ }
+
+ if ($move_box == "Trash") {
+ continue;
+ }
+
echo "<option value=\"$move_box\">$move_box</option>";
}
@@ -408,8 +411,6 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
echo "<div class=\"spacer\"></div>";
}
-
-
echo "<div class=\"message\">";
$filePath = "attach/o/$fileUsr/$fileDir";
@@ -556,7 +557,9 @@ if (isset($header_rr) and (strlen($header_rr) > 0)) {
$rcpt_mail = extract_emails_from($header_rr);
$rcpt_mail = $rcpt_mail[0];
- if (strlen($rcpt_mail) > 0) {
+ $header_ov = imap_fetch_overview($mbox,$msgno,FT_UID);
+
+ if ((strlen($rcpt_mail) > 0) and ($folder != "Sent") and ($folder != "Trash") and ($folder != "Spam") and ($folder != "Junk") and ($header_ov[0]->answered == "0")) {
$header_message_id = header_mime2text($header->message_id);
@@ -565,7 +568,8 @@ if (isset($header_rr) and (strlen($header_rr) > 0)) {
echo "<input type=\"hidden\" name=\"rcpt_subj\" value=\"$header_subject\">";
echo "<input type=\"hidden\" name=\"rcpt_date\" value=\"$header_date\">";
echo "<input type=\"hidden\" name=\"rcpt_omid\" value=\"$header_message_id\">";
-
+ echo "<input type=\"hidden\" name=\"rcpt_omno\" value=\"$msgno\">";
+
echo "<iframe id=\"rcpt\" name=\"rcpt\" src=\"rcpt.php\" frameborder=\"0\" scrolling=\"0\" width=\"0\" height=\"0\" style=\"display: none;\"></iframe>";
echo "</form>";
diff --git a/search.php b/search.php
index 57a8e17..3fcecdc 100644
--- a/search.php
+++ b/search.php
@@ -6,7 +6,7 @@ if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset
exit;
}
-$search_folders = kartero_sort_folders($host,imap_list($mbox,$host,"*"));
+$search_folders = kartero_sort_folders($imap_host,imap_list($mbox,$imap_host,"*"));
if (is_array($search_folders)) {
@@ -19,7 +19,7 @@ if (is_array($search_folders)) {
foreach ($search_folders as $search_folder) {
- $search_folder = str_replace($host,"",$search_folder);
+ $search_folder = str_replace($imap_host,"",$search_folder);
if ($folder == $search_folder) {
echo "<option selected>$search_folder</option>";