@@ -37,9 +37,9 @@ |
||
| 37 | 37 | <?php _e('core', 'deny_message', 'The IP address you are using has been blocked.') ?> |
| 38 | 38 | </div> |
| 39 | 39 | </div> |
| 40 | - <?php if (! empty($dialoguserinfo)) : ?> |
|
| 40 | + <?php if (!empty($dialoguserinfo)) : ?> |
|
| 41 | 41 | <div class="status-user-info"> |
| 42 | - <?php foreach($dialoguserinfo as $key => $userinfo) : ?> |
|
| 42 | + <?php foreach ($dialoguserinfo as $key => $userinfo) : ?> |
|
| 43 | 43 | <div class="row"> |
| 44 | 44 | <strong><?php echo $key; ?></strong> <span><?php echo $userinfo; ?></span> |
| 45 | 45 | </div> |
@@ -46,9 +46,9 @@ |
||
| 46 | 46 | <p><input type="submit" value="<?php _e('core', 'stop_submit', 'Submit') ?>" /></p> |
| 47 | 47 | </form> |
| 48 | 48 | </div> |
| 49 | - <?php if (! empty($dialoguserinfo)) : ?> |
|
| 49 | + <?php if (!empty($dialoguserinfo)) : ?> |
|
| 50 | 50 | <div class="status-user-info"> |
| 51 | - <?php foreach($dialoguserinfo as $key => $userinfo) : ?> |
|
| 51 | + <?php foreach ($dialoguserinfo as $key => $userinfo) : ?> |
|
| 52 | 52 | <div class="row"> |
| 53 | 53 | <strong><?php echo $key; ?></strong> <span><?php echo $userinfo; ?></span> |
| 54 | 54 | </div> |
@@ -9,6 +9,6 @@ |
||
| 9 | 9 | * file that was distributed with this source code. |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -require __DIR__. '/src/Shieldon/Autoloader.php'; |
|
| 12 | +require __DIR__ . '/src/Shieldon/Autoloader.php'; |
|
| 13 | 13 | |
| 14 | 14 | Shieldon\Autoloader::register(); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * |
| 389 | 389 | * @return void |
| 390 | 390 | */ |
| 391 | - public function __construct(array $properties = [], string $sessionId = '') |
|
| 391 | + public function __construct(array $properties = [], string $sessionId = '') |
|
| 392 | 392 | { |
| 393 | 393 | // Set to container. |
| 394 | 394 | Container::set('shieldon', $this); |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | // At least load a captcha instance. Foundation is the base one. |
| 401 | 401 | $this->setCaptcha(new \Shieldon\Captcha\Foundation()); |
| 402 | 402 | |
| 403 | - if (! empty($properties)) { |
|
| 403 | + if (!empty($properties)) { |
|
| 404 | 404 | $this->setProperties($properties); |
| 405 | 405 | } |
| 406 | 406 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | $logData['first_time_flag'] = $ipDetail['first_time_flag']; |
| 451 | 451 | |
| 452 | - if (! empty($ipDetail['ip'])) { |
|
| 452 | + if (!empty($ipDetail['ip'])) { |
|
| 453 | 453 | $logData['ip'] = $this->ip; |
| 454 | 454 | $logData['session'] = $this->sessionId; |
| 455 | 455 | $logData['hostname'] = $this->ipResolvedHostname; |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | if ($this->enableCookieCheck) { |
| 510 | 510 | |
| 511 | 511 | // Get values from data table. We will count it and save it back to data table. |
| 512 | - $logData['flag_js_cookie'] = $ipDetail['flag_js_cookie'] ?? 0; |
|
| 512 | + $logData['flag_js_cookie'] = $ipDetail['flag_js_cookie'] ?? 0; |
|
| 513 | 513 | $logData['pageviews_cookie'] = $ipDetail['pageviews_cookie'] ?? 0; |
| 514 | 514 | |
| 515 | 515 | $c = $this->properties['cookie_name']; |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | $jsCookie = $_COOKIE[$c] ?? 0; |
| 518 | 518 | |
| 519 | 519 | // Checking if a cookie is created by JavaScript. |
| 520 | - if (! empty($jsCookie)) { |
|
| 520 | + if (!empty($jsCookie)) { |
|
| 521 | 521 | |
| 522 | 522 | if ($jsCookie == '1') { |
| 523 | 523 | $logData['pageviews_cookie']++; |
@@ -559,9 +559,9 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | foreach (array_keys($this->properties['time_unit_quota']) as $timeUnit) { |
| 561 | 561 | switch ($timeUnit) { |
| 562 | - case 's': $timeSecond = 1; break; |
|
| 563 | - case 'm': $timeSecond = 60; break; |
|
| 564 | - case 'h': $timeSecond = 3600; break; |
|
| 562 | + case 's': $timeSecond = 1; break; |
|
| 563 | + case 'm': $timeSecond = 60; break; |
|
| 564 | + case 'h': $timeSecond = 3600; break; |
|
| 565 | 565 | case 'd': $timeSecond = 86400; break; |
| 566 | 566 | } |
| 567 | 567 | if (($now - $ipDetail["first_time_{$timeUnit}"]) >= ($timeSecond + 1)) { |
@@ -601,11 +601,11 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | // Is fagged as unusual beavior? Count the first time. |
| 603 | 603 | if ($isFlaggedAsUnusualBehavior) { |
| 604 | - $logData['first_time_flag'] = (! empty($logData['first_time_flag'])) ? $logData['first_time_flag'] : $now; |
|
| 604 | + $logData['first_time_flag'] = (!empty($logData['first_time_flag'])) ? $logData['first_time_flag'] : $now; |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | // Reset the flagged factor check. |
| 608 | - if (! empty($ipDetail['first_time_flag'])) { |
|
| 608 | + if (!empty($ipDetail['first_time_flag'])) { |
|
| 609 | 609 | if ($now - $ipDetail['first_time_flag'] >= $this->properties['time_reset_limit']) { |
| 610 | 610 | $logData['flag_multi_session'] = 0; |
| 611 | 611 | $logData['flag_empty_referer'] = 0; |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | $currentSessionOrder = 0; |
| 737 | 737 | |
| 738 | 738 | //die('<pre>' . var_dump($onlineSessions) . '</pre>'); |
| 739 | - if (! empty($onlineSessions)) { |
|
| 739 | + if (!empty($onlineSessions)) { |
|
| 740 | 740 | foreach ($onlineSessions as $k => $v) { |
| 741 | 741 | $sessionPools[] = $v['id']; |
| 742 | 742 | $lasttime = (int) $v['time']; |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | $this->currentSessionOrder = $currentSessionOrder; |
| 765 | 765 | $this->currentWaitNumber = $currentSessionOrder - $limit; |
| 766 | 766 | |
| 767 | - if (! in_array($this->sessionId, $sessionPools)) { |
|
| 767 | + if (!in_array($this->sessionId, $sessionPools)) { |
|
| 768 | 768 | $this->sessionCount++; |
| 769 | 769 | |
| 770 | 770 | // New session, record this data. |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | if (session_status() === PHP_SESSION_NONE) { |
| 808 | 808 | session_start(); |
| 809 | 809 | } |
| 810 | - if (! $this->sessionId) { |
|
| 810 | + if (!$this->sessionId) { |
|
| 811 | 811 | $this->sessionId = session_id(); |
| 812 | 812 | } |
| 813 | 813 | } |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | */ |
| 909 | 909 | public function setChannel(string $channel): self |
| 910 | 910 | { |
| 911 | - if (! $this->driver instanceof DriverProvider) { |
|
| 911 | + if (!$this->driver instanceof DriverProvider) { |
|
| 912 | 912 | throw new LogicException('setChannel method requires setDriver set first.'); |
| 913 | 913 | } else { |
| 914 | 914 | $this->driver->setChannel($channel); |
@@ -945,12 +945,12 @@ discard block |
||
| 945 | 945 | public function captchaResponse(): bool |
| 946 | 946 | { |
| 947 | 947 | foreach ($this->captcha as $captcha) { |
| 948 | - if (! $captcha->response()) { |
|
| 948 | + if (!$captcha->response()) { |
|
| 949 | 949 | return false; |
| 950 | 950 | } |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | - if (! empty($this->isLimitSession)) { |
|
| 953 | + if (!empty($this->isLimitSession)) { |
|
| 954 | 954 | $this->result = $this->sessionHandler(self::RESPONSE_ALLOW); |
| 955 | 955 | } |
| 956 | 956 | |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | |
| 974 | 974 | |
| 975 | 975 | $class = substr($class, strrpos($class, '\\') + 1); |
| 976 | - $this->component[$class] =& $instance; |
|
| 976 | + $this->component[$class] = & $instance; |
|
| 977 | 977 | |
| 978 | 978 | } |
| 979 | 979 | |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | |
| 1176 | 1176 | if (file_exists($viewPath)) { |
| 1177 | 1177 | |
| 1178 | - if (! defined('SHIELDON_VIEW')) { |
|
| 1178 | + if (!defined('SHIELDON_VIEW')) { |
|
| 1179 | 1179 | define('SHIELDON_VIEW', true); |
| 1180 | 1180 | } |
| 1181 | 1181 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | public function run(): int |
| 1252 | 1252 | { |
| 1253 | 1253 | // Ignore the excluded urls. |
| 1254 | - if (! empty($this->excludedUrls)) { |
|
| 1254 | + if (!empty($this->excludedUrls)) { |
|
| 1255 | 1255 | foreach ($this->excludedUrls as $url) { |
| 1256 | 1256 | if (0 === strpos($this->currentUrl, $url)) { |
| 1257 | 1257 | return $this->result = self::RESPONSE_ALLOW; |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | $ipRule = $this->driver->get($this->ip, 'rule'); |
| 1344 | 1344 | |
| 1345 | - if (! empty($ipRule)) { |
|
| 1345 | + if (!empty($ipRule)) { |
|
| 1346 | 1346 | |
| 1347 | 1347 | $ruleType = (int) $ipRule['type']; |
| 1348 | 1348 | |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | |
| 1564 | 1564 | $result = $this->getComponent('Ip')->check(); |
| 1565 | 1565 | |
| 1566 | - if (! empty($result)) { |
|
| 1566 | + if (!empty($result)) { |
|
| 1567 | 1567 | |
| 1568 | 1568 | switch ($result['status']) { |
| 1569 | 1569 | |
@@ -1701,7 +1701,7 @@ discard block |
||
| 1701 | 1701 | */ |
| 1702 | 1702 | public function getSessionId(): string |
| 1703 | 1703 | { |
| 1704 | - if (! empty($this->sessionId)) { |
|
| 1704 | + if (!empty($this->sessionId)) { |
|
| 1705 | 1705 | return $this->sessionId; |
| 1706 | 1706 | } |
| 1707 | 1707 | |
@@ -577,10 +577,18 @@ |
||
| 577 | 577 | // He or she will get banned. |
| 578 | 578 | if ($logData["pageviews_{$timeUnit}"] > $this->properties['time_unit_quota'][$timeUnit]) { |
| 579 | 579 | |
| 580 | - if ($timeUnit === 's') $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_SECOND); |
|
| 581 | - if ($timeUnit === 'm') $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_MINUTE); |
|
| 582 | - if ($timeUnit === 'h') $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_HOUR); |
|
| 583 | - if ($timeUnit === 'd') $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_DAY); |
|
| 580 | + if ($timeUnit === 's') { |
|
| 581 | + $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_SECOND); |
|
| 582 | + } |
|
| 583 | + if ($timeUnit === 'm') { |
|
| 584 | + $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_MINUTE); |
|
| 585 | + } |
|
| 586 | + if ($timeUnit === 'h') { |
|
| 587 | + $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_HOUR); |
|
| 588 | + } |
|
| 589 | + if ($timeUnit === 'd') { |
|
| 590 | + $this->action(self::ACTION_TEMPORARILY_DENY, self::REASON_REACHED_LIMIT_DAY); |
|
| 591 | + } |
|
| 584 | 592 | |
| 585 | 593 | return self::RESPONSE_TEMPORARILY_DENY; |
| 586 | 594 | } |
@@ -33,8 +33,8 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function send(string $message): bool |
| 35 | 35 | { |
| 36 | - if (! empty($message)) { |
|
| 37 | - echo "\n" . $this->provider() . "\n";; |
|
| 36 | + if (!empty($message)) { |
|
| 37 | + echo "\n" . $this->provider() . "\n"; ; |
|
| 38 | 38 | echo "\n--- BEGIN - Mock of sending message ---\n\n"; |
| 39 | 39 | echo $message; |
| 40 | 40 | echo "\n--- END - Mock of sending message ---\n"; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // If we don't get the string from the localization file, use placeholder instead. |
| 75 | 75 | $resultString = $placeholder; |
| 76 | 76 | |
| 77 | - if (! empty($i18n[$filename][$langcode])) { |
|
| 77 | + if (!empty($i18n[$filename][$langcode])) { |
|
| 78 | 78 | $resultString = $i18n[$filename][$langcode]; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $masked = implode('.', $tmp); |
| 128 | 128 | |
| 129 | 129 | } else { |
| 130 | - $masked = str_repeat('*', strlen($str) - 6) . substr(str, -6); |
|
| 130 | + $masked = str_repeat('*', strlen($str) - 6) . substr(str, -6); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | return $masked; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $cpuLoads = @sys_getloadavg(); |
| 155 | 155 | $cpuCores = trim(@shell_exec("grep -P '^processor' /proc/cpuinfo|wc -l")); |
| 156 | 156 | |
| 157 | - if (! empty($cpuCores) && ! empty($cpuLoads)) { |
|
| 157 | + if (!empty($cpuCores) && !empty($cpuLoads)) { |
|
| 158 | 158 | $return = round($cpuLoads[1] / ($cpuCores + 1) * 100, 0) . '%'; |
| 159 | 159 | } |
| 160 | 160 | return $return; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $freeResult = explode("\n", trim(@shell_exec('free'))); |
| 181 | 181 | |
| 182 | - if (! empty($freeResult)) { |
|
| 182 | + if (!empty($freeResult)) { |
|
| 183 | 183 | $parsed = preg_split("/[\s]+/", $freeResult[1]); |
| 184 | 184 | $return = round($parsed[2] / $parsed[1] * 100, 0) . '%'; |
| 185 | 185 | } |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | $keepCache = false; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if (! $keepCache) { |
|
| 122 | + if (!$keepCache) { |
|
| 123 | 123 | $data = []; |
| 124 | 124 | } |
| 125 | 125 | // @codeCoverageIgnoreEnd |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function add(array $record): void |
| 96 | 96 | { |
| 97 | - if (! empty($record['session_id'])) { |
|
| 97 | + if (!empty($record['session_id'])) { |
|
| 98 | 98 | $record['session_id'] = substr($record['session_id'], 0, 4); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $data[0] = $record['ip'] ?? 'null'; |
|
| 102 | - $data[1] = $record['session_id'] ?? 'null'; |
|
| 101 | + $data[0] = $record['ip'] ?? 'null'; |
|
| 102 | + $data[1] = $record['session_id'] ?? 'null'; |
|
| 103 | 103 | $data[2] = $record['action_code'] ?? 'null'; |
| 104 | - $data[3] = $record['timesamp'] ?? 'null'; |
|
| 104 | + $data[3] = $record['timesamp'] ?? 'null'; |
|
| 105 | 105 | |
| 106 | 106 | file_put_contents($this->filePath, implode(',', $data) . "\n", FILE_APPEND | LOCK_EX); |
| 107 | 107 | } |
@@ -131,14 +131,14 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $logFile = fopen($this->filePath, 'r'); |
| 133 | 133 | |
| 134 | - while (! feof($logFile)) { |
|
| 134 | + while (!feof($logFile)) { |
|
| 135 | 135 | $line = fgets($logFile); |
| 136 | 136 | |
| 137 | - if (! empty($line)) { |
|
| 137 | + if (!empty($line)) { |
|
| 138 | 138 | $data = explode(',', trim($line)); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if (! empty($data[0])) { |
|
| 141 | + if (!empty($data[0])) { |
|
| 142 | 142 | $results[] = [ |
| 143 | 143 | 'ip' => $data[0], |
| 144 | 144 | 'session_id' => $data[1], |
@@ -173,14 +173,14 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $logFile = fopen($thisDayLogFile, 'r'); |
| 175 | 175 | |
| 176 | - while (! feof($logFile)) { |
|
| 176 | + while (!feof($logFile)) { |
|
| 177 | 177 | $line = fgets($logFile); |
| 178 | 178 | |
| 179 | - if (! empty($line)) { |
|
| 179 | + if (!empty($line)) { |
|
| 180 | 180 | $data = explode(',', trim($line)); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if (! empty($data[0])) { |
|
| 183 | + if (!empty($data[0])) { |
|
| 184 | 184 | $results[] = [ |
| 185 | 185 | 'ip' => $data[0], |
| 186 | 186 | 'session_id' => $data[1], |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | { |
| 208 | 208 | $result = true; |
| 209 | 209 | |
| 210 | - if (! is_dir($this->directory)) { |
|
| 210 | + if (!is_dir($this->directory)) { |
|
| 211 | 211 | $originalUmask = umask(0); |
| 212 | 212 | $result = @mkdir($this->directory, 0777, true); |
| 213 | 213 | umask($originalUmask); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | // @codeCoverageIgnoreStart |
| 217 | - if (! is_writable($this->directory)) { |
|
| 217 | + if (!is_writable($this->directory)) { |
|
| 218 | 218 | throw new RuntimeException('The directory usded by ActionLogger must be writable. (' . $this->directory . ')'); |
| 219 | 219 | } |
| 220 | 220 | // @codeCoverageIgnoreEnd |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $it = new RecursiveDirectoryIterator($this->directory, RecursiveDirectoryIterator::SKIP_DOTS); |
| 246 | 246 | $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); |
| 247 | 247 | |
| 248 | - foreach($files as $file) { |
|
| 248 | + foreach ($files as $file) { |
|
| 249 | 249 | if ($file->isDir()) { |
| 250 | 250 | // @codeCoverageIgnoreStart |
| 251 | 251 | rmdir($file->getRealPath()); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $it = new RecursiveDirectoryIterator($this->directory, RecursiveDirectoryIterator::SKIP_DOTS); |
| 276 | 276 | $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); |
| 277 | 277 | |
| 278 | - foreach($files as $file) { |
|
| 278 | + foreach ($files as $file) { |
|
| 279 | 279 | if ($file->isFile()) { |
| 280 | 280 | $key = $file->getBasename('.log'); |
| 281 | 281 | $size = $file->getSize(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function __construct(string $directory = '') |
| 89 | 89 | { |
| 90 | - if (! isset($this->logger)) { |
|
| 90 | + if (!isset($this->logger)) { |
|
| 91 | 91 | $this->logger = new Logger($directory); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | default: |
| 207 | 207 | |
| 208 | 208 | // We also accept querying N days data from logs. For example: `past_365_days`. |
| 209 | - if (preg_match('/past_([0-9]+)_days/', $this->type, $matches) ) { |
|
| 209 | + if (preg_match('/past_([0-9]+)_days/', $this->type, $matches)) { |
|
| 210 | 210 | |
| 211 | 211 | $dayCount = $matches[1]; |
| 212 | 212 | $startDate = date('Ymd', strtotime('-' . $dayCount . ' days')); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | // Fetch data from log files. |
| 232 | 232 | $logs = $this->logger->get($startDate, $endDate); |
| 233 | 233 | |
| 234 | - foreach($logs as $log) { |
|
| 234 | + foreach ($logs as $log) { |
|
| 235 | 235 | |
| 236 | 236 | $logTimesamp = (int) $log['timesamp']; |
| 237 | 237 | $logIp = $log['ip']; |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | // Initialize all the counters. |
| 254 | 254 | foreach ($this->fields as $field) { |
| 255 | - if (! isset($this->periodDetail[$t][$k][$field])) { |
|
| 255 | + if (!isset($this->periodDetail[$t][$k][$field])) { |
|
| 256 | 256 | $this->periodDetail[$t][$k][$field] = 0; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | if ($logTimesamp >= $detailTimesampBegin && $logTimesamp < $detailTimesampEnd) { |
| 260 | - if (! isset($this->ipDetail[$t][$logIp][$field])) { |
|
| 260 | + if (!isset($this->ipDetail[$t][$logIp][$field])) { |
|
| 261 | 261 | $this->ipDetail[$t][$logIp][$field] = 0; |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | public function getPeriodData() |
| 299 | 299 | { |
| 300 | - if (! empty($this->periodDetail[$this->type])) { |
|
| 300 | + if (!empty($this->periodDetail[$this->type])) { |
|
| 301 | 301 | return $this->periodDetail[$this->type]; |
| 302 | 302 | } |
| 303 | 303 | return []; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function getIpData() |
| 312 | 312 | { |
| 313 | - if (! empty($this->ipDetail[$this->type])) { |
|
| 313 | + if (!empty($this->ipDetail[$this->type])) { |
|
| 314 | 314 | return $this->ipDetail[$this->type]; |
| 315 | 315 | } |
| 316 | 316 | return []; |
@@ -329,25 +329,25 @@ discard block |
||
| 329 | 329 | return []; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - $results['captcha_chart_string'] = ''; // string |
|
| 333 | - $results['pageview_chart_string'] = ''; // string |
|
| 334 | - $results['captcha_success_count'] = 0; // integer |
|
| 335 | - $results['captcha_failure_count'] = 0; // integer |
|
| 336 | - $results['captcha_count'] = 0; // integer |
|
| 337 | - $results['pageview_count'] = 0; // integer |
|
| 338 | - $results['captcha_percentageage'] = 0; // integer |
|
| 332 | + $results['captcha_chart_string'] = ''; // string |
|
| 333 | + $results['pageview_chart_string'] = ''; // string |
|
| 334 | + $results['captcha_success_count'] = 0; // integer |
|
| 335 | + $results['captcha_failure_count'] = 0; // integer |
|
| 336 | + $results['captcha_count'] = 0; // integer |
|
| 337 | + $results['pageview_count'] = 0; // integer |
|
| 338 | + $results['captcha_percentageage'] = 0; // integer |
|
| 339 | 339 | $results['captcha_failure_percentage'] = 0; // integer |
| 340 | 340 | $results['captcha_success_percentage'] = 0; // integer |
| 341 | 341 | |
| 342 | - $results['action_ban_count'] = 0; // integer |
|
| 343 | - $results['action_temp_ban_count'] = 0; // integer |
|
| 344 | - $results['action_unban_count'] = 0; // integer |
|
| 345 | - $results['blacklist_count'] = 0; // integer |
|
| 346 | - $results['session_limit_count'] = 0; // integer |
|
| 342 | + $results['action_ban_count'] = 0; // integer |
|
| 343 | + $results['action_temp_ban_count'] = 0; // integer |
|
| 344 | + $results['action_unban_count'] = 0; // integer |
|
| 345 | + $results['blacklist_count'] = 0; // integer |
|
| 346 | + $results['session_limit_count'] = 0; // integer |
|
| 347 | 347 | |
| 348 | 348 | $ipdData = $this->getIpData(); |
| 349 | 349 | |
| 350 | - if (! empty($ipdData)) { |
|
| 350 | + if (!empty($ipdData)) { |
|
| 351 | 351 | |
| 352 | 352 | foreach ($ipdData as $ipKey => $ipInfo) { |
| 353 | 353 | |
@@ -384,24 +384,24 @@ discard block |
||
| 384 | 384 | { |
| 385 | 385 | $periodData = $this->getPeriodData(); |
| 386 | 386 | |
| 387 | - $results['captcha_chart_string'] = ''; // string |
|
| 388 | - $results['pageview_chart_string'] = ''; // string |
|
| 389 | - $results['label_chart_string'] = ''; // string |
|
| 390 | - $results['captcha_success_count'] = 0; // integer |
|
| 391 | - $results['captcha_failure_count'] = 0; // integer |
|
| 392 | - $results['captcha_count'] = 0; // integer |
|
| 393 | - $results['pageview_count'] = 0; // integer |
|
| 394 | - $results['captcha_percentageage'] = 0; // integer |
|
| 387 | + $results['captcha_chart_string'] = ''; // string |
|
| 388 | + $results['pageview_chart_string'] = ''; // string |
|
| 389 | + $results['label_chart_string'] = ''; // string |
|
| 390 | + $results['captcha_success_count'] = 0; // integer |
|
| 391 | + $results['captcha_failure_count'] = 0; // integer |
|
| 392 | + $results['captcha_count'] = 0; // integer |
|
| 393 | + $results['pageview_count'] = 0; // integer |
|
| 394 | + $results['captcha_percentageage'] = 0; // integer |
|
| 395 | 395 | $results['captcha_failure_percentage'] = 0; // integer |
| 396 | 396 | $results['captcha_success_percentage'] = 0; // integer |
| 397 | 397 | |
| 398 | - $results['action_ban_count'] = 0; // integer |
|
| 399 | - $results['action_temp_ban_count'] = 0; // integer |
|
| 400 | - $results['action_unban_count'] = 0; // integer |
|
| 401 | - $results['blacklist_count'] = 0; // integer |
|
| 402 | - $results['session_limit_count'] = 0; // integer |
|
| 398 | + $results['action_ban_count'] = 0; // integer |
|
| 399 | + $results['action_temp_ban_count'] = 0; // integer |
|
| 400 | + $results['action_unban_count'] = 0; // integer |
|
| 401 | + $results['blacklist_count'] = 0; // integer |
|
| 402 | + $results['session_limit_count'] = 0; // integer |
|
| 403 | 403 | |
| 404 | - if (! empty($periodData)) { |
|
| 404 | + if (!empty($periodData)) { |
|
| 405 | 405 | |
| 406 | 406 | $chartCaptcha = []; |
| 407 | 407 | $chartPageview = []; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | $results['captcha_chart_string'] = implode(',', $chartCaptcha); |
| 432 | - $results['pageview_chart_string']= implode(',', $chartPageview); |
|
| 432 | + $results['pageview_chart_string'] = implode(',', $chartPageview); |
|
| 433 | 433 | $results['captcha_success_chart_string'] = implode(',', $chartCaptchaSuccess); |
| 434 | 434 | $results['captcha_failure_chart_string'] = implode(',', $chartCaptchaFailure); |
| 435 | 435 | $results['label_chart_string'] = "'" . implode("','", $labels) . "'"; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $ip = $log['ip']; |
| 460 | 460 | $sessionId = $log['session_id']; |
| 461 | 461 | |
| 462 | - $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1; |
|
| 462 | + $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1; |
|
| 463 | 463 | |
| 464 | 464 | if ($logActionCode === self::LOG_TEMPORARILY_BAN) { |
| 465 | 465 | $this->periodDetail[$t][$k]['action_temp_ban_count']++; |