Added Email Logging for Emailnotification class
This commit is contained in:
48
application/EmailLog/EmailLogController.php
Normal file
48
application/EmailLog/EmailLogController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
class EmailLogController extends mfBaseController {
|
||||
protected function init() {
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
}
|
||||
|
||||
protected function downloadContentAction() {
|
||||
$hash = $this->request->hash;
|
||||
$aid = $this->request->aid;
|
||||
|
||||
$att = EmailLogAttachment::getOne($aid);
|
||||
if(!$att) {
|
||||
header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
|
||||
echo "File not found";
|
||||
}
|
||||
|
||||
//var_dump($att);exit;
|
||||
|
||||
$content = EmailLogAttachmentContent::getFirst(["sha256" => $hash]);
|
||||
if(!$content) {
|
||||
header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
|
||||
echo "File not found";
|
||||
}
|
||||
|
||||
if($att->content_id != $content->id) {
|
||||
header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
|
||||
echo "File not found";
|
||||
}
|
||||
|
||||
set_time_limit(36000);
|
||||
if($content->mimetype) {
|
||||
header("Content-Type: $content->mimetype");
|
||||
} else {
|
||||
header("Content-Type: application/octet-stream");
|
||||
}
|
||||
header('Content-disposition: attachment; filename="' . $att->filename . '"');
|
||||
header("Content-Length: $content->filesize");
|
||||
|
||||
echo $content->content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user