@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | $this->user = $user; |
81 | 81 | $this->request = $request; |
82 | 82 | $this->template = $template; |
83 | - $this->root_path= $root_path; |
|
83 | + $this->root_path = $root_path; |
|
84 | 84 | |
85 | - $this->registration_table = $registration_table; |
|
85 | + $this->registration_table = $registration_table; |
|
86 | 86 | |
87 | - $this->u2f = new \paul999\u2f\U2F('https://' . $this->request->server('HTTP_HOST')); |
|
87 | + $this->u2f = new \paul999\u2f\U2F('https://'.$this->request->server('HTTP_HOST')); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return false; |
118 | 118 | } |
119 | 119 | $sql = 'SELECT COUNT(registration_id) as reg_id |
120 | - FROM ' . $this->registration_table . ' |
|
120 | + FROM ' . $this->registration_table.' |
|
121 | 121 | WHERE |
122 | 122 | user_id = ' . (int) $user_id; |
123 | 123 | $result = $this->db->sql_query($sql); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function is_potentially_usable($user_id = false) |
140 | 140 | { |
141 | - $browsercap = new Browscap($this->root_path . 'cache/'); |
|
141 | + $browsercap = new Browscap($this->root_path.'cache/'); |
|
142 | 142 | $info = $browsercap->getBrowser($this->request->server('HTTP_USER_AGENT')); |
143 | 143 | return strtolower($info->Browser) === 'chrome' && $this->is_ssl(); |
144 | 144 | } |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | 'u2f_request' => $registrations |
192 | 192 | ); |
193 | 193 | |
194 | - $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
194 | + $sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' |
|
195 | 195 | WHERE |
196 | - session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND |
|
196 | + session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND |
|
197 | 197 | session_user_id = ' . (int) $this->user->data['user_id']; |
198 | 198 | $this->db->sql_query($sql); |
199 | 199 | $count = $this->db->sql_affectedrows(); |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | { |
205 | 205 | // Reset sessions table. We had multiple sessions with same ID!!! |
206 | 206 | $sql_ary['u2f_request'] = ''; |
207 | - $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
207 | + $sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' |
|
208 | 208 | WHERE |
209 | - session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND |
|
209 | + session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND |
|
210 | 210 | session_user_id = ' . (int) $this->user->data['user_id']; |
211 | 211 | $this->db->sql_query($sql); |
212 | 212 | } |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | try |
227 | 227 | { |
228 | 228 | $sql = 'SELECT u2f_request |
229 | - FROM ' . SESSIONS_TABLE . ' |
|
229 | + FROM ' . SESSIONS_TABLE.' |
|
230 | 230 | WHERE |
231 | - session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND |
|
231 | + session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND |
|
232 | 232 | session_user_id = ' . (int) $this->user->data['user_id']; |
233 | 233 | $result = $this->db->sql_query($sql); |
234 | 234 | $row = $this->db->sql_fetchrow($result); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'last_used' => time(), |
259 | 259 | ); |
260 | 260 | |
261 | - $sql = 'UPDATE ' . $this->registration_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE registration_id = ' . (int) $reg->getId(); |
|
261 | + $sql = 'UPDATE '.$this->registration_table.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' WHERE registration_id = '.(int) $reg->getId(); |
|
262 | 262 | $this->db->sql_query($sql); |
263 | 263 | } |
264 | 264 | catch (U2fError $error) |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | catch (\InvalidArgumentException $invalid) |
269 | 269 | { |
270 | - throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG') . '<br />' . $invalid->getMessage(), $invalid); |
|
270 | + throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG').'<br />'.$invalid->getMessage(), $invalid); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | 'last_used' => time(), |
343 | 343 | ); |
344 | 344 | |
345 | - $sql = 'INSERT INTO ' . $this->registration_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); |
|
345 | + $sql = 'INSERT INTO '.$this->registration_table.' '.$this->db->sql_build_array('INSERT', $sql_ary); |
|
346 | 346 | $this->db->sql_query($sql); |
347 | 347 | |
348 | 348 | $sql_ary = array( |
@@ -364,8 +364,8 @@ discard block |
||
364 | 364 | public function show_ucp() |
365 | 365 | { |
366 | 366 | $sql = 'SELECT * |
367 | - FROM ' . $this->registration_table . ' |
|
368 | - WHERE user_id = ' . (int) $this->user->data['user_id'] . ' |
|
367 | + FROM ' . $this->registration_table.' |
|
368 | + WHERE user_id = ' . (int) $this->user->data['user_id'].' |
|
369 | 369 | ORDER BY registration_id ASC'; |
370 | 370 | |
371 | 371 | $result = $this->db->sql_query($sql); |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function delete($key) |
402 | 402 | { |
403 | - $sql = 'DELETE FROM ' . $this->registration_table . ' |
|
404 | - WHERE user_id = ' . (int) $this->user->data['user_id'] . ' |
|
403 | + $sql = 'DELETE FROM '.$this->registration_table.' |
|
404 | + WHERE user_id = ' . (int) $this->user->data['user_id'].' |
|
405 | 405 | AND registration_id =' . (int) $key; |
406 | 406 | |
407 | 407 | $this->db->sql_query($sql); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | */ |
445 | 445 | private function getRegistrations($user_id) |
446 | 446 | { |
447 | - $sql = 'SELECT * FROM ' . $this->registration_table . ' WHERE user_id = ' . (int) $user_id; |
|
447 | + $sql = 'SELECT * FROM '.$this->registration_table.' WHERE user_id = '.(int) $user_id; |
|
448 | 448 | $result = $this->db->sql_query($sql); |
449 | 449 | $rows = array(); |
450 | 450 | |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | */ |
533 | 533 | private function update_session($sql_ary) |
534 | 534 | { |
535 | - $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
535 | + $sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' |
|
536 | 536 | WHERE |
537 | - session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND |
|
537 | + session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND |
|
538 | 538 | session_user_id = ' . (int) $this->user->data['user_id']; |
539 | 539 | $this->db->sql_query($sql); |
540 | 540 |