PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.1.2
Fluent Support – Helpdesk & Customer Support Ticket System v2.1.2
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
← All changes | app/Http/Controllers/UploaderController.php +10 -24 2.2.02.1.2 View file →
@@ -76,27 +76,15 @@
76 76
77 77 private function resolveTicketId($request)
78 78 {
79 79 $ticketId = $request->getSafe('ticket_id', 'intval');
80 -
81 - if ($ticketId == 'undefined' || !$ticketId) {
82 - return null;
83 - }
84 -
85 - if (Helper::getCurrentAgent()) {
86 - return $ticketId;
87 - }
88 -
89 - $ticket = Ticket::wherePublicIdentifier($ticketId)->first();
90 -
91 - return $ticket ? $ticket->id : null;
80 + return $ticketId == 'undefined' ? null : $ticketId;
92 81 }
93 82
94 83 private function resolvePerson($ticketId, Request $request)
95 84 {
96 - $agent = Helper::getCurrentAgent();
97 - if ($agent) {
98 - return $agent;
85 + if ($request->getSafe('is_agent', 'sanitize_text_field') == 'yes') {
86 + return Helper::getCurrentAgent();
99 87 }
100 88
101 89 if ($ticketId && Helper::isPublicSignedTicketEnabled()) {
102 90 $intendedTicketHash = $request->getSafe('intended_ticket_hash', 'sanitize_text_field');
@@ -102,10 +90,9 @@
102 90 $intendedTicketHash = $request->getSafe('intended_ticket_hash', 'sanitize_text_field');
103 91 if ($intendedTicketHash && $intendedTicketHash != 'undefined') {
104 92 $ticket = Ticket::with(['customer'])
105 93 ->where('hash', $intendedTicketHash)
106 - ->wherePublicIdentifier($ticketId)
107 - ->first();
94 + ->find($ticketId);
108 95
109 96 if ($ticket && $ticket->customer) {
110 97 return $ticket->customer;
111 98 }
@@ -135,9 +122,9 @@
135 122
136 123 private function createAttachmentRecords($uploadedFiles, $ticketId, $person, $imageType)
137 124 {
138 125 $attachments = [];
139 - $directPasteUrl = null;
126 + $full_path = null;
140 127
141 128 foreach ($uploadedFiles as $file) {
142 129 if (empty($file['file_path'])) continue;
143 130
@@ -154,16 +141,15 @@
154 141 'local_temp_path' => $file['file_path'],
155 142 ]
156 143 ];
157 144
145 + if($imageType == 'direct_paste'){
146 + $full_path = esc_url($file['url']);
147 + }
148 +
158 149 try {
159 150 $attachment = Attachment::create($fileData);
160 151 $attachments[] = $attachment->file_hash;
161 -
162 - if ($imageType == 'direct_paste') {
163 - $directPasteUrl = $attachment->secureUrl;
164 - }
165 -
166 152 do_action('fluent_support/attachment_uploaded_as_temp', $attachment, $ticketId);
167 153 $driver = Helper::getUploadDriverKey();
168 154
169 155 do_action_ref_array('fluent_support/attachment_uploaded_as_temp_' . $driver, [&$attachment, $ticketId]);
@@ -171,9 +157,9 @@
171 157 continue;
172 158 }
173 159 }
174 160
175 - return $imageType == 'direct_paste' ? $directPasteUrl : $attachments;
161 + return $imageType == 'direct_paste' ? $full_path : $attachments;
176 162 }
177 163
178 164 public function uploadImage(Request $request)
179 165 {