@@ -62,15 +62,15 @@ |
||
62 | 62 | |
63 | 63 | $usedToken = null; |
64 | 64 | foreach ($scratchTokens as $scratchToken) { |
65 | - if (password_verify($data, $scratchToken)){ |
|
65 | + if (password_verify($data, $scratchToken)) { |
|
66 | 66 | $usedToken = $scratchToken; |
67 | 67 | SessionAlert::quick("Hey, it looks like you used a scratch token to log in. Would you like to change your multi-factor authentication configuration?", 'alert-warning'); |
68 | - WebRequest::setPostLoginRedirect($this->getConfiguration()->getBaseUrl() . "/internal.php/multiFactor"); |
|
68 | + WebRequest::setPostLoginRedirect($this->getConfiguration()->getBaseUrl()."/internal.php/multiFactor"); |
|
69 | 69 | break; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - if($usedToken === null) { |
|
73 | + if ($usedToken === null) { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | $usedToken = null; |
64 | 64 | foreach ($scratchTokens as $scratchToken) { |
65 | - if (password_verify($data, $scratchToken)){ |
|
65 | + if (password_verify($data, $scratchToken)) { |
|
66 | 66 | $usedToken = $scratchToken; |
67 | 67 | SessionAlert::quick("Hey, it looks like you used a scratch token to log in. Would you like to change your multi-factor authentication configuration?", 'alert-warning'); |
68 | 68 | WebRequest::setPostLoginRedirect($this->getConfiguration()->getBaseUrl() . "/internal.php/multiFactor"); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $userSearchRequest = WebRequest::getString('usersearch'); |
41 | 41 | if ($userSearchRequest !== null) { |
42 | 42 | $searchedUser = User::getByUsername($userSearchRequest, $database); |
43 | - if($searchedUser !== false) { |
|
43 | + if ($searchedUser !== false) { |
|
44 | 44 | $this->redirect('statistics/users', 'detail', ['user' => $searchedUser->getId()]); |
45 | 45 | return; |
46 | 46 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | - $newValue = WebRequest::postBoolean('role-' . $name) ? 1 : 0; |
|
137 | + $newValue = WebRequest::postBoolean('role-'.$name) ? 1 : 0; |
|
138 | 138 | if ($newValue !== $r['active']) { |
139 | 139 | if ($newValue === 0) { |
140 | 140 | $delete[] = $r['object']; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $user->save(); |
178 | 178 | |
179 | 179 | $this->getNotificationHelper()->userRolesEdited($user, $reason); |
180 | - SessionAlert::quick('Roles changed for user ' . htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
180 | + SessionAlert::quick('Roles changed for user '.htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
181 | 181 | |
182 | 182 | $this->redirect('statistics/users', 'detail', array('user' => $user->getId())); |
183 | 183 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | Logger::suspendedUser($database, $user, $reason); |
231 | 231 | |
232 | 232 | $this->getNotificationHelper()->userSuspended($user, $reason); |
233 | - SessionAlert::quick('Suspended user ' . htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
233 | + SessionAlert::quick('Suspended user '.htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
234 | 234 | |
235 | 235 | // send email |
236 | 236 | $this->sendStatusChangeEmail( |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | Logger::declinedUser($database, $user, $reason); |
292 | 292 | |
293 | 293 | $this->getNotificationHelper()->userDeclined($user, $reason); |
294 | - SessionAlert::quick('Declined user ' . htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
294 | + SessionAlert::quick('Declined user '.htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
295 | 295 | |
296 | 296 | // send email |
297 | 297 | $this->sendStatusChangeEmail( |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | Logger::approvedUser($database, $user); |
347 | 347 | |
348 | 348 | $this->getNotificationHelper()->userApproved($user); |
349 | - SessionAlert::quick('Approved user ' . htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
349 | + SessionAlert::quick('Approved user '.htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
|
350 | 350 | |
351 | 351 | // send email |
352 | 352 | $this->sendStatusChangeEmail( |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | 'ip' => '172.16.0.164', |
37 | 37 | 'routable' => false, |
38 | 38 | |
39 | - ],[ |
|
39 | + ], [ |
|
40 | 40 | 'trust' => true, |
41 | 41 | 'ip' => '198.51.100.123', |
42 | 42 | 'routable' => true, |
43 | 43 | 'rdns' => 'trustedproxy.example.com', |
44 | 44 | |
45 | - ],[ |
|
45 | + ], [ |
|
46 | 46 | 'trust' => true, |
47 | 47 | 'ip' => '192.0.2.1', |
48 | 48 | 'routable' => true, |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | 'ip' => '172.16.0.164', |
64 | 64 | 'routable' => false, |
65 | 65 | |
66 | - ],[ |
|
66 | + ], [ |
|
67 | 67 | 'trust' => false, |
68 | 68 | 'ip' => '198.51.100.234', |
69 | 69 | 'routable' => true, |
70 | 70 | 'rdns' => 'sketchyproxy.example.com', |
71 | 71 | 'showlinks' => true |
72 | 72 | |
73 | - ],[ |
|
73 | + ], [ |
|
74 | 74 | 'trust' => false, |
75 | 75 | 'ip' => '192.0.2.1', |
76 | 76 | 'routable' => true, |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | 'ip' => '172.16.0.164', |
92 | 92 | 'routable' => false, |
93 | 93 | |
94 | - ],[ |
|
94 | + ], [ |
|
95 | 95 | 'trust' => true, |
96 | 96 | 'ip' => '198.51.100.123', |
97 | 97 | 'routable' => true, |
98 | 98 | 'rdns' => 'trustedproxy.example.com', |
99 | - ],[ |
|
99 | + ], [ |
|
100 | 100 | 'trust' => false, |
101 | 101 | 'ip' => '198.51.100.234', |
102 | 102 | 'routable' => true, |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'routable' => true, |
110 | 110 | 'rdns' => 'trustedproxy2.example.com', |
111 | 111 | 'showlinks' => true |
112 | - ],[ |
|
112 | + ], [ |
|
113 | 113 | 'trust' => false, |
114 | 114 | 'ip' => '192.0.2.1', |
115 | 115 | 'routable' => true, |
@@ -152,7 +152,7 @@ |
||
152 | 152 | { |
153 | 153 | $user = User::getById($id, $database); |
154 | 154 | |
155 | - if ($user === false || $user->isCommunityUser()) { |
|
155 | + if ($user === false || $user->isCommunityUser()) { |
|
156 | 156 | throw new ApplicationLogicException("Password reset failed. Please try again."); |
157 | 157 | } |
158 | 158 |
@@ -44,7 +44,8 @@ |
||
44 | 44 | $userObj = User::getByUsername($filterUser, $database); |
45 | 45 | if ($userObj !== false) { |
46 | 46 | $logSearch->byUser($userObj->getId()); |
47 | - } else { |
|
47 | + } |
|
48 | + else { |
|
48 | 49 | $logSearch->byUser(-1); |
49 | 50 | } |
50 | 51 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $CORSallowed = $this->getSiteConfiguration()->getCrossOriginResourceSharingHosts(); |
34 | 34 | |
35 | 35 | if (in_array($httpOrigin, $CORSallowed)) { |
36 | - header("Access-Control-Allow-Origin: " . $httpOrigin); |
|
36 | + header("Access-Control-Allow-Origin: ".$httpOrigin); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $targetVar = WebRequest::getString('targetVariable'); |
72 | 72 | if ($targetVar !== null && preg_match('/^[a-z]+$/', $targetVar)) { |
73 | - $data = $targetVar . ' = ' . $data . ';'; |
|
73 | + $data = $targetVar.' = '.$data.';'; |
|
74 | 74 | header("Content-Type: text/javascript"); |
75 | 75 | } else { |
76 | 76 | header("Content-Type: application/json"); |
@@ -72,7 +72,8 @@ |
||
72 | 72 | if ($targetVar !== null && preg_match('/^[a-z]+$/', $targetVar)) { |
73 | 73 | $data = $targetVar . ' = ' . $data . ';'; |
74 | 74 | header("Content-Type: text/javascript"); |
75 | - } else { |
|
75 | + } |
|
76 | + else { |
|
76 | 77 | header("Content-Type: application/json"); |
77 | 78 | } |
78 | 79 |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $targetScriptName = $currentScriptName; |
250 | 250 | } |
251 | 251 | else { |
252 | - $targetScriptName = $this->getSiteConfiguration()->getBaseUrl() . '/' . $script; |
|
252 | + $targetScriptName = $this->getSiteConfiguration()->getBaseUrl().'/'.$script; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | $pathInfo = array($targetScriptName); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $url = implode('/', $pathInfo); |
264 | 264 | |
265 | 265 | if (is_array($parameters) && count($parameters) > 0) { |
266 | - $url .= '?' . http_build_query($parameters); |
|
266 | + $url .= '?'.http_build_query($parameters); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | $this->redirectUrl($url); |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @param string $path The path (relative to the application root) of the file |
309 | 309 | */ |
310 | - final protected function addJs($path){ |
|
311 | - if(in_array($path, $this->extraJs)){ |
|
310 | + final protected function addJs($path) { |
|
311 | + if (in_array($path, $this->extraJs)) { |
|
312 | 312 | // nothing to do |
313 | 313 | return; |
314 | 314 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | final protected function setHtmlTitle($title) |
333 | 333 | { |
334 | - $this->htmlTitle = $this->smarty->fetch('string:' . $title); |
|
334 | + $this->htmlTitle = $this->smarty->fetch('string:'.$title); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | public function execute() |
@@ -307,8 +307,9 @@ |
||
307 | 307 | * |
308 | 308 | * @param string $path The path (relative to the application root) of the file |
309 | 309 | */ |
310 | - final protected function addJs($path){ |
|
311 | - if(in_array($path, $this->extraJs)){ |
|
310 | + final protected function addJs($path) |
|
311 | + { |
|
312 | + if(in_array($path, $this->extraJs)) { |
|
312 | 313 | // nothing to do |
313 | 314 | return; |
314 | 315 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | try { |
28 | 28 | $then = new DateTime($input); |
29 | 29 | } |
30 | - catch(Exception $ex) { |
|
30 | + catch (Exception $ex) { |
|
31 | 31 | return $input; |
32 | 32 | } |
33 | 33 | } |
@@ -55,25 +55,25 @@ discard block |
||
55 | 55 | $pluralise = false; |
56 | 56 | } |
57 | 57 | elseif ($secs > 10 && $secs < $minuteCut) { |
58 | - $output = round($secs / $second) . " second"; |
|
58 | + $output = round($secs / $second)." second"; |
|
59 | 59 | } |
60 | 60 | elseif ($secs >= $minuteCut && $secs < $hourCut) { |
61 | - $output = round($secs / $minute) . " minute"; |
|
61 | + $output = round($secs / $minute)." minute"; |
|
62 | 62 | } |
63 | 63 | elseif ($secs >= $hourCut && $secs < $dayCut) { |
64 | - $output = round($secs / $hour) . " hour"; |
|
64 | + $output = round($secs / $hour)." hour"; |
|
65 | 65 | } |
66 | 66 | elseif ($secs >= $dayCut && $secs < $weekCut) { |
67 | - $output = round($secs / $day) . " day"; |
|
67 | + $output = round($secs / $day)." day"; |
|
68 | 68 | } |
69 | 69 | elseif ($secs >= $weekCut && $secs < $monthCut) { |
70 | - $output = round($secs / $week) . " week"; |
|
70 | + $output = round($secs / $week)." week"; |
|
71 | 71 | } |
72 | 72 | elseif ($secs >= $monthCut && $secs < $yearCut) { |
73 | - $output = round($secs / $month) . " month"; |
|
73 | + $output = round($secs / $month)." month"; |
|
74 | 74 | } |
75 | 75 | elseif ($secs >= $yearCut && $secs < $year * 10) { |
76 | - $output = round($secs / $year) . " year"; |
|
76 | + $output = round($secs / $year)." year"; |
|
77 | 77 | } |
78 | 78 | else { |
79 | 79 | $output = "a long time ago"; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | if ($pluralise) { |
84 | - $output = (substr($output, 0, 2) <> "1 ") ? $output . "s ago" : $output . " ago"; |
|
84 | + $output = (substr($output, 0, 2) <> "1 ") ? $output."s ago" : $output." ago"; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return $output; |
@@ -549,7 +549,8 @@ |
||
549 | 549 | * |
550 | 550 | * @return bool|null |
551 | 551 | */ |
552 | - public function getForceIdentified() { |
|
552 | + public function getForceIdentified() |
|
553 | + { |
|
553 | 554 | return $this->forceidentified; |
554 | 555 | } |
555 | 556 |