@@ -356,8 +356,8 @@ |
||
| 356 | 356 | $path = []; |
| 357 | 357 | |
| 358 | 358 | $path['filter'] = $this->directory . '/' . $this->tableFilterLogs . '/' . $ip . '.' . $this->extension; |
| 359 | - $path['session'] = $this->directory . '/' . $this->tableSessions . '/' . $ip . '.' . $this->extension; |
|
| 360 | - $path['rule'] = $this->directory . '/' . $this->tableRuleList . '/' . $ip . '.' . $this->extension; |
|
| 359 | + $path['session'] = $this->directory . '/' . $this->tableSessions . '/' . $ip . '.' . $this->extension; |
|
| 360 | + $path['rule'] = $this->directory . '/' . $this->tableRuleList . '/' . $ip . '.' . $this->extension; |
|
| 361 | 361 | |
| 362 | 362 | return $path[$type] ?? ''; |
| 363 | 363 | } |
@@ -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 | } |
@@ -224,13 +224,13 @@ |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | - * Get data from log file. |
|
| 228 | - * |
|
| 229 | - * @param string $fromYmd The string in Ymd Date format. |
|
| 230 | - * @param string $toYmd The end date. |
|
| 231 | - * |
|
| 232 | - * @return array |
|
| 233 | - */ |
|
| 227 | + * Get data from log file. |
|
| 228 | + * |
|
| 229 | + * @param string $fromYmd The string in Ymd Date format. |
|
| 230 | + * @param string $toYmd The end date. |
|
| 231 | + * |
|
| 232 | + * @return array |
|
| 233 | + */ |
|
| 234 | 234 | private function getDataFromSingleDate(string $fromYmd = '', string $toYmd = ''): array |
| 235 | 235 | { |
| 236 | 236 | $results = []; |
@@ -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 { |
@@ -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 | ?> |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | <p><input type="submit" value="<?php _e('core', 'stop_submit', 'Submit') ?>" /></p> |
| 51 | 51 | </form> |
| 52 | 52 | </div> |
| 53 | - <?php if (! empty($dialoguserinfo)) : ?> |
|
| 53 | + <?php if (!empty($dialoguserinfo)) : ?> |
|
| 54 | 54 | <div class="status-user-info"> |
| 55 | 55 | <?php foreach ($dialoguserinfo as $key => $userinfo) : ?> |
| 56 | 56 | <div class="row"> |
@@ -165,7 +165,7 @@ |
||
| 165 | 165 | define('SHIELDON_VIEW', true); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $viewFilePath = __DIR__ . '/../../../templates/' . $page . '.php'; |
|
| 168 | + $viewFilePath = __DIR__ . '/../../../templates/' . $page . '.php'; |
|
| 169 | 169 | |
| 170 | 170 | if (!empty($data)) { |
| 171 | 171 | extract($data); |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | trait ConfigMethodsTrait |
| 37 | 37 | { |
| 38 | - /** |
|
| 39 | - * Parse the POST fields and set them into configuration data structure. |
|
| 40 | - * Used for saveConfig method only. |
|
| 41 | - * |
|
| 42 | - * @param array $postParams |
|
| 43 | - * |
|
| 44 | - * @return void |
|
| 45 | - */ |
|
| 38 | + /** |
|
| 39 | + * Parse the POST fields and set them into configuration data structure. |
|
| 40 | + * Used for saveConfig method only. |
|
| 41 | + * |
|
| 42 | + * @param array $postParams |
|
| 43 | + * |
|
| 44 | + * @return void |
|
| 45 | + */ |
|
| 46 | 46 | protected function saveConfigPrepareSettings(array $postParams): void |
| 47 | 47 | { |
| 48 | 48 | foreach ($postParams as $postKey => $postData) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } else { |
| 78 | 78 | if (is_numeric($postData)) { |
| 79 | 79 | $this->setConfig(str_replace('__', '.', $postKey), (int) $postData); |
| 80 | - } else { |
|
| 80 | + } else { |
|
| 81 | 81 | $this->setConfig(str_replace('__', '.', $postKey), $postData); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -165,10 +165,10 @@ discard block |
||
| 165 | 165 | // Create default log files. |
| 166 | 166 | if (is_writable($iptablesWatchingFolder)) { |
| 167 | 167 | fopen($iptablesWatchingFolder . '/iptables_queue.log', 'w+'); |
| 168 | - fopen($iptablesWatchingFolder . '/ipv4_status.log', 'w+'); |
|
| 169 | - fopen($iptablesWatchingFolder . '/ipv6_status.log', 'w+'); |
|
| 170 | - fopen($iptablesWatchingFolder . '/ipv4_command.log', 'w+'); |
|
| 171 | - fopen($iptablesWatchingFolder . '/ipv6_command.log', 'w+'); |
|
| 168 | + fopen($iptablesWatchingFolder . '/ipv4_status.log', 'w+'); |
|
| 169 | + fopen($iptablesWatchingFolder . '/ipv6_status.log', 'w+'); |
|
| 170 | + fopen($iptablesWatchingFolder . '/ipv4_command.log', 'w+'); |
|
| 171 | + fopen($iptablesWatchingFolder . '/ipv6_command.log', 'w+'); |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | (string) $db['user'], |
| 247 | 247 | (string) $db['pass'] |
| 248 | 248 | ); |
| 249 | - } catch(PDOException $e) { |
|
| 249 | + } catch (PDOException $e) { |
|
| 250 | 250 | $result = false; |
| 251 | 251 | $this->pushMessage('error', |
| 252 | 252 | __( |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | if (class_exists('PDO')) { |
| 300 | 300 | try { |
| 301 | 301 | new PDO('sqlite:' . $sqliteFilePath); |
| 302 | - } catch(PDOException $e) { |
|
| 302 | + } catch (PDOException $e) { |
|
| 303 | 303 | $this->pushMessage('error', $e->getMessage()); |
| 304 | 304 | $result = false; |
| 305 | 305 | } |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | $redis = new Redis(); |
| 342 | 342 | $redis->connect( |
| 343 | 343 | (string) $this->getConfig('drivers.redis.host'), |
| 344 | - (int) $this->getConfig('drivers.redis.port') |
|
| 344 | + (int) $this->getConfig('drivers.redis.port') |
|
| 345 | 345 | ); |
| 346 | 346 | unset($redis); |
| 347 | - } catch(RedisException $e) { |
|
| 347 | + } catch (RedisException $e) { |
|
| 348 | 348 | $this->pushMessage('error', $e->getMessage()); |
| 349 | 349 | $result = false; |
| 350 | 350 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | // @codeCoverageIgnoreStart |
| 46 | 46 | |
| 47 | - } catch(PDOException $e) { |
|
| 47 | + } catch (PDOException $e) { |
|
| 48 | 48 | echo $e->getMessage(); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | // @codeCoverageIgnoreStart |
| 62 | 62 | |
| 63 | - } catch(RedisException $e) { |
|
| 63 | + } catch (RedisException $e) { |
|
| 64 | 64 | echo $e->getMessage(); |
| 65 | 65 | } |
| 66 | 66 | |