Skip to content

Commit 277fa9f

Browse files
committed
run ecs-legacy
1 parent c8339f1 commit 277fa9f

11 files changed

Lines changed: 102 additions & 97 deletions

src/Resources/contao/classes/ModuleVisitorChecks.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ public function checkUserAgent($visitors_category_id)
128128
// Suche
129129
$CheckUserAgent=str_replace($arrUserAgents, '#', $UserAgent);
130130
if ($UserAgent != $CheckUserAgent)
131-
{ // es wurde ersetzt also was gefunden
131+
{
132+
// es wurde ersetzt also was gefunden
132133
ModuleVisitorLog::writeLog(__METHOD__, __LINE__, 'checkUserAgent: True');
133134

134135
return true;
@@ -212,8 +213,9 @@ public function isIP4($ip4)
212213
public function visitorGetUserIP()
213214
{
214215
$UserIP = Environment::get('ip');
215-
if (strpos($UserIP, ',') !== false) // first IP
216+
if (strpos($UserIP, ',') !== false)
216217
{
218+
// first IP
217219
$UserIP = trim(substr($UserIP, 0, strpos($UserIP, ',')));
218220
}
219221
if (
@@ -225,8 +227,9 @@ public function visitorGetUserIP()
225227
$_SERVER['HTTP_X_FORWARDED_FOR'] = '';
226228

227229
$UserIP = Environment::get('ip');
228-
if (strpos($UserIP, ',') !== false) // first IP
230+
if (strpos($UserIP, ',') !== false)
229231
{
232+
// first IP
230233
$UserIP = trim(substr($UserIP, 0, strpos($UserIP, ',')));
231234
}
232235
$_SERVER['HTTP_X_FORWARDED_FOR'] = $HTTPXFF;

src/Resources/contao/classes/ModuleVisitorLog.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static function logMessage($strMessage, $strLog=null)
168168
$strLogsDir = $strRootDir . '/var/logs';
169169
}
170170

171-
error_log(sprintf("[%s] %s\n", date('d-M-Y H:i:s'), $strMessage . " (logMessage is deprecated)"), 3, $strLogsDir . '/' . $strLog);
171+
error_log(\sprintf("[%s] %s\n", date('d-M-Y H:i:s'), $strMessage . " (logMessage is deprecated)"), 3, $strLogsDir . '/' . $strLog);
172172
}
173173

174174
/**
@@ -196,7 +196,7 @@ public static function logMonolog($uuid, $class, $line, $message)
196196
// $strLogsDir = $strRootDir . '/var/logs';
197197
// }
198198

199-
$strMessage = sprintf("%s %s\n", $uuid, $message);
199+
$strMessage = \sprintf("%s %s\n", $uuid, $message);
200200

201201
// $logger = new \Monolog\Logger('visitors');
202202
// $logger->pushHandler(new \Monolog\Handler\StreamHandler($strLogsDir . '/' . $strLog, \Monolog\Logger::DEBUG));

src/Resources/contao/classes/ModuleVisitorReferrer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ protected function reset()
6969
{
7070
ModuleVisitorLog::writeLog(__METHOD__, __LINE__, 'Referrer Raw: ' . ($_SERVER['HTTP_REFERER'] ?? self::REFERRER_UNKNOWN));
7171
// NEVER TRUST USER INPUT
72-
if (\function_exists('filter_var')) // Adjustment for hoster without the filter extension
72+
if (\function_exists('filter_var'))
7373
{
74+
// Adjustment for hoster without the filter extension
7475
$this->_http_referrer = isset($_SERVER['HTTP_REFERER']) ? filter_var($_SERVER['HTTP_REFERER'], FILTER_SANITIZE_URL) : self::REFERRER_UNKNOWN;
7576
}
7677
else
@@ -97,8 +98,9 @@ public function checkReferrer($referrer='')
9798
if ($referrer != "")
9899
{
99100
// NEVER TRUST USER INPUT
100-
if (\function_exists('filter_var')) // Adjustment for hoster without the filter extension
101+
if (\function_exists('filter_var'))
101102
{
103+
// Adjustment for hoster without the filter extension
102104
$this->_http_referrer = filter_var($referrer, FILTER_SANITIZE_URL);
103105
}
104106
else

src/Resources/contao/classes/ModuleVisitorSearchEngine.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ class ModuleVisitorSearchEngine // extends Frontend
131131
protected function reset()
132132
{
133133
// NEVER TRUST USER INPUT
134-
if (\function_exists('filter_var')) // Adjustment for hoster without the filter extension
134+
if (\function_exists('filter_var'))
135135
{
136+
// Adjustment for hoster without the filter extension
136137
$this->_http_referer = isset($_SERVER['HTTP_REFERER']) ? filter_var($_SERVER['HTTP_REFERER'], FILTER_SANITIZE_URL) : self::REFERER_UNKNOWN;
137138
}
138139
else
@@ -150,8 +151,9 @@ public function checkEngines($referer='')
150151
if ($referer != "")
151152
{
152153
// NEVER TRUST USER INPUT
153-
if (\function_exists('filter_var')) // Adjustment for hoster without the filter extension
154+
if (\function_exists('filter_var'))
154155
{
156+
// Adjustment for hoster with the filter extension
155157
$this->_http_referer = filter_var($referer, FILTER_SANITIZE_URL);
156158
}
157159
else
@@ -336,8 +338,9 @@ protected function checkEngineBaidu()
336338
{
337339
$this->_keywords = $this->_parse_result['wd'];
338340
}
339-
if ($this->_keywords == 'QQ') // I don't know what QQ is, but no keyword from an user
341+
if ($this->_keywords == 'QQ')
340342
{
343+
// I don't know what QQ is, but no keyword from an user
341344
$this->_search_engine = self::SEARCH_ENGINE_UNKNOWN;
342345
$this->_keywords = self::KEYWORDS_UNKNOWN;
343346

src/Resources/contao/classes/ModuleVisitorStatPageCounter.php

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function generatePageVisitHitTop($VisitorsID, $limit = 20, $parse = true)
123123
if (null !== $objPage)
124124
{
125125
$alias = $objPage->alias;
126-
if ($alias == 404)
126+
if ($alias == 404)
127127
{
128128
$alias = $objPage->title . ' [404]';
129129
}
@@ -214,7 +214,7 @@ public function generatePageVisitHitToday($VisitorsID, $limit=5)
214214
if (null !== $objPage)
215215
{
216216
$alias = $objPage->alias;
217-
if ($alias == 404)
217+
if ($alias == 404)
218218
{
219219
$alias = $objPage->title . ' [404]';
220220
}
@@ -299,7 +299,7 @@ public function generatePageVisitHitYesterday($VisitorsID, $limit=5)
299299
if (null !== $objPage)
300300
{
301301
$alias = $objPage->alias;
302-
if ($alias == 404)
302+
if ($alias == 404)
303303
{
304304
$alias = $objPage->title . ' [404]';
305305
}
@@ -385,7 +385,7 @@ public function generatePageVisitHitDays($VisitorsID, $limit=20, $days=7)
385385
if (null !== $objPage)
386386
{
387387
$alias = $objPage->alias;
388-
if ($alias == 404)
388+
if ($alias == 404)
389389
{
390390
$alias = $objPage->title . ' [404]';
391391
}
@@ -455,14 +455,13 @@ public function getNewsAliases($visitors_page_id)
455455
return array('PageAlias' => $objNewsAliases->PageAlias,
456456
'NewsAlias' => $objNewsAliases->NewsAlias);
457457
}
458+
458459
return array('PageAlias' => false,
459460
'NewsAlias' => false);
460461
}
461-
else
462-
{
463-
return array('PageAlias' => false,
464-
'NewsAlias' => false);
465-
}
462+
463+
return array('PageAlias' => false,
464+
'NewsAlias' => false);
466465
}
467466

468467
public function getFaqAliases($visitors_page_id)
@@ -493,14 +492,13 @@ public function getFaqAliases($visitors_page_id)
493492
return array('PageAlias' => $objFaqAliases->PageAlias,
494493
'FaqAlias' => $objFaqAliases->FaqAlias);
495494
}
495+
496496
return array('PageAlias' => false,
497497
'FaqAlias' => false);
498498
}
499-
else
500-
{
501-
return array('PageAlias' => false,
502-
'FaqAlias' => false);
503-
}
499+
500+
return array('PageAlias' => false,
501+
'FaqAlias' => false);
504502
}
505503

506504
public function getEventsAliases($visitors_page_id)
@@ -531,14 +529,13 @@ public function getEventsAliases($visitors_page_id)
531529
return array('PageAlias' => $objEventsAliases->PageAlias,
532530
'EventsAlias' => $objEventsAliases->EventsAlias);
533531
}
532+
534533
return array('PageAlias' => false,
535534
'EventsAlias' => false);
536535
}
537-
else
538-
{
539-
return array('PageAlias' => false,
540-
'EventsAlias' => false);
541-
}
536+
537+
return array('PageAlias' => false,
538+
'EventsAlias' => false);
542539
}
543540

544541
public function getIsotopeAliases($visitors_page_id, $visitors_page_pid)
@@ -579,6 +576,7 @@ public function getIsotopeAliases($visitors_page_id, $visitors_page_pid)
579576
return array('PageAlias' => $PageAlias,
580577
'ProductAlias' => $objIsotopeProduct->ProductAlias);
581578
}
579+
582580
return array('PageAlias' => false,
583581
'ProductAlias' => false);
584582
}
@@ -603,7 +601,7 @@ public function getForbiddenAlias($visitors_page_id, $visitors_page_lang)
603601
{
604602
$objPage->loadDetails();
605603

606-
$objRootPage = PageModel::findByPk($objPage->rootId);
604+
$objRootPage = PageModel::findById($objPage->rootId);
607605
}
608606
}
609607
else

src/Resources/contao/classes/ModuleVisitorsTag.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,8 @@ protected function visitorCountUpdate($vid, $BlockTime, $visitors_category_id, $
875875
// Page Counter End
876876

877877
if ($objVisitIP->numRows < 1)
878-
{ // Browser Check wenn nicht geblockt
878+
{
879+
// Browser Check wenn nicht geblockt
879880
// Only counting if User Agent is set.
880881
if (Environment::get('httpUserAgent') !=='')
881882
{
@@ -1095,7 +1096,8 @@ protected function visitorCheckReferrer($vid)
10951096
// Debug log_message('visitorCheckReferrer $ReferrerDNS:'.print_r($ReferrerDNS,true), 'debug.log');
10961097
// Debug log_message('visitorCheckReferrer Host:'.print_r($this->ModuleVisitorReferrer->getHost(),true), 'debug.log');
10971098
if ($ReferrerDNS != 'o' && $ReferrerDNS != 'w')
1098-
{ // not the own, not wrong
1099+
{
1100+
// not the own, not wrong
10991101
// Insert
11001102
$arrSet = array
11011103
(

src/Resources/contao/classes/VisitorsStatExport.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use BugBuster\Visitors\ModuleVisitorStatPageCounter;
2121
use Contao\Config;
2222
use Contao\Database;
23-
use Contao\Environment;
2423
use Contao\Input;
2524
use Contao\System;
2625
use PhpOffice\PhpSpreadsheet\IOFactory;

src/Resources/contao/config/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
*/
4848
use Contao\System;
4949
use Symfony\Component\HttpFoundation\Request;
50+
5051
if (!System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create('')))
5152
{
5253
$GLOBALS['TL_CSS'][] = 'bundles/bugbustervisitors/mod_visitors_basic.css|static';

src/Resources/contao/dca/tl_module.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
'label' => &$GLOBALS['TL_LANG']['tl_module']['visitors_screencount'],
5353
'inputType' => 'checkbox',
5454
'explanation' => 'visitors_help_module',
55-
'sql' => [
56-
'type' => 'boolean',
57-
'default' => false,
58-
],
55+
'sql' => array(
56+
'type' => 'boolean',
57+
'default' => false,
58+
),
5959
'eval' => array('mandatory'=>false, 'helpwizard'=>true)
6060
);
6161

0 commit comments

Comments
 (0)