This commit has been accessed 586 times via Git panel.
commit 9ed0d56480fb30af88d877039c4ae2ed9e809eb5
tree 18a51060928b64232ce71f9094c1d23c5ee9c918
parent 822b6c1476ed60dc9c9dbb701b086ee457e4646d
author Engels Antonio <engels@majcms.org> 1332703935 +0800
committer Engels Antonio <engels@majcms.org> 1332703935 +0800
Add clamdscan support for outgoing mail attachments
diff --git a/filedrop.php b/filedrop.php
index 363483f..8014959 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -64,6 +64,16 @@ if (file_exists("attach/i/$fileUsr/$filedrop_box")) {
$fileSize = filesize($fileAttachment);
$fileSize = HumanReadableFilesize($fileSize);
+ $fileScan = "";
+
+ $scanFile = exec("clamdscan -i --no-summary $fileAttachment",$scanResult,$scanErr);
+
+ if ($scanErr == "1") {
+
+ $fileScan = explode(" ", $scanFile);
+ $fileScan = " <font color=\"red\">{$fileScan[1]}</font>";
+ }
+
if (is_image($fileAttachment)) {
$img_size = getimagesize($fileAttachment);
@@ -80,10 +90,10 @@ if (file_exists("attach/i/$fileUsr/$filedrop_box")) {
}
}
- echo "\r\n<tr><td><a href=\"$fileAttachment\" target=\"_blank\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\" target=\"_blank\">$fileName</a><br>$fileSize{$imgSize}</td></tr>\r\n";
+ echo "\r\n<tr><td><a href=\"$fileAttachment\" target=\"_blank\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\" target=\"_blank\">$fileName</a><br>$fileSize{$imgSize}{$fileScan}</td></tr>\r\n";
}
else {
- echo "\r\n<tr><td><a href=\"$fileAttachment\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\">$fileName</a><br>$fileSize</td></tr>\r\n";
+ echo "\r\n<tr><td><a href=\"$fileAttachment\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\">$fileName</a><br>$fileSize{$fileScan}</td></tr>\r\n";
}
}
tree 18a51060928b64232ce71f9094c1d23c5ee9c918
parent 822b6c1476ed60dc9c9dbb701b086ee457e4646d
author Engels Antonio <engels@majcms.org> 1332703935 +0800
committer Engels Antonio <engels@majcms.org> 1332703935 +0800
Add clamdscan support for outgoing mail attachments
diff --git a/filedrop.php b/filedrop.php
index 363483f..8014959 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -64,6 +64,16 @@ if (file_exists("attach/i/$fileUsr/$filedrop_box")) {
$fileSize = filesize($fileAttachment);
$fileSize = HumanReadableFilesize($fileSize);
+ $fileScan = "";
+
+ $scanFile = exec("clamdscan -i --no-summary $fileAttachment",$scanResult,$scanErr);
+
+ if ($scanErr == "1") {
+
+ $fileScan = explode(" ", $scanFile);
+ $fileScan = " <font color=\"red\">{$fileScan[1]}</font>";
+ }
+
if (is_image($fileAttachment)) {
$img_size = getimagesize($fileAttachment);
@@ -80,10 +90,10 @@ if (file_exists("attach/i/$fileUsr/$filedrop_box")) {
}
}
- echo "\r\n<tr><td><a href=\"$fileAttachment\" target=\"_blank\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\" target=\"_blank\">$fileName</a><br>$fileSize{$imgSize}</td></tr>\r\n";
+ echo "\r\n<tr><td><a href=\"$fileAttachment\" target=\"_blank\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\" target=\"_blank\">$fileName</a><br>$fileSize{$imgSize}{$fileScan}</td></tr>\r\n";
}
else {
- echo "\r\n<tr><td><a href=\"$fileAttachment\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\">$fileName</a><br>$fileSize</td></tr>\r\n";
+ echo "\r\n<tr><td><a href=\"$fileAttachment\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\">$fileName</a><br>$fileSize{$fileScan}</td></tr>\r\n";
}
}