This commit has been accessed 586 times via Git panel.
commit a6889934bb5014dccad08cfe66f53a8658fdd76a
tree bbe069d06420bd00fe14e537633c045d2d97c68a
parent 655702909064d7dd9790943ea3e58abb6ded92d6
author Engels Antonio <engels@majcms.org> 1340864066 +0800
committer Engels Antonio <engels@majcms.org> 1340864066 +0800
Include attachments in forwarded messages
diff --git a/filedrop.php b/filedrop.php
index 42e6e0c..57f092a 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -2,18 +2,18 @@
require_once("core.php");
-if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber")) {
+if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber") or !isset($_SESSION['filedrop_dir']) or empty($_SESSION['filedrop_dir'])) {
exit;
}
-if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj']) and isset($_POST['filedrop_box']) and !empty($_POST['filedrop_box'])) {
+$filedrop_box = $_SESSION['filedrop_dir'];
+
+if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj'])) {
if (is_uploaded_file($_FILES['filedrop_obj']['tmp_name'])) {
if ($_FILES['filedrop_obj']['size'] <= $max_file_size) {
- $filedrop_box = $_POST['filedrop_box'];
-
$filedrop_nom = str_replace(" ", "_", $_FILES['filedrop_obj']['name']);
$filedrop_nom = preg_replace("/[^a-zA-Z0-9.\-_]/u", "", $filedrop_nom);
diff --git a/index.php b/index.php
index a1a3dcf..c3c37c4 100644
--- a/index.php
+++ b/index.php
@@ -157,6 +157,10 @@ unset($pw_mbox);
if ($_SESSION['logged_lvl'] == "subscriber") {
+ $filedrop_box = sha1(microtime(true));
+
+ $_SESSION['filedrop_dir'] = $filedrop_box;
+
if (isset($_SESSION['clean_up_i']) and file_exists("attach/i/$fileUsr/{$_SESSION['clean_up_i']}") and (!isset($_POST['filedrop_box']) or empty($_POST['filedrop_box']))) {
rmdirr("attach/i/$fileUsr/{$_SESSION['clean_up_i']}");
@@ -169,7 +173,18 @@ if ($_SESSION['logged_lvl'] == "subscriber") {
if (isset($_SESSION['clean_up_o']) and file_exists("attach/o/$fileUsr/{$_SESSION['clean_up_o']}")) {
- rmdirr("attach/o/$fileUsr/{$_SESSION['clean_up_o']}");
+ if ($_POST['rep'] == 2) {
+
+ if (!file_exists("attach/i/$fileUsr")) {
+ mkdir("attach/i/$fileUsr",0700,1);
+ }
+
+ rename("attach/o/$fileUsr/{$_SESSION['clean_up_o']}","attach/i/$fileUsr/$filedrop_box");
+ }
+ else {
+ rmdirr("attach/o/$fileUsr/{$_SESSION['clean_up_o']}");
+ }
+
unset($_SESSION['clean_up_o']);
if (count(glob("attach/o/$fileUsr/*")) == 0) {
@@ -942,8 +957,6 @@ if (isset($_SESSION['logged_uid'])) {
if ($_SESSION['logged_lvl'] == "subscriber") {
- $filedrop_box = sha1(microtime(true));
-
$host = "{127.0.0.1:143/imap/notls/norsh}";
if (!isset($_POST['box']) or empty($_POST['box'])) {
diff --git a/send.php b/send.php
index 054d630..782e26e 100644
--- a/send.php
+++ b/send.php
@@ -223,28 +223,6 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
}
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;
@@ -254,6 +232,7 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_quote_line = "> $reply_quote_line";
$reply_quote_line = preg_replace("/(^> >)/",">>",$reply_quote_line);
+ $reply_quote_line = preg_replace("/(^>> >)/",">>>",$reply_quote_line);
echo $reply_quote_line;
}
tree bbe069d06420bd00fe14e537633c045d2d97c68a
parent 655702909064d7dd9790943ea3e58abb6ded92d6
author Engels Antonio <engels@majcms.org> 1340864066 +0800
committer Engels Antonio <engels@majcms.org> 1340864066 +0800
Include attachments in forwarded messages
diff --git a/filedrop.php b/filedrop.php
index 42e6e0c..57f092a 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -2,18 +2,18 @@
require_once("core.php");
-if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber")) {
+if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber") or !isset($_SESSION['filedrop_dir']) or empty($_SESSION['filedrop_dir'])) {
exit;
}
-if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj']) and isset($_POST['filedrop_box']) and !empty($_POST['filedrop_box'])) {
+$filedrop_box = $_SESSION['filedrop_dir'];
+
+if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj'])) {
if (is_uploaded_file($_FILES['filedrop_obj']['tmp_name'])) {
if ($_FILES['filedrop_obj']['size'] <= $max_file_size) {
- $filedrop_box = $_POST['filedrop_box'];
-
$filedrop_nom = str_replace(" ", "_", $_FILES['filedrop_obj']['name']);
$filedrop_nom = preg_replace("/[^a-zA-Z0-9.\-_]/u", "", $filedrop_nom);
diff --git a/index.php b/index.php
index a1a3dcf..c3c37c4 100644
--- a/index.php
+++ b/index.php
@@ -157,6 +157,10 @@ unset($pw_mbox);
if ($_SESSION['logged_lvl'] == "subscriber") {
+ $filedrop_box = sha1(microtime(true));
+
+ $_SESSION['filedrop_dir'] = $filedrop_box;
+
if (isset($_SESSION['clean_up_i']) and file_exists("attach/i/$fileUsr/{$_SESSION['clean_up_i']}") and (!isset($_POST['filedrop_box']) or empty($_POST['filedrop_box']))) {
rmdirr("attach/i/$fileUsr/{$_SESSION['clean_up_i']}");
@@ -169,7 +173,18 @@ if ($_SESSION['logged_lvl'] == "subscriber") {
if (isset($_SESSION['clean_up_o']) and file_exists("attach/o/$fileUsr/{$_SESSION['clean_up_o']}")) {
- rmdirr("attach/o/$fileUsr/{$_SESSION['clean_up_o']}");
+ if ($_POST['rep'] == 2) {
+
+ if (!file_exists("attach/i/$fileUsr")) {
+ mkdir("attach/i/$fileUsr",0700,1);
+ }
+
+ rename("attach/o/$fileUsr/{$_SESSION['clean_up_o']}","attach/i/$fileUsr/$filedrop_box");
+ }
+ else {
+ rmdirr("attach/o/$fileUsr/{$_SESSION['clean_up_o']}");
+ }
+
unset($_SESSION['clean_up_o']);
if (count(glob("attach/o/$fileUsr/*")) == 0) {
@@ -942,8 +957,6 @@ if (isset($_SESSION['logged_uid'])) {
if ($_SESSION['logged_lvl'] == "subscriber") {
- $filedrop_box = sha1(microtime(true));
-
$host = "{127.0.0.1:143/imap/notls/norsh}";
if (!isset($_POST['box']) or empty($_POST['box'])) {
diff --git a/send.php b/send.php
index 054d630..782e26e 100644
--- a/send.php
+++ b/send.php
@@ -223,28 +223,6 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
}
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;
@@ -254,6 +232,7 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_quote_line = "> $reply_quote_line";
$reply_quote_line = preg_replace("/(^> >)/",">>",$reply_quote_line);
+ $reply_quote_line = preg_replace("/(^>> >)/",">>>",$reply_quote_line);
echo $reply_quote_line;
}