| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 |  	{ | 
| 17 | 17 | return array( | 
| 18 | 18 | 'add_tables' => array( | 
| 19 | - $this->table_prefix . 'tfa_registration' => array( | |
| 19 | + $this->table_prefix.'tfa_registration' => array( | |
| 20 | 20 | 'COLUMNS' => array( | 
| 21 | 21 |  						'registration_id'		=> array('UINT', null, 'auto_increment'), | 
| 22 | 22 |  						'user_id'				=> array('UINT', 0), | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 |  	{ | 
| 41 | 41 | return array( | 
| 42 | 42 | 'drop_tables' => array( | 
| 43 | - $this->table_prefix . 'tfa_registration', | |
| 43 | + $this->table_prefix.'tfa_registration', | |
| 44 | 44 | ), | 
| 45 | 45 | ); | 
| 46 | 46 | } | 
| @@ -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 | ), | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 |  	{ | 
| 17 | 17 | return array( | 
| 18 | 18 | 'add_tables' => array( | 
| 19 | - $this->table_prefix . 'tfa_back_reg' => array( | |
| 19 | + $this->table_prefix.'tfa_back_reg' => array( | |
| 20 | 20 | 'COLUMNS' => array( | 
| 21 | 21 |  						'registration_id'		=> array('UINT', null, 'auto_increment'), | 
| 22 | 22 |  						'user_id'				=> array('UINT', 0), | 
| @@ -38,7 +38,7 @@ discard block | ||
| 38 | 38 |  	{ | 
| 39 | 39 | return array( | 
| 40 | 40 | 'drop_tables' => array( | 
| 41 | - $this->table_prefix . 'tfa_back_reg', | |
| 41 | + $this->table_prefix.'tfa_back_reg', | |
| 42 | 42 | ), | 
| 43 | 43 | ); | 
| 44 | 44 | } | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 |  	{ | 
| 17 | 17 | return array( | 
| 18 | 18 | 'add_tables' => array( | 
| 19 | - $this->table_prefix . 'tfa_otp_reg' => array( | |
| 19 | + $this->table_prefix.'tfa_otp_reg' => array( | |
| 20 | 20 | 'COLUMNS' => array( | 
| 21 | 21 |  						'registration_id'		=> array('UINT', null, 'auto_increment'), | 
| 22 | 22 |  						'user_id'				=> array('UINT', 0), | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 |  	{ | 
| 38 | 38 | return array( | 
| 39 | 39 | 'drop_tables' => array( | 
| 40 | - $this->table_prefix . 'tfa_otp_reg', | |
| 40 | + $this->table_prefix.'tfa_otp_reg', | |
| 41 | 41 | ), | 
| 42 | 42 | ); | 
| 43 | 43 | } | 
| @@ -101,7 +101,7 @@ discard block | ||
| 101 | 101 |  				{ | 
| 102 | 102 | $module->register(); | 
| 103 | 103 | meta_refresh(3, $this->u_action); | 
| 104 | -					$message = $this->user->lang('TFA_KEY_ADDED') . '<br /><br />' . $this->user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); | |
| 104 | +					$message = $this->user->lang('TFA_KEY_ADDED').'<br /><br />'.$this->user->lang('RETURN_UCP', '<a href="'.$this->u_action.'">', '</a>'); | |
| 105 | 105 | trigger_error($message); | 
| 106 | 106 | } | 
| 107 | 107 | if ($module->can_register()) | 
| @@ -227,7 +227,7 @@ discard block | ||
| 227 | 227 | } | 
| 228 | 228 | } | 
| 229 | 229 | meta_refresh(3, $this->u_action); | 
| 230 | -		$message = $this->user->lang('TFA_KEYS_DELETED') . '<br /><br />' . $this->user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); | |
| 230 | +		$message = $this->user->lang('TFA_KEYS_DELETED').'<br /><br />'.$this->user->lang('RETURN_UCP', '<a href="'.$this->u_action.'">', '</a>'); | |
| 231 | 231 | trigger_error($message); | 
| 232 | 232 | } | 
| 233 | 233 | } | 
| @@ -87,13 +87,13 @@ discard block | ||
| 87 | 87 | */ | 
| 88 | 88 | public function __construct(driver_interface $db, config $config, user $user, service_collection $modules, template $template, helper $controller_helper, $registration_table, $user_table) | 
| 89 | 89 |  	{ | 
| 90 | - $this->db = $db; | |
| 91 | - $this->user = $user; | |
| 92 | - $this->config = $config; | |
| 93 | - $this->template = $template; | |
| 90 | + $this->db = $db; | |
| 91 | + $this->user = $user; | |
| 92 | + $this->config = $config; | |
| 93 | + $this->template = $template; | |
| 94 | 94 | $this->controller_helper = $controller_helper; | 
| 95 | 95 | $this->registration_table = $registration_table; | 
| 96 | - $this->user_table = $user_table; | |
| 96 | + $this->user_table = $user_table; | |
| 97 | 97 | |
| 98 | 98 | $this->validateModules($modules); | 
| 99 | 99 | |
| @@ -257,9 +257,9 @@ discard block | ||
| 257 | 257 | 'tfa_random' => $random, | 
| 258 | 258 | 'tfa_uid' => $user_id, | 
| 259 | 259 | ); | 
| 260 | -		$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . " | |
| 260 | +		$sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary)." | |
| 261 | 261 | WHERE | 
| 262 | - session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND | |
| 262 | + session_id = '" . $this->db->sql_escape($this->user->data['session_id'])."' AND | |
| 263 | 263 | session_user_id = " . (int) $this->user->data['user_id']; | 
| 264 | 264 | $this->db->sql_query($sql); | 
| 265 | 265 | |
| @@ -287,7 +287,7 @@ discard block | ||
| 287 | 287 |  	{ | 
| 288 | 288 | if (empty($userdata)) | 
| 289 | 289 |  		{ | 
| 290 | - $sql = 'SELECT * FROM ' . $this->user_table . ' WHERE user_id = ' . (int) $user_id; | |
| 290 | + $sql = 'SELECT * FROM '.$this->user_table.' WHERE user_id = '.(int) $user_id; | |
| 291 | 291 | $result = $this->db->sql_query($sql); | 
| 292 | 292 | $userdata = $this->db->sql_fetchrow($result); | 
| 293 | 293 | $this->db->sql_freeresult($result); | 
| @@ -42,8 +42,8 @@ | ||
| 42 | 42 | protected function role_exists($role) | 
| 43 | 43 |  	{ | 
| 44 | 44 | $sql = 'SELECT role_id | 
| 45 | - FROM ' . ACL_ROLES_TABLE . " | |
| 46 | - WHERE role_name = '" . $this->db->sql_escape($role) . "'"; | |
| 45 | + FROM ' . ACL_ROLES_TABLE." | |
| 46 | + WHERE role_name = '" . $this->db->sql_escape($role)."'"; | |
| 47 | 47 | $result = $this->db->sql_query_limit($sql, 1); | 
| 48 | 48 |  		$role_id = $this->db->sql_fetchfield('role_id'); | 
| 49 | 49 | $this->db->sql_freeresult($result); | 
| @@ -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 | |