Completed
Push — master ( a0a1ba...4650ff )
by Paul
01:24
created
event/listener.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,12 +126,12 @@
 block discarded – undo
126 126
 			return;
127 127
 		}
128 128
 		if (strpos($this->user->page['page_name'], 'app' . $this->php_ext) !== false && strrpos($this->user->page['page_name'], 'paul999/tfa') !== false) {
129
-            @define('SKIP_CHECK_DISABLED', true);
130
-        }
129
+			@define('SKIP_CHECK_DISABLED', true);
130
+		}
131 131
 
132 132
 		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']))
133 133
 		{
134
-		    @define('SKIP_CHECK_DISABLED', true);
134
+			@define('SKIP_CHECK_DISABLED', true);
135 135
 			$sql = 'SELECT module_id FROM ' . MODULES_TABLE . " WHERE module_langname = 'UCP_TFA' OR module_langname = 'UCP_TFA_MANAGE'";
136 136
 			$result = $this->db->sql_query($sql, 3600);
137 137
 			$allowed_i = array();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 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
 
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
 		{
126 126
 			return;
127 127
 		}
128
-		if (strpos($this->user->page['page_name'], 'app' . $this->php_ext) !== false && strrpos($this->user->page['page_name'], 'paul999/tfa') !== false) {
128
+		if (strpos($this->user->page['page_name'], 'app'.$this->php_ext) !== false && strrpos($this->user->page['page_name'], 'paul999/tfa') !== false) {
129 129
             @define('SKIP_CHECK_DISABLED', true);
130 130
         }
131 131
 
132 132
 		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']))
133 133
 		{
134 134
 		    @define('SKIP_CHECK_DISABLED', true);
135
-			$sql = 'SELECT module_id FROM ' . MODULES_TABLE . " WHERE module_langname = 'UCP_TFA' OR module_langname = 'UCP_TFA_MANAGE'";
135
+			$sql = 'SELECT module_id FROM '.MODULES_TABLE." WHERE module_langname = 'UCP_TFA' OR module_langname = 'UCP_TFA_MANAGE'";
136 136
 			$result = $this->db->sql_query($sql, 3600);
137 137
 			$allowed_i = array();
138 138
 
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 			$ucp_mode = '-paul999-tfa-ucp-tfa_module';
145 145
 			$allowed_i[] = $ucp_mode;
146 146
 
147
-			if ($this->user->page['page_name'] === 'ucp.' . $this->php_ext && in_array($this->request->variable('i', ''), $allowed_i))
147
+			if ($this->user->page['page_name'] === 'ucp.'.$this->php_ext && in_array($this->request->variable('i', ''), $allowed_i))
148 148
 			{
149 149
 				return; // We are at our UCP page, so skip any other checks. This page is always available
150 150
 			}
151 151
 			$this->user->add_lang_ext('paul999/tfa', 'common');
152 152
 			$url = append_sid("{$this->root_path}ucp.{$this->php_ext}", "i={$ucp_mode}");
153
-			$msg_text = $this->user->lang('TFA_REQUIRED_KEY_MISSING', '<a href="' . $url . '">', '</a>');
154
-			$msg_title =  $this->user->lang['INFORMATION'];
153
+			$msg_text = $this->user->lang('TFA_REQUIRED_KEY_MISSING', '<a href="'.$url.'">', '</a>');
154
+			$msg_title = $this->user->lang['INFORMATION'];
155 155
 
156 156
 			page_header($msg_title);
157 157
 
Please login to merge, or discard this patch.
modules/otp.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 				$sql_ary = array(
178 178
 					'last_used' => time(),
179 179
 				);
180
-				$sql = 'UPDATE ' . $this->otp_registration_table . ' 
181
-					SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' 
180
+				$sql = 'UPDATE '.$this->otp_registration_table.' 
181
+					SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).' 
182 182
 					WHERE 
183 183
 						registration_id = ' . (int) $registration['registration_id'];
184 184
 				$this->db->sql_query($sql);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		$secret = $this->otp->generateSecret();
211 211
 		$QR = $this->otp_helper->generateKeyURI('totp', $secret, $this->user->data['username'], generate_board_url(), 0, 'sha1');
212 212
 		$this->template->assign_vars(array(
213
-			'TFA_QR_CODE'				=> 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=' . $QR,
213
+			'TFA_QR_CODE'				=> 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl='.$QR,
214 214
 			'TFA_SECRET'				=> $secret,
215 215
 			'L_TFA_ADD_OTP_KEY_EXPLAIN'	=> $this->user->lang('TFA_ADD_OTP_KEY_EXPLAIN', $secret),
216 216
 			'S_HIDDEN_FIELDS_MODULE'	=> build_hidden_fields(array(
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	public function register()
231 231
 	{
232 232
 		$secret = $this->request->variable('secret', '');
233
-		$otp	= $this->request->variable('register', '');
233
+		$otp = $this->request->variable('register', '');
234 234
 
235 235
 		if (!$this->otp->checkTOTP($secret, $otp, 'sha1'))
236 236
 		{
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			'last_used' 	=> time(),
245 245
 		);
246 246
 
247
-		$sql = 'INSERT INTO ' . $this->otp_registration_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
247
+		$sql = 'INSERT INTO '.$this->otp_registration_table.' '.$this->db->sql_build_array('INSERT', $sql_ary);
248 248
 		$this->db->sql_query($sql);
249 249
 	}
250 250
 
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function delete($key)
269 269
 	{
270
-		$sql = 'DELETE FROM ' . $this->otp_registration_table . '
271
-			WHERE user_id = ' . (int) $this->user->data['user_id'] . '
270
+		$sql = 'DELETE FROM '.$this->otp_registration_table.'
271
+			WHERE user_id = ' . (int) $this->user->data['user_id'].'
272 272
 			AND registration_id =' . (int) $key;
273 273
 
274 274
 		$this->db->sql_query($sql);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	private function getRegistrations($user_id)
283 283
 	{
284
-		$sql = 'SELECT * FROM ' . $this->otp_registration_table . ' WHERE user_id = ' . (int) $user_id;
284
+		$sql = 'SELECT * FROM '.$this->otp_registration_table.' WHERE user_id = '.(int) $user_id;
285 285
 		$result = $this->db->sql_query($sql);
286 286
 		$rows = $this->db->sql_fetchrowset($result);
287 287
 
Please login to merge, or discard this patch.