mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 01:37:02 +02:00
@ -22,20 +22,25 @@ class ControllerMessagePDF extends Controller {
|
||||
|
||||
$this->data['id'] = @$this->request->get['id'];
|
||||
|
||||
$this->data['search'] = "";
|
||||
|
||||
// FIXME!!!
|
||||
$message = $this->model_search_message->get_message_array($this->data['id'], $this->data['search']);
|
||||
if(!$this->model_search_search->check_your_permission_by_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
|
||||
die("no permission for " . $this->data['id']);
|
||||
}
|
||||
|
||||
$images = $this->model_message_attachment->write_image_attachments_to_tmp($message['attachments'], $this->data['id']);
|
||||
$this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
|
||||
$this->data['attachments'] = $this->model_search_message->get_attachment_list($this->data['piler_id']);
|
||||
$this->data['message'] = $this->model_search_message->extract_message($this->data['piler_id']);
|
||||
|
||||
$images = $this->model_message_attachment->write_image_attachments_to_tmp($this->data['attachments'], $this->data['id']);
|
||||
|
||||
|
||||
$tmpname = $message['piler_id'] . "-tmp-" . microtime(true) . ".html";
|
||||
$tmpname = $this->data['piler_id'] . "-tmp-" . microtime(true) . ".html";
|
||||
|
||||
$fp = fopen(DIR_BASE . 'tmp/' . $tmpname, "w+");
|
||||
if($fp) {
|
||||
fwrite($fp, "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /></head><body>");
|
||||
fwrite($fp, $message['message']['message']);
|
||||
fwrite($fp, $this->data['message']['message']);
|
||||
|
||||
foreach($images as $img) {
|
||||
fwrite($fp, "<p><img src=" . SITE_URL . "/tmp/" . $img['name'] . " alt=\"\" /></p>\n");
|
||||
@ -50,7 +55,7 @@ class ControllerMessagePDF extends Controller {
|
||||
header("Cache-Control: public, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Content-Type: application/pdf");
|
||||
header("Content-Disposition: attachment; filename=" . $message['piler_id'] . ".pdf");
|
||||
header("Content-Disposition: attachment; filename=" . $this->data['piler_id'] . ".pdf");
|
||||
header("Content-Transfer-Encoding: binary\n");
|
||||
|
||||
print(system(WKHTMLTOPDF_COMMAND . " " . SITE_URL . "tmp/$tmpname -"));
|
||||
|
Reference in New Issue
Block a user