Completed
Push — master ( d14778...e59fd5 )
by Paul
03:22
created
modules/u2f.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 		$this->user     = $user;
77 77
 		$this->request  = $request;
78 78
 		$this->template = $template;
79
-		$this->root_path= $root_path;
79
+		$this->root_path = $root_path;
80 80
 
81
-		$this->registration_table	= $registration_table;
81
+		$this->registration_table = $registration_table;
82 82
 
83
-		$this->u2f = new \paul999\u2f\U2F('https://' . $this->request->server('HTTP_HOST'));
83
+		$this->u2f = new \paul999\u2f\U2F('https://'.$this->request->server('HTTP_HOST'));
84 84
 	}
85 85
 
86 86
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			return false;
114 114
 		}
115 115
 		$sql = 'SELECT COUNT(registration_id) as reg_id 
116
-					FROM ' . $this->registration_table . ' 
116
+					FROM ' . $this->registration_table.' 
117 117
 					WHERE 
118 118
 						user_id = ' . (int) $user_id;
119 119
 		$result = $this->db->sql_query($sql);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function is_potentially_usable($user_id = false)
136 136
 	{
137
-		$browsercap = new Browscap($this->root_path . 'cache/');
137
+		$browsercap = new Browscap($this->root_path.'cache/');
138 138
 		$info = $browsercap->getBrowser($this->request->server('HTTP_USER_AGENT'));
139 139
 		return strtolower($info->Browser) === 'chrome' && $this->is_ssl();
140 140
 	}
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 			'u2f_request'	=> $registrations
188 188
 		);
189 189
 
190
-		$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
190
+		$sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).'
191 191
 					WHERE
192
-						session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND
192
+						session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND
193 193
 						session_user_id = ' . (int) $this->user->data['user_id'];
194 194
 		$this->db->sql_query($sql);
195 195
 		$count = $this->db->sql_affectedrows();
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 			{
201 201
 				// Reset sessions table. We had multiple sessions with same ID!!!
202 202
 				$sql_ary['u2f_request'] = '';
203
-				$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
203
+				$sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).'
204 204
 					WHERE
205
-						session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND
205
+						session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND
206 206
 						session_user_id = ' . (int) $this->user->data['user_id'];
207 207
 				$this->db->sql_query($sql);
208 208
 			}
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 		try
223 223
 		{
224 224
 			$sql = 'SELECT u2f_request 
225
-						FROM ' . SESSIONS_TABLE . ' 
225
+						FROM ' . SESSIONS_TABLE.' 
226 226
 						WHERE
227
-							session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND
227
+							session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND
228 228
 							session_user_id = ' . (int) $this->user->data['user_id'];
229 229
 			$result = $this->db->sql_query($sql);
230 230
 			$row = $this->db->sql_fetchrow($result);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				'last_used' => time(),
255 255
 			);
256 256
 
257
-			$sql = 'UPDATE ' . $this->registration_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE registration_id = ' . (int) $reg->getId();
257
+			$sql = 'UPDATE '.$this->registration_table.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' WHERE registration_id = '.(int) $reg->getId();
258 258
 			$this->db->sql_query($sql);
259 259
 		}
260 260
 		catch (U2fError $error)
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 		catch (\InvalidArgumentException $invalid)
265 265
 		{
266
-			throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG') . '<br />' . $invalid->getMessage(), $invalid);
266
+			throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG').'<br />'.$invalid->getMessage(), $invalid);
267 267
 		}
268 268
 	}
269 269
 
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 	public function register_start()
289 289
 	{
290 290
 		$sql = 'SELECT *
291
-			FROM ' . $this->registration_table . '
292
-			WHERE user_id = ' . (int) $this->user->data['user_id'] . '
291
+			FROM ' . $this->registration_table.'
292
+			WHERE user_id = ' . (int) $this->user->data['user_id'].'
293 293
 			ORDER BY registration_id ASC';
294 294
 
295 295
 		$result = $this->db->sql_query($sql);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 				'last_used' => time(),
367 367
 			);
368 368
 
369
-			$sql = 'INSERT INTO ' . $this->registration_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
369
+			$sql = 'INSERT INTO '.$this->registration_table.' '.$this->db->sql_build_array('INSERT', $sql_ary);
370 370
 			$this->db->sql_query($sql);
371 371
 
372 372
 			$sql_ary = array(
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 	public function show_ucp()
389 389
 	{
390 390
 		$sql = 'SELECT *
391
-			FROM ' . $this->registration_table . '
392
-			WHERE user_id = ' . (int) $this->user->data['user_id'] . '
391
+			FROM ' . $this->registration_table.'
392
+			WHERE user_id = ' . (int) $this->user->data['user_id'].'
393 393
 			ORDER BY registration_id ASC';
394 394
 
395 395
 		$result = $this->db->sql_query($sql);
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 	 */
416 416
 	public function delete($key)
417 417
 	{
418
-			$sql = 'DELETE FROM ' . $this->registration_table . '
419
-						WHERE user_id = ' . (int) $this->user->data['user_id'] . '
418
+			$sql = 'DELETE FROM '.$this->registration_table.'
419
+						WHERE user_id = ' . (int) $this->user->data['user_id'].'
420 420
 						AND registration_id =' . (int) $key;
421 421
 
422 422
 			$this->db->sql_query($sql);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 */
460 460
 	private function getRegistrations($user_id)
461 461
 	{
462
-		$sql = 'SELECT * FROM ' . $this->registration_table . ' WHERE user_id = ' . (int) $user_id;
462
+		$sql = 'SELECT * FROM '.$this->registration_table.' WHERE user_id = '.(int) $user_id;
463 463
 		$result = $this->db->sql_query($sql);
464 464
 		$rows = array();
465 465
 
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	private function update_session($sql_ary)
549 549
 	{
550
-		$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
550
+		$sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).'
551 551
 							WHERE
552
-								session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND
552
+								session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND
553 553
 								session_user_id = ' . (int) $this->user->data['user_id'];
554 554
 		$this->db->sql_query($sql);
555 555
 
Please login to merge, or discard this patch.