@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private static function socket() |
51 | 51 | { |
52 | - if(empty(config('clamavfileupload.clamd_ip')) && empty(config('clamavfileupload.clamd_ip'))) { |
|
52 | + if (empty(config('clamavfileupload.clamd_ip')) && empty(config('clamavfileupload.clamd_ip'))) { |
|
53 | 53 | // By default we just use the local socket |
54 | 54 | $socket = socket_create(AF_UNIX, SOCK_STREAM, 0); |
55 | 55 | |
56 | - if(socket_connect($socket, config('clamavfileupload.clamd_sock'))) { |
|
56 | + if (socket_connect($socket, config('clamavfileupload.clamd_sock'))) { |
|
57 | 57 | self::$message = trans('clamavfileupload::clamav.socket_connected'); |
58 | 58 | return $socket; |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Attempt to use a network based socket |
63 | 63 | $socket = socket_create(AF_INET, SOCK_STREAM, 0); |
64 | 64 | |
65 | - if(socket_connect($socket, config('clamavfileupload.clamd_ip'), config('clamavfileupload.clamd_ip'))) { |
|
65 | + if (socket_connect($socket, config('clamavfileupload.clamd_ip'), config('clamavfileupload.clamd_ip'))) { |
|
66 | 66 | self::$message = trans('clamavfileupload::clamav.socket_connected'); |
67 | 67 | return $socket; |
68 | 68 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $ping = self::send("PING"); |
92 | 92 | |
93 | - if($ping == "PONG") { |
|
93 | + if ($ping == "PONG") { |
|
94 | 94 | return true; |
95 | 95 | } |
96 | 96 | |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public static function scan($file): bool |
108 | 108 | { |
109 | - if(!file_exists($file)) { |
|
109 | + if (!file_exists($file)) { |
|
110 | 110 | self::$message = trans('clamavfileupload::clamav.file_not_found', |
111 | 111 | ['name' => $file]); |
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | |
115 | 115 | $scan = self::send("SCAN $file"); |
116 | - if($scan === false) { |
|
116 | + if ($scan === false) { |
|
117 | 117 | self::$message = trans('clamavfileupload::clamav.not_running'); |
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | 121 | $scanMessage = trim(substr(strrchr($scan, ":"), 1)); |
122 | - if($scanMessage == 'OK') { |
|
122 | + if ($scanMessage == 'OK') { |
|
123 | 123 | self::$message = $scanMessage; |
124 | 124 | return true; |
125 | 125 | } |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | public static function scanstream($file): bool |
140 | 140 | { |
141 | 141 | $socket = self::socket(); |
142 | - if(!$socket) { |
|
142 | + if (!$socket) { |
|
143 | 143 | self::$message = trans('clamavfileupload::clamav.not_running'); |
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | |
147 | - if(!file_exists($file)) { |
|
147 | + if (!file_exists($file)) { |
|
148 | 148 | self::$message = trans('clamavfileupload::clamav.file_not_found'); |
149 | 149 | return false; |
150 | 150 | } |
@@ -160,18 +160,18 @@ discard block |
||
160 | 160 | socket_send($socket, $packet, strlen($packet), 0); |
161 | 161 | } |
162 | 162 | |
163 | - $packet = pack("Nx",0); |
|
163 | + $packet = pack("Nx", 0); |
|
164 | 164 | socket_send($socket, $packet, strlen($packet), 0); |
165 | 165 | socket_recv($socket, $scan, config('clamavfileupload.clamd_sock_len'), 0); |
166 | 166 | socket_close($socket); |
167 | 167 | |
168 | - if($scan === false) { |
|
168 | + if ($scan === false) { |
|
169 | 169 | self::$message = trans('clamavfileupload::clamav.not_running'); |
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | |
173 | 173 | $scanMessage = trim(substr(strrchr($scan, ":"), 1)); |
174 | - if($scanMessage == 'OK') { |
|
174 | + if ($scanMessage == 'OK') { |
|
175 | 175 | self::$message = $scanMessage; |
176 | 176 | return true; |
177 | 177 | } |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | * @return bool |
190 | 190 | */ |
191 | 191 | public static function send($command) { |
192 | - if(empty($command)) { |
|
192 | + if (empty($command)) { |
|
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
196 | 196 | try { |
197 | 197 | $socket = self::socket(); |
198 | 198 | |
199 | - if($socket) { |
|
199 | + if ($socket) { |
|
200 | 200 | socket_send($socket, $command, strlen($command), 0); |
201 | 201 | socket_recv($socket, $return, config('clamavfileupload.clamd_sock_len'), 0); |
202 | 202 | socket_close($socket); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public static function fileUpload(): bool|FileUploadModel|EloquentCollection |
25 | 25 | { |
26 | - if(self::$request->file()) { |
|
26 | + if (self::$request->file()) { |
|
27 | 27 | self::storeFiles(); |
28 | 28 | |
29 | 29 | if (!self::areFilesSafe()) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | return self::$scanData['status']; |
111 | 111 | } |
112 | 112 | |
113 | - $i ++; |
|
113 | + $i++; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | FileScanPass::dispatch(self::$scanData); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param array $files |
28 | 28 | * @return ?bool |
29 | 29 | */ |
30 | - public static function removeFiles(array $files = []): ?bool |
|
30 | + public static function removeFiles(array $files = []): ?bool |
|
31 | 31 | { |
32 | 32 | foreach ($files as $file) { |
33 | 33 | $file = str_replace(self::storageDisk()->path('tmp'), '', $file); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $disk->putFileAs("", $file, $tmp); |
86 | 86 | $tmpFiles[] = self::storageDisk()->path("tmp/{$tmp}"); |
87 | 87 | |
88 | - $i ++; |
|
88 | + $i++; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $tmpFiles; |