@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function up(): void |
13 | 13 | { |
14 | - Schema::create('file_uploads', function (Blueprint $table) { |
|
14 | + Schema::create('file_uploads', function(Blueprint $table) { |
|
15 | 15 | $table->id(); |
16 | 16 | $table->string('ref'); |
17 | 17 | $table->string('name'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function up(): void |
13 | 13 | { |
14 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
14 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
15 | 15 | $table->string('folder')->after('url')->nullable(); |
16 | 16 | $table->tinyInteger('hashed')->after('folder')->default(0); |
17 | 17 | }); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function down(): void |
24 | 24 | { |
25 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
25 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
26 | 26 | $table->dropColumn(['folder', 'hashed']); |
27 | 27 | }); |
28 | 28 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function fileUpload(): bool|array |
17 | 17 | { |
18 | - if($this->request->file()) { |
|
18 | + if ($this->request->file()) { |
|
19 | 19 | return $this->storeFiles(); |
20 | 20 | } |
21 | 21 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | foreach ($files as $file) { |
35 | 35 | $file = str_replace($this->storageDisk()->path('tmp'), '', $file); |
36 | - $this->storageDisk()->delete('tmp' . $file); |
|
36 | + $this->storageDisk()->delete('tmp'.$file); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return true; |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | $i = 1; |
94 | 94 | |
95 | 95 | foreach ($this->request->file($this->input) as $file) { |
96 | - $tmp = $fileName . "_{$i}" . $this->getExtension($file); |
|
96 | + $tmp = $fileName."_{$i}".$this->getExtension($file); |
|
97 | 97 | $disk->putFileAs("", $file, $tmp); |
98 | 98 | $tmpFiles[] = $this->storageDisk()->path("tmp/{$tmp}"); |
99 | 99 | |
100 | - $i ++; |
|
100 | + $i++; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return $tmpFiles; |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function saveSingleFile(null|string $fileName = null): bool|array |
114 | 114 | { |
115 | - $tmp = $fileName . $this->getExtension(); |
|
115 | + $tmp = $fileName.$this->getExtension(); |
|
116 | 116 | |
117 | 117 | $this->provideDisk()->putFileAs("", |
118 | 118 | $this->request->file($this->input), |
119 | - $fileName . $this->getExtension()); |
|
119 | + $fileName.$this->getExtension()); |
|
120 | 120 | |
121 | 121 | return [$this->storageDisk()->path("tmp/{$tmp}")]; |
122 | 122 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function fileUpload(): bool|FileUploadModel|EloquentCollection |
35 | 35 | { |
36 | - if($this->request->file()) { |
|
36 | + if ($this->request->file()) { |
|
37 | 37 | if (!$this->storeFiles()) { |
38 | 38 | return $this->failedUpload(trans('clamavfileupload::clamav.failed')); |
39 | 39 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
164 | - $i ++; |
|
164 | + $i++; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | FileScanPass::dispatch($this->scanData); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $storageDisk = Storage::disk('local'); |
178 | 178 | $ary = explode('/', $file->getRealPath()); |
179 | - $relativeFilePath = 'tmp/' . array_pop($ary); |
|
179 | + $relativeFilePath = 'tmp/'.array_pop($ary); |
|
180 | 180 | |
181 | 181 | return [$storageDisk, $relativeFilePath]; |
182 | 182 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function fileUpload(): bool|FileUploadModel|EloquentCollection |
20 | 20 | { |
21 | - if($this->request->file()) { |
|
21 | + if ($this->request->file()) { |
|
22 | 22 | if (!$this->storeFiles()) { |
23 | 23 | return $this->failedUpload(trans('clamavfileupload::clamav.failed')); |
24 | 24 | } |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private function socket() |
53 | 53 | { |
54 | - if(empty(config('clamavfileupload.clamd_ip')) && empty(config('clamavfileupload.clamd_ip'))) { |
|
54 | + if (empty(config('clamavfileupload.clamd_ip')) && empty(config('clamavfileupload.clamd_ip'))) { |
|
55 | 55 | // By default we just use the local socket |
56 | 56 | $socket = socket_create(AF_UNIX, SOCK_STREAM, 0); |
57 | 57 | |
58 | - if(socket_connect($socket, config('clamavfileupload.clamd_sock'))) { |
|
58 | + if (socket_connect($socket, config('clamavfileupload.clamd_sock'))) { |
|
59 | 59 | $this->message = trans('clamavfileupload::clamav.socket_connected'); |
60 | 60 | return $socket; |
61 | 61 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // Attempt to use a network based socket |
65 | 65 | $socket = socket_create(AF_INET, SOCK_STREAM, 0); |
66 | 66 | |
67 | - if(socket_connect($socket, config('clamavfileupload.clamd_ip'), config('clamavfileupload.clamd_ip'))) { |
|
67 | + if (socket_connect($socket, config('clamavfileupload.clamd_ip'), config('clamavfileupload.clamd_ip'))) { |
|
68 | 68 | $this->message = trans('clamavfileupload::clamav.socket_connected'); |
69 | 69 | return $socket; |
70 | 70 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $ping = $this->send("PING"); |
94 | 94 | |
95 | - if($ping == "PONG") { |
|
95 | + if ($ping == "PONG") { |
|
96 | 96 | return true; |
97 | 97 | } |
98 | 98 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function scan($file): bool |
112 | 112 | { |
113 | - if(!file_exists($file)) { |
|
113 | + if (!file_exists($file)) { |
|
114 | 114 | $this->message = trans('clamavfileupload::clamav.file_not_found', |
115 | 115 | ['name' => $file]); |
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $scan = $this->send("SCAN $file"); |
120 | - if($scan === false) { |
|
120 | + if ($scan === false) { |
|
121 | 121 | $this->message = trans('clamavfileupload::clamav.not_running'); |
122 | 122 | ClamavIsNotRunning::dispatch(); |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | $scanMessage = trim(substr(strrchr($scan, ":"), 1)); |
128 | - if($scanMessage == 'OK') { |
|
128 | + if ($scanMessage == 'OK') { |
|
129 | 129 | $this->message = $scanMessage; |
130 | 130 | return true; |
131 | 131 | } |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | public function scanStream($file): bool |
146 | 146 | { |
147 | 147 | $socket = $this->socket(); |
148 | - if(!$socket) { |
|
148 | + if (!$socket) { |
|
149 | 149 | $this->message = trans('clamavfileupload::clamav.not_running'); |
150 | 150 | ClamavIsNotRunning::dispatch(); |
151 | 151 | |
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | |
155 | - if(!file_exists($file)) { |
|
155 | + if (!file_exists($file)) { |
|
156 | 156 | $this->message = trans('clamavfileupload::clamav.file_not_found'); |
157 | 157 | return false; |
158 | 158 | } |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | socket_send($socket, $packet, strlen($packet), 0); |
189 | 189 | } |
190 | 190 | |
191 | - $packet = pack("Nx",0); |
|
191 | + $packet = pack("Nx", 0); |
|
192 | 192 | socket_send($socket, $packet, strlen($packet), 0); |
193 | 193 | socket_recv($socket, $scan, config('clamavfileupload.clamd_sock_len'), 0); |
194 | 194 | socket_close($socket); |
195 | 195 | |
196 | - if($scan === false) { |
|
196 | + if ($scan === false) { |
|
197 | 197 | $this->message = trans('clamavfileupload::clamav.not_running'); |
198 | 198 | ClamavIsNotRunning::dispatch(); |
199 | 199 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | $scanMessage = trim(substr(strrchr($scan, ":"), 1)); |
204 | - if($scanMessage == 'OK') { |
|
204 | + if ($scanMessage == 'OK') { |
|
205 | 205 | $this->message = $scanMessage; |
206 | 206 | return true; |
207 | 207 | } |
@@ -219,14 +219,14 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function send($command) |
221 | 221 | { |
222 | - if(empty($command)) { |
|
222 | + if (empty($command)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | |
226 | 226 | try { |
227 | 227 | $socket = $this->socket(); |
228 | 228 | |
229 | - if($socket) { |
|
229 | + if ($socket) { |
|
230 | 230 | socket_send($socket, $command, strlen($command), 0); |
231 | 231 | socket_recv($socket, $return, config('clamavfileupload.clamd_sock_len'), 0); |
232 | 232 | socket_close($socket); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function up(): void |
13 | 13 | { |
14 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
14 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
15 | 15 | $table->string('path', 1000)->change(); |
16 | 16 | }); |
17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function down(): void |
23 | 23 | { |
24 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
24 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
25 | 25 | $table->string('path', 255)->change(); |
26 | 26 | }); |
27 | 27 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function up(): void |
13 | 13 | { |
14 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
14 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
15 | 15 | $table->string('file_name', 1000)->change(); |
16 | 16 | $table->string('url', 1000)->change(); |
17 | 17 | }); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function down(): void |
24 | 24 | { |
25 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
25 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
26 | 26 | $table->string('file_name', 255)->change(); |
27 | 27 | $table->string('url', 255)->change(); |
28 | 28 | }); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function up(): void |
13 | 13 | { |
14 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
14 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
15 | 15 | $table->text('relative_path')->after('path')->nullable(); |
16 | 16 | }); |
17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function down(): void |
23 | 23 | { |
24 | - Schema::table('file_uploads', function (Blueprint $table) { |
|
24 | + Schema::table('file_uploads', function(Blueprint $table) { |
|
25 | 25 | $table->dropColumn(['relative_path']); |
26 | 26 | }); |
27 | 27 | } |