Completed
Pull Request — master (#6)
by Paul
07:59
created
modules/u2f.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 		$this->user     = $user;
60 60
 		$this->request  = $request;
61 61
 		$this->template = $template;
62
-		$this->root_path= $root_path;
62
+		$this->root_path = $root_path;
63 63
 
64
-		$this->registration_table	= $registration_table;
64
+		$this->registration_table = $registration_table;
65 65
 
66
-		$this->u2f = new \paul999\u2f\U2F('https://' . $this->request->server('HTTP_HOST'));
66
+		$this->u2f = new \paul999\u2f\U2F('https://'.$this->request->server('HTTP_HOST'));
67 67
 	}
68 68
 
69 69
 	/**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 		try
191 191
 		{
192 192
 			$sql = 'SELECT u2f_request 
193
-				FROM ' . SESSIONS_TABLE . " 
193
+				FROM ' . SESSIONS_TABLE." 
194 194
 				WHERE
195
-					session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND
195
+					session_id = '" . $this->db->sql_escape($this->user->data['session_id'])."' AND
196 196
 					session_user_id = " . (int) $this->user->data['user_id'];
197 197
 			$result = $this->db->sql_query($sql);
198 198
 			$row = $this->db->sql_fetchrow($result);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 				'last_used' => time(),
223 223
 			);
224 224
 
225
-			$sql = 'UPDATE ' . $this->registration_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE registration_id = ' . (int) $reg->getId();
225
+			$sql = 'UPDATE '.$this->registration_table.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' WHERE registration_id = '.(int) $reg->getId();
226 226
 			$this->db->sql_query($sql);
227 227
 
228 228
 			return true;
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 				'last_used' => time(),
319 319
 			);
320 320
 
321
-			$sql = 'INSERT INTO ' . $this->registration_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
321
+			$sql = 'INSERT INTO '.$this->registration_table.' '.$this->db->sql_build_array('INSERT', $sql_ary);
322 322
 			$this->db->sql_query($sql);
323 323
 
324 324
 			$sql_ary = array(
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 	 */
351 351
 	public function delete($key)
352 352
 	{
353
-		$sql = 'DELETE FROM ' . $this->registration_table . '
354
-			WHERE user_id = ' . (int) $this->user->data['user_id'] . '
353
+		$sql = 'DELETE FROM '.$this->registration_table.'
354
+			WHERE user_id = ' . (int) $this->user->data['user_id'].'
355 355
 			AND registration_id =' . (int) $key;
356 356
 
357 357
 		$this->db->sql_query($sql);
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	private function getRegistrations($user_id)
395 395
 	{
396
-		$sql = 'SELECT * FROM ' . $this->registration_table . ' WHERE user_id = ' . (int) $user_id;
396
+		$sql = 'SELECT * FROM '.$this->registration_table.' WHERE user_id = '.(int) $user_id;
397 397
 		$result = $this->db->sql_query($sql);
398 398
 		$rows = array();
399 399
 
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
 	 */
482 482
 	private function update_session($sql_ary)
483 483
 	{
484
-		$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "
484
+		$sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary)."
485 485
 			WHERE
486
-				session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND
486
+				session_id = '" . $this->db->sql_escape($this->user->data['session_id'])."' AND
487 487
 				session_user_id = " . (int) $this->user->data['user_id'];
488 488
 		$this->db->sql_query($sql);
489 489
 
Please login to merge, or discard this patch.
event/listener.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function __construct(session_helper_interface $session_helper, user $user, request_interface $request, driver_interface $db, template $template, config $config, $php_ext, $root_path)
81 81
 	{
82
-		$this->session_helper		= $session_helper;
83
-		$this->user					= $user;
84
-		$this->request				= $request;
85
-		$this->config				= $config;
86
-		$this->db					= $db;
82
+		$this->session_helper = $session_helper;
83
+		$this->user = $user;
84
+		$this->request = $request;
85
+		$this->config = $config;
86
+		$this->db = $db;
87 87
 		$this->template				= $template;
88
-		$this->php_ext				= $php_ext;
88
+		$this->php_ext = $php_ext;
89 89
 		$this->root_path			= $root_path;
90 90
 	}
91 91
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		}
128 128
 		if ($this->user->data['is_bot'] == false && $this->user->data['user_id'] != ANONYMOUS && $this->session_helper->isTfaRequired($this->user->data['user_id'], false, $this->user->data) && !$this->session_helper->isTfaRegistered($this->user->data['user_id']))
129 129
 		{
130
-			$sql = 'SELECT module_id FROM ' . MODULES_TABLE . " WHERE module_langname = 'UCP_TFA' OR module_langname = 'UCP_TFA_MANAGE'";
130
+			$sql = 'SELECT module_id FROM '.MODULES_TABLE." WHERE module_langname = 'UCP_TFA' OR module_langname = 'UCP_TFA_MANAGE'";
131 131
 			$result = $this->db->sql_query($sql, 3600);
132 132
 			$allowed_i = array();
133 133
 
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 			$ucp_mode = '-paul999-tfa-ucp-tfa_module';
140 140
 			$allowed_i[] = $ucp_mode;
141 141
 
142
-			if ($this->user->page['page_name'] === 'ucp.' . $this->php_ext && in_array($this->request->variable('i', ''), $allowed_i))
142
+			if ($this->user->page['page_name'] === 'ucp.'.$this->php_ext && in_array($this->request->variable('i', ''), $allowed_i))
143 143
 			{
144 144
 				return; // We are at our UCP page, so skip any other checks. This page is always available
145 145
 			}
146 146
 			$this->user->add_lang_ext('paul999/tfa', 'common');
147 147
 			$url = append_sid("{$this->root_path}ucp.{$this->php_ext}", "i={$ucp_mode}");
148
-			$msg_text = $this->user->lang('TFA_REQUIRED_KEY_MISSING', '<a href="' . $url . '">', '</a>');
149
-			$msg_title =  $this->user->lang['INFORMATION'];
148
+			$msg_text = $this->user->lang('TFA_REQUIRED_KEY_MISSING', '<a href="'.$url.'">', '</a>');
149
+			$msg_title = $this->user->lang['INFORMATION'];
150 150
 
151 151
 			page_header($msg_title);
152 152
 
Please login to merge, or discard this patch.
controller/main_controller.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function __construct(helper $controller_helper, driver_interface $db, template $template, user $user, request_interface $request, config $config, session_helper_interface $session_helper, $root_path, $php_ext)
87 87
 	{
88
-		$this->controller_helper 	= $controller_helper;
89
-		$this->template 			= $template;
90
-		$this->db					= $db;
91
-		$this->user					= $user;
92
-		$this->request				= $request;
93
-		$this->config				= $config;
94
-		$this->session_helper		= $session_helper;
95
-		$this->root_path			= $root_path;
96
-		$this->php_ext				= $php_ext;
88
+		$this->controller_helper = $controller_helper;
89
+		$this->template = $template;
90
+		$this->db = $db;
91
+		$this->user = $user;
92
+		$this->request = $request;
93
+		$this->config = $config;
94
+		$this->session_helper = $session_helper;
95
+		$this->root_path = $root_path;
96
+		$this->php_ext = $php_ext;
97 97
 
98 98
 	}
99 99
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 			'tfa_random' => '',
130 130
 			'tfa_uid'    => 0,
131 131
 		);
132
-		$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "
132
+		$sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary)."
133 133
 			WHERE
134
-				session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND
134
+				session_id = '" . $this->db->sql_escape($this->user->data['session_id'])."' AND
135 135
 				session_user_id = " . (int) $this->user->data['user_id'];
136 136
 		$this->db->sql_query($sql);
137 137
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 			if ($admin)
188 188
 			{
189 189
 				// the login array is used because the user ids do not differ for re-authentication
190
-				$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
191
-					WHERE session_id = '" . $this->db->sql_escape($old_session_id) . "'
190
+				$sql = 'DELETE FROM '.SESSIONS_TABLE."
191
+					WHERE session_id = '" . $this->db->sql_escape($old_session_id)."'
192 192
 					AND session_user_id = " . (int) $user_id;
193 193
 				$this->db->sql_query($sql);
194 194
 
Please login to merge, or discard this patch.