@@ -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"); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | SessionAlert::success('Enabled YubiKey OTP.'); |
78 | 78 | |
79 | 79 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
80 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
80 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
81 | 81 | $scratchProvider->setCredential($currentUser, 2, null); |
82 | 82 | $tokens = $scratchProvider->getTokens(); |
83 | 83 | $this->assign('tokens', $tokens); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | catch (ApplicationLogicException $ex) { |
89 | - SessionAlert::error('Error enabling YubiKey OTP: ' . $ex->getMessage()); |
|
89 | + SessionAlert::error('Error enabling YubiKey OTP: '.$ex->getMessage()); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->redirect('multiFactor'); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | SessionAlert::success('Enabled TOTP.'); |
178 | 178 | |
179 | 179 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
180 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
180 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
181 | 181 | $scratchProvider->setCredential($currentUser, 2, null); |
182 | 182 | $tokens = $scratchProvider->getTokens(); |
183 | 183 | $this->assign('tokens', $tokens); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | list($data, $reqs) = $otpCredentialProvider->getRegistrationData(); |
259 | 259 | |
260 | - $u2fRequest =json_encode($data); |
|
260 | + $u2fRequest = json_encode($data); |
|
261 | 261 | $u2fSigns = json_encode($reqs); |
262 | 262 | |
263 | 263 | $this->addJs('/vendor/yubico/u2flib-server/examples/assets/u2f-api.js'); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | SessionAlert::success('Enabled U2F.'); |
307 | 307 | |
308 | 308 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
309 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
309 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
310 | 310 | $scratchProvider->setCredential($currentUser, 2, null); |
311 | 311 | $tokens = $scratchProvider->getTokens(); |
312 | 312 | $this->assign('tokens', $tokens); |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | |
420 | 420 | if ($result) { |
421 | 421 | $otpCredentialProvider->deleteCredential($currentUser); |
422 | - SessionAlert::success('Disabled ' . $factorType . '.'); |
|
422 | + SessionAlert::success('Disabled '.$factorType.'.'); |
|
423 | 423 | $this->redirect('multiFactor'); |
424 | 424 | } |
425 | 425 | else { |
426 | - SessionAlert::error('Error disabling ' . $factorType . ' - invalid credentials.'); |
|
426 | + SessionAlert::error('Error disabling '.$factorType.' - invalid credentials.'); |
|
427 | 427 | $this->redirect('multiFactor'); |
428 | 428 | } |
429 | 429 | } |
@@ -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() |
@@ -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; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | throw new ApplicationLogicException('Cannot locate request'); |
178 | 178 | } |
179 | 179 | |
180 | - if($this->job->getEmailTemplate() !== null){ |
|
180 | + if ($this->job->getEmailTemplate() !== null) { |
|
181 | 181 | $this->emailTemplate = EmailTemplate::getById($this->job->getEmailTemplate(), $this->getDatabase()); |
182 | 182 | |
183 | 183 | if ($this->emailTemplate === false) { |
@@ -185,20 +185,20 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - if($this->job->getParameters() !== null) { |
|
188 | + if ($this->job->getParameters() !== null) { |
|
189 | 189 | $this->parameters = json_decode($this->job->getParameters()); |
190 | 190 | |
191 | 191 | if (json_last_error() !== JSON_ERROR_NONE) { |
192 | - throw new ApplicationLogicException('JSON decode: ' . json_last_error_msg()); |
|
192 | + throw new ApplicationLogicException('JSON decode: '.json_last_error_msg()); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Should we wait for a parent job? |
197 | - if($this->job->getParent() !== null) { |
|
197 | + if ($this->job->getParent() !== null) { |
|
198 | 198 | /** @var JobQueue $parentJob */ |
199 | 199 | $parentJob = JobQueue::getById($this->job->getParent(), $this->getDatabase()); |
200 | 200 | |
201 | - if($parentJob === false) { |
|
201 | + if ($parentJob === false) { |
|
202 | 202 | $this->markFailed("Parent job could not be found"); |
203 | 203 | return; |
204 | 204 | } |
@@ -147,7 +147,7 @@ |
||
147 | 147 | $oauth = new OAuthUserHelper($user, $database, $this->getOAuthProtocolHelper(), $this->getSiteConfiguration()); |
148 | 148 | $this->assign('oauth', $oauth); |
149 | 149 | |
150 | - if($user->getForceIdentified() === null) { |
|
150 | + if ($user->getForceIdentified() === null) { |
|
151 | 151 | $idVerifier = new IdentificationVerifier($this->getHttpHelper(), $this->getSiteConfiguration(), $this->getDatabase()); |
152 | 152 | $this->assign('identificationStatus', $idVerifier->isUserIdentified($user->getOnWikiName()) ? 'detected' : 'missing'); |
153 | 153 | } else { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | protected function main() |
21 | 21 | { |
22 | - if(WebRequest::wasPosted()) { |
|
22 | + if (WebRequest::wasPosted()) { |
|
23 | 23 | Session::destroy(); |
24 | 24 | $this->redirect("login"); |
25 | 25 | return; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // Create a task. |
79 | 79 | $taskName = $job->getTask(); |
80 | 80 | |
81 | - if(!class_exists($taskName)) { |
|
81 | + if (!class_exists($taskName)) { |
|
82 | 82 | throw new ApplicationLogicException('Job task does not exist'); |
83 | 83 | } |
84 | 84 | |
@@ -132,6 +132,6 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | public static function errorHandler($errno, $errstr, $errfile, $errline) { |
135 | - throw new Exception($errfile . "@" . $errline . ": " . $errstr); |
|
135 | + throw new Exception($errfile."@".$errline.": ".$errstr); |
|
136 | 136 | } |
137 | 137 | } |
@@ -133,7 +133,7 @@ |
||
133 | 133 | if ($reservationId !== 0 && $reservationId !== null) { |
134 | 134 | if ($currentUser->getId() !== $reservationId) { |
135 | 135 | SessionAlert::error("Request is reserved by someone else."); |
136 | - $this->redirect('/viewRequest', null, ['id' => $request->getId()] ); |
|
136 | + $this->redirect('/viewRequest', null, ['id' => $request->getId()]); |
|
137 | 137 | return true; |
138 | 138 | } |
139 | 139 | } |