@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | try { |
18 | 18 | $statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); |
19 | 19 | } catch (Exception $e) { |
20 | - $hookinfo['errors'][] = '[statistics] Could not get configuration: ' . $e->getMessage(); |
|
20 | + $hookinfo['errors'][] = '[statistics] Could not get configuration: '.$e->getMessage(); |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | $inputfile = $statconfig->getValue('inputfile'); |
26 | 26 | |
27 | 27 | if (file_exists($statdir)) { |
28 | - $hookinfo['info'][] = '[statistics] Statistics dir [' . $statdir . '] exists'; |
|
28 | + $hookinfo['info'][] = '[statistics] Statistics dir ['.$statdir.'] exists'; |
|
29 | 29 | if (is_writable($statdir)) { |
30 | - $hookinfo['info'][] = '[statistics] Statistics dir [' . $statdir . '] is writable'; |
|
30 | + $hookinfo['info'][] = '[statistics] Statistics dir ['.$statdir.'] is writable'; |
|
31 | 31 | } else { |
32 | - $hookinfo['errors'][] = '[statistics] Statistics dir [' . $statdir . '] is not writable'; |
|
32 | + $hookinfo['errors'][] = '[statistics] Statistics dir ['.$statdir.'] is not writable'; |
|
33 | 33 | } |
34 | 34 | } else { |
35 | - $hookinfo['errors'][] = '[statistics] Statistics dir [' . $statdir . '] does not exist'; |
|
35 | + $hookinfo['errors'][] = '[statistics] Statistics dir ['.$statdir.'] does not exist'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if (file_exists($inputfile)) { |
39 | - $hookinfo['info'][] = '[statistics] Input file [' . $inputfile . '] exists'; |
|
39 | + $hookinfo['info'][] = '[statistics] Input file ['.$inputfile.'] exists'; |
|
40 | 40 | } else { |
41 | - $hookinfo['errors'][] = '[statistics] Input file [' . $inputfile . '] does not exist'; |
|
41 | + $hookinfo['errors'][] = '[statistics] Input file ['.$inputfile.'] does not exist'; |
|
42 | 42 | } |
43 | 43 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $aggregator->store($results); |
38 | 38 | } |
39 | 39 | } catch (\Exception $e) { |
40 | - $message = 'Loganalyzer threw exception: ' . $e->getMessage(); |
|
40 | + $message = 'Loganalyzer threw exception: '.$e->getMessage(); |
|
41 | 41 | \SimpleSAML\Logger::warning($message); |
42 | 42 | $croninfo['summary'][] = $message; |
43 | 43 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'statrules' => [ |
97 | 97 | 'sloratio' => [ |
98 | 98 | 'name' => 'SLO to SSO ratio', |
99 | - 'descr' => 'Comparison of the number of Single Log-Out compared to Single Sign-On.' . |
|
99 | + 'descr' => 'Comparison of the number of Single Log-Out compared to Single Sign-On.'. |
|
100 | 100 | ' Graph shows how many logouts where initiated for each Single Sign-On.', |
101 | 101 | 'type' => 'calculated', |
102 | 102 | 'presenter' => 'statistics:Ratio', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ], |
109 | 109 | 'ssomulti' => [ |
110 | 110 | 'name' => 'Requests per session', |
111 | - 'descr' => 'Number of SSO request pairs exchanged between IdP and SP within the same IdP session.' . |
|
111 | + 'descr' => 'Number of SSO request pairs exchanged between IdP and SP within the same IdP session.'. |
|
112 | 112 | ' A high number indicates that the session at the SP is timing out faster than at the IdP.', |
113 | 113 | 'type' => 'calculated', |
114 | 114 | 'presenter' => 'statistics:Ratio', |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | ], |
151 | 151 | 'consent' => [ |
152 | 152 | 'name' => 'Consent', |
153 | - 'descr' => 'Consent statistics. Everytime a user logs in to a service an entry is logged for' . |
|
153 | + 'descr' => 'Consent statistics. Everytime a user logs in to a service an entry is logged for'. |
|
154 | 154 | ' one of three states: consent was found, consent was not found or consent storage was not available.', |
155 | 155 | 'action' => 'consent', |
156 | 156 | 'col' => 6, |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | ], |
162 | 162 | 'consentresponse' => [ |
163 | 163 | 'name' => 'Consent response', |
164 | - 'descr' => 'Consent response statistics. Everytime a user accepts consent,' . |
|
164 | + 'descr' => 'Consent response statistics. Everytime a user accepts consent,'. |
|
165 | 165 | ' it is logged whether the user selected to remember the consent to next time.', |
166 | 166 | 'action' => 'consentResponse', |
167 | 167 | 'col' => 6, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $data = $dataset->getDebugData(); |
161 | 161 | foreach ($data as $de) { |
162 | 162 | if (isset($de[1])) { |
163 | - echo '"' . $de[0] . '",' . $de[1] . "\n"; |
|
163 | + echo '"'.$de[0].'",'.$de[1]."\n"; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | exit; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | } |
239 | 239 | if ($type === 'get') { |
240 | - return Module::getModuleURL("statistics/showstats.php") . '?' . http_build_query($vars, '', '&'); |
|
240 | + return Module::getModuleURL("statistics/showstats.php").'?'.http_build_query($vars, '', '&'); |
|
241 | 241 | } |
242 | 242 | return $vars; |
243 | 243 | } |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function dumpConfig() |
53 | 53 | { |
54 | - echo 'Statistics directory : ' . $this->statdir . "\n"; |
|
55 | - echo 'Input file : ' . $this->inputfile . "\n"; |
|
56 | - echo 'Offset : ' . $this->offset . "\n"; |
|
54 | + echo 'Statistics directory : '.$this->statdir."\n"; |
|
55 | + echo 'Input file : '.$this->inputfile."\n"; |
|
56 | + echo 'Offset : '.$this->offset."\n"; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | public function clean($debug = false) |
66 | 66 | { |
67 | 67 | if (!is_dir($this->statdir)) { |
68 | - throw new \Exception('Statistics module: output dir do not exists [' . $this->statdir . ']'); |
|
68 | + throw new \Exception('Statistics module: output dir do not exists ['.$this->statdir.']'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (!file_exists($this->inputfile)) { |
72 | - throw new \Exception('Statistics module: input file do not exists [' . $this->inputfile . ']'); |
|
72 | + throw new \Exception('Statistics module: input file do not exists ['.$this->inputfile.']'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $file = fopen($this->inputfile, 'r'); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $content = $logparser->parseContent($logline); |
99 | 99 | |
100 | 100 | if (($i % 10000) == 0) { |
101 | - echo "Read line " . $i . "\n"; |
|
101 | + echo "Read line ".$i."\n"; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $trackid = $content[4]; |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | if ($debug) { |
112 | 112 | echo "----------------------------------------\n"; |
113 | - echo 'Log line: ' . $logline . "\n"; |
|
114 | - echo 'Date parse [' . substr($logline, 0, $this->statconfig->getValue('datelength', 15)) . |
|
115 | - '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n"; |
|
113 | + echo 'Log line: '.$logline."\n"; |
|
114 | + echo 'Date parse ['.substr($logline, 0, $this->statconfig->getValue('datelength', 15)). |
|
115 | + '] to ['.date(DATE_RFC822, $epoch).']'."\n"; |
|
116 | 116 | /** @var string $ret */ |
117 | 117 | $ret = print_r($content, true); |
118 | 118 | echo htmlentities($ret); |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function store(array $todelete, $outputfile) |
152 | 152 | { |
153 | - echo "Preparing to delete [" . count($todelete) . "] trackids\n"; |
|
153 | + echo "Preparing to delete [".count($todelete)."] trackids\n"; |
|
154 | 154 | |
155 | 155 | if (!is_dir($this->statdir)) { |
156 | - throw new \Exception('Statistics module: output dir do not exists [' . $this->statdir . ']'); |
|
156 | + throw new \Exception('Statistics module: output dir do not exists ['.$this->statdir.']'); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | if (!file_exists($this->inputfile)) { |
160 | - throw new \Exception('Statistics module: input file do not exists [' . $this->inputfile . ']'); |
|
160 | + throw new \Exception('Statistics module: input file do not exists ['.$this->inputfile.']'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | $file = fopen($this->inputfile, 'r'); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $content = $logparser->parseContent($logline); |
190 | 190 | |
191 | 191 | if (($i % 10000) == 0) { |
192 | - echo "Read line " . $i . "\n"; |
|
192 | + echo "Read line ".$i."\n"; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | $trackid = $content[4]; |
@@ -57,6 +57,6 @@ |
||
57 | 57 | { |
58 | 58 | $month = ($from % 12) + 1; |
59 | 59 | $year = 2000 + intval(floor($from / 12)); |
60 | - return $year . '-' . $month; |
|
60 | + return $year.'-'.$month; |
|
61 | 61 | } |
62 | 62 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | foreach ($datasets as $dataset) { |
54 | 54 | $setstr[] = self::extEncode($dataset); |
55 | 55 | } |
56 | - return 'e:' . join(',', $setstr); |
|
56 | + return 'e:'.join(',', $setstr); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -94,31 +94,31 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function show(array $axis, array $axispos, array $datasets, array $maxes) |
96 | 96 | { |
97 | - $labeld = '&chxt=x,y' . '&chxr=0,0,1|1,0,' . $maxes[0]; |
|
97 | + $labeld = '&chxt=x,y'.'&chxr=0,0,1|1,0,'.$maxes[0]; |
|
98 | 98 | if (count($datasets) > 1) { |
99 | 99 | if (count($datasets) !== count($maxes)) { |
100 | 100 | throw new \Exception('Incorrect number of max calculations for graph plotting.'); |
101 | 101 | } |
102 | - $labeld = '&chxt=x,y,r' . '&chxr=0,0,1|1,0,' . $maxes[0] . '|2,0,' . $maxes[1]; |
|
102 | + $labeld = '&chxt=x,y,r'.'&chxr=0,0,1|1,0,'.$maxes[0].'|2,0,'.$maxes[1]; |
|
103 | 103 | } |
104 | 104 | |
105 | - $url = 'https://chart.apis.google.com/chart?' . |
|
105 | + $url = 'https://chart.apis.google.com/chart?'. |
|
106 | 106 | // Dimension of graph. Default is 800x350 |
107 | - 'chs=' . $this->x . 'x' . $this->y . |
|
107 | + 'chs='.$this->x.'x'.$this->y. |
|
108 | 108 | |
109 | 109 | // Dateset values |
110 | - '&chd=' . $this->encodedata($datasets) . |
|
110 | + '&chd='.$this->encodedata($datasets). |
|
111 | 111 | |
112 | 112 | // Fill area... |
113 | - '&chco=ff5c00,cca600' . |
|
114 | - '&chls=1,1,0|1,6,3' . |
|
113 | + '&chco=ff5c00,cca600'. |
|
114 | + '&chls=1,1,0|1,6,3'. |
|
115 | 115 | |
116 | 116 | // chart type is linechart |
117 | - '&cht=lc' . |
|
118 | - $labeld . |
|
119 | - '&chxl=0:|' . $this->encodeaxis($axis) . #.$'|1:||top' . |
|
120 | - '&chxp=0,' . join(',', $axispos) . |
|
121 | - '&chg=' . (2400 / (count($datasets[0]) - 1)) . ',-1,3,3'; // lines |
|
117 | + '&cht=lc'. |
|
118 | + $labeld. |
|
119 | + '&chxl=0:|'.$this->encodeaxis($axis).#.$'|1:||top' . |
|
120 | + '&chxp=0,'.join(',', $axispos). |
|
121 | + '&chg='.(2400 / (count($datasets[0]) - 1)).',-1,3,3'; // lines |
|
122 | 122 | |
123 | 123 | return $url; |
124 | 124 | } |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function showPie(array $axis, array $datasets) |
133 | 133 | { |
134 | - $url = 'https://chart.apis.google.com/chart?' . |
|
134 | + $url = 'https://chart.apis.google.com/chart?'. |
|
135 | 135 | |
136 | 136 | // Dimension of graph. Default is 800x350 |
137 | - 'chs=' . $this->x . 'x' . $this->y . |
|
137 | + 'chs='.$this->x.'x'.$this->y. |
|
138 | 138 | |
139 | 139 | // Dateset values. |
140 | - '&chd=' . $this->encodedata([$datasets]) . |
|
140 | + '&chd='.$this->encodedata([$datasets]). |
|
141 | 141 | |
142 | 142 | // chart type is linechart |
143 | - '&cht=p' . |
|
143 | + '&cht=p'. |
|
144 | 144 | |
145 | - '&chl=' . $this->encodeaxis($axis); |
|
145 | + '&chl='.$this->encodeaxis($axis); |
|
146 | 146 | |
147 | 147 | return $url; |
148 | 148 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $as->requireAuth(); |
56 | 56 | |
57 | 57 | // User logged in with auth source. |
58 | - Logger::debug('Statistics auth - valid login with auth source [' . $authsource . ']'); |
|
58 | + Logger::debug('Statistics auth - valid login with auth source ['.$authsource.']'); |
|
59 | 59 | |
60 | 60 | // Retrieving attributes |
61 | 61 | $attributes = $as->getAttributes(); |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | // Check if userid is allowed access.. |
70 | 70 | if (in_array($attributes[$useridattr][0], $allowedusers, true)) { |
71 | 71 | Logger::debug( |
72 | - 'Statistics auth - User granted access by user ID [' . $attributes[$useridattr][0] . ']' |
|
72 | + 'Statistics auth - User granted access by user ID ['.$attributes[$useridattr][0].']' |
|
73 | 73 | ); |
74 | 74 | return; |
75 | 75 | } |
76 | 76 | Logger::debug( |
77 | - 'Statistics auth - User denied access by user ID [' . $attributes[$useridattr][0] . ']' |
|
77 | + 'Statistics auth - User denied access by user ID ['.$attributes[$useridattr][0].']' |
|
78 | 78 | ); |
79 | 79 | } else { |
80 | 80 | Logger::debug('Statistics auth - no allowedUsers list.'); |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | 'Statistics\FieldPresentation' |
345 | 345 | ); |
346 | 346 | if (!class_exists($classname)) { |
347 | - throw new \Exception('Could not find field presentation plugin [' . $classname . ']: No class found'); |
|
347 | + throw new \Exception('Could not find field presentation plugin ['.$classname.']: No class found'); |
|
348 | 348 | } |
349 | 349 | $presentationHandler = new $classname($availdelimiters, $fieldpresConfig->getValue('config'), $t); |
350 | 350 | |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | $rules = Arrays::arrayize($this->ruleid); |
387 | 387 | foreach ($rules as $rule) { |
388 | 388 | // Get file and extract results. |
389 | - $resultFileName = $statdir . '/' . $rule . '-' . $this->timeres . '-' . $this->fileslot . '.stat'; |
|
389 | + $resultFileName = $statdir.'/'.$rule.'-'.$this->timeres.'-'.$this->fileslot.'.stat'; |
|
390 | 390 | if (!file_exists($resultFileName)) { |
391 | - throw new \Exception('Aggregated statitics file [' . $resultFileName . '] not found.'); |
|
391 | + throw new \Exception('Aggregated statitics file ['.$resultFileName.'] not found.'); |
|
392 | 392 | } |
393 | 393 | if (!is_readable($resultFileName)) { |
394 | - throw new \Exception('Could not read statitics file [' . $resultFileName . ']. Bad file permissions?'); |
|
394 | + throw new \Exception('Could not read statitics file ['.$resultFileName.']. Bad file permissions?'); |
|
395 | 395 | } |
396 | 396 | $resultfile = file_get_contents($resultFileName); |
397 | 397 | $newres = unserialize($resultfile); |
398 | 398 | if (empty($newres)) { |
399 | - throw new \Exception('Aggregated statistics in file [' . $resultFileName . '] was empty.'); |
|
399 | + throw new \Exception('Aggregated statistics in file ['.$resultFileName.'] was empty.'); |
|
400 | 400 | } |
401 | 401 | $resarray[] = $newres; |
402 | 402 | } |