@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $data['period_data'] = $ipDetailsCachedData['period_data']; |
128 | 128 | $lastCachedTime = date('Y-m-d H:i:s', $ipDetailsCachedData['time']); |
129 | 129 | |
130 | - if ('today' === $type ) { |
|
130 | + if ('today' === $type) { |
|
131 | 131 | $ipDetailsCachedData = $logCacheHandler->get('past_seven_hours'); |
132 | 132 | $data['past_seven_hours'] = $ipDetailsCachedData['period_data']; |
133 | 133 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $logCacheHandler->save($type, $data); |
143 | 143 | |
144 | - if ('today' === $type ) { |
|
144 | + if ('today' === $type) { |
|
145 | 145 | $this->parser->prepare('past_seven_hours'); |
146 | 146 | $data['past_seven_hours'] = $this->parser->getParsedPeriodData(); |
147 | 147 | |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | private function operationTemplateVarsOfComponents(array $data = []): array |
173 | 173 | { |
174 | 174 | $data['components'] = [ |
175 | - 'Ip' => (!empty($this->kernel->component['Ip'])) ? true : false, |
|
175 | + 'Ip' => (!empty($this->kernel->component['Ip'])) ? true : false, |
|
176 | 176 | 'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false, |
177 | - 'Header' => (!empty($this->kernel->component['Header'])) ? true : false, |
|
178 | - 'Rdns' => (!empty($this->kernel->component['Rdns'])) ? true : false, |
|
179 | - 'UserAgent' => (!empty($this->kernel->component['UserAgent'])) ? true : false, |
|
177 | + 'Header' => (!empty($this->kernel->component['Header'])) ? true : false, |
|
178 | + 'Rdns' => (!empty($this->kernel->component['Rdns'])) ? true : false, |
|
179 | + 'UserAgent' => (!empty($this->kernel->component['UserAgent'])) ? true : false, |
|
180 | 180 | ]; |
181 | 181 | |
182 | 182 | return $data; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | if ( |
98 | 98 | isset($_SERVER['HTTP_HOST']) && |
99 | 99 | strpos($_SERVER['HTTP_HOST'], 'project.lo') !== false |
100 | -) { |
|
100 | +) { |
|
101 | 101 | // `shieldon-doc.lo` is the virtual domain that Terry is using to design CSS for Firewall Panel UI. |
102 | 102 | $staticSrc = 'http://shieldon-doc.lo/static'; |
103 | 103 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | </div> |
331 | 331 | </div> |
332 | 332 | </div> |
333 | - <?php if (! empty($this->messages)) : ?> |
|
333 | + <?php if (!empty($this->messages)) : ?> |
|
334 | 334 | <div id="message-modal" class="modal fade" tabindex="-1" role="dialog"> |
335 | 335 | <div class="modal-dialog modal-dialog-centered modal-lightbox" role="document"> |
336 | 336 | <div class="modal-content"> |
@@ -100,10 +100,10 @@ |
||
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 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | </div> |
40 | 40 | <div class="board-field right"> |
41 | 41 | <div class="heading"><?php _e('panel', 'table_heading_period', 'Period'); ?></div> |
42 | - <div class="nums"><?php echo number_format($session_limit_period ); ?></div> |
|
42 | + <div class="nums"><?php echo number_format($session_limit_period); ?></div> |
|
43 | 43 | <div class="note"><?php _e('panel', 'table_note_period', 'Keep-alive period. (minutes)'); ?></div> |
44 | 44 | </div> |
45 | 45 | </div> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | </div> |
50 | 50 | <div class="board-field right"> |
51 | 51 | <div class="heading"><?php _e('panel', 'table_heading_online', 'Online'); ?></div> |
52 | - <div class="nums"><?php echo number_format($online_count ); ?></div> |
|
52 | + <div class="nums"><?php echo number_format($online_count); ?></div> |
|
53 | 53 | <div class="note"><?php _e('panel', 'table_note_online', 'Online session amount.'); ?></div> |
54 | 54 | </div> |
55 | 55 | </div> |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | $remainsTime = $expires - (time() - $sessionInfo['time']); |
91 | 91 | |
92 | - if ($remainsTime < 1 ) { |
|
92 | + if ($remainsTime < 1) { |
|
93 | 93 | $remainsTime = 0; |
94 | 94 | } |
95 | 95 | |
96 | - if ($i < $session_limit_count ) { |
|
96 | + if ($i < $session_limit_count) { |
|
97 | 97 | $satusName = __('panel', 'table_text_allowable', 'Allowable'); |
98 | 98 | |
99 | - if ($remainsTime < 1 ) { |
|
99 | + if ($remainsTime < 1) { |
|
100 | 100 | $satusName = __('panel', 'table_text_expired', 'Expired'); |
101 | 101 | } |
102 | 102 | } else { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | </div> |
62 | 62 | </div> |
63 | 63 | <br /> |
64 | - <?php if ( empty($ip_list)) : ?> |
|
64 | + <?php if (empty($ip_list)) : ?> |
|
65 | 65 | <div id="so-table-container" class="so-datatables"> |
66 | 66 | <table id="so-datalog" class="cell-border compact stripe responsive" cellspacing="0" width="100%"> |
67 | 67 | <tbody> |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | </tr> |
97 | 97 | </thead> |
98 | 98 | <tbody> |
99 | - <?php if (! empty($ip_list)) : ?> |
|
99 | + <?php if (!empty($ip_list)) : ?> |
|
100 | 100 | <?php foreach ($ip_list as $i => $ipInfo) : ?> |
101 | 101 | <tr> |
102 | 102 | <td><?php echo $i + 1; ?></td> |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | </div> |
120 | 120 | </div> |
121 | 121 | |
122 | -<?php if (! empty($ip_list)) : ?> |
|
122 | +<?php if (!empty($ip_list)) : ?> |
|
123 | 123 | |
124 | 124 | <script> |
125 | 125 |
@@ -87,7 +87,7 @@ |
||
87 | 87 | </tr> |
88 | 88 | </thead> |
89 | 89 | <tbody> |
90 | - <?php if (! empty($authentication_list)) : ?> |
|
90 | + <?php if (!empty($authentication_list)) : ?> |
|
91 | 91 | <?php foreach ($authentication_list as $i => $authInfo) : ?> |
92 | 92 | <tr> |
93 | 93 | <td><?php echo $authInfo['url']; ?></td> |
@@ -58,20 +58,20 @@ |
||
58 | 58 | </thead> |
59 | 59 | <tbody> |
60 | 60 | <?php foreach ($ip_log_list as $ipInfo) : ?> |
61 | - <?php $logData = is_array($ipInfo['log_data']) ? $ipInfo['log_data'] : json_decode($ipInfo['log_data'], true ); ?> |
|
61 | + <?php $logData = is_array($ipInfo['log_data']) ? $ipInfo['log_data'] : json_decode($ipInfo['log_data'], true); ?> |
|
62 | 62 | <?php |
63 | 63 | |
64 | 64 | $text_warning = ''; |
65 | 65 | |
66 | - if ($logData['pageviews_m'] > 6 || $logData['pageviews_h'] > 50 || $logData['pageviews_d'] > 100 ) { |
|
66 | + if ($logData['pageviews_m'] > 6 || $logData['pageviews_h'] > 50 || $logData['pageviews_d'] > 100) { |
|
67 | 67 | $text_warning = '<span class="so-text-warning"><i class="fas fa-exclamation-triangle"></i></span>'; |
68 | 68 | } |
69 | 69 | |
70 | - if ($logData['flag_js_cookie'] > 2 || $logData['flag_multi_session'] > 2 || $logData['flag_empty_referer'] > 2 ) { |
|
70 | + if ($logData['flag_js_cookie'] > 2 || $logData['flag_multi_session'] > 2 || $logData['flag_empty_referer'] > 2) { |
|
71 | 71 | $text_warning = '<span class="so-text-warning"><i class="fas fa-exclamation-triangle"></i></span>'; |
72 | 72 | } |
73 | 73 | |
74 | - if ($logData['flag_js_cookie'] > 3 || $logData['flag_multi_session'] > 3 || $logData['flag_empty_referer'] > 3 ) { |
|
74 | + if ($logData['flag_js_cookie'] > 3 || $logData['flag_multi_session'] > 3 || $logData['flag_empty_referer'] > 3) { |
|
75 | 75 | $text_warning = '<span class="so-text-danger"><i class="fas fa-exclamation-triangle"></i></span>'; |
76 | 76 | } |
77 | 77 | ?> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </div> |
68 | 68 | </div> |
69 | 69 | <?php endif; ?> |
70 | - <?php if (! empty($rule_list)) : ?> |
|
70 | + <?php if (!empty($rule_list)) : ?> |
|
71 | 71 | <div id="so-table-container" class="so-datatables" style="display: none;"> |
72 | 72 | <table id="so-datalog" class="cell-border compact stripe responsive" cellspacing="0" width="100%"> |
73 | 73 | <thead> |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | <td><?php echo $ipInfo['ip_resolve']; ?></td> |
93 | 93 | <td> |
94 | 94 | <?php |
95 | - if (! empty($type_mapping[$ipInfo['type'] ]) ) { |
|
96 | - echo $type_mapping[$ipInfo['type'] ]; |
|
95 | + if (!empty($type_mapping[$ipInfo['type']])) { |
|
96 | + echo $type_mapping[$ipInfo['type']]; |
|
97 | 97 | } |
98 | 98 | ?> |
99 | 99 | </td> |
100 | 100 | <td> |
101 | 101 | <?php |
102 | - if (! empty($reason_mapping[$ipInfo['reason'] ]) ) { |
|
103 | - echo $reason_mapping[$ipInfo['reason'] ]; |
|
102 | + if (!empty($reason_mapping[$ipInfo['reason']])) { |
|
103 | + echo $reason_mapping[$ipInfo['reason']]; |
|
104 | 104 | } |
105 | 105 | ?> |
106 | 106 | </td> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | <select name="subnet" class="regular" id="subnet"> |
50 | 50 | <option value="null">---</option> |
51 | 51 | <?php for ($i = 32; $i > 0; $i--) : ?> |
52 | - <?php $label = $i; ?> |
|
52 | + <?php $label = $i; ?> |
|
53 | 53 | <?php if ($i === 8) $label = $i . ' (A)'; ?> |
54 | 54 | <?php if ($i === 16) $label = $i . ' (B)'; ?> |
55 | 55 | <?php if ($i === 24) $label = $i . ' (C)'; ?> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | <select name="subnet" class="regular" id="subnet"> |
62 | 62 | <option value="null">---</option> |
63 | 63 | <?php for ($i = 128; $i > 0; $i--) : ?> |
64 | - <?php $label = $i; ?> |
|
64 | + <?php $label = $i; ?> |
|
65 | 65 | <option value="<?php echo $i; ?>"><?php echo $label; ?></option> |
66 | 66 | <?php endfor; ?> |
67 | 67 | </select> |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | </tr> |
149 | 149 | </thead> |
150 | 150 | <tbody> |
151 | - <?php if (! empty($ipCommand)) : ?> |
|
151 | + <?php if (!empty($ipCommand)) : ?> |
|
152 | 152 | <?php foreach ($ipCommand as $i => $ipInfo) : ?> |
153 | - <?php $subnet = (! empty($ipInfo[3]) && $ipInfo[3] !== 'null') ? '/' . $ipInfo[3] : '' ?> |
|
153 | + <?php $subnet = (!empty($ipInfo[3]) && $ipInfo[3] !== 'null') ? '/' . $ipInfo[3] : '' ?> |
|
154 | 154 | <tr> |
155 | 155 | <td> |
156 | 156 | <?php if ($this->mode === 'demo') : ?> |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | </div> |
181 | 181 | </div> |
182 | 182 | |
183 | -<?php if (! empty($ipCommand)) : ?> |
|
183 | +<?php if (!empty($ipCommand)) : ?> |
|
184 | 184 | |
185 | 185 | <script> |
186 | 186 |