@@ -85,15 +85,15 @@ discard block |
||
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 |
||
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 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | if ($admin) |
181 | 181 | { |
182 | 182 | // the login array is used because the user ids do not differ for re-authentication |
183 | - $sql = 'DELETE FROM ' . SESSIONS_TABLE . " |
|
184 | - WHERE session_id = '" . $this->db->sql_escape($old_session_id) . "' |
|
183 | + $sql = 'DELETE FROM '.SESSIONS_TABLE." |
|
184 | + WHERE session_id = '" . $this->db->sql_escape($old_session_id)."' |
|
185 | 185 | AND session_user_id = " . (int) $user_id; |
186 | 186 | $this->db->sql_query($sql); |
187 | 187 |
@@ -155,8 +155,7 @@ |
||
155 | 155 | $this->template->assign_var('S_ERROR', $this->user->lang('TFA_INCORRECT_KEY')); |
156 | 156 | $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); |
157 | 157 | } |
158 | - } |
|
159 | - catch (http_exception $ex) // @TODO: Replace exception with own exception |
|
158 | + } catch (http_exception $ex) // @TODO: Replace exception with own exception |
|
160 | 159 | { |
161 | 160 | $this->template->assign_var('S_ERROR', $ex->getMessage()); |
162 | 161 | $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | protected function show_ucp_complete($table, $where = '') |
39 | 39 | { |
40 | 40 | $sql = 'SELECT * |
41 | - FROM ' . $this->db->sql_escape($table) . ' |
|
42 | - WHERE user_id = ' . (int) $this->user->data['user_id'] . ' ' . $where . ' |
|
41 | + FROM ' . $this->db->sql_escape($table).' |
|
42 | + WHERE user_id = ' . (int) $this->user->data['user_id'].' '.$where.' |
|
43 | 43 | ORDER BY registration_id ASC'; |
44 | 44 | |
45 | 45 | $result = $this->db->sql_query($sql); |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | protected function check_table_for_user($table, $user_id, $where = '') |
70 | 70 | { |
71 | 71 | $sql = 'SELECT COUNT(registration_id) as reg_id |
72 | - FROM ' . $this->db->sql_escape($table) . ' |
|
73 | - WHERE user_id = ' . (int) $user_id . ' ' . $where; |
|
72 | + FROM ' . $this->db->sql_escape($table).' |
|
73 | + WHERE user_id = ' . (int) $user_id.' '.$where; |
|
74 | 74 | $result = $this->db->sql_query($sql); |
75 | 75 | $row = $this->db->sql_fetchrow($result); |
76 | 76 | $this->db->sql_freeresult($result); |
@@ -177,8 +177,8 @@ discard block |
||
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); |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | public function register_start() |
209 | 209 | { |
210 | 210 | $secret = $this->otp->generateSecret(); |
211 | - $QR = $this->otp_helper->generateKeyURI('totp', $secret, generate_board_url(), '',0, 'sha1'); |
|
211 | + $QR = $this->otp_helper->generateKeyURI('totp', $secret, 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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | 'last_used' => time(), |
182 | 182 | 'valid' => false, |
183 | 183 | ); |
184 | - $sql = 'UPDATE ' . $this->backup_registration_table . ' |
|
185 | - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
184 | + $sql = 'UPDATE '.$this->backup_registration_table.' |
|
185 | + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).' |
|
186 | 186 | WHERE |
187 | 187 | registration_id = ' . (int) $registration['registration_id']; |
188 | 188 | $this->db->sql_query($sql); |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function delete($key) |
265 | 265 | { |
266 | - $sql = 'DELETE FROM ' . $this->backup_registration_table . ' |
|
267 | - WHERE user_id = ' . (int) $this->user->data['user_id'] . ' |
|
266 | + $sql = 'DELETE FROM '.$this->backup_registration_table.' |
|
267 | + WHERE user_id = ' . (int) $this->user->data['user_id'].' |
|
268 | 268 | AND registration_id =' . (int) $key; |
269 | 269 | |
270 | 270 | $this->db->sql_query($sql); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | private function getRegistrations($user_id) |
279 | 279 | { |
280 | - $sql = 'SELECT * FROM ' . $this->backup_registration_table . ' WHERE user_id = ' . (int) $user_id; |
|
280 | + $sql = 'SELECT * FROM '.$this->backup_registration_table.' WHERE user_id = '.(int) $user_id; |
|
281 | 281 | $result = $this->db->sql_query($sql); |
282 | 282 | $rows = $this->db->sql_fetchrowset($result); |
283 | 283 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'title' => 'ACP_TFA_SETTINGS', |
44 | 44 | 'vars' => array( |
45 | 45 | 'legend1' => 'ACP_TFA_SETTINGS', |
46 | - 'tfa_mode' => array('lang' => 'TFA_MODE', 'validate' => 'int', 'type' => 'select', 'method' => 'select_tfa_method', 'explain' => true), |
|
46 | + 'tfa_mode' => array('lang' => 'TFA_MODE', 'validate' => 'int', 'type' => 'select', 'method' => 'select_tfa_method', 'explain' => true), |
|
47 | 47 | |
48 | 48 | 'legend4' => 'ACP_SUBMIT_CHANGES', |
49 | 49 | ) |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | |
98 | 98 | if ($submit) |
99 | 99 | { |
100 | - $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_TFA_CONFIG_' . strtoupper($mode)); |
|
100 | + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_TFA_CONFIG_'.strtoupper($mode)); |
|
101 | 101 | |
102 | 102 | $message = $user->lang('CONFIG_UPDATED'); |
103 | 103 | $message_type = E_USER_NOTICE; |
104 | 104 | |
105 | - trigger_error($message . adm_back_link($this->u_action), $message_type); |
|
105 | + trigger_error($message.adm_back_link($this->u_action), $message_type); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | if (!$request->is_secure()) |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $template->assign_vars(array( |
117 | 117 | 'L_TITLE' => $user->lang($display_vars['title']), |
118 | - 'L_TITLE_EXPLAIN' => $user->lang($display_vars['title'] . '_EXPLAIN'), |
|
118 | + 'L_TITLE_EXPLAIN' => $user->lang($display_vars['title'].'_EXPLAIN'), |
|
119 | 119 | |
120 | 120 | 'S_ERROR' => (sizeof($error)) ? true : false, |
121 | 121 | 'ERROR_MSG' => implode('<br />', $error), |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | $type = explode(':', $vars['type']); |
145 | 145 | |
146 | 146 | $l_explain = ''; |
147 | - if ($vars['explain'] && array_key_exists($vars['lang'] . '_EXPLAIN', $user->lang)) |
|
147 | + if ($vars['explain'] && array_key_exists($vars['lang'].'_EXPLAIN', $user->lang)) |
|
148 | 148 | { |
149 | - $l_explain = $user->lang($vars['lang'] . '_EXPLAIN'); |
|
149 | + $l_explain = $user->lang($vars['lang'].'_EXPLAIN'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | foreach ($act_ary as $key => $data) |
187 | 187 | { |
188 | 188 | $selected = ($data == $selected_value) ? ' selected="selected"' : ''; |
189 | - $act_options .= '<option value="' . $data . '"' . $selected . '>' . $user->lang($key) . '</option>'; |
|
189 | + $act_options .= '<option value="'.$data.'"'.$selected.'>'.$user->lang($key).'</option>'; |
|
190 | 190 | } |
191 | 191 | return $act_options; |
192 | 192 | } |