@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function is_usable($user_id) |
| 108 | 108 | { |
| 109 | 109 | $sql = 'SELECT COUNT(registration_id) as reg_id |
| 110 | - FROM ' . $this->otp_registration_table . ' |
|
| 110 | + FROM ' . $this->otp_registration_table.' |
|
| 111 | 111 | WHERE |
| 112 | 112 | user_id = ' . (int) $user_id; |
| 113 | 113 | $result = $this->db->sql_query($sql); |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | $sql_ary = array( |
| 181 | 181 | 'last_used' => time(), |
| 182 | 182 | ); |
| 183 | - $sql = 'UPDATE ' . $this->otp_registration_table . ' |
|
| 184 | - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
| 183 | + $sql = 'UPDATE '.$this->otp_registration_table.' |
|
| 184 | + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).' |
|
| 185 | 185 | WHERE |
| 186 | 186 | registration_id = ' . (int) $registration['registration_id']; |
| 187 | 187 | $this->db->sql_query($sql); |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | public function register_start() |
| 211 | 211 | { |
| 212 | 212 | $secret = $this->otp->generateSecret(); |
| 213 | - $QR = $this->otp_helper->generateKeyURI('totp', $secret, generate_board_url(), '',0, 'sha1'); |
|
| 213 | + $QR = $this->otp_helper->generateKeyURI('totp', $secret, generate_board_url(), '', 0, 'sha1'); |
|
| 214 | 214 | $this->template->assign_vars(array( |
| 215 | - 'TFA_QR_CODE' => 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=' . $QR, |
|
| 215 | + 'TFA_QR_CODE' => 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl='.$QR, |
|
| 216 | 216 | 'TFA_SECRET' => $secret, |
| 217 | 217 | 'L_TFA_ADD_OTP_KEY_EXPLAIN' => $this->user->lang('TFA_ADD_OTP_KEY_EXPLAIN', $secret), |
| 218 | 218 | 'S_HIDDEN_FIELDS_MODULE' => build_hidden_fields(array( |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | public function register() |
| 233 | 233 | { |
| 234 | 234 | $secret = $this->request->variable('secret', ''); |
| 235 | - $otp = $this->request->variable('register', ''); |
|
| 235 | + $otp = $this->request->variable('register', ''); |
|
| 236 | 236 | |
| 237 | 237 | if (!$this->otp->checkTOTP($secret, $otp, 'sha1')) |
| 238 | 238 | { |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | 'last_used' => time(), |
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | - $sql = 'INSERT INTO ' . $this->otp_registration_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); |
|
| 249 | + $sql = 'INSERT INTO '.$this->otp_registration_table.' '.$this->db->sql_build_array('INSERT', $sql_ary); |
|
| 250 | 250 | $this->db->sql_query($sql); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public function delete($key) |
| 271 | 271 | { |
| 272 | - $sql = 'DELETE FROM ' . $this->otp_registration_table . ' |
|
| 273 | - WHERE user_id = ' . (int) $this->user->data['user_id'] . ' |
|
| 272 | + $sql = 'DELETE FROM '.$this->otp_registration_table.' |
|
| 273 | + WHERE user_id = ' . (int) $this->user->data['user_id'].' |
|
| 274 | 274 | AND registration_id =' . (int) $key; |
| 275 | 275 | |
| 276 | 276 | $this->db->sql_query($sql); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | private function getRegistrations($user_id) |
| 285 | 285 | { |
| 286 | - $sql = 'SELECT * FROM ' . $this->otp_registration_table . ' WHERE user_id = ' . (int) $user_id; |
|
| 286 | + $sql = 'SELECT * FROM '.$this->otp_registration_table.' WHERE user_id = '.(int) $user_id; |
|
| 287 | 287 | $result = $this->db->sql_query($sql); |
| 288 | 288 | $rows = $this->db->sql_fetchrowset($result); |
| 289 | 289 | |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace paul999\tfa\controller; |
| 12 | 12 | |
| 13 | 13 | use paul999\tfa\helper\session_helper_interface; |
| 14 | -use paul999\tfa\modules\module_interface; |
|
| 15 | 14 | use phpbb\config\config; |
| 16 | 15 | use phpbb\controller\helper; |
| 17 | 16 | use phpbb\db\driver\driver_interface; |
@@ -87,15 +87,15 @@ discard block |
||
| 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 | |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | 'tfa_random' => '', |
| 131 | 131 | 'tfa_uid' => 0, |
| 132 | 132 | ); |
| 133 | - $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
| 133 | + $sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' |
|
| 134 | 134 | WHERE |
| 135 | - session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND |
|
| 135 | + session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND |
|
| 136 | 136 | session_user_id = ' . (int) $this->user->data['user_id']; |
| 137 | 137 | $this->db->sql_query($sql); |
| 138 | 138 | |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | if ($admin) |
| 171 | 171 | { |
| 172 | 172 | // the login array is used because the user ids do not differ for re-authentication |
| 173 | - $sql = 'DELETE FROM ' . SESSIONS_TABLE . " |
|
| 174 | - WHERE session_id = '" . $this->db->sql_escape($old_session_id) . "' |
|
| 173 | + $sql = 'DELETE FROM '.SESSIONS_TABLE." |
|
| 174 | + WHERE session_id = '" . $this->db->sql_escape($old_session_id)."' |
|
| 175 | 175 | AND session_user_id = " . (int) $user_id; |
| 176 | 176 | $this->db->sql_query($sql); |
| 177 | 177 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | return array( |
| 26 | 26 | 'add_columns' => array( |
| 27 | - $this->table_prefix . 'sessions' => array( |
|
| 27 | + $this->table_prefix.'sessions' => array( |
|
| 28 | 28 | 'u2f_request' => array('TEXT', null), |
| 29 | 29 | ), |
| 30 | 30 | ), |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | return array( |
| 37 | 37 | 'drop_columns' => array( |
| 38 | - $this->table_prefix . 'sessions' => array( |
|
| 38 | + $this->table_prefix.'sessions' => array( |
|
| 39 | 39 | 'u2f_request', |
| 40 | 40 | ), |
| 41 | 41 | ), |