diff --git a/.gitignore b/.gitignore index 2e3f55a2..70d3d8c3 100644 --- a/.gitignore +++ b/.gitignore @@ -270,7 +270,7 @@ readme.html robots.txt .idea/ attachments/__latest.txt -attachments +/attachments img/ban.png img/banned.png img/ico_tools.png diff --git a/api/BusinessLogic/Attachments/Attachment.php b/api/BusinessLogic/Attachments/Attachment.php new file mode 100644 index 00000000..380d00b3 --- /dev/null +++ b/api/BusinessLogic/Attachments/Attachment.php @@ -0,0 +1,21 @@ +AttachmentTypeAttachmentType] */ + public $type; +} \ No newline at end of file diff --git a/api/Controllers/Attachments/StaffAttachmentsController.php b/api/Controllers/Attachments/StaffAttachmentsController.php new file mode 100644 index 00000000..6bfbbd81 --- /dev/null +++ b/api/Controllers/Attachments/StaffAttachmentsController.php @@ -0,0 +1,10 @@ +init(); + + hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "attachments` + (`ticket_id`, `note_id`, `saved_name`, `real_name`, `size`, `type`, `download_count`) + VALUES ('" . hesk_dbEscape($attachment->ticketTrackingId) . "', NULL, '" . hesk_dbEscape($attachment->savedName) . "', + '" . hesk_dbEscape($attachment->displayName) . "', " . intval($attachment->fileSize) . ", '" . intval($attachment->type) . "', 0)"); + + $attachmentId = hesk_dbInsertID(); + + $this->close(); + + return $attachmentId; + } +} \ No newline at end of file diff --git a/api/Tests/BusinessLogic/Attachments/AttachmentHandlerTest.php b/api/Tests/BusinessLogic/Attachments/AttachmentHandlerTest.php new file mode 100644 index 00000000..335b3b88 --- /dev/null +++ b/api/Tests/BusinessLogic/Attachments/AttachmentHandlerTest.php @@ -0,0 +1,17 @@ +attachmentHandler = new AttachmentHandler(); + } +}