This commit has been accessed 657 times via Git panel.
commit b92c6e892ebe3df0c465762512dfcc1fa19faef1
tree 230f35dab927a9273ff7b413107df1a2a52f474e
parent fddf4d9e8b441a9456de5d43de9ab03255a11235
author Engels Antonio <engels@majcms.org> 1343355021 +0800
committer Engels Antonio <engels@majcms.org> 1343355021 +0800
Add read receipt detection and transmission
diff --git a/index.php b/index.php
index ffeea2c..cecacc5 100644
--- a/index.php
+++ b/index.php
@@ -1225,6 +1225,10 @@ 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>";
echo "<div class=\"message\">";
@@ -1245,10 +1249,6 @@ echo "</tr>";
echo "</td></tr></table>";
echo "</div>";
- 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>";
-
if ($_POST['set'] == "account") {
echo "<div id=\"account\">";
}
diff --git a/rcpt.php b/rcpt.php
new file mode 100644
index 0000000..474495c
--- /dev/null
+++ b/rcpt.php
@@ -0,0 +1,27 @@
+<?php
+
+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'])) {
+ exit;
+}
+
+$rcpt_user = $_SESSION['logged_uid'];
+$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_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");
+
+echo "<script>alert('Read receipt sent to $rcpt_mail');</script>";
+
+?>
diff --git a/read.php b/read.php
index 6963f54..955855d 100644
--- a/read.php
+++ b/read.php
@@ -551,4 +551,27 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
echo "</td></tr></table>";
}
+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_message_id = header_mime2text($header->message_id);
+
+ echo "<form id=\"receipt\" method=\"post\" action=\"rcpt.php\" target=\"rcpt\" style=\"display: none;\">";
+ echo "<input type=\"hidden\" name=\"rcpt_mail\" value=\"$rcpt_mail\">";
+ 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 "<iframe id=\"rcpt\" name=\"rcpt\" src=\"rcpt.php\" frameborder=\"0\" scrolling=\"0\" width=\"0\" height=\"0\" style=\"display: none;\"></iframe>";
+
+ echo "</form>";
+
+ echo "<script>if (confirm('The message sender has requested a response to indicate that you have read this message.\\nWould you like to send a receipt?')) { document.getElementById('receipt').submit(); }</script>";
+ }
+}
+
?>
tree 230f35dab927a9273ff7b413107df1a2a52f474e
parent fddf4d9e8b441a9456de5d43de9ab03255a11235
author Engels Antonio <engels@majcms.org> 1343355021 +0800
committer Engels Antonio <engels@majcms.org> 1343355021 +0800
Add read receipt detection and transmission
diff --git a/index.php b/index.php
index ffeea2c..cecacc5 100644
--- a/index.php
+++ b/index.php
@@ -1225,6 +1225,10 @@ 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>";
echo "<div class=\"message\">";
@@ -1245,10 +1249,6 @@ echo "</tr>";
echo "</td></tr></table>";
echo "</div>";
- 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>";
-
if ($_POST['set'] == "account") {
echo "<div id=\"account\">";
}
diff --git a/rcpt.php b/rcpt.php
new file mode 100644
index 0000000..474495c
--- /dev/null
+++ b/rcpt.php
@@ -0,0 +1,27 @@
+<?php
+
+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'])) {
+ exit;
+}
+
+$rcpt_user = $_SESSION['logged_uid'];
+$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_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");
+
+echo "<script>alert('Read receipt sent to $rcpt_mail');</script>";
+
+?>
diff --git a/read.php b/read.php
index 6963f54..955855d 100644
--- a/read.php
+++ b/read.php
@@ -551,4 +551,27 @@ echo "<span class=\"hide\" id=\"headerL\" onclick=\"document.getElementById('hea
echo "</td></tr></table>";
}
+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_message_id = header_mime2text($header->message_id);
+
+ echo "<form id=\"receipt\" method=\"post\" action=\"rcpt.php\" target=\"rcpt\" style=\"display: none;\">";
+ echo "<input type=\"hidden\" name=\"rcpt_mail\" value=\"$rcpt_mail\">";
+ 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 "<iframe id=\"rcpt\" name=\"rcpt\" src=\"rcpt.php\" frameborder=\"0\" scrolling=\"0\" width=\"0\" height=\"0\" style=\"display: none;\"></iframe>";
+
+ echo "</form>";
+
+ echo "<script>if (confirm('The message sender has requested a response to indicate that you have read this message.\\nWould you like to send a receipt?')) { document.getElementById('receipt').submit(); }</script>";
+ }
+}
+
?>