@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private static 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 | self::$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 | self::$message = trans('clamavfileupload::clamav.socket_connected'); |
69 | 69 | return $socket; |
70 | 70 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $ping = self::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 static function scan($file): bool |
112 | 112 | { |
113 | - if(!file_exists($file)) { |
|
113 | + if (!file_exists($file)) { |
|
114 | 114 | self::$message = trans('clamavfileupload::clamav.file_not_found', |
115 | 115 | ['name' => $file]); |
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $scan = self::send("SCAN $file"); |
120 | - if($scan === false) { |
|
120 | + if ($scan === false) { |
|
121 | 121 | self::$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 | self::$message = $scanMessage; |
130 | 130 | return true; |
131 | 131 | } |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | public static function scanStream($file): bool |
146 | 146 | { |
147 | 147 | $socket = self::socket(); |
148 | - if(!$socket) { |
|
148 | + if (!$socket) { |
|
149 | 149 | self::$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 | self::$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 | self::$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 | self::$message = $scanMessage; |
206 | 206 | return true; |
207 | 207 | } |
@@ -219,14 +219,14 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static 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 = self::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); |