@@ -45,7 +45,7 @@ |
||
45 | 45 | public function isDenied(): bool |
46 | 46 | { |
47 | 47 | if (!empty($this->deniedList)) { |
48 | - if (preg_match('/(' . implode('|', $this->deniedList). ')/i', $this->rdns)) { |
|
48 | + if (preg_match('/(' . implode('|', $this->deniedList) . ')/i', $this->rdns)) { |
|
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | } |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $this->deniedList = [ |
50 | 50 | |
51 | 51 | // Backlink crawlers |
52 | - 'Ahrefs', // http://ahrefs.com/robot/ |
|
53 | - 'roger', // rogerbot (SEOMOZ) |
|
54 | - 'moz.com', // SEOMOZ crawlers |
|
55 | - 'MJ12bot', // Majestic crawlers |
|
56 | - 'findlinks', // http://wortschatz.uni-leipzig.de/findlinks |
|
57 | - 'Semrush', // http://www.semrush.com/bot.html |
|
52 | + 'Ahrefs', // http://ahrefs.com/robot/ |
|
53 | + 'roger', // rogerbot (SEOMOZ) |
|
54 | + 'moz.com', // SEOMOZ crawlers |
|
55 | + 'MJ12bot', // Majestic crawlers |
|
56 | + 'findlinks', // http://wortschatz.uni-leipzig.de/findlinks |
|
57 | + 'Semrush', // http://www.semrush.com/bot.html |
|
58 | 58 | |
59 | 59 | // Web information crawlers |
60 | - 'domain', // Domain name information crawlers. |
|
61 | - 'copyright', // Copyright information crawlers. |
|
60 | + 'domain', // Domain name information crawlers. |
|
61 | + 'copyright', // Copyright information crawlers. |
|
62 | 62 | |
63 | 63 | // Others |
64 | - 'archive', // Wayback machine |
|
64 | + 'archive', // Wayback machine |
|
65 | 65 | ]; |
66 | 66 | } |
67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function isDenied(): bool |
72 | 72 | { |
73 | 73 | if (!empty($this->deniedList)) { |
74 | - if (preg_match('/(' . implode('|', $this->deniedList). ')/i', $this->userAgent)) { |
|
74 | + if (preg_match('/(' . implode('|', $this->deniedList) . ')/i', $this->userAgent)) { |
|
75 | 75 | return true; |
76 | 76 | } |
77 | 77 | } |
@@ -50,19 +50,19 @@ discard block |
||
50 | 50 | protected $deniedList = [ |
51 | 51 | |
52 | 52 | // Backlink crawlers |
53 | - 'Ahrefs', // http://ahrefs.com/robot/ |
|
54 | - 'roger', // rogerbot (SEOMOZ) |
|
55 | - 'moz.com', // SEOMOZ crawlers |
|
56 | - 'MJ12bot', // Majestic crawlers |
|
57 | - 'findlinks', // http://wortschatz.uni-leipzig.de/findlinks |
|
58 | - 'Semrush', // http://www.semrush.com/bot.html |
|
53 | + 'Ahrefs', // http://ahrefs.com/robot/ |
|
54 | + 'roger', // rogerbot (SEOMOZ) |
|
55 | + 'moz.com', // SEOMOZ crawlers |
|
56 | + 'MJ12bot', // Majestic crawlers |
|
57 | + 'findlinks', // http://wortschatz.uni-leipzig.de/findlinks |
|
58 | + 'Semrush', // http://www.semrush.com/bot.html |
|
59 | 59 | |
60 | 60 | // Web information crawlers |
61 | - 'domain', // Domain name information crawlers. |
|
62 | - 'copyright', // Copyright information crawlers. |
|
61 | + 'domain', // Domain name information crawlers. |
|
62 | + 'copyright', // Copyright information crawlers. |
|
63 | 63 | |
64 | 64 | // Others |
65 | - 'archive', // Wayback machine |
|
65 | + 'archive', // Wayback machine |
|
66 | 66 | ]; |
67 | 67 | |
68 | 68 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | if (!empty($this->deniedList)) { |
99 | - if (preg_match('/(' . implode('|', $this->deniedList). ')/i', $userAgent)) { |
|
99 | + if (preg_match('/(' . implode('|', $this->deniedList) . ')/i', $userAgent)) { |
|
100 | 100 | return (new Response)->withStatus(self::HTTP_STATUS_CODE); |
101 | 101 | } |
102 | 102 | } |
@@ -274,8 +274,8 @@ |
||
274 | 274 | { |
275 | 275 | $table = [ |
276 | 276 | 'filter' => $this->tableFilterLogs . ':' . $ip, |
277 | - 'session' => $this->tableSessions . ':' . $ip, |
|
278 | - 'rule' => $this->tableRuleList . ':' . $ip, |
|
277 | + 'session' => $this->tableSessions . ':' . $ip, |
|
278 | + 'rule' => $this->tableRuleList . ':' . $ip, |
|
279 | 279 | ]; |
280 | 280 | |
281 | 281 | return $table[$type] ?? ''; |
@@ -100,8 +100,8 @@ |
||
100 | 100 | $path = []; |
101 | 101 | |
102 | 102 | $path['filter'] = $this->directory . '/' . $this->tableFilterLogs . '/' . $ip . '.' . $this->extension; |
103 | - $path['session'] = $this->directory . '/' . $this->tableSessions . '/' . $ip . '.' . $this->extension; |
|
104 | - $path['rule'] = $this->directory . '/' . $this->tableRuleList . '/' . $ip . '.' . $this->extension; |
|
103 | + $path['session'] = $this->directory . '/' . $this->tableSessions . '/' . $ip . '.' . $this->extension; |
|
104 | + $path['rule'] = $this->directory . '/' . $this->tableRuleList . '/' . $ip . '.' . $this->extension; |
|
105 | 105 | |
106 | 106 | return $path[$type] ?? ''; |
107 | 107 | } |
@@ -272,7 +272,7 @@ |
||
272 | 272 | $channel = '_' . $this->channel; |
273 | 273 | } |
274 | 274 | |
275 | - return $this->directory . '/' . $this->version . $channel . '_' . $driverType . '_' . $this->checkpoint; |
|
275 | + return $this->directory . '/' . $this->version . $channel . '_' . $driverType . '_' . $this->checkpoint; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | if (empty($ip)) |
317 | 317 | continue; |
318 | 318 | |
319 | - if (0 === strpos($this->kernel->getCurrentUrl(), empty($ip['url']) ? '/' : $ip['url']) ) { |
|
319 | + if (0 === strpos($this->kernel->getCurrentUrl(), empty($ip['url']) ? '/' : $ip['url'])) { |
|
320 | 320 | |
321 | 321 | if ('allow' === $ip['rule']) { |
322 | 322 | $allowedList[] = $ip['ip']; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $this->kernel->setProperty( |
379 | 379 | 'deny_attempt_enable', |
380 | 380 | [ |
381 | - 'data_circle' => $setting['data_circle']['enable'], // false |
|
381 | + 'data_circle' => $setting['data_circle']['enable'], // false |
|
382 | 382 | 'system_firewall' => $setting['system_firewall']['enable'], // false |
383 | 383 | ] |
384 | 384 | ); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $this->kernel->setProperty( |
387 | 387 | 'deny_attempt_buffer', |
388 | 388 | [ |
389 | - 'data_circle' => $setting['data_circle']['buffer'], // 10 |
|
389 | + 'data_circle' => $setting['data_circle']['buffer'], // 10 |
|
390 | 390 | 'system_firewall' => $setting['system_firewall']['buffer'], // 10 |
391 | 391 | ] |
392 | 392 | ); |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | |
432 | 432 | if ($sessionLimitSetting['enable']) { |
433 | 433 | |
434 | - $onlineUsers = $sessionLimitSetting['config']['count']; // default: 100 |
|
435 | - $alivePeriod = $sessionLimitSetting['config']['period']; // default: 300 |
|
434 | + $onlineUsers = $sessionLimitSetting['config']['count']; // default: 100 |
|
435 | + $alivePeriod = $sessionLimitSetting['config']['period']; // default: 300 |
|
436 | 436 | $isUniqueIp = $sessionLimitSetting['config']['unique_only']; // false |
437 | 437 | |
438 | 438 | $this->kernel->limitSession($onlineUsers, $alivePeriod, $isUniqueIp); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | |
456 | 456 | $lastResetTime = $cronjobSetting['config']['last_update']; |
457 | 457 | |
458 | - if (!empty($lastResetTime) ) { |
|
458 | + if (!empty($lastResetTime)) { |
|
459 | 459 | $lastResetTime = strtotime($lastResetTime); |
460 | 460 | } else { |
461 | 461 | // @codeCoverageIgnoreStart |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | $dialogInfo = $this->getOption('dialog_info_disclosure'); |
536 | 536 | |
537 | 537 | $this->kernel->setProperty('display_online_info', $dialogInfo['online_user_amount']); |
538 | - $this->kernel->setProperty('display_user_info', $dialogInfo['user_inforamtion']); |
|
539 | - $this->kernel->setProperty('display_http_code', $dialogInfo['http_status_code']); |
|
538 | + $this->kernel->setProperty('display_user_info', $dialogInfo['user_inforamtion']); |
|
539 | + $this->kernel->setProperty('display_http_code', $dialogInfo['http_status_code']); |
|
540 | 540 | $this->kernel->setProperty('display_reason_code', $dialogInfo['reason_code']); |
541 | 541 | $this->kernel->setProperty('display_reason_text', $dialogInfo['reason_text']); |
542 | 542 | } |
@@ -313,8 +313,9 @@ |
||
313 | 313 | $deniedList = []; |
314 | 314 | |
315 | 315 | foreach ($ipList as $ip) { |
316 | - if (empty($ip)) |
|
317 | - continue; |
|
316 | + if (empty($ip)) { |
|
317 | + continue; |
|
318 | + } |
|
318 | 319 | |
319 | 320 | if (0 === strpos($this->kernel->getCurrentUrl(), empty($ip['url']) ? '/' : $ip['url']) ) { |
320 | 321 |
@@ -347,18 +347,18 @@ discard block |
||
347 | 347 | |
348 | 348 | $results['captcha_chart_string'] = ''; // string |
349 | 349 | $results['pageview_chart_string'] = ''; // string |
350 | - $results['captcha_success_count'] = 0; // integer |
|
351 | - $results['captcha_failure_count'] = 0; // integer |
|
352 | - $results['captcha_count'] = 0; // integer |
|
353 | - $results['pageview_count'] = 0; // integer |
|
354 | - $results['captcha_percentageage'] = 0; // integer |
|
355 | - $results['captcha_failure_percentage'] = 0; // integer |
|
356 | - $results['captcha_success_percentage'] = 0; // integer |
|
357 | - $results['action_ban_count'] = 0; // integer |
|
358 | - $results['action_temp_ban_count'] = 0; // integer |
|
359 | - $results['action_unban_count'] = 0; // integer |
|
360 | - $results['blacklist_count'] = 0; // integer |
|
361 | - $results['session_limit_count'] = 0; // integer |
|
350 | + $results['captcha_success_count'] = 0; // integer |
|
351 | + $results['captcha_failure_count'] = 0; // integer |
|
352 | + $results['captcha_count'] = 0; // integer |
|
353 | + $results['pageview_count'] = 0; // integer |
|
354 | + $results['captcha_percentageage'] = 0; // integer |
|
355 | + $results['captcha_failure_percentage'] = 0; // integer |
|
356 | + $results['captcha_success_percentage'] = 0; // integer |
|
357 | + $results['action_ban_count'] = 0; // integer |
|
358 | + $results['action_temp_ban_count'] = 0; // integer |
|
359 | + $results['action_unban_count'] = 0; // integer |
|
360 | + $results['blacklist_count'] = 0; // integer |
|
361 | + $results['session_limit_count'] = 0; // integer |
|
362 | 362 | |
363 | 363 | $ipdData = $this->getIpData(); |
364 | 364 | |
@@ -407,18 +407,18 @@ discard block |
||
407 | 407 | $results['label_chart_string'] = ''; // string |
408 | 408 | $results['captcha_chart_string'] = ''; // string |
409 | 409 | $results['pageview_chart_string'] = ''; // string |
410 | - $results['captcha_success_count'] = 0; // integer |
|
411 | - $results['captcha_failure_count'] = 0; // integer |
|
412 | - $results['captcha_count'] = 0; // integer |
|
413 | - $results['pageview_count'] = 0; // integer |
|
414 | - $results['captcha_percentageage'] = 0; // integer |
|
415 | - $results['captcha_failure_percentage'] = 0; // integer |
|
416 | - $results['captcha_success_percentage'] = 0; // integer |
|
417 | - $results['action_ban_count'] = 0; // integer |
|
418 | - $results['action_temp_ban_count'] = 0; // integer |
|
419 | - $results['action_unban_count'] = 0; // integer |
|
420 | - $results['blacklist_count'] = 0; // integer |
|
421 | - $results['session_limit_count'] = 0; // integer |
|
410 | + $results['captcha_success_count'] = 0; // integer |
|
411 | + $results['captcha_failure_count'] = 0; // integer |
|
412 | + $results['captcha_count'] = 0; // integer |
|
413 | + $results['pageview_count'] = 0; // integer |
|
414 | + $results['captcha_percentageage'] = 0; // integer |
|
415 | + $results['captcha_failure_percentage'] = 0; // integer |
|
416 | + $results['captcha_success_percentage'] = 0; // integer |
|
417 | + $results['action_ban_count'] = 0; // integer |
|
418 | + $results['action_temp_ban_count'] = 0; // integer |
|
419 | + $results['action_unban_count'] = 0; // integer |
|
420 | + $results['blacklist_count'] = 0; // integer |
|
421 | + $results['session_limit_count'] = 0; // integer |
|
422 | 422 | |
423 | 423 | if (!empty($periodData)) { |
424 | 424 | $chartCaptcha = []; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $ip = $log['ip']; |
484 | 484 | $sessionId = $log['session_id']; |
485 | 485 | |
486 | - $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1; |
|
486 | + $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1; |
|
487 | 487 | |
488 | 488 | if ($logActionCode === self::LOG_TEMPORARILY_BAN) { |
489 | 489 | $this->periodDetail[$t][$k]['action_temp_ban_count']++; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if ($enable['post']) { |
88 | 88 | $this->kernel->setClosure( |
89 | 89 | 'xss_post', |
90 | - function () use ($xss) { |
|
90 | + function() use ($xss) { |
|
91 | 91 | if (!empty($_POST)) { |
92 | 92 | foreach (array_keys($_POST) as $k) { |
93 | 93 | $_POST[$k] = $xss->clean($_POST[$k]); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if ($enable['get']) { |
112 | 112 | $this->kernel->setClosure( |
113 | 113 | 'xss_get', |
114 | - function () use ($xss) { |
|
114 | + function() use ($xss) { |
|
115 | 115 | if (!empty($_GET)) { |
116 | 116 | foreach (array_keys($_GET) as $k) { |
117 | 117 | $_GET[$k] = $xss->clean($_GET[$k]); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if ($enable['cookie']) { |
136 | 136 | $this->kernel->setClosure( |
137 | 137 | 'xss_cookie', |
138 | - function () use ($xss) { |
|
138 | + function() use ($xss) { |
|
139 | 139 | if (!empty($_COOKIE)) { |
140 | 140 | foreach (array_keys($_COOKIE) as $k) { |
141 | 141 | $_COOKIE[$k] = $xss->clean($_COOKIE[$k]); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | if (!empty($protectedList)) { |
160 | 160 | $this->kernel->setClosure( |
161 | 161 | 'xss_protection', |
162 | - function () use ($xss, $protectedList) { |
|
162 | + function() use ($xss, $protectedList) { |
|
163 | 163 | foreach ($protectedList as $v) { |
164 | 164 | $k = $v['variable'] ?? 'undefined'; |
165 | 165 |