Completed
Push — master ( fcafe6...a3354e )
by Paul
02:15
created
helper/session_helper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@
 block discarded – undo
72 72
 	 */
73 73
 	public function __construct(driver_interface $db, config $config, user $user, service_collection $modules, $registration_table, $user_table)
74 74
 	{
75
-		$this->db					= $db;
75
+		$this->db = $db;
76 76
 		$this->user_array			= $user;
77
-		$this->config				= $config;
78
-		$this->registration_table	= $registration_table;
77
+		$this->config = $config;
78
+		$this->registration_table = $registration_table;
79 79
 		$this->user_table			= $user_table;
80 80
 
81 81
 		$this->validateModules($modules);
Please login to merge, or discard this patch.
controller/main_controller.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -87,15 +87,15 @@
 block discarded – undo
87 87
 	 */
88 88
 	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)
89 89
 	{
90
-		$this->controller_helper 	= $controller_helper;
91
-		$this->template 			= $template;
92
-		$this->db					= $db;
93
-		$this->user					= $user;
94
-		$this->request				= $request;
95
-		$this->config				= $config;
96
-		$this->session_helper		= $session_helper;
97
-		$this->root_path			= $root_path;
98
-		$this->php_ext				= $php_ext;
90
+		$this->controller_helper = $controller_helper;
91
+		$this->template = $template;
92
+		$this->db = $db;
93
+		$this->user = $user;
94
+		$this->request = $request;
95
+		$this->config = $config;
96
+		$this->session_helper = $session_helper;
97
+		$this->root_path = $root_path;
98
+		$this->php_ext = $php_ext;
99 99
 
100 100
 	}
101 101
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@
 block discarded – undo
127 127
 		if (!empty($default))
128 128
 		{
129 129
 			$module = $this->session_helper->findModule($class);
130
-		}
131
-		else
130
+		} else
132 131
 		{
133 132
 			foreach ($modules as $row)
134 133
 			{
Please login to merge, or discard this patch.
modules/u2f.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 	 *
87 87
 	 * Do not return false in case a specific user disabeld this module,
88 88
 	 * OR if the user is unable to use this specific module.
89
-	 * @return boolean
89
+	 * @return boolean|null
90 90
 	 */
91 91
 	public function is_enabled()
92 92
 	{
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- *
4
- * 2FA extension for the phpBB Forum Software package.
5
- *
6
- * @copyright (c) 2015 Paul Sohier
7
- * @license GNU General Public License, version 2 (GPL-2.0)
8
- *
9
- */
3
+	 *
4
+	 * 2FA extension for the phpBB Forum Software package.
5
+	 *
6
+	 * @copyright (c) 2015 Paul Sohier
7
+	 * @license GNU General Public License, version 2 (GPL-2.0)
8
+	 *
9
+	 */
10 10
 
11 11
 namespace paul999\tfa\acp;
12 12
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -215,10 +215,12 @@  discard block
 block discarded – undo
215 215
 
216 216
 			if (property_exists($response, 'errorCode'))
217 217
 			{
218
-				if ($response->errorCode == 4) // errorCode 4 means that this device wasn't registered
218
+				if ($response->errorCode == 4) {
219
+					// errorCode 4 means that this device wasn't registered
219 220
 				{
220 221
 					throw new AccessDeniedHttpException($this->user->lang('TFA_NOT_REGISTERED'));
221 222
 				}
223
+				}
222 224
 				throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG'));
223 225
 			}
224 226
 			$result = new AuthenticationResponse($response->signatureData, $response->clientData, $response->keyHandle, $response->errorCode);
@@ -232,12 +234,10 @@  discard block
 block discarded – undo
232 234
 
233 235
 			$sql = 'UPDATE ' . $this->registration_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE registration_id = ' . (int)$reg->id;
234 236
 			$this->db->sql_query($sql);
235
-		}
236
-		catch (U2fError $error)
237
+		} catch (U2fError $error)
237 238
 		{
238 239
 			$this->createError($error);
239
-		}
240
-		catch (\InvalidArgumentException $invalid)
240
+		} catch (\InvalidArgumentException $invalid)
241 241
 		{
242 242
 			throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG') . '<br />' . $invalid->getMessage(), $invalid);
243 243
 		}
@@ -274,8 +274,7 @@  discard block
 block discarded – undo
274 274
 		if ($count == 0)
275 275
 		{
276 276
 			trigger_error('TFA_UNABLE_TO_UPDATE_SESSION');
277
-		}
278
-		else if ($count > 1)
277
+		} else if ($count > 1)
279 278
 		{
280 279
 			// Reset sessions table. We had multiple sessions with same ID!!!
281 280
 			$sql_ary['u2f_request'] = '';
@@ -319,8 +318,7 @@  discard block
 block discarded – undo
319 318
 			);
320 319
 
321 320
 			$this->update_session($sql_ary);
322
-		}
323
-		catch (U2fError $err)
321
+		} catch (U2fError $err)
324 322
 		{
325 323
 			$this->createError($err);
326 324
 		}
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$this->request  = $request;
76 76
 		$this->template = $template;
77 77
 
78
-		$this->registration_table	= $registration_table;
78
+		$this->registration_table = $registration_table;
79 79
 
80 80
 		$this->u2f = new \paul999\u2f\U2F('https://' . $this->request->server('HTTP_HOST'));
81 81
 	}
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 				'LAST_USED'     => $this->user->format_date($row['last_used']),
349 349
 			));
350 350
 
351
-			$reg				= new registration_helper();
351
+			$reg = new registration_helper();
352 352
 			$reg->setCounter($row['counter']);
353 353
 			$reg->setCertificate($row['certificate']);
354 354
 			$reg->setKeyHandle($row['key_handle']);
355 355
 			$reg->setPublicKey($row['public_key']);
356
-			$reg->id			= $row['registration_id'];
357
-			$this->reg_data[]	= $reg;
356
+			$reg->id = $row['registration_id'];
357
+			$this->reg_data[] = $reg;
358 358
 		}
359 359
 		$this->db->sql_freeresult($result);
360 360
 	}
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 
392 392
 		while ($row = $this->db->sql_fetchrow($result))
393 393
 		{
394
-			$reg 				= new registration_helper();
394
+			$reg = new registration_helper();
395 395
 			$reg->setCounter($row['counter']);
396 396
 			$reg->setCertificate($row['certificate']);
397 397
 			$reg->setKeyHandle($row['key_handle']);
398 398
 			$reg->setPublicKey($row['public_key']);
399
-			$reg->id 			= $row['registration_id'];
400
-			$rows[] 			= $reg;
399
+			$reg->id = $row['registration_id'];
400
+			$rows[] = $reg;
401 401
 		}
402 402
 
403 403
 		$this->db->sql_freeresult($result);
Please login to merge, or discard this patch.
modules/module_interface.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,93 +1,93 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- *
4
- * 2FA extension for the phpBB Forum Software package.
5
- *
6
- * @copyright (c) 2015 Paul Sohier
7
- * @license GNU General Public License, version 2 (GPL-2.0)
8
- *
9
- */
3
+	 *
4
+	 * 2FA extension for the phpBB Forum Software package.
5
+	 *
6
+	 * @copyright (c) 2015 Paul Sohier
7
+	 * @license GNU General Public License, version 2 (GPL-2.0)
8
+	 *
9
+	 */
10 10
 
11 11
 namespace paul999\tfa\modules;
12 12
 
13 13
 interface module_interface
14 14
 {
15
-    /**
16
-     * Return if this module is enabled by the admin
17
-     * (And all server requirements are met).
18
-     *
19
-     * Do not return false in case a specific user disabeld this module,
20
-     * OR if the user is unable to use this specific module.
21
-     * @return boolean
22
-     */
23
-    public function is_enabled();
15
+	/**
16
+	 * Return if this module is enabled by the admin
17
+	 * (And all server requirements are met).
18
+	 *
19
+	 * Do not return false in case a specific user disabeld this module,
20
+	 * OR if the user is unable to use this specific module.
21
+	 * @return boolean
22
+	 */
23
+	public function is_enabled();
24 24
 
25
-    /**
26
-     * Check if the current user is able to use this module.
27
-     *
28
-     * This means that the user enabled it in the UCP,
29
-     * And has it setup up correctly.
30
-     * This method will be called during login, not during registration/
31
-     *
32
-     * @param int $user_id
33
-     * @return bool
34
-     */
35
-    public function is_usable($user_id);
25
+	/**
26
+	 * Check if the current user is able to use this module.
27
+	 *
28
+	 * This means that the user enabled it in the UCP,
29
+	 * And has it setup up correctly.
30
+	 * This method will be called during login, not during registration/
31
+	 *
32
+	 * @param int $user_id
33
+	 * @return bool
34
+	 */
35
+	public function is_usable($user_id);
36 36
 
37
-    /**
38
-     * Check if the user can potentially use this.
39
-     * This method is called at registration page.
40
-     *
41
-     * You can, for example, check if the current browser is suitable.
42
-     *
43
-     * @param int $user_id
44
-     * @return bool
45
-     */
46
-    public function is_potentially_usable($user_id);
37
+	/**
38
+	 * Check if the user can potentially use this.
39
+	 * This method is called at registration page.
40
+	 *
41
+	 * You can, for example, check if the current browser is suitable.
42
+	 *
43
+	 * @param int $user_id
44
+	 * @return bool
45
+	 */
46
+	public function is_potentially_usable($user_id);
47 47
 
48
-    /**
49
-     * Get the priority for this module.
50
-     * A lower priority means more chance it gets selected as default option
51
-     *
52
-     * There can be only one module with a specific priority!
53
-     * If there is already a module registered with this priority,
54
-     * a Exception might be thrown
55
-     *
56
-     * @param int $user_id If set, the priority can depend on the current user
57
-     * @return int
58
-     */
59
-    public function get_priority($user_id = 0);
48
+	/**
49
+	 * Get the priority for this module.
50
+	 * A lower priority means more chance it gets selected as default option
51
+	 *
52
+	 * There can be only one module with a specific priority!
53
+	 * If there is already a module registered with this priority,
54
+	 * a Exception might be thrown
55
+	 *
56
+	 * @param int $user_id If set, the priority can depend on the current user
57
+	 * @return int
58
+	 */
59
+	public function get_priority($user_id = 0);
60 60
 
61
-    /**
62
-     * Start of the login procedure.
63
-     * @param int $user_id
64
-     * @return int
65
-     */
66
-    public function login_start($user_id);
61
+	/**
62
+	 * Start of the login procedure.
63
+	 * @param int $user_id
64
+	 * @return int
65
+	 */
66
+	public function login_start($user_id);
67 67
 
68
-    /**
69
-     * Actual login procedure
70
-     * @param int $user_id
71
-     */
72
-    public function login($user_id);
68
+	/**
69
+	 * Actual login procedure
70
+	 * @param int $user_id
71
+	 */
72
+	public function login($user_id);
73 73
 
74
-    /**
75
-     * Start of registration
76
-     * @return void
77
-     */
78
-    public function register_start();
74
+	/**
75
+	 * Start of registration
76
+	 * @return void
77
+	 */
78
+	public function register_start();
79 79
 
80
-    /**
81
-     * Actual registration
82
-     * @return void
83
-     */
84
-    public function register();
80
+	/**
81
+	 * Actual registration
82
+	 * @return void
83
+	 */
84
+	public function register();
85 85
 
86
-    /**
87
-     * This method is called to show the UCP page.
88
-     * You can assign template variables to the template, or do anything else here.
89
-     */
90
-    public function show_ucp();
86
+	/**
87
+	 * This method is called to show the UCP page.
88
+	 * You can assign template variables to the template, or do anything else here.
89
+	 */
90
+	public function show_ucp();
91 91
 
92 92
 	/**
93 93
 	 * Delete a specific row from the UCP.
Please login to merge, or discard this patch.