@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | use function time; |
| 36 | 36 | use function version_compare; |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Cross-Site Scripting protection. |
|
| 40 | - */ |
|
| 38 | + /** |
|
| 39 | + * Cross-Site Scripting protection. |
|
| 40 | + */ |
|
| 41 | 41 | class Xss |
| 42 | 42 | { |
| 43 | 43 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | unset($original); |
| 285 | 285 | |
| 286 | 286 | // Remove evil attributes such as style, onclick and xmlns |
| 287 | - $str = $this->removeEvilAttributes($str, $isImage); |
|
| 287 | + $str = $this->removeEvilAttributes($str, $isImage); |
|
| 288 | 288 | |
| 289 | 289 | /* |
| 290 | 290 | * Sanitize naughty HTML elements |
@@ -448,62 +448,62 @@ discard block |
||
| 448 | 448 | * @param boolean $is_image TRUE if this is an image |
| 449 | 449 | * @return string The string with the evil attributes removed |
| 450 | 450 | */ |
| 451 | - protected function removeEvilAttributes($str, $is_image) |
|
| 452 | - { |
|
| 453 | - // All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns |
|
| 454 | - $evilAttributes = array('on\w*', 'style', 'xmlns', 'formaction', 'form', 'xlink:href'); |
|
| 451 | + protected function removeEvilAttributes($str, $is_image) |
|
| 452 | + { |
|
| 453 | + // All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns |
|
| 454 | + $evilAttributes = array('on\w*', 'style', 'xmlns', 'formaction', 'form', 'xlink:href'); |
|
| 455 | 455 | |
| 456 | - if ($is_image) { |
|
| 457 | - /* |
|
| 456 | + if ($is_image) { |
|
| 457 | + /* |
|
| 458 | 458 | * Adobe Photoshop puts XML metadata into JFIF images, |
| 459 | 459 | * including namespacing, so we have to allow this for images. |
| 460 | 460 | */ |
| 461 | - unset($evilAttributes[array_search('xmlns', $evilAttributes)]); |
|
| 462 | - } |
|
| 461 | + unset($evilAttributes[array_search('xmlns', $evilAttributes)]); |
|
| 462 | + } |
|
| 463 | 463 | |
| 464 | - do { |
|
| 465 | - $count = 0; |
|
| 466 | - $attribs = array(); |
|
| 464 | + do { |
|
| 465 | + $count = 0; |
|
| 466 | + $attribs = array(); |
|
| 467 | 467 | |
| 468 | - // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes) |
|
| 469 | - preg_match_all( |
|
| 468 | + // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes) |
|
| 469 | + preg_match_all( |
|
| 470 | 470 | '/(?<!\w)(' . implode('|', $evilAttributes) . ')\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is', |
| 471 | 471 | $str, |
| 472 | 472 | $matches, |
| 473 | 473 | PREG_SET_ORDER |
| 474 | 474 | ); |
| 475 | 475 | |
| 476 | - foreach ($matches as $attr) { |
|
| 477 | - $attribs[] = preg_quote($attr[0], '/'); |
|
| 478 | - } |
|
| 476 | + foreach ($matches as $attr) { |
|
| 477 | + $attribs[] = preg_quote($attr[0], '/'); |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | - // find occurrences of illegal attribute strings without quotes |
|
| 481 | - preg_match_all( |
|
| 480 | + // find occurrences of illegal attribute strings without quotes |
|
| 481 | + preg_match_all( |
|
| 482 | 482 | '/(?<!\w)(' . implode('|', $evilAttributes) . ')\s*=\s*([^\s>]*)/is', |
| 483 | 483 | $str, |
| 484 | 484 | $matches, |
| 485 | 485 | PREG_SET_ORDER |
| 486 | 486 | ); |
| 487 | 487 | |
| 488 | - foreach ($matches as $attr) { |
|
| 489 | - $attribs[] = preg_quote($attr[0], '/'); |
|
| 490 | - } |
|
| 488 | + foreach ($matches as $attr) { |
|
| 489 | + $attribs[] = preg_quote($attr[0], '/'); |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - // replace illegal attribute strings that are inside an html tag |
|
| 493 | - if (count($attribs) > 0) { |
|
| 494 | - $str = preg_replace( |
|
| 492 | + // replace illegal attribute strings that are inside an html tag |
|
| 493 | + if (count($attribs) > 0) { |
|
| 494 | + $str = preg_replace( |
|
| 495 | 495 | '/(<?)(\/?[^><]+?)([^A-Za-z<>\-])(.*?)(' . implode('|', $attribs) . ')(.*?)([\s><]?)([><]*)/i', |
| 496 | 496 | '$1$2 $4$6$7$8', |
| 497 | 497 | $str, |
| 498 | 498 | -1, |
| 499 | 499 | $count |
| 500 | 500 | ); |
| 501 | - } |
|
| 501 | + } |
|
| 502 | 502 | |
| 503 | - } while ($count); |
|
| 503 | + } while ($count); |
|
| 504 | 504 | |
| 505 | - return $str; |
|
| 506 | - } |
|
| 505 | + return $str; |
|
| 506 | + } |
|
| 507 | 507 | |
| 508 | 508 | /** |
| 509 | 509 | * Random Hash for protecting URLs |
@@ -856,16 +856,16 @@ discard block |
||
| 856 | 856 | * @return bool |
| 857 | 857 | */ |
| 858 | 858 | protected function isPHP($version): bool |
| 859 | - { |
|
| 859 | + { |
|
| 860 | 860 | static $_isPHP; |
| 861 | 861 | |
| 862 | - $version = (string) $version; |
|
| 862 | + $version = (string) $version; |
|
| 863 | 863 | |
| 864 | - if (!isset($_isPHP[$version])) { |
|
| 865 | - $_isPHP[$version] = version_compare(PHP_VERSION, $version, '>='); |
|
| 866 | - } |
|
| 864 | + if (!isset($_isPHP[$version])) { |
|
| 865 | + $_isPHP[$version] = version_compare(PHP_VERSION, $version, '>='); |
|
| 866 | + } |
|
| 867 | 867 | |
| 868 | - return $_isPHP[$version]; |
|
| 869 | - } |
|
| 868 | + return $_isPHP[$version]; |
|
| 869 | + } |
|
| 870 | 870 | } |
| 871 | 871 | |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $this->deniedRegexList = [ |
| 91 | 91 | 'javascript\s*:', |
| 92 | - '\bon\w+=\S+(?=.*>)', // Inline JavaScript. |
|
| 92 | + '\bon\w+=\S+(?=.*>)', // Inline JavaScript. |
|
| 93 | 93 | '(document|(document\.)?window)\.(location|on\w*)', |
| 94 | 94 | 'expression\s*(\(|&\#40;)', // CSS and IE |
| 95 | - 'vbscript\s*:', // IE, surprise! |
|
| 96 | - 'wscript\s*:', // IE |
|
| 97 | - 'jscript\s*:', // IE |
|
| 98 | - 'vbs\s*:', // IE |
|
| 95 | + 'vbscript\s*:', // IE, surprise! |
|
| 96 | + 'wscript\s*:', // IE |
|
| 97 | + 'jscript\s*:', // IE |
|
| 98 | + 'vbs\s*:', // IE |
|
| 99 | 99 | 'Redirect\s+30\d:', |
| 100 | 100 | "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?", |
| 101 | 101 | ]; |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | $words = [ |
| 224 | 224 | 'javascript', 'expression', 'vbscript', 'jscript', 'wscript', |
| 225 | - 'vbs', 'script', 'base64', 'applet', 'alert', |
|
| 226 | - 'document', 'write', 'cookie', 'window', 'confirm', |
|
| 227 | - 'prompt', 'eval', |
|
| 225 | + 'vbs', 'script', 'base64', 'applet', 'alert', |
|
| 226 | + 'document', 'write', 'cookie', 'window', 'confirm', |
|
| 227 | + 'prompt', 'eval', |
|
| 228 | 228 | ]; |
| 229 | 229 | |
| 230 | 230 | foreach ($words as $word) { |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | ); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - } while($original !== $str); |
|
| 282 | + } while ($original !== $str); |
|
| 283 | 283 | |
| 284 | 284 | unset($original); |
| 285 | 285 | |
@@ -581,17 +581,17 @@ discard block |
||
| 581 | 581 | "'", '"', '&', '$', '#', |
| 582 | 582 | '{', '}', '[', ']', '=', |
| 583 | 583 | ';', '?', '%20', '%22', |
| 584 | - '%3c', // < |
|
| 585 | - '%253c', // < |
|
| 586 | - '%3e', // > |
|
| 587 | - '%0e', // > |
|
| 588 | - '%28', // ( |
|
| 589 | - '%29', // ) |
|
| 590 | - '%2528', // ( |
|
| 591 | - '%26', // & |
|
| 592 | - '%24', // $ |
|
| 593 | - '%3f', // ? |
|
| 594 | - '%3b', // ; |
|
| 584 | + '%3c', // < |
|
| 585 | + '%253c', // < |
|
| 586 | + '%3e', // > |
|
| 587 | + '%0e', // > |
|
| 588 | + '%28', // ( |
|
| 589 | + '%29', // ) |
|
| 590 | + '%2528', // ( |
|
| 591 | + '%26', // & |
|
| 592 | + '%24', // $ |
|
| 593 | + '%3f', // ? |
|
| 594 | + '%3b', // ; |
|
| 595 | 595 | '%3d' // = |
| 596 | 596 | ]; |
| 597 | 597 | |
@@ -637,19 +637,19 @@ discard block |
||
| 637 | 637 | protected function sanitizeNaughtyHtml(array $matches): string |
| 638 | 638 | { |
| 639 | 639 | static $naughtyTags = [ |
| 640 | - 'alert', 'prompt', 'confirm', 'applet', 'audio', |
|
| 641 | - 'basefont', 'base', 'behavior', 'bgsound', 'blink', |
|
| 642 | - 'body', 'embed', 'expression', 'form', 'frameset', |
|
| 643 | - 'frame', 'head', 'html', 'ilayer', 'iframe', |
|
| 644 | - 'input', 'button', 'select', 'isindex', 'layer', |
|
| 645 | - 'link', 'meta', 'keygen', 'object', 'plaintext', |
|
| 646 | - 'style', 'script', 'textarea', 'title', 'math', |
|
| 647 | - 'video', 'svg', 'xml', 'xss', |
|
| 640 | + 'alert', 'prompt', 'confirm', 'applet', 'audio', |
|
| 641 | + 'basefont', 'base', 'behavior', 'bgsound', 'blink', |
|
| 642 | + 'body', 'embed', 'expression', 'form', 'frameset', |
|
| 643 | + 'frame', 'head', 'html', 'ilayer', 'iframe', |
|
| 644 | + 'input', 'button', 'select', 'isindex', 'layer', |
|
| 645 | + 'link', 'meta', 'keygen', 'object', 'plaintext', |
|
| 646 | + 'style', 'script', 'textarea', 'title', 'math', |
|
| 647 | + 'video', 'svg', 'xml', 'xss', |
|
| 648 | 648 | ]; |
| 649 | 649 | |
| 650 | 650 | static $evilAttributes = [ |
| 651 | - 'on\w+', 'style', 'xmlns', 'seekSegmentTime', |
|
| 652 | - 'form', 'xlink:href', 'FSCommand', 'formaction', |
|
| 651 | + 'on\w+', 'style', 'xmlns', 'seekSegmentTime', |
|
| 652 | + 'form', 'xlink:href', 'FSCommand', 'formaction', |
|
| 653 | 653 | ]; |
| 654 | 654 | |
| 655 | 655 | // First, escape unclosed tags |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $attributes = empty($attributes) |
| 708 | 708 | ? '' |
| 709 | - : ' '.implode(' ', $attributes); |
|
| 709 | + : ' ' . implode(' ', $attributes); |
|
| 710 | 710 | return '<' . $matches['slash'] . $matches['tagName'] . $attributes . '>'; |
| 711 | 711 | } |
| 712 | 712 | |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | $record['session_id'] = substr($record['session_id'], 0, 4); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $data[0] = $record['ip'] ?? 'null'; |
|
| 104 | - $data[1] = $record['session_id'] ?? 'null'; |
|
| 103 | + $data[0] = $record['ip'] ?? 'null'; |
|
| 104 | + $data[1] = $record['session_id'] ?? 'null'; |
|
| 105 | 105 | $data[2] = $record['action_code'] ?? 'null'; |
| 106 | - $data[3] = $record['timesamp'] ?? 'null'; |
|
| 106 | + $data[3] = $record['timesamp'] ?? 'null'; |
|
| 107 | 107 | |
| 108 | 108 | file_put_contents($this->filePath, implode(',', $data) . "\n", FILE_APPEND | LOCK_EX); |
| 109 | 109 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $it = new RecursiveDirectoryIterator($this->directory, RecursiveDirectoryIterator::SKIP_DOTS); |
| 248 | 248 | $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); |
| 249 | 249 | |
| 250 | - foreach($files as $file) { |
|
| 250 | + foreach ($files as $file) { |
|
| 251 | 251 | if ($file->isDir()) { |
| 252 | 252 | // @codeCoverageIgnoreStart |
| 253 | 253 | rmdir($file->getRealPath()); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $it = new RecursiveDirectoryIterator($this->directory, RecursiveDirectoryIterator::SKIP_DOTS); |
| 278 | 278 | $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); |
| 279 | 279 | |
| 280 | - foreach($files as $file) { |
|
| 280 | + foreach ($files as $file) { |
|
| 281 | 281 | if ($file->isFile()) { |
| 282 | 282 | $key = $file->getBasename('.log'); |
| 283 | 283 | $size = $file->getSize(); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | default: |
| 209 | 209 | |
| 210 | 210 | // We also accept querying N days data from logs. For example: `past_365_days`. |
| 211 | - if (preg_match('/past_([0-9]+)_days/', $this->type, $matches) ) { |
|
| 211 | + if (preg_match('/past_([0-9]+)_days/', $this->type, $matches)) { |
|
| 212 | 212 | |
| 213 | 213 | $dayCount = $matches[1]; |
| 214 | 214 | $startDate = date('Ymd', strtotime('-' . $dayCount . ' days')); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | // Fetch data from log files. |
| 234 | 234 | $logs = $this->logger->get($startDate, $endDate); |
| 235 | 235 | |
| 236 | - foreach($logs as $log) { |
|
| 236 | + foreach ($logs as $log) { |
|
| 237 | 237 | |
| 238 | 238 | $logTimesamp = (int) $log['timesamp']; |
| 239 | 239 | $logIp = $log['ip']; |
@@ -331,21 +331,21 @@ discard block |
||
| 331 | 331 | return []; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - $results['captcha_chart_string'] = ''; // string |
|
| 335 | - $results['pageview_chart_string'] = ''; // string |
|
| 336 | - $results['captcha_success_count'] = 0; // integer |
|
| 337 | - $results['captcha_failure_count'] = 0; // integer |
|
| 338 | - $results['captcha_count'] = 0; // integer |
|
| 339 | - $results['pageview_count'] = 0; // integer |
|
| 340 | - $results['captcha_percentageage'] = 0; // integer |
|
| 334 | + $results['captcha_chart_string'] = ''; // string |
|
| 335 | + $results['pageview_chart_string'] = ''; // string |
|
| 336 | + $results['captcha_success_count'] = 0; // integer |
|
| 337 | + $results['captcha_failure_count'] = 0; // integer |
|
| 338 | + $results['captcha_count'] = 0; // integer |
|
| 339 | + $results['pageview_count'] = 0; // integer |
|
| 340 | + $results['captcha_percentageage'] = 0; // integer |
|
| 341 | 341 | $results['captcha_failure_percentage'] = 0; // integer |
| 342 | 342 | $results['captcha_success_percentage'] = 0; // integer |
| 343 | 343 | |
| 344 | - $results['action_ban_count'] = 0; // integer |
|
| 345 | - $results['action_temp_ban_count'] = 0; // integer |
|
| 346 | - $results['action_unban_count'] = 0; // integer |
|
| 347 | - $results['blacklist_count'] = 0; // integer |
|
| 348 | - $results['session_limit_count'] = 0; // integer |
|
| 344 | + $results['action_ban_count'] = 0; // integer |
|
| 345 | + $results['action_temp_ban_count'] = 0; // integer |
|
| 346 | + $results['action_unban_count'] = 0; // integer |
|
| 347 | + $results['blacklist_count'] = 0; // integer |
|
| 348 | + $results['session_limit_count'] = 0; // integer |
|
| 349 | 349 | |
| 350 | 350 | $ipdData = $this->getIpData(); |
| 351 | 351 | |
@@ -386,22 +386,22 @@ discard block |
||
| 386 | 386 | { |
| 387 | 387 | $periodData = $this->getPeriodData(); |
| 388 | 388 | |
| 389 | - $results['captcha_chart_string'] = ''; // string |
|
| 390 | - $results['pageview_chart_string'] = ''; // string |
|
| 391 | - $results['label_chart_string'] = ''; // string |
|
| 392 | - $results['captcha_success_count'] = 0; // integer |
|
| 393 | - $results['captcha_failure_count'] = 0; // integer |
|
| 394 | - $results['captcha_count'] = 0; // integer |
|
| 395 | - $results['pageview_count'] = 0; // integer |
|
| 396 | - $results['captcha_percentageage'] = 0; // integer |
|
| 389 | + $results['captcha_chart_string'] = ''; // string |
|
| 390 | + $results['pageview_chart_string'] = ''; // string |
|
| 391 | + $results['label_chart_string'] = ''; // string |
|
| 392 | + $results['captcha_success_count'] = 0; // integer |
|
| 393 | + $results['captcha_failure_count'] = 0; // integer |
|
| 394 | + $results['captcha_count'] = 0; // integer |
|
| 395 | + $results['pageview_count'] = 0; // integer |
|
| 396 | + $results['captcha_percentageage'] = 0; // integer |
|
| 397 | 397 | $results['captcha_failure_percentage'] = 0; // integer |
| 398 | 398 | $results['captcha_success_percentage'] = 0; // integer |
| 399 | 399 | |
| 400 | - $results['action_ban_count'] = 0; // integer |
|
| 401 | - $results['action_temp_ban_count'] = 0; // integer |
|
| 402 | - $results['action_unban_count'] = 0; // integer |
|
| 403 | - $results['blacklist_count'] = 0; // integer |
|
| 404 | - $results['session_limit_count'] = 0; // integer |
|
| 400 | + $results['action_ban_count'] = 0; // integer |
|
| 401 | + $results['action_temp_ban_count'] = 0; // integer |
|
| 402 | + $results['action_unban_count'] = 0; // integer |
|
| 403 | + $results['blacklist_count'] = 0; // integer |
|
| 404 | + $results['session_limit_count'] = 0; // integer |
|
| 405 | 405 | |
| 406 | 406 | if (!empty($periodData)) { |
| 407 | 407 | |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | $results['captcha_chart_string'] = implode(',', $chartCaptcha); |
| 434 | - $results['pageview_chart_string']= implode(',', $chartPageview); |
|
| 434 | + $results['pageview_chart_string'] = implode(',', $chartPageview); |
|
| 435 | 435 | $results['captcha_success_chart_string'] = implode(',', $chartCaptchaSuccess); |
| 436 | 436 | $results['captcha_failure_chart_string'] = implode(',', $chartCaptchaFailure); |
| 437 | 437 | $results['label_chart_string'] = "'" . implode("','", $labels) . "'"; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $ip = $log['ip']; |
| 462 | 462 | $sessionId = $log['session_id']; |
| 463 | 463 | |
| 464 | - $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1; |
|
| 464 | + $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1; |
|
| 465 | 465 | |
| 466 | 466 | if ($logActionCode === self::LOG_TEMPORARILY_BAN) { |
| 467 | 467 | $this->periodDetail[$t][$k]['action_temp_ban_count']++; |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | $masked = implode('.', $tmp); |
| 168 | 168 | |
| 169 | 169 | } else { |
| 170 | - $masked = str_repeat('*', strlen($str) - 6) . substr(str, -6); |
|
| 170 | + $masked = str_repeat('*', strlen($str) - 6) . substr(str, -6); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $masked; |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | if ( |
| 58 | 58 | // Default password, unencrypted. |
| 59 | - $admin['user'] === $postParams['s_user'] && |
|
| 59 | + $admin['user'] === $postParams['s_user'] && |
|
| 60 | 60 | 'shieldon_pass' === $postParams['s_pass'] && |
| 61 | 61 | 'shieldon_pass' === $admin['pass'] |
| 62 | 62 | ) { |
@@ -171,11 +171,11 @@ |
||
| 171 | 171 | */ |
| 172 | 172 | |
| 173 | 173 | $data['components'] = [ |
| 174 | - 'Ip' => (!empty($this->kernel->component['Ip'])) ? true : false, |
|
| 174 | + 'Ip' => (!empty($this->kernel->component['Ip'])) ? true : false, |
|
| 175 | 175 | 'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false, |
| 176 | - 'Header' => (!empty($this->kernel->component['Header'])) ? true : false, |
|
| 177 | - 'Rdns' => (!empty($this->kernel->component['Rdns'])) ? true : false, |
|
| 178 | - 'UserAgent' => (!empty($this->kernel->component['UserAgent'])) ? true : false, |
|
| 176 | + 'Header' => (!empty($this->kernel->component['Header'])) ? true : false, |
|
| 177 | + 'Rdns' => (!empty($this->kernel->component['Rdns'])) ? true : false, |
|
| 178 | + 'UserAgent' => (!empty($this->kernel->component['UserAgent'])) ? true : false, |
|
| 179 | 179 | ]; |
| 180 | 180 | |
| 181 | 181 | $reflection = new ReflectionObject($this->kernel); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | define('SHIELDON_VIEW', true); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $viewFilePath = __DIR__ . '/../../../templates/' . $page . '.php'; |
|
| 177 | + $viewFilePath = __DIR__ . '/../../../templates/' . $page . '.php'; |
|
| 178 | 178 | |
| 179 | 179 | if (!empty($data)) { |
| 180 | 180 | extract($data); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } else { |
| 366 | 366 | if (is_numeric($postData)) { |
| 367 | 367 | $this->setConfig(str_replace('__', '.', $postKey), (int) $postData); |
| 368 | - } else { |
|
| 368 | + } else { |
|
| 369 | 369 | $this->setConfig(str_replace('__', '.', $postKey), $postData); |
| 370 | 370 | } |
| 371 | 371 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | (string) $db['user'], |
| 396 | 396 | (string) $db['pass'] |
| 397 | 397 | ); |
| 398 | - } catch(PDOException $e) { |
|
| 398 | + } catch (PDOException $e) { |
|
| 399 | 399 | $isDataDriverFailed = true; |
| 400 | 400 | $this->pushMessage('error', |
| 401 | 401 | __( |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | if (class_exists('PDO')) { |
| 441 | 441 | try { |
| 442 | 442 | $pdo = new PDO('sqlite:' . $sqliteFilePath); |
| 443 | - } catch(PDOException $e) { |
|
| 443 | + } catch (PDOException $e) { |
|
| 444 | 444 | $isDataDriverFailed = true; |
| 445 | 445 | $this->pushMessage('error', $e->getMessage()); |
| 446 | 446 | } |
@@ -475,9 +475,9 @@ discard block |
||
| 475 | 475 | $redis = new Redis(); |
| 476 | 476 | $redis->connect( |
| 477 | 477 | (string) $this->getConfig('drivers.redis.host'), |
| 478 | - (int) $this->getConfig('drivers.redis.port') |
|
| 478 | + (int) $this->getConfig('drivers.redis.port') |
|
| 479 | 479 | ); |
| 480 | - } catch(RedisException $e) { |
|
| 480 | + } catch (RedisException $e) { |
|
| 481 | 481 | $isDataDriverFailed = true; |
| 482 | 482 | $this->pushMessage('error', $e->getMessage()); |
| 483 | 483 | } |
@@ -573,10 +573,10 @@ discard block |
||
| 573 | 573 | // Create default log files. |
| 574 | 574 | if (is_writable($iptablesWatchingFolder)) { |
| 575 | 575 | fopen($iptablesWatchingFolder . '/iptables_queue.log', 'w+'); |
| 576 | - fopen($iptablesWatchingFolder . '/ipv4_status.log', 'w+'); |
|
| 577 | - fopen($iptablesWatchingFolder . '/ipv6_status.log', 'w+'); |
|
| 578 | - fopen($iptablesWatchingFolder . '/ipv4_command.log', 'w+'); |
|
| 579 | - fopen($iptablesWatchingFolder . '/ipv6_command.log', 'w+'); |
|
| 576 | + fopen($iptablesWatchingFolder . '/ipv4_status.log', 'w+'); |
|
| 577 | + fopen($iptablesWatchingFolder . '/ipv6_status.log', 'w+'); |
|
| 578 | + fopen($iptablesWatchingFolder . '/ipv4_command.log', 'w+'); |
|
| 579 | + fopen($iptablesWatchingFolder . '/ipv6_command.log', 'w+'); |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | public function operation(): ResponseInterface |
| 43 | 43 | { |
| 44 | 44 | $data['components'] = [ |
| 45 | - 'Ip' => (!empty($this->kernel->component['Ip'])) ? true : false, |
|
| 45 | + 'Ip' => (!empty($this->kernel->component['Ip'])) ? true : false, |
|
| 46 | 46 | 'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false, |
| 47 | - 'Header' => (!empty($this->kernel->component['Header'])) ? true : false, |
|
| 48 | - 'Rdns' => (!empty($this->kernel->component['Rdns'])) ? true : false, |
|
| 49 | - 'UserAgent' => (!empty($this->kernel->component['UserAgent'])) ? true : false, |
|
| 47 | + 'Header' => (!empty($this->kernel->component['Header'])) ? true : false, |
|
| 48 | + 'Rdns' => (!empty($this->kernel->component['Rdns'])) ? true : false, |
|
| 49 | + 'UserAgent' => (!empty($this->kernel->component['UserAgent'])) ? true : false, |
|
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | 52 | $reflection = new ReflectionObject($this->kernel); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $data['period_data'] = $ipDetailsCachedData['period_data']; |
| 219 | 219 | $lastCachedTime = date('Y-m-d H:i:s', $ipDetailsCachedData['time']); |
| 220 | 220 | |
| 221 | - if ('today' === $type ) { |
|
| 221 | + if ('today' === $type) { |
|
| 222 | 222 | $ipDetailsCachedData = $logCacheHandler->get('past_seven_hours'); |
| 223 | 223 | $data['past_seven_hours'] = $ipDetailsCachedData['period_data']; |
| 224 | 224 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $logCacheHandler->save($type, $data); |
| 234 | 234 | |
| 235 | - if ('today' === $type ) { |
|
| 235 | + if ('today' === $type) { |
|
| 236 | 236 | $this->parser->prepare('past_seven_hours'); |
| 237 | 237 | $data['past_seven_hours'] = $this->parser->getParsedPeriodData(); |
| 238 | 238 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | 16 | <div class="so-dashboard"> |
| 17 | - <?php if (! empty($period_data)) : ?> |
|
| 17 | + <?php if (!empty($period_data)) : ?> |
|
| 18 | 18 | <div class="so-flex"> |
| 19 | 19 | <div class="so-board"> |
| 20 | 20 | <div class="board-field left"> |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | </tr> |
| 86 | 86 | </thead> |
| 87 | 87 | <tbody> |
| 88 | - <?php if (! empty($ip_details)) : ?> |
|
| 89 | - <?php foreach($ip_details as $ip => $ipInfo) : ?> |
|
| 88 | + <?php if (!empty($ip_details)) : ?> |
|
| 89 | + <?php foreach ($ip_details as $ip => $ipInfo) : ?> |
|
| 90 | 90 | <tr> |
| 91 | 91 | <td> |
| 92 | 92 | <?php if ($this->mode === 'demo') : ?> |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | </table> |
| 109 | 109 | </div> |
| 110 | 110 | <div class="so-timezone"> |
| 111 | - <?php if (! empty($last_cached_time)) : ?> |
|
| 111 | + <?php if (!empty($last_cached_time)) : ?> |
|
| 112 | 112 | <?php _e('panel', 'log_label_cache_time', 'Report generated time'); ?>: <strong class="text-info"><?php echo $last_cached_time; ?></strong> |
| 113 | 113 | |
| 114 | 114 | <?php endif; ?> |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | <?php |
| 120 | 120 | |
| 121 | - if (! empty($period_data)) { |
|
| 121 | + if (!empty($period_data)) { |
|
| 122 | 122 | $data['period_data'] = $period_data; |
| 123 | 123 | $this->_include('panel/js/chart', $data); |
| 124 | 124 | } |
@@ -60,9 +60,12 @@ |
||
| 60 | 60 | </div> |
| 61 | 61 | </div> |
| 62 | 62 | </div> |
| 63 | - <?php else : ?> |
|
| 63 | + <?php else { |
|
| 64 | + : ?> |
|
| 64 | 65 | <div class="alert alert-danger"> |
| 65 | - <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.'); ?> |
|
| 66 | + <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.'); |
|
| 67 | +} |
|
| 68 | +?> |
|
| 66 | 69 | |
| 67 | 70 | </div> |
| 68 | 71 | <?php endif; ?> |