@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | /** |
| 3 | 3 | * Name: Auth Lang - Romanian |
| 4 | 4 | * |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $lang['forgot_password_username_identity_label'] = 'Utilizator'; |
| 132 | 132 | $lang['forgot_password_email_identity_label'] = 'Email'; |
| 133 | 133 | $lang['forgot_password_email_not_found'] = 'Nu există nicio înregistrare cu acest email.'; |
| 134 | -$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
| 134 | +$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
| 135 | 135 | |
| 136 | 136 | // Reset Password |
| 137 | 137 | $lang['reset_password_heading'] = 'Schimbare parolă'; |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | /** |
| 3 | 3 | * Name: Ion Auth Lang - Finnish |
| 4 | 4 | * |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $lang['deactivate_unsuccessful'] = 'Tilin sulkeminen epäonnistui'; |
| 38 | 38 | $lang['activation_email_successful'] = 'Aktivointiviesti lähetetty'; |
| 39 | 39 | $lang['activation_email_unsuccessful'] = 'Aktivointiviestiä ei voitu lähettää'; |
| 40 | -$lang['deactivate_current_user_unsuccessful']= 'You cannot De-Activate your self.'; |
|
| 40 | +$lang['deactivate_current_user_unsuccessful'] = 'You cannot De-Activate your self.'; |
|
| 41 | 41 | |
| 42 | 42 | // Login / Logout |
| 43 | 43 | $lang['login_successful'] = 'Olet nyt kirjautunut sisään!'; |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | $lang['group_name_admin_not_alter'] = 'Admin group name can not be changed'; |
| 64 | 64 | |
| 65 | 65 | // Activation Email |
| 66 | -$lang['email_activation_subject'] = 'Tilin aktivointi'; |
|
| 66 | +$lang['email_activation_subject'] = 'Tilin aktivointi'; |
|
| 67 | 67 | $lang['email_activate_heading'] = 'Activate account for %s'; |
| 68 | 68 | $lang['email_activate_subheading'] = 'Please click this link to %s.'; |
| 69 | 69 | $lang['email_activate_link'] = 'Activate Your Account'; |
| 70 | 70 | // Forgot Password Email |
| 71 | -$lang['email_forgotten_password_subject'] = 'Unohtuneen salasanan palautus'; |
|
| 71 | +$lang['email_forgotten_password_subject'] = 'Unohtuneen salasanan palautus'; |
|
| 72 | 72 | $lang['email_forgot_password_heading'] = 'Reset Password for %s'; |
| 73 | 73 | $lang['email_forgot_password_subheading'] = 'Please click this link to %s.'; |
| 74 | 74 | $lang['email_forgot_password_link'] = 'Reset Your Password'; |
| 75 | 75 | // New Password Email |
| 76 | -$lang['email_new_password_subject'] = 'Uusi salasana'; |
|
| 76 | +$lang['email_new_password_subject'] = 'Uusi salasana'; |
|
| 77 | 77 | $lang['email_new_password_heading'] = 'New Password for %s'; |
| 78 | 78 | $lang['email_new_password_subheading'] = 'Your password has been reset to: %s'; |
| 79 | 79 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | /** |
| 3 | 3 | * Name: Ion Auth Lang - Korean |
| 4 | 4 | * |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | // Account Creation |
| 18 | -$lang['account_creation_successful'] = '계정을 만들었습니다'; |
|
| 19 | -$lang['account_creation_unsuccessful'] = '계정을 만들 수 없습니다'; |
|
| 20 | -$lang['account_creation_duplicate_email'] = '이 이메일은 사용중이거나 올바르지 않습니다'; |
|
| 18 | +$lang['account_creation_successful'] = '계정을 만들었습니다'; |
|
| 19 | +$lang['account_creation_unsuccessful'] = '계정을 만들 수 없습니다'; |
|
| 20 | +$lang['account_creation_duplicate_email'] = '이 이메일은 사용중이거나 올바르지 않습니다'; |
|
| 21 | 21 | $lang['account_creation_duplicate_identity'] = '이 계정명은 사용중이거나 올바르지 않습니다'; |
| 22 | 22 | |
| 23 | 23 | // TODO Please Translate |
@@ -26,31 +26,31 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // Password |
| 28 | 28 | $lang['password_change_successful'] = '비밀번호를 바꾸었습니다'; |
| 29 | -$lang['password_change_unsuccessful'] = '비밀번호를 바꿀 수 없습니다'; |
|
| 29 | +$lang['password_change_unsuccessful'] = '비밀번호를 바꿀 수 없습니다'; |
|
| 30 | 30 | $lang['forgot_password_successful'] = '비밀번호 재설정 이메일을 보냈습니다'; |
| 31 | -$lang['forgot_password_unsuccessful'] = '비밀번호를 재설정할 수 없습니다.'; |
|
| 31 | +$lang['forgot_password_unsuccessful'] = '비밀번호를 재설정할 수 없습니다.'; |
|
| 32 | 32 | |
| 33 | 33 | // Activation |
| 34 | -$lang['activate_successful'] = '계정을 활성화하였습니다'; |
|
| 35 | -$lang['activate_unsuccessful'] = '계정을 활성화할 수 없습니다'; |
|
| 36 | -$lang['deactivate_successful'] = '계정을 비활성화하였습니다'; |
|
| 34 | +$lang['activate_successful'] = '계정을 활성화하였습니다'; |
|
| 35 | +$lang['activate_unsuccessful'] = '계정을 활성화할 수 없습니다'; |
|
| 36 | +$lang['deactivate_successful'] = '계정을 비활성화하였습니다'; |
|
| 37 | 37 | $lang['deactivate_unsuccessful'] = '계정을 비활성화할 수 없습니다'; |
| 38 | 38 | $lang['activation_email_successful'] = '계정 활성화 이메일을 보냈습니다'; |
| 39 | -$lang['activation_email_unsuccessful'] = '계정 활성화 이메일을 보날 수 없습니다'; |
|
| 40 | -$lang['deactivate_current_user_unsuccessful']= 'You cannot De-Activate your self.'; |
|
| 39 | +$lang['activation_email_unsuccessful'] = '계정 활성화 이메일을 보날 수 없습니다'; |
|
| 40 | +$lang['deactivate_current_user_unsuccessful'] = 'You cannot De-Activate your self.'; |
|
| 41 | 41 | |
| 42 | 42 | // Login / Logout |
| 43 | -$lang['login_successful'] = '로그인 하였습니다'; |
|
| 44 | -$lang['login_unsuccessful'] = '로그인할 수 없습니다'; |
|
| 45 | -$lang['login_unsuccessful_not_active'] = '계정이 비활성화 되어 로그인할 수 없습니다'; |
|
| 46 | -$lang['login_timeout'] = '계정이 잠시 잠긴 것 같습니다. 잠시 후에 다시 시도해 주세요.'; |
|
| 43 | +$lang['login_successful'] = '로그인 하였습니다'; |
|
| 44 | +$lang['login_unsuccessful'] = '로그인할 수 없습니다'; |
|
| 45 | +$lang['login_unsuccessful_not_active'] = '계정이 비활성화 되어 로그인할 수 없습니다'; |
|
| 46 | +$lang['login_timeout'] = '계정이 잠시 잠긴 것 같습니다. 잠시 후에 다시 시도해 주세요.'; |
|
| 47 | 47 | $lang['logout_successful'] = '로그아웃을 하였습니다'; |
| 48 | 48 | |
| 49 | 49 | // Account Changes |
| 50 | 50 | $lang['update_successful'] = '계정 정보를 업데이트 하였습니다'; |
| 51 | -$lang['update_unsuccessful'] = '계정 정보를 업데이트할 수 없습니다'; |
|
| 52 | -$lang['delete_successful'] = '사용자를 삭제하였습니다'; |
|
| 53 | -$lang['delete_unsuccessful'] = '사용자를 삭제할 수 없습니다'; |
|
| 51 | +$lang['update_unsuccessful'] = '계정 정보를 업데이트할 수 없습니다'; |
|
| 52 | +$lang['delete_successful'] = '사용자를 삭제하였습니다'; |
|
| 53 | +$lang['delete_unsuccessful'] = '사용자를 삭제할 수 없습니다'; |
|
| 54 | 54 | |
| 55 | 55 | // Groups |
| 56 | 56 | $lang['group_creation_successful'] = '그룹을 생성하였습니다'; |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | $lang['group_delete_successful'] = '그룹을 삭제했습니다'; |
| 60 | 60 | $lang['group_delete_unsuccessful'] = '그룹을 삭제할 수 없습니다'; |
| 61 | 61 | $lang['group_delete_notallowed'] = 'Can\'t delete the administrators\' group'; |
| 62 | -$lang['group_name_required'] = '그룹 이름을 입력해 주십시오'; |
|
| 62 | +$lang['group_name_required'] = '그룹 이름을 입력해 주십시오'; |
|
| 63 | 63 | $lang['group_name_admin_not_alter'] = 'Admin group name can not be changed'; |
| 64 | 64 | |
| 65 | 65 | // Activation Email |
| 66 | -$lang['email_activation_subject'] = '계정 활성화 방법을 보내드립니다'; |
|
| 66 | +$lang['email_activation_subject'] = '계정 활성화 방법을 보내드립니다'; |
|
| 67 | 67 | $lang['email_activate_heading'] = 'Activate account for %s'; |
| 68 | 68 | $lang['email_activate_subheading'] = 'Please click this link to %s.'; |
| 69 | 69 | $lang['email_activate_link'] = 'Activate Your Account'; |
| 70 | 70 | // Forgot Password Email |
| 71 | -$lang['email_forgotten_password_subject'] = '잊어버린 비밀번호를 찾는 절차를 보내드립니다'; |
|
| 71 | +$lang['email_forgotten_password_subject'] = '잊어버린 비밀번호를 찾는 절차를 보내드립니다'; |
|
| 72 | 72 | $lang['email_forgot_password_heading'] = 'Reset Password for %s'; |
| 73 | 73 | $lang['email_forgot_password_subheading'] = 'Please click this link to %s.'; |
| 74 | 74 | $lang['email_forgot_password_link'] = 'Reset Your Password'; |
| 75 | 75 | // New Password Email |
| 76 | -$lang['email_new_password_subject'] = '새 비밀번호를 보내드립니다'; |
|
| 76 | +$lang['email_new_password_subject'] = '새 비밀번호를 보내드립니다'; |
|
| 77 | 77 | $lang['email_new_password_heading'] = 'New Password for %s'; |
| 78 | 78 | $lang['email_new_password_subheading'] = 'Your password has been reset to: %s'; |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | /** |
| 3 | 3 | * Name: Auth Lang - Korean |
| 4 | 4 | * |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $lang['forgot_password_username_identity_label'] = '계정명'; |
| 136 | 136 | $lang['forgot_password_email_identity_label'] = '이메일'; |
| 137 | 137 | $lang['forgot_password_email_not_found'] = 'No record of that email address.'; |
| 138 | -$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
| 138 | +$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
| 139 | 139 | |
| 140 | 140 | // Reset Password |
| 141 | 141 | $lang['reset_password_heading'] = '비밀번호 바꾸기'; |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | /** |
| 3 | 3 | * Name: Ion Auth Lang - Italian |
| 4 | 4 | * |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | // Account Creation |
| 18 | -$lang['account_creation_successful'] = 'Account creato con successo.'; |
|
| 19 | -$lang['account_creation_unsuccessful'] = 'Impossibile creare l\'account.'; |
|
| 20 | -$lang['account_creation_duplicate_email'] = 'Email già in uso o non valida.'; |
|
| 21 | -$lang['account_creation_duplicate_identity'] = 'Nome utente già in uso o non valido.'; |
|
| 18 | +$lang['account_creation_successful'] = 'Account creato con successo.'; |
|
| 19 | +$lang['account_creation_unsuccessful'] = 'Impossibile creare l\'account.'; |
|
| 20 | +$lang['account_creation_duplicate_email'] = 'Email già in uso o non valida.'; |
|
| 21 | +$lang['account_creation_duplicate_identity'] = 'Nome utente già in uso o non valido.'; |
|
| 22 | 22 | |
| 23 | 23 | // TODO Please Translate |
| 24 | 24 | $lang['account_creation_missing_default_group'] = 'Default group is not set'; |
@@ -27,24 +27,24 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | // Password |
| 29 | 29 | $lang['password_change_successful'] = 'Password modificata con successo.'; |
| 30 | -$lang['password_change_unsuccessful'] = 'Impossibile modificare la password.'; |
|
| 30 | +$lang['password_change_unsuccessful'] = 'Impossibile modificare la password.'; |
|
| 31 | 31 | $lang['forgot_password_successful'] = 'Email di reset della password inviata.'; |
| 32 | -$lang['forgot_password_unsuccessful'] = 'Impossibile resettare la password.'; |
|
| 32 | +$lang['forgot_password_unsuccessful'] = 'Impossibile resettare la password.'; |
|
| 33 | 33 | |
| 34 | 34 | // Activation |
| 35 | -$lang['activate_successful'] = 'Account attivato.'; |
|
| 36 | -$lang['activate_unsuccessful'] = 'Impossibile attivare l\'account.'; |
|
| 37 | -$lang['deactivate_successful'] = 'Account disattivato.'; |
|
| 38 | -$lang['deactivate_unsuccessful'] = 'Impossibile disattivare l\'account.'; |
|
| 39 | -$lang['activation_email_successful'] = 'Email di attivazione inviata.'; |
|
| 40 | -$lang['activation_email_unsuccessful'] = 'Impossibile inviare l\'email di attivazione.'; |
|
| 41 | -$lang['deactivate_current_user_unsuccessful']= 'You cannot De-Activate your self.'; |
|
| 35 | +$lang['activate_successful'] = 'Account attivato.'; |
|
| 36 | +$lang['activate_unsuccessful'] = 'Impossibile attivare l\'account.'; |
|
| 37 | +$lang['deactivate_successful'] = 'Account disattivato.'; |
|
| 38 | +$lang['deactivate_unsuccessful'] = 'Impossibile disattivare l\'account.'; |
|
| 39 | +$lang['activation_email_successful'] = 'Email di attivazione inviata.'; |
|
| 40 | +$lang['activation_email_unsuccessful'] = 'Impossibile inviare l\'email di attivazione.'; |
|
| 41 | +$lang['deactivate_current_user_unsuccessful'] = 'You cannot De-Activate your self.'; |
|
| 42 | 42 | |
| 43 | 43 | // Login / Logout |
| 44 | -$lang['login_successful'] = 'Login effettuato con successo.'; |
|
| 45 | -$lang['login_unsuccessful'] = 'Login non corretto.'; |
|
| 46 | -$lang['login_unsuccessful_not_active'] = 'Account is inactive'; |
|
| 47 | -$lang['login_timeout'] = 'Temporarily Locked Out. Try again later.'; |
|
| 44 | +$lang['login_successful'] = 'Login effettuato con successo.'; |
|
| 45 | +$lang['login_unsuccessful'] = 'Login non corretto.'; |
|
| 46 | +$lang['login_unsuccessful_not_active'] = 'Account is inactive'; |
|
| 47 | +$lang['login_timeout'] = 'Temporarily Locked Out. Try again later.'; |
|
| 48 | 48 | $lang['logout_successful'] = 'Logout effettuato con successo.'; |
| 49 | 49 | |
| 50 | 50 | // Account Changes |
@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | $lang['group_delete_successful'] = 'Group deleted'; |
| 61 | 61 | $lang['group_delete_unsuccessful'] = 'Unable to delete group'; |
| 62 | 62 | $lang['group_delete_notallowed'] = 'Can\'t delete the administrators\' group'; |
| 63 | -$lang['group_name_required'] = 'Group name is a required field'; |
|
| 63 | +$lang['group_name_required'] = 'Group name is a required field'; |
|
| 64 | 64 | $lang['group_name_admin_not_alter'] = 'Admin group name can not be changed'; |
| 65 | 65 | |
| 66 | 66 | // Activation Email |
| 67 | -$lang['email_activation_subject'] = 'Attivazione Account'; |
|
| 67 | +$lang['email_activation_subject'] = 'Attivazione Account'; |
|
| 68 | 68 | $lang['email_activate_heading'] = 'Activate account for %s'; |
| 69 | 69 | $lang['email_activate_subheading'] = 'Please click this link to %s.'; |
| 70 | 70 | $lang['email_activate_link'] = 'Activate Your Account'; |
| 71 | 71 | // Forgot Password Email |
| 72 | -$lang['email_forgotten_password_subject'] = 'Verifica il cambio password dimenticata'; |
|
| 72 | +$lang['email_forgotten_password_subject'] = 'Verifica il cambio password dimenticata'; |
|
| 73 | 73 | $lang['email_forgot_password_heading'] = 'Reset Password for %s'; |
| 74 | 74 | $lang['email_forgot_password_subheading'] = 'Please click this link to %s.'; |
| 75 | 75 | $lang['email_forgot_password_link'] = 'Reset Your Password'; |
| 76 | 76 | // New Password Email |
| 77 | -$lang['email_new_password_subject'] = 'Nuova Password'; |
|
| 77 | +$lang['email_new_password_subject'] = 'Nuova Password'; |
|
| 78 | 78 | $lang['email_new_password_heading'] = 'New Password for %s'; |
| 79 | 79 | $lang['email_new_password_subheading'] = 'Your password has been reset to: %s'; |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | /** |
| 3 | 3 | * Name: Auth Lang - Italian |
| 4 | 4 | * |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $lang['forgot_password_username_identity_label'] = 'Username'; |
| 139 | 139 | $lang['forgot_password_email_identity_label'] = 'Email'; |
| 140 | 140 | $lang['forgot_password_email_not_found'] = 'Indirizzo email non presente nel database.'; |
| 141 | -$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
| 141 | +$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
| 142 | 142 | |
| 143 | 143 | // Reset Password |
| 144 | 144 | $lang['reset_password_heading'] = 'Cambia Password'; |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | /** |
| 3 | 3 | * Name: Ion Auth Model |
| 4 | 4 | * |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | $this->lang->load('ion_auth'); |
| 172 | 172 | |
| 173 | 173 | // initialize db tables data |
| 174 | - $this->tables = $this->config->item('tables', 'ion_auth'); |
|
| 174 | + $this->tables = $this->config->item('tables', 'ion_auth'); |
|
| 175 | 175 | |
| 176 | 176 | //initialize data |
| 177 | 177 | $this->identity_column = $this->config->item('identity', 'ion_auth'); |
| 178 | 178 | $this->store_salt = $this->config->item('store_salt', 'ion_auth'); |
| 179 | 179 | $this->salt_length = $this->config->item('salt_length', 'ion_auth'); |
| 180 | - $this->join = $this->config->item('join', 'ion_auth'); |
|
| 180 | + $this->join = $this->config->item('join', 'ion_auth'); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | // initialize hash method options (Bcrypt) |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $delimiters_source = $this->config->item('delimiters_source', 'ion_auth'); |
| 195 | 195 | |
| 196 | 196 | // load the error delimeters either from the config file or use what's been supplied to form validation |
| 197 | - if ($delimiters_source === 'form_validation') |
|
| 197 | + if($delimiters_source === 'form_validation') |
|
| 198 | 198 | { |
| 199 | 199 | // load in delimiters from form_validation |
| 200 | 200 | // to keep this simple we'll load the value using reflection since these properties are protected |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | $this->_ion_hooks = new stdClass; |
| 226 | 226 | |
| 227 | 227 | // load the bcrypt class if needed |
| 228 | - if ($this->hash_method == 'bcrypt') { |
|
| 229 | - if ($this->random_rounds) |
|
| 228 | + if($this->hash_method == 'bcrypt') { |
|
| 229 | + if($this->random_rounds) |
|
| 230 | 230 | { |
| 231 | - $rand = rand($this->min_rounds,$this->max_rounds); |
|
| 231 | + $rand = rand($this->min_rounds, $this->max_rounds); |
|
| 232 | 232 | $params = array('rounds' => $rand); |
| 233 | 233 | } |
| 234 | 234 | else |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $params['salt_prefix'] = $this->config->item('salt_prefix', 'ion_auth'); |
| 240 | - $this->load->library('bcrypt',$params); |
|
| 240 | + $this->load->library('bcrypt', $params); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | $this->trigger_events('model_constructor'); |
@@ -260,28 +260,28 @@ discard block |
||
| 260 | 260 | * @return void |
| 261 | 261 | * @author Mathew |
| 262 | 262 | **/ |
| 263 | - public function hash_password($password, $salt=false, $use_sha1_override=FALSE) |
|
| 263 | + public function hash_password($password, $salt = false, $use_sha1_override = FALSE) |
|
| 264 | 264 | { |
| 265 | - if (empty($password)) |
|
| 265 | + if(empty($password)) |
|
| 266 | 266 | { |
| 267 | 267 | return FALSE; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // bcrypt |
| 271 | - if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
| 271 | + if($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
| 272 | 272 | { |
| 273 | 273 | return $this->bcrypt->hash($password); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
| 277 | - if ($this->store_salt && $salt) |
|
| 277 | + if($this->store_salt && $salt) |
|
| 278 | 278 | { |
| 279 | - return sha1($password . $salt); |
|
| 279 | + return sha1($password.$salt); |
|
| 280 | 280 | } |
| 281 | 281 | else |
| 282 | 282 | { |
| 283 | 283 | $salt = $this->salt(); |
| 284 | - return $salt . substr(sha1($salt . $password), 0, -$this->salt_length); |
|
| 284 | + return $salt.substr(sha1($salt.$password), 0, -$this->salt_length); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | * @return void |
| 293 | 293 | * @author Mathew |
| 294 | 294 | **/ |
| 295 | - public function hash_password_db($id, $password, $use_sha1_override=FALSE) |
|
| 295 | + public function hash_password_db($id, $password, $use_sha1_override = FALSE) |
|
| 296 | 296 | { |
| 297 | - if (empty($id) || empty($password)) |
|
| 297 | + if(empty($id) || empty($password)) |
|
| 298 | 298 | { |
| 299 | 299 | return FALSE; |
| 300 | 300 | } |
@@ -309,15 +309,15 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $hash_password_db = $query->row(); |
| 311 | 311 | |
| 312 | - if ($query->num_rows() !== 1) |
|
| 312 | + if($query->num_rows() !== 1) |
|
| 313 | 313 | { |
| 314 | 314 | return FALSE; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | // bcrypt |
| 318 | - if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
| 318 | + if($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
| 319 | 319 | { |
| 320 | - if ($this->bcrypt->verify($password,$hash_password_db->password)) |
|
| 320 | + if($this->bcrypt->verify($password, $hash_password_db->password)) |
|
| 321 | 321 | { |
| 322 | 322 | return TRUE; |
| 323 | 323 | } |
@@ -326,15 +326,15 @@ discard block |
||
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | // sha1 |
| 329 | - if ($this->store_salt) |
|
| 329 | + if($this->store_salt) |
|
| 330 | 330 | { |
| 331 | - $db_password = sha1($password . $hash_password_db->salt); |
|
| 331 | + $db_password = sha1($password.$hash_password_db->salt); |
|
| 332 | 332 | } |
| 333 | 333 | else |
| 334 | 334 | { |
| 335 | 335 | $salt = substr($hash_password_db->password, 0, $this->salt_length); |
| 336 | 336 | |
| 337 | - $db_password = $salt . substr(sha1($salt . $password), 0, -$this->salt_length); |
|
| 337 | + $db_password = $salt.substr(sha1($salt.$password), 0, -$this->salt_length); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | if($db_password == $hash_password_db->password) |
@@ -374,44 +374,44 @@ discard block |
||
| 374 | 374 | $buffer = ''; |
| 375 | 375 | $buffer_valid = false; |
| 376 | 376 | |
| 377 | - if (function_exists('random_bytes')) { |
|
| 377 | + if(function_exists('random_bytes')) { |
|
| 378 | 378 | $buffer = random_bytes($raw_salt_len); |
| 379 | - if ($buffer) { |
|
| 379 | + if($buffer) { |
|
| 380 | 380 | $buffer_valid = true; |
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - if (!$buffer_valid && function_exists('mcrypt_create_iv') && !defined('PHALANGER')) { |
|
| 384 | + if(!$buffer_valid && function_exists('mcrypt_create_iv') && !defined('PHALANGER')) { |
|
| 385 | 385 | $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM); |
| 386 | - if ($buffer) { |
|
| 386 | + if($buffer) { |
|
| 387 | 387 | $buffer_valid = true; |
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) { |
|
| 391 | + if(!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) { |
|
| 392 | 392 | $buffer = openssl_random_pseudo_bytes($raw_salt_len); |
| 393 | - if ($buffer) { |
|
| 393 | + if($buffer) { |
|
| 394 | 394 | $buffer_valid = true; |
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if (!$buffer_valid && @is_readable('/dev/urandom')) { |
|
| 398 | + if(!$buffer_valid && @is_readable('/dev/urandom')) { |
|
| 399 | 399 | $f = fopen('/dev/urandom', 'r'); |
| 400 | 400 | $read = strlen($buffer); |
| 401 | - while ($read < $raw_salt_len) { |
|
| 401 | + while($read < $raw_salt_len) { |
|
| 402 | 402 | $buffer .= fread($f, $raw_salt_len - $read); |
| 403 | 403 | $read = strlen($buffer); |
| 404 | 404 | } |
| 405 | 405 | fclose($f); |
| 406 | - if ($read >= $raw_salt_len) { |
|
| 406 | + if($read >= $raw_salt_len) { |
|
| 407 | 407 | $buffer_valid = true; |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - if (!$buffer_valid || strlen($buffer) < $raw_salt_len) { |
|
| 411 | + if(!$buffer_valid || strlen($buffer) < $raw_salt_len) { |
|
| 412 | 412 | $bl = strlen($buffer); |
| 413 | - for ($i = 0; $i < $raw_salt_len; $i++) { |
|
| 414 | - if ($i < $bl) { |
|
| 413 | + for($i = 0; $i < $raw_salt_len; $i++) { |
|
| 414 | + if($i < $bl) { |
|
| 415 | 415 | $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255)); |
| 416 | 416 | } else { |
| 417 | 417 | $buffer .= chr(mt_rand(0, 255)); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | { |
| 454 | 454 | $this->trigger_events('pre_activate'); |
| 455 | 455 | |
| 456 | - if ($code !== FALSE) |
|
| 456 | + if($code !== FALSE) |
|
| 457 | 457 | { |
| 458 | 458 | $query = $this->db->select($this->identity_column) |
| 459 | 459 | ->where('activation_code', $code) |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | $result = $query->row(); |
| 466 | 466 | |
| 467 | - if ($query->num_rows() !== 1) |
|
| 467 | + if($query->num_rows() !== 1) |
|
| 468 | 468 | { |
| 469 | 469 | $this->trigger_events(array('post_activate', 'post_activate_unsuccessful')); |
| 470 | 470 | $this->set_error('activate_unsuccessful'); |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | |
| 495 | 495 | $return = $this->db->affected_rows() == 1; |
| 496 | - if ($return) |
|
| 496 | + if($return) |
|
| 497 | 497 | { |
| 498 | 498 | $this->trigger_events(array('post_activate', 'post_activate_successful')); |
| 499 | 499 | $this->set_message('activate_successful'); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | { |
| 520 | 520 | $this->trigger_events('deactivate'); |
| 521 | 521 | |
| 522 | - if (!isset($id)) |
|
| 522 | + if(!isset($id)) |
|
| 523 | 523 | { |
| 524 | 524 | $this->set_error('deactivate_unsuccessful'); |
| 525 | 525 | return FALSE; |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | $this->db->update($this->tables['users'], $data, array('id' => $id)); |
| 543 | 543 | |
| 544 | 544 | $return = $this->db->affected_rows() == 1; |
| 545 | - if ($return) |
|
| 545 | + if($return) |
|
| 546 | 546 | $this->set_message('deactivate_successful'); |
| 547 | 547 | else |
| 548 | 548 | $this->set_error('deactivate_unsuccessful'); |
@@ -552,14 +552,14 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public function clear_forgotten_password_code($code) { |
| 554 | 554 | |
| 555 | - if (empty($code)) |
|
| 555 | + if(empty($code)) |
|
| 556 | 556 | { |
| 557 | 557 | return FALSE; |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | $this->db->where('forgotten_password_code', $code); |
| 561 | 561 | |
| 562 | - if ($this->db->count_all_results($this->tables['users']) > 0) |
|
| 562 | + if($this->db->count_all_results($this->tables['users']) > 0) |
|
| 563 | 563 | { |
| 564 | 564 | $data = array( |
| 565 | 565 | 'forgotten_password_code' => NULL, |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | public function reset_password($identity, $new) { |
| 584 | 584 | $this->trigger_events('pre_change_password'); |
| 585 | 585 | |
| 586 | - if (!$this->identity_check($identity)) { |
|
| 586 | + if(!$this->identity_check($identity)) { |
|
| 587 | 587 | $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful')); |
| 588 | 588 | return FALSE; |
| 589 | 589 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | ->order_by('id', 'desc') |
| 597 | 597 | ->get($this->tables['users']); |
| 598 | 598 | |
| 599 | - if ($query->num_rows() !== 1) |
|
| 599 | + if($query->num_rows() !== 1) |
|
| 600 | 600 | { |
| 601 | 601 | $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful')); |
| 602 | 602 | $this->set_error('password_change_unsuccessful'); |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | $this->db->update($this->tables['users'], $data, array($this->identity_column => $identity)); |
| 621 | 621 | |
| 622 | 622 | $return = $this->db->affected_rows() == 1; |
| 623 | - if ($return) |
|
| 623 | + if($return) |
|
| 624 | 624 | { |
| 625 | 625 | $this->trigger_events(array('post_change_password', 'post_change_password_successful')); |
| 626 | 626 | $this->set_message('password_change_successful'); |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | ->order_by('id', 'desc') |
| 653 | 653 | ->get($this->tables['users']); |
| 654 | 654 | |
| 655 | - if ($query->num_rows() !== 1) |
|
| 655 | + if($query->num_rows() !== 1) |
|
| 656 | 656 | { |
| 657 | 657 | $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful')); |
| 658 | 658 | $this->set_error('password_change_unsuccessful'); |
@@ -663,10 +663,10 @@ discard block |
||
| 663 | 663 | |
| 664 | 664 | $old_password_matches = $this->hash_password_db($user->id, $old); |
| 665 | 665 | |
| 666 | - if ($old_password_matches === TRUE) |
|
| 666 | + if($old_password_matches === TRUE) |
|
| 667 | 667 | { |
| 668 | 668 | // store the new password and reset the remember code so all remembered instances have to re-login |
| 669 | - $hashed_new_password = $this->hash_password($new, $user->salt); |
|
| 669 | + $hashed_new_password = $this->hash_password($new, $user->salt); |
|
| 670 | 670 | $data = array( |
| 671 | 671 | 'password' => $hashed_new_password, |
| 672 | 672 | 'remember_code' => NULL, |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | $this->trigger_events('extra_where'); |
| 676 | 676 | |
| 677 | 677 | $successfully_changed_password_in_db = $this->db->update($this->tables['users'], $data, array($this->identity_column => $identity)); |
| 678 | - if ($successfully_changed_password_in_db) |
|
| 678 | + if($successfully_changed_password_in_db) |
|
| 679 | 679 | { |
| 680 | 680 | $this->trigger_events(array('post_change_password', 'post_change_password_successful')); |
| 681 | 681 | $this->set_message('password_change_successful'); |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | { |
| 704 | 704 | $this->trigger_events('username_check'); |
| 705 | 705 | |
| 706 | - if (empty($username)) |
|
| 706 | + if(empty($username)) |
|
| 707 | 707 | { |
| 708 | 708 | return FALSE; |
| 709 | 709 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | { |
| 728 | 728 | $this->trigger_events('email_check'); |
| 729 | 729 | |
| 730 | - if (empty($email)) |
|
| 730 | + if(empty($email)) |
|
| 731 | 731 | { |
| 732 | 732 | return FALSE; |
| 733 | 733 | } |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | { |
| 752 | 752 | $this->trigger_events('identity_check'); |
| 753 | 753 | |
| 754 | - if (empty($identity)) |
|
| 754 | + if(empty($identity)) |
|
| 755 | 755 | { |
| 756 | 756 | return FALSE; |
| 757 | 757 | } |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | **/ |
| 771 | 771 | public function forgotten_password($identity) |
| 772 | 772 | { |
| 773 | - if (empty($identity)) |
|
| 773 | + if(empty($identity)) |
|
| 774 | 774 | { |
| 775 | 775 | $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful')); |
| 776 | 776 | return FALSE; |
@@ -782,18 +782,18 @@ discard block |
||
| 782 | 782 | $activation_code_part = openssl_random_pseudo_bytes(128); |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | - for($i=0;$i<1024;$i++) { |
|
| 786 | - $activation_code_part = sha1($activation_code_part . mt_rand() . microtime()); |
|
| 785 | + for($i = 0; $i < 1024; $i++) { |
|
| 786 | + $activation_code_part = sha1($activation_code_part.mt_rand().microtime()); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | $key = $this->hash_code($activation_code_part.$identity); |
| 790 | 790 | |
| 791 | 791 | // If enable query strings is set, then we need to replace any unsafe characters so that the code can still work |
| 792 | - if ($key != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE) |
|
| 792 | + if($key != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE) |
|
| 793 | 793 | { |
| 794 | 794 | // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards |
| 795 | 795 | // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern |
| 796 | - if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $key)) |
|
| 796 | + if(!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $key)) |
|
| 797 | 797 | { |
| 798 | 798 | $key = preg_replace("/[^".$this->config->item('permitted_uri_chars')."]+/i", "-", $key); |
| 799 | 799 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | |
| 814 | 814 | $return = $this->db->affected_rows() == 1; |
| 815 | 815 | |
| 816 | - if ($return) |
|
| 816 | + if($return) |
|
| 817 | 817 | $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_successful')); |
| 818 | 818 | else |
| 819 | 819 | $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful')); |
@@ -827,11 +827,11 @@ discard block |
||
| 827 | 827 | * @return string |
| 828 | 828 | * @author Mathew |
| 829 | 829 | **/ |
| 830 | - public function forgotten_password_complete($code, $salt=FALSE) |
|
| 830 | + public function forgotten_password_complete($code, $salt = FALSE) |
|
| 831 | 831 | { |
| 832 | 832 | $this->trigger_events('pre_forgotten_password_complete'); |
| 833 | 833 | |
| 834 | - if (empty($code)) |
|
| 834 | + if(empty($code)) |
|
| 835 | 835 | { |
| 836 | 836 | $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful')); |
| 837 | 837 | return FALSE; |
@@ -839,12 +839,12 @@ discard block |
||
| 839 | 839 | |
| 840 | 840 | $profile = $this->where('forgotten_password_code', $code)->users()->row(); //pass the code to profile |
| 841 | 841 | |
| 842 | - if ($profile) { |
|
| 842 | + if($profile) { |
|
| 843 | 843 | |
| 844 | - if ($this->config->item('forgot_password_expiration', 'ion_auth') > 0) { |
|
| 844 | + if($this->config->item('forgot_password_expiration', 'ion_auth') > 0) { |
|
| 845 | 845 | //Make sure it isn't expired |
| 846 | 846 | $expiration = $this->config->item('forgot_password_expiration', 'ion_auth'); |
| 847 | - if (time() - $profile->forgotten_password_time > $expiration) { |
|
| 847 | + if(time() - $profile->forgotten_password_time > $expiration) { |
|
| 848 | 848 | //it has expired |
| 849 | 849 | $this->set_error('forgot_password_expired'); |
| 850 | 850 | $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful')); |
@@ -882,20 +882,20 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | $manual_activation = $this->config->item('manual_activation', 'ion_auth'); |
| 884 | 884 | |
| 885 | - if ($this->identity_check($identity)) |
|
| 885 | + if($this->identity_check($identity)) |
|
| 886 | 886 | { |
| 887 | 887 | $this->set_error('account_creation_duplicate_identity'); |
| 888 | 888 | return FALSE; |
| 889 | 889 | } |
| 890 | - elseif ( !$this->config->item('default_group', 'ion_auth') && empty($groups) ) |
|
| 890 | + elseif(!$this->config->item('default_group', 'ion_auth') && empty($groups)) |
|
| 891 | 891 | { |
| 892 | 892 | $this->set_error('account_creation_missing_default_group'); |
| 893 | 893 | return FALSE; |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | // check if the default set in config exists in database |
| 897 | - $query = $this->db->get_where($this->tables['groups'],array('name' => $this->config->item('default_group', 'ion_auth')),1)->row(); |
|
| 898 | - if( !isset($query->id) && empty($groups) ) |
|
| 897 | + $query = $this->db->get_where($this->tables['groups'], array('name' => $this->config->item('default_group', 'ion_auth')), 1)->row(); |
|
| 898 | + if(!isset($query->id) && empty($groups)) |
|
| 899 | 899 | { |
| 900 | 900 | $this->set_error('account_creation_invalid_default_group'); |
| 901 | 901 | return FALSE; |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | 'active' => ($manual_activation === false ? 1 : 0) |
| 921 | 921 | ); |
| 922 | 922 | |
| 923 | - if ($this->store_salt) |
|
| 923 | + if($this->store_salt) |
|
| 924 | 924 | { |
| 925 | 925 | $data['salt'] = $salt; |
| 926 | 926 | } |
@@ -933,18 +933,18 @@ discard block |
||
| 933 | 933 | |
| 934 | 934 | $this->db->insert($this->tables['users'], $user_data); |
| 935 | 935 | |
| 936 | - $id = $this->db->insert_id($this->tables['users'] . '_id_seq'); |
|
| 936 | + $id = $this->db->insert_id($this->tables['users'].'_id_seq'); |
|
| 937 | 937 | |
| 938 | 938 | // add in groups array if it doesn't exists and stop adding into default group if default group ids are set |
| 939 | - if( isset($default_group->id) && empty($groups) ) |
|
| 939 | + if(isset($default_group->id) && empty($groups)) |
|
| 940 | 940 | { |
| 941 | 941 | $groups[] = $default_group->id; |
| 942 | 942 | } |
| 943 | 943 | |
| 944 | - if (!empty($groups)) |
|
| 944 | + if(!empty($groups)) |
|
| 945 | 945 | { |
| 946 | 946 | // add to groups |
| 947 | - foreach ($groups as $group) |
|
| 947 | + foreach($groups as $group) |
|
| 948 | 948 | { |
| 949 | 949 | $this->add_to_group($group, $id); |
| 950 | 950 | } |
@@ -961,11 +961,11 @@ discard block |
||
| 961 | 961 | * @return bool |
| 962 | 962 | * @author Mathew |
| 963 | 963 | **/ |
| 964 | - public function login($identity, $password, $remember=FALSE) |
|
| 964 | + public function login($identity, $password, $remember = FALSE) |
|
| 965 | 965 | { |
| 966 | 966 | $this->trigger_events('pre_login'); |
| 967 | 967 | |
| 968 | - if (empty($identity) || empty($password)) |
|
| 968 | + if(empty($identity) || empty($password)) |
|
| 969 | 969 | { |
| 970 | 970 | $this->set_error('login_unsuccessful'); |
| 971 | 971 | return FALSE; |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | |
| 974 | 974 | $this->trigger_events('extra_where'); |
| 975 | 975 | |
| 976 | - $query = $this->db->select($this->identity_column . ', email, id, password, active, last_login') |
|
| 976 | + $query = $this->db->select($this->identity_column.', email, id, password, active, last_login') |
|
| 977 | 977 | ->where($this->identity_column, $identity) |
| 978 | 978 | ->limit(1) |
| 979 | 979 | ->order_by('id', 'desc') |
@@ -990,15 +990,15 @@ discard block |
||
| 990 | 990 | return FALSE; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - if ($query->num_rows() === 1) |
|
| 993 | + if($query->num_rows() === 1) |
|
| 994 | 994 | { |
| 995 | 995 | $user = $query->row(); |
| 996 | 996 | |
| 997 | 997 | $password = $this->hash_password_db($user->id, $password); |
| 998 | 998 | |
| 999 | - if ($password === TRUE) |
|
| 999 | + if($password === TRUE) |
|
| 1000 | 1000 | { |
| 1001 | - if ($user->active == 0) |
|
| 1001 | + if($user->active == 0) |
|
| 1002 | 1002 | { |
| 1003 | 1003 | $this->trigger_events('post_login_unsuccessful'); |
| 1004 | 1004 | $this->set_error('login_unsuccessful_not_active'); |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | |
| 1013 | 1013 | $this->clear_login_attempts($identity); |
| 1014 | 1014 | |
| 1015 | - if ($remember && $this->config->item('remember_users', 'ion_auth')) |
|
| 1015 | + if($remember && $this->config->item('remember_users', 'ion_auth')) |
|
| 1016 | 1016 | { |
| 1017 | 1017 | $this->remember_user($user->id); |
| 1018 | 1018 | } |
@@ -1044,19 +1044,19 @@ discard block |
||
| 1044 | 1044 | { |
| 1045 | 1045 | $recheck = (null !== $this->config->item('recheck_timer', 'ion_auth')) ? $this->config->item('recheck_timer', 'ion_auth') : 0; |
| 1046 | 1046 | |
| 1047 | - if($recheck!==0) |
|
| 1047 | + if($recheck !== 0) |
|
| 1048 | 1048 | { |
| 1049 | 1049 | $last_login = $this->session->userdata('last_check'); |
| 1050 | - if($last_login+$recheck < time()) |
|
| 1050 | + if($last_login + $recheck < time()) |
|
| 1051 | 1051 | { |
| 1052 | 1052 | $query = $this->db->select('id') |
| 1053 | - ->where(array($this->identity_column=>$this->session->userdata('identity'),'active'=>'1')) |
|
| 1053 | + ->where(array($this->identity_column=>$this->session->userdata('identity'), 'active'=>'1')) |
|
| 1054 | 1054 | ->limit(1) |
| 1055 | 1055 | ->order_by('id', 'desc') |
| 1056 | 1056 | ->get($this->tables['users']); |
| 1057 | - if ($query->num_rows() === 1) |
|
| 1057 | + if($query->num_rows() === 1) |
|
| 1058 | 1058 | { |
| 1059 | - $this->session->set_userdata('last_check',time()); |
|
| 1059 | + $this->session->set_userdata('last_check', time()); |
|
| 1060 | 1060 | } |
| 1061 | 1061 | else |
| 1062 | 1062 | { |
@@ -1064,13 +1064,13 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | $identity = $this->config->item('identity', 'ion_auth'); |
| 1066 | 1066 | |
| 1067 | - if (substr(CI_VERSION, 0, 1) == '2') |
|
| 1067 | + if(substr(CI_VERSION, 0, 1) == '2') |
|
| 1068 | 1068 | { |
| 1069 | - $this->session->unset_userdata( array($identity => '', 'id' => '', 'user_id' => '') ); |
|
| 1069 | + $this->session->unset_userdata(array($identity => '', 'id' => '', 'user_id' => '')); |
|
| 1070 | 1070 | } |
| 1071 | 1071 | else |
| 1072 | 1072 | { |
| 1073 | - $this->session->unset_userdata( array($identity, 'id', 'user_id') ); |
|
| 1073 | + $this->session->unset_userdata(array($identity, 'id', 'user_id')); |
|
| 1074 | 1074 | } |
| 1075 | 1075 | return false; |
| 1076 | 1076 | } |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | * @return boolean |
| 1093 | 1093 | **/ |
| 1094 | 1094 | public function is_max_login_attempts_exceeded($identity, $ip_address = NULL) { |
| 1095 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1095 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1096 | 1096 | $max_attempts = $this->config->item('maximum_login_attempts', 'ion_auth'); |
| 1097 | - if ($max_attempts > 0) { |
|
| 1097 | + if($max_attempts > 0) { |
|
| 1098 | 1098 | $attempts = $this->get_attempts_num($identity, $ip_address); |
| 1099 | 1099 | return $attempts >= $max_attempts; |
| 1100 | 1100 | } |
@@ -1115,11 +1115,11 @@ discard block |
||
| 1115 | 1115 | */ |
| 1116 | 1116 | public function get_attempts_num($identity, $ip_address = NULL) |
| 1117 | 1117 | { |
| 1118 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1118 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1119 | 1119 | $this->db->select('1', FALSE); |
| 1120 | 1120 | $this->db->where('login', $identity); |
| 1121 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1122 | - if (!isset($ip_address)) { |
|
| 1121 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1122 | + if(!isset($ip_address)) { |
|
| 1123 | 1123 | $ip_address = $this->_prepare_ip($this->input->ip_address()); |
| 1124 | 1124 | } |
| 1125 | 1125 | $this->db->where('ip_address', $ip_address); |
@@ -1164,11 +1164,11 @@ discard block |
||
| 1164 | 1164 | * @return int |
| 1165 | 1165 | */ |
| 1166 | 1166 | public function get_last_attempt_time($identity, $ip_address = NULL) { |
| 1167 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1167 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1168 | 1168 | $this->db->select('time'); |
| 1169 | 1169 | $this->db->where('login', $identity); |
| 1170 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1171 | - if (!isset($ip_address)) { |
|
| 1170 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1171 | + if(!isset($ip_address)) { |
|
| 1172 | 1172 | $ip_address = $this->_prepare_ip($this->input->ip_address()); |
| 1173 | 1173 | } |
| 1174 | 1174 | $this->db->where('ip_address', $ip_address); |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | * @return string |
| 1192 | 1192 | */ |
| 1193 | 1193 | public function get_last_attempt_ip($identity) { |
| 1194 | - if ($this->config->item('track_login_attempts', 'ion_auth') && $this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1194 | + if($this->config->item('track_login_attempts', 'ion_auth') && $this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1195 | 1195 | $this->db->select('ip_address'); |
| 1196 | 1196 | $this->db->where('login', $identity); |
| 1197 | 1197 | $this->db->order_by('id', 'desc'); |
@@ -1214,9 +1214,9 @@ discard block |
||
| 1214 | 1214 | * @param string $identity: user's identity |
| 1215 | 1215 | **/ |
| 1216 | 1216 | public function increase_login_attempts($identity) { |
| 1217 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1217 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1218 | 1218 | $data = array('ip_address' => '', 'login' => $identity, 'time' => time()); |
| 1219 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1219 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1220 | 1220 | $data['ip_address'] = $this->_prepare_ip($this->input->ip_address()); |
| 1221 | 1221 | } |
| 1222 | 1222 | return $this->db->insert($this->tables['login_attempts'], $data); |
@@ -1238,13 +1238,13 @@ discard block |
||
| 1238 | 1238 | * Use get_last_attempt_ip($identity) to retrieve user's last IP |
| 1239 | 1239 | **/ |
| 1240 | 1240 | public function clear_login_attempts($identity, $old_attempts_expire_period = 86400, $ip_address = NULL) { |
| 1241 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1241 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
| 1242 | 1242 | // Make sure $old_attempts_expire_period is at least equals to lockout_time |
| 1243 | 1243 | $old_attempts_expire_period = max($old_attempts_expire_period, $this->config->item('lockout_time', 'ion_auth')); |
| 1244 | 1244 | |
| 1245 | 1245 | $this->db->where('login', $identity); |
| 1246 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1247 | - if (!isset($ip_address)) { |
|
| 1246 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
| 1247 | + if(!isset($ip_address)) { |
|
| 1248 | 1248 | $ip_address = $this->_prepare_ip($this->input->ip_address()); |
| 1249 | 1249 | } |
| 1250 | 1250 | $this->db->where('ip_address', $ip_address); |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | { |
| 1278 | 1278 | $this->trigger_events('where'); |
| 1279 | 1279 | |
| 1280 | - if (!is_array($where)) |
|
| 1280 | + if(!is_array($where)) |
|
| 1281 | 1281 | { |
| 1282 | 1282 | $where = array($where => $value); |
| 1283 | 1283 | } |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | return $this; |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | - public function order_by($by, $order='desc') |
|
| 1312 | + public function order_by($by, $order = 'desc') |
|
| 1313 | 1313 | { |
| 1314 | 1314 | $this->trigger_events('order_by'); |
| 1315 | 1315 | |
@@ -1374,9 +1374,9 @@ discard block |
||
| 1374 | 1374 | { |
| 1375 | 1375 | $this->trigger_events('users'); |
| 1376 | 1376 | |
| 1377 | - if (isset($this->_ion_select) && !empty($this->_ion_select)) |
|
| 1377 | + if(isset($this->_ion_select) && !empty($this->_ion_select)) |
|
| 1378 | 1378 | { |
| 1379 | - foreach ($this->_ion_select as $select) |
|
| 1379 | + foreach($this->_ion_select as $select) |
|
| 1380 | 1380 | { |
| 1381 | 1381 | $this->db->select($select); |
| 1382 | 1382 | } |
@@ -1394,16 +1394,16 @@ discard block |
||
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | 1396 | // filter by group id(s) if passed |
| 1397 | - if (isset($groups)) |
|
| 1397 | + if(isset($groups)) |
|
| 1398 | 1398 | { |
| 1399 | 1399 | // build an array if only one group was passed |
| 1400 | - if (!is_array($groups)) |
|
| 1400 | + if(!is_array($groups)) |
|
| 1401 | 1401 | { |
| 1402 | 1402 | $groups = Array($groups); |
| 1403 | 1403 | } |
| 1404 | 1404 | |
| 1405 | 1405 | // join and then run a where_in against the group ids |
| 1406 | - if (isset($groups) && !empty($groups)) |
|
| 1406 | + if(isset($groups) && !empty($groups)) |
|
| 1407 | 1407 | { |
| 1408 | 1408 | $this->db->distinct(); |
| 1409 | 1409 | $this->db->join( |
@@ -1425,8 +1425,8 @@ discard block |
||
| 1425 | 1425 | // if group name was used we do one more join with groups |
| 1426 | 1426 | if(!empty($group_names)) |
| 1427 | 1427 | { |
| 1428 | - $this->db->join($this->tables['groups'], $this->tables['users_groups'] . '.' . $this->join['groups'] . ' = ' . $this->tables['groups'] . '.id', 'inner'); |
|
| 1429 | - $this->db->where_in($this->tables['groups'] . '.name', $group_names); |
|
| 1428 | + $this->db->join($this->tables['groups'], $this->tables['users_groups'].'.'.$this->join['groups'].' = '.$this->tables['groups'].'.id', 'inner'); |
|
| 1429 | + $this->db->where_in($this->tables['groups'].'.name', $group_names); |
|
| 1430 | 1430 | } |
| 1431 | 1431 | if(!empty($group_ids)) |
| 1432 | 1432 | { |
@@ -1437,9 +1437,9 @@ discard block |
||
| 1437 | 1437 | $this->trigger_events('extra_where'); |
| 1438 | 1438 | |
| 1439 | 1439 | // run each where that was passed |
| 1440 | - if (isset($this->_ion_where) && !empty($this->_ion_where)) |
|
| 1440 | + if(isset($this->_ion_where) && !empty($this->_ion_where)) |
|
| 1441 | 1441 | { |
| 1442 | - foreach ($this->_ion_where as $where) |
|
| 1442 | + foreach($this->_ion_where as $where) |
|
| 1443 | 1443 | { |
| 1444 | 1444 | $this->db->where($where); |
| 1445 | 1445 | } |
@@ -1447,9 +1447,9 @@ discard block |
||
| 1447 | 1447 | $this->_ion_where = array(); |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | - if (isset($this->_ion_like) && !empty($this->_ion_like)) |
|
| 1450 | + if(isset($this->_ion_like) && !empty($this->_ion_like)) |
|
| 1451 | 1451 | { |
| 1452 | - foreach ($this->_ion_like as $like) |
|
| 1452 | + foreach($this->_ion_like as $like) |
|
| 1453 | 1453 | { |
| 1454 | 1454 | $this->db->or_like($like['like'], $like['value'], $like['position']); |
| 1455 | 1455 | } |
@@ -1457,22 +1457,22 @@ discard block |
||
| 1457 | 1457 | $this->_ion_like = array(); |
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | - if (isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
| 1460 | + if(isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
| 1461 | 1461 | { |
| 1462 | 1462 | $this->db->limit($this->_ion_limit, $this->_ion_offset); |
| 1463 | 1463 | |
| 1464 | 1464 | $this->_ion_limit = NULL; |
| 1465 | 1465 | $this->_ion_offset = NULL; |
| 1466 | 1466 | } |
| 1467 | - else if (isset($this->_ion_limit)) |
|
| 1467 | + else if(isset($this->_ion_limit)) |
|
| 1468 | 1468 | { |
| 1469 | 1469 | $this->db->limit($this->_ion_limit); |
| 1470 | 1470 | |
| 1471 | - $this->_ion_limit = NULL; |
|
| 1471 | + $this->_ion_limit = NULL; |
|
| 1472 | 1472 | } |
| 1473 | 1473 | |
| 1474 | 1474 | // set the order |
| 1475 | - if (isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
| 1475 | + if(isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
| 1476 | 1476 | { |
| 1477 | 1477 | $this->db->order_by($this->_ion_order_by, $this->_ion_order); |
| 1478 | 1478 | |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | * @return array |
| 1514 | 1514 | * @author Ben Edmunds |
| 1515 | 1515 | **/ |
| 1516 | - public function get_users_groups($id=FALSE) |
|
| 1516 | + public function get_users_groups($id = FALSE) |
|
| 1517 | 1517 | { |
| 1518 | 1518 | $this->trigger_events('get_users_group'); |
| 1519 | 1519 | |
@@ -1532,7 +1532,7 @@ discard block |
||
| 1532 | 1532 | * @return bool |
| 1533 | 1533 | * @author Ben Edmunds |
| 1534 | 1534 | **/ |
| 1535 | - public function add_to_group($group_ids, $user_id=false) |
|
| 1535 | + public function add_to_group($group_ids, $user_id = false) |
|
| 1536 | 1536 | { |
| 1537 | 1537 | $this->trigger_events('add_to_group'); |
| 1538 | 1538 | |
@@ -1547,11 +1547,11 @@ discard block |
||
| 1547 | 1547 | $return = 0; |
| 1548 | 1548 | |
| 1549 | 1549 | // Then insert each into the database |
| 1550 | - foreach ($group_ids as $group_id) |
|
| 1550 | + foreach($group_ids as $group_id) |
|
| 1551 | 1551 | { |
| 1552 | - if ($this->db->insert($this->tables['users_groups'], array( $this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id))) |
|
| 1552 | + if($this->db->insert($this->tables['users_groups'], array($this->join['groups'] => (float) $group_id, $this->join['users'] => (float) $user_id))) |
|
| 1553 | 1553 | { |
| 1554 | - if (isset($this->_cache_groups[$group_id])) { |
|
| 1554 | + if(isset($this->_cache_groups[$group_id])) { |
|
| 1555 | 1555 | $group_name = $this->_cache_groups[$group_id]; |
| 1556 | 1556 | } |
| 1557 | 1557 | else { |
@@ -1575,7 +1575,7 @@ discard block |
||
| 1575 | 1575 | * @return bool |
| 1576 | 1576 | * @author Ben Edmunds |
| 1577 | 1577 | **/ |
| 1578 | - public function remove_from_group($group_ids=false, $user_id=false) |
|
| 1578 | + public function remove_from_group($group_ids = false, $user_id = false) |
|
| 1579 | 1579 | { |
| 1580 | 1580 | $this->trigger_events('remove_from_group'); |
| 1581 | 1581 | |
@@ -1586,7 +1586,7 @@ discard block |
||
| 1586 | 1586 | } |
| 1587 | 1587 | |
| 1588 | 1588 | // if group id(s) are passed remove user from the group(s) |
| 1589 | - if( ! empty($group_ids)) |
|
| 1589 | + if(!empty($group_ids)) |
|
| 1590 | 1590 | { |
| 1591 | 1591 | if(!is_array($group_ids)) |
| 1592 | 1592 | { |
@@ -1595,8 +1595,8 @@ discard block |
||
| 1595 | 1595 | |
| 1596 | 1596 | foreach($group_ids as $group_id) |
| 1597 | 1597 | { |
| 1598 | - $this->db->delete($this->tables['users_groups'], array($this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id)); |
|
| 1599 | - if (isset($this->_cache_user_in_group[$user_id]) && isset($this->_cache_user_in_group[$user_id][$group_id])) |
|
| 1598 | + $this->db->delete($this->tables['users_groups'], array($this->join['groups'] => (float) $group_id, $this->join['users'] => (float) $user_id)); |
|
| 1599 | + if(isset($this->_cache_user_in_group[$user_id]) && isset($this->_cache_user_in_group[$user_id][$group_id])) |
|
| 1600 | 1600 | { |
| 1601 | 1601 | unset($this->_cache_user_in_group[$user_id][$group_id]); |
| 1602 | 1602 | } |
@@ -1607,7 +1607,7 @@ discard block |
||
| 1607 | 1607 | // otherwise remove user from all groups |
| 1608 | 1608 | else |
| 1609 | 1609 | { |
| 1610 | - if ($return = $this->db->delete($this->tables['users_groups'], array($this->join['users'] => (float)$user_id))) { |
|
| 1610 | + if($return = $this->db->delete($this->tables['users_groups'], array($this->join['users'] => (float) $user_id))) { |
|
| 1611 | 1611 | $this->_cache_user_in_group[$user_id] = array(); |
| 1612 | 1612 | } |
| 1613 | 1613 | } |
@@ -1625,31 +1625,31 @@ discard block |
||
| 1625 | 1625 | $this->trigger_events('groups'); |
| 1626 | 1626 | |
| 1627 | 1627 | // run each where that was passed |
| 1628 | - if (isset($this->_ion_where) && !empty($this->_ion_where)) |
|
| 1628 | + if(isset($this->_ion_where) && !empty($this->_ion_where)) |
|
| 1629 | 1629 | { |
| 1630 | - foreach ($this->_ion_where as $where) |
|
| 1630 | + foreach($this->_ion_where as $where) |
|
| 1631 | 1631 | { |
| 1632 | 1632 | $this->db->where($where); |
| 1633 | 1633 | } |
| 1634 | 1634 | $this->_ion_where = array(); |
| 1635 | 1635 | } |
| 1636 | 1636 | |
| 1637 | - if (isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
| 1637 | + if(isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
| 1638 | 1638 | { |
| 1639 | 1639 | $this->db->limit($this->_ion_limit, $this->_ion_offset); |
| 1640 | 1640 | |
| 1641 | 1641 | $this->_ion_limit = NULL; |
| 1642 | 1642 | $this->_ion_offset = NULL; |
| 1643 | 1643 | } |
| 1644 | - else if (isset($this->_ion_limit)) |
|
| 1644 | + else if(isset($this->_ion_limit)) |
|
| 1645 | 1645 | { |
| 1646 | 1646 | $this->db->limit($this->_ion_limit); |
| 1647 | 1647 | |
| 1648 | - $this->_ion_limit = NULL; |
|
| 1648 | + $this->_ion_limit = NULL; |
|
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | 1651 | // set the order |
| 1652 | - if (isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
| 1652 | + if(isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
| 1653 | 1653 | { |
| 1654 | 1654 | $this->db->order_by($this->_ion_order_by, $this->_ion_order); |
| 1655 | 1655 | } |
@@ -1669,7 +1669,7 @@ discard block |
||
| 1669 | 1669 | { |
| 1670 | 1670 | $this->trigger_events('group'); |
| 1671 | 1671 | |
| 1672 | - if (isset($id)) |
|
| 1672 | + if(isset($id)) |
|
| 1673 | 1673 | { |
| 1674 | 1674 | $this->where($this->tables['groups'].'.id', $id); |
| 1675 | 1675 | } |
@@ -1694,7 +1694,7 @@ discard block |
||
| 1694 | 1694 | |
| 1695 | 1695 | $this->db->trans_begin(); |
| 1696 | 1696 | |
| 1697 | - if (array_key_exists($this->identity_column, $data) && $this->identity_check($data[$this->identity_column]) && $user->{$this->identity_column} !== $data[$this->identity_column]) |
|
| 1697 | + if(array_key_exists($this->identity_column, $data) && $this->identity_check($data[$this->identity_column]) && $user->{$this->identity_column} !== $data[$this->identity_column]) |
|
| 1698 | 1698 | { |
| 1699 | 1699 | $this->db->trans_rollback(); |
| 1700 | 1700 | $this->set_error('account_creation_duplicate_identity'); |
@@ -1708,11 +1708,11 @@ discard block |
||
| 1708 | 1708 | // Filter the data passed |
| 1709 | 1709 | $data = $this->_filter_data($this->tables['users'], $data); |
| 1710 | 1710 | |
| 1711 | - if (array_key_exists($this->identity_column, $data) || array_key_exists('password', $data) || array_key_exists('email', $data)) |
|
| 1711 | + if(array_key_exists($this->identity_column, $data) || array_key_exists('password', $data) || array_key_exists('email', $data)) |
|
| 1712 | 1712 | { |
| 1713 | - if (array_key_exists('password', $data)) |
|
| 1713 | + if(array_key_exists('password', $data)) |
|
| 1714 | 1714 | { |
| 1715 | - if( ! empty($data['password'])) |
|
| 1715 | + if(!empty($data['password'])) |
|
| 1716 | 1716 | { |
| 1717 | 1717 | $data['password'] = $this->hash_password($data['password'], $user->salt); |
| 1718 | 1718 | } |
@@ -1727,7 +1727,7 @@ discard block |
||
| 1727 | 1727 | $this->trigger_events('extra_where'); |
| 1728 | 1728 | $this->db->update($this->tables['users'], $data, array('id' => $user->id)); |
| 1729 | 1729 | |
| 1730 | - if ($this->db->trans_status() === FALSE) |
|
| 1730 | + if($this->db->trans_status() === FALSE) |
|
| 1731 | 1731 | { |
| 1732 | 1732 | $this->db->trans_rollback(); |
| 1733 | 1733 | |
@@ -1762,7 +1762,7 @@ discard block |
||
| 1762 | 1762 | $this->db->delete($this->tables['users'], array('id' => $id)); |
| 1763 | 1763 | |
| 1764 | 1764 | |
| 1765 | - if ($this->db->trans_status() === FALSE) |
|
| 1765 | + if($this->db->trans_status() === FALSE) |
|
| 1766 | 1766 | { |
| 1767 | 1767 | $this->db->trans_rollback(); |
| 1768 | 1768 | $this->trigger_events(array('post_delete_user', 'post_delete_user_unsuccessful')); |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | // if the user_expire is set to zero we'll set the expiration two years from now. |
| 1810 | 1810 | if($this->config->item('user_expire', 'ion_auth') === 0) |
| 1811 | 1811 | { |
| 1812 | - $expire = (60*60*24*365*2); |
|
| 1812 | + $expire = (60 * 60 * 24 * 365 * 2); |
|
| 1813 | 1813 | } |
| 1814 | 1814 | // otherwise use what is set |
| 1815 | 1815 | else |
@@ -1863,7 +1863,7 @@ discard block |
||
| 1863 | 1863 | { |
| 1864 | 1864 | $this->trigger_events('pre_remember_user'); |
| 1865 | 1865 | |
| 1866 | - if (!$id) |
|
| 1866 | + if(!$id) |
|
| 1867 | 1867 | { |
| 1868 | 1868 | return FALSE; |
| 1869 | 1869 | } |
@@ -1874,12 +1874,12 @@ discard block |
||
| 1874 | 1874 | |
| 1875 | 1875 | $this->db->update($this->tables['users'], array('remember_code' => $salt), array('id' => $id)); |
| 1876 | 1876 | |
| 1877 | - if ($this->db->affected_rows() > -1) |
|
| 1877 | + if($this->db->affected_rows() > -1) |
|
| 1878 | 1878 | { |
| 1879 | 1879 | // if the user_expire is set to zero we'll set the expiration two years from now. |
| 1880 | 1880 | if($this->config->item('user_expire', 'ion_auth') === 0) |
| 1881 | 1881 | { |
| 1882 | - $expire = (60*60*24*365*2); |
|
| 1882 | + $expire = (60 * 60 * 24 * 365 * 2); |
|
| 1883 | 1883 | } |
| 1884 | 1884 | // otherwise use what is set |
| 1885 | 1885 | else |
@@ -1918,7 +1918,7 @@ discard block |
||
| 1918 | 1918 | $this->trigger_events('pre_login_remembered_user'); |
| 1919 | 1919 | |
| 1920 | 1920 | // check for valid data |
| 1921 | - if (!get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) |
|
| 1921 | + if(!get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) |
|
| 1922 | 1922 | || !get_cookie($this->config->item('remember_cookie_name', 'ion_auth')) |
| 1923 | 1923 | || !$this->identity_check(get_cookie($this->config->item('identity_cookie_name', 'ion_auth')))) |
| 1924 | 1924 | { |
@@ -1931,13 +1931,13 @@ discard block |
||
| 1931 | 1931 | $query = $this->db->select($this->identity_column.', id, email, last_login') |
| 1932 | 1932 | ->where($this->identity_column, urldecode(get_cookie($this->config->item('identity_cookie_name', 'ion_auth')))) |
| 1933 | 1933 | ->where('remember_code', get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))) |
| 1934 | - ->where('active',1) |
|
| 1934 | + ->where('active', 1) |
|
| 1935 | 1935 | ->limit(1) |
| 1936 | 1936 | ->order_by('id', 'desc') |
| 1937 | 1937 | ->get($this->tables['users']); |
| 1938 | 1938 | |
| 1939 | 1939 | // if the user was found, sign them in |
| 1940 | - if ($query->num_rows() == 1) |
|
| 1940 | + if($query->num_rows() == 1) |
|
| 1941 | 1941 | { |
| 1942 | 1942 | $user = $query->row(); |
| 1943 | 1943 | |
@@ -1946,7 +1946,7 @@ discard block |
||
| 1946 | 1946 | $this->set_session($user); |
| 1947 | 1947 | |
| 1948 | 1948 | // extend the users cookies if the option is enabled |
| 1949 | - if ($this->config->item('user_extend_on_login', 'ion_auth')) |
|
| 1949 | + if($this->config->item('user_extend_on_login', 'ion_auth')) |
|
| 1950 | 1950 | { |
| 1951 | 1951 | $this->remember_user($user->id); |
| 1952 | 1952 | } |
@@ -1982,17 +1982,17 @@ discard block |
||
| 1982 | 1982 | return FALSE; |
| 1983 | 1983 | } |
| 1984 | 1984 | |
| 1985 | - $data = array('name'=>$group_name,'description'=>$group_description); |
|
| 1985 | + $data = array('name'=>$group_name, 'description'=>$group_description); |
|
| 1986 | 1986 | |
| 1987 | 1987 | // filter out any data passed that doesnt have a matching column in the groups table |
| 1988 | 1988 | // and merge the set group data and the additional data |
| 1989 | - if (!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
| 1989 | + if(!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
| 1990 | 1990 | |
| 1991 | 1991 | $this->trigger_events('extra_group_set'); |
| 1992 | 1992 | |
| 1993 | 1993 | // insert the new group |
| 1994 | 1994 | $this->db->insert($this->tables['groups'], $data); |
| 1995 | - $group_id = $this->db->insert_id($this->tables['groups'] . '_id_seq'); |
|
| 1995 | + $group_id = $this->db->insert_id($this->tables['groups'].'_id_seq'); |
|
| 1996 | 1996 | |
| 1997 | 1997 | // report success |
| 1998 | 1998 | $this->set_message('group_creation_successful'); |
@@ -2008,11 +2008,11 @@ discard block |
||
| 2008 | 2008 | **/ |
| 2009 | 2009 | public function update_group($group_id = FALSE, $group_name = FALSE, $additional_data = array()) |
| 2010 | 2010 | { |
| 2011 | - if (empty($group_id)) return FALSE; |
|
| 2011 | + if(empty($group_id)) return FALSE; |
|
| 2012 | 2012 | |
| 2013 | 2013 | $data = array(); |
| 2014 | 2014 | |
| 2015 | - if (!empty($group_name)) |
|
| 2015 | + if(!empty($group_name)) |
|
| 2016 | 2016 | { |
| 2017 | 2017 | // we are changing the name, so do some checks |
| 2018 | 2018 | |
@@ -2038,12 +2038,12 @@ discard block |
||
| 2038 | 2038 | |
| 2039 | 2039 | // IMPORTANT!! Third parameter was string type $description; this following code is to maintain backward compatibility |
| 2040 | 2040 | // New projects should work with 3rd param as array |
| 2041 | - if (is_string($additional_data)) $additional_data = array('description' => $additional_data); |
|
| 2041 | + if(is_string($additional_data)) $additional_data = array('description' => $additional_data); |
|
| 2042 | 2042 | |
| 2043 | 2043 | |
| 2044 | 2044 | // filter out any data passed that doesnt have a matching column in the groups table |
| 2045 | 2045 | // and merge the set group data and the additional data |
| 2046 | - if (!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
| 2046 | + if(!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
| 2047 | 2047 | |
| 2048 | 2048 | |
| 2049 | 2049 | $this->db->update($this->tables['groups'], $data, array('id' => $group_id)); |
@@ -2083,7 +2083,7 @@ discard block |
||
| 2083 | 2083 | // remove the group itself |
| 2084 | 2084 | $this->db->delete($this->tables['groups'], array('id' => $group_id)); |
| 2085 | 2085 | |
| 2086 | - if ($this->db->trans_status() === FALSE) |
|
| 2086 | + if($this->db->trans_status() === FALSE) |
|
| 2087 | 2087 | { |
| 2088 | 2088 | $this->db->trans_rollback(); |
| 2089 | 2089 | $this->trigger_events(array('post_delete_group', 'post_delete_group_unsuccessful')); |
@@ -2108,7 +2108,7 @@ discard block |
||
| 2108 | 2108 | |
| 2109 | 2109 | public function remove_hook($event, $name) |
| 2110 | 2110 | { |
| 2111 | - if (isset($this->_ion_hooks->{$event}[$name])) |
|
| 2111 | + if(isset($this->_ion_hooks->{$event}[$name])) |
|
| 2112 | 2112 | { |
| 2113 | 2113 | unset($this->_ion_hooks->{$event}[$name]); |
| 2114 | 2114 | } |
@@ -2116,7 +2116,7 @@ discard block |
||
| 2116 | 2116 | |
| 2117 | 2117 | public function remove_hooks($event) |
| 2118 | 2118 | { |
| 2119 | - if (isset($this->_ion_hooks->$event)) |
|
| 2119 | + if(isset($this->_ion_hooks->$event)) |
|
| 2120 | 2120 | { |
| 2121 | 2121 | unset($this->_ion_hooks->$event); |
| 2122 | 2122 | } |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | |
| 2125 | 2125 | protected function _call_hook($event, $name) |
| 2126 | 2126 | { |
| 2127 | - if (isset($this->_ion_hooks->{$event}[$name]) && method_exists($this->_ion_hooks->{$event}[$name]->class, $this->_ion_hooks->{$event}[$name]->method)) |
|
| 2127 | + if(isset($this->_ion_hooks->{$event}[$name]) && method_exists($this->_ion_hooks->{$event}[$name]->class, $this->_ion_hooks->{$event}[$name]->method)) |
|
| 2128 | 2128 | { |
| 2129 | 2129 | $hook = $this->_ion_hooks->{$event}[$name]; |
| 2130 | 2130 | |
@@ -2136,18 +2136,18 @@ discard block |
||
| 2136 | 2136 | |
| 2137 | 2137 | public function trigger_events($events) |
| 2138 | 2138 | { |
| 2139 | - if (is_array($events) && !empty($events)) |
|
| 2139 | + if(is_array($events) && !empty($events)) |
|
| 2140 | 2140 | { |
| 2141 | - foreach ($events as $event) |
|
| 2141 | + foreach($events as $event) |
|
| 2142 | 2142 | { |
| 2143 | 2143 | $this->trigger_events($event); |
| 2144 | 2144 | } |
| 2145 | 2145 | } |
| 2146 | 2146 | else |
| 2147 | 2147 | { |
| 2148 | - if (isset($this->_ion_hooks->$events) && !empty($this->_ion_hooks->$events)) |
|
| 2148 | + if(isset($this->_ion_hooks->$events) && !empty($this->_ion_hooks->$events)) |
|
| 2149 | 2149 | { |
| 2150 | - foreach ($this->_ion_hooks->$events as $name => $hook) |
|
| 2150 | + foreach($this->_ion_hooks->$events as $name => $hook) |
|
| 2151 | 2151 | { |
| 2152 | 2152 | $this->_call_hook($events, $name); |
| 2153 | 2153 | } |
@@ -2215,10 +2215,10 @@ discard block |
||
| 2215 | 2215 | public function messages() |
| 2216 | 2216 | { |
| 2217 | 2217 | $_output = ''; |
| 2218 | - foreach ($this->messages as $message) |
|
| 2218 | + foreach($this->messages as $message) |
|
| 2219 | 2219 | { |
| 2220 | - $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##'; |
|
| 2221 | - $_output .= $this->message_start_delimiter . $messageLang . $this->message_end_delimiter; |
|
| 2220 | + $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##'.$message.'##'; |
|
| 2221 | + $_output .= $this->message_start_delimiter.$messageLang.$this->message_end_delimiter; |
|
| 2222 | 2222 | } |
| 2223 | 2223 | |
| 2224 | 2224 | return $_output; |
@@ -2234,13 +2234,13 @@ discard block |
||
| 2234 | 2234 | **/ |
| 2235 | 2235 | public function messages_array($langify = TRUE) |
| 2236 | 2236 | { |
| 2237 | - if ($langify) |
|
| 2237 | + if($langify) |
|
| 2238 | 2238 | { |
| 2239 | 2239 | $_output = array(); |
| 2240 | - foreach ($this->messages as $message) |
|
| 2240 | + foreach($this->messages as $message) |
|
| 2241 | 2241 | { |
| 2242 | - $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##'; |
|
| 2243 | - $_output[] = $this->message_start_delimiter . $messageLang . $this->message_end_delimiter; |
|
| 2242 | + $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##'.$message.'##'; |
|
| 2243 | + $_output[] = $this->message_start_delimiter.$messageLang.$this->message_end_delimiter; |
|
| 2244 | 2244 | } |
| 2245 | 2245 | return $_output; |
| 2246 | 2246 | } |
@@ -2293,10 +2293,10 @@ discard block |
||
| 2293 | 2293 | public function errors() |
| 2294 | 2294 | { |
| 2295 | 2295 | $_output = ''; |
| 2296 | - foreach ($this->errors as $error) |
|
| 2296 | + foreach($this->errors as $error) |
|
| 2297 | 2297 | { |
| 2298 | - $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##'; |
|
| 2299 | - $_output .= $this->error_start_delimiter . $errorLang . $this->error_end_delimiter; |
|
| 2298 | + $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##'.$error.'##'; |
|
| 2299 | + $_output .= $this->error_start_delimiter.$errorLang.$this->error_end_delimiter; |
|
| 2300 | 2300 | } |
| 2301 | 2301 | |
| 2302 | 2302 | return $_output; |
@@ -2312,13 +2312,13 @@ discard block |
||
| 2312 | 2312 | **/ |
| 2313 | 2313 | public function errors_array($langify = TRUE) |
| 2314 | 2314 | { |
| 2315 | - if ($langify) |
|
| 2315 | + if($langify) |
|
| 2316 | 2316 | { |
| 2317 | 2317 | $_output = array(); |
| 2318 | - foreach ($this->errors as $error) |
|
| 2318 | + foreach($this->errors as $error) |
|
| 2319 | 2319 | { |
| 2320 | - $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##'; |
|
| 2321 | - $_output[] = $this->error_start_delimiter . $errorLang . $this->error_end_delimiter; |
|
| 2320 | + $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##'.$error.'##'; |
|
| 2321 | + $_output[] = $this->error_start_delimiter.$errorLang.$this->error_end_delimiter; |
|
| 2322 | 2322 | } |
| 2323 | 2323 | return $_output; |
| 2324 | 2324 | } |
@@ -2351,11 +2351,11 @@ discard block |
||
| 2351 | 2351 | $filtered_data = array(); |
| 2352 | 2352 | $columns = $this->db->list_fields($table); |
| 2353 | 2353 | |
| 2354 | - if (is_array($data)) |
|
| 2354 | + if(is_array($data)) |
|
| 2355 | 2355 | { |
| 2356 | - foreach ($columns as $column) |
|
| 2356 | + foreach($columns as $column) |
|
| 2357 | 2357 | { |
| 2358 | - if (array_key_exists($column, $data)) |
|
| 2358 | + if(array_key_exists($column, $data)) |
|
| 2359 | 2359 | $filtered_data[$column] = $data[$column]; |
| 2360 | 2360 | } |
| 2361 | 2361 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | | salt_prefix: Used for bcrypt. Versions of PHP before 5.3.7 only support "$2a$" as the salt prefix |
| 67 | 67 | | Versions 5.3.7 or greater should use the default of "$2y$". |
| 68 | 68 | */ |
| 69 | -$config['hash_method'] = 'bcrypt'; // sha1 or bcrypt, bcrypt is STRONGLY recommended |
|
| 70 | -$config['default_rounds'] = 8; // This does not apply if random_rounds is set to true |
|
| 69 | +$config['hash_method'] = 'bcrypt'; // sha1 or bcrypt, bcrypt is STRONGLY recommended |
|
| 70 | +$config['default_rounds'] = 8; // This does not apply if random_rounds is set to true |
|
| 71 | 71 | $config['random_rounds'] = FALSE; |
| 72 | 72 | $config['min_rounds'] = 5; |
| 73 | 73 | $config['max_rounds'] = 9; |
@@ -82,24 +82,24 @@ discard block |
||
| 82 | 82 | | The controller should check this function and act |
| 83 | 83 | | appropriately. If this variable set to 0, there is no maximum. |
| 84 | 84 | */ |
| 85 | -$config['site_title'] = "Manga Tracker"; // Site Title, example.com |
|
| 86 | -$config['admin_email'] = "[email protected]"; // Admin Email, [email protected] //FIXME: This is being used for a lot of things it shouldn't be. We need a diff config option. |
|
| 87 | -$config['default_group'] = 'members'; // Default group, use name |
|
| 88 | -$config['admin_group'] = 'admin'; // Default administrators group, use name |
|
| 89 | -$config['identity'] = 'email'; // [NOTE: username can be used too] You can use any unique column in your table as identity column. The values in this column, alongside password, will be used for login purposes |
|
| 90 | -$config['min_password_length'] = 6; // Minimum Required Length of Password |
|
| 91 | -$config['max_password_length'] = 64; // Maximum Allowed Length of Password |
|
| 92 | -$config['email_activation'] = FALSE; // Email Activation for registration |
|
| 93 | -$config['manual_activation'] = FALSE; // Manual Activation for registration |
|
| 94 | -$config['remember_users'] = TRUE; // Allow users to be remembered and enable auto-login |
|
| 85 | +$config['site_title'] = "Manga Tracker"; // Site Title, example.com |
|
| 86 | +$config['admin_email'] = "[email protected]"; // Admin Email, [email protected] //FIXME: This is being used for a lot of things it shouldn't be. We need a diff config option. |
|
| 87 | +$config['default_group'] = 'members'; // Default group, use name |
|
| 88 | +$config['admin_group'] = 'admin'; // Default administrators group, use name |
|
| 89 | +$config['identity'] = 'email'; // [NOTE: username can be used too] You can use any unique column in your table as identity column. The values in this column, alongside password, will be used for login purposes |
|
| 90 | +$config['min_password_length'] = 6; // Minimum Required Length of Password |
|
| 91 | +$config['max_password_length'] = 64; // Maximum Allowed Length of Password |
|
| 92 | +$config['email_activation'] = FALSE; // Email Activation for registration |
|
| 93 | +$config['manual_activation'] = FALSE; // Manual Activation for registration |
|
| 94 | +$config['remember_users'] = TRUE; // Allow users to be remembered and enable auto-login |
|
| 95 | 95 | $config['user_expire'] = 259200; /*3DAYS*/ // How long to remember the user (seconds). Set to zero for no expiration |
| 96 | -$config['user_extend_on_login'] = TRUE; // Extend the users cookies every time they auto-login |
|
| 97 | -$config['track_login_attempts'] = FALSE; // Track the number of failed login attempts for each user or ip. //CHECK: Should this be true? |
|
| 98 | -$config['track_login_ip_address'] = TRUE; // Track login attempts by IP Address, if FALSE will track based on identity. (Default: TRUE) |
|
| 99 | -$config['maximum_login_attempts'] = 3; // The maximum number of failed login attempts. |
|
| 100 | -$config['lockout_time'] = 600; // The number of seconds to lockout an account due to exceeded attempts |
|
| 96 | +$config['user_extend_on_login'] = TRUE; // Extend the users cookies every time they auto-login |
|
| 97 | +$config['track_login_attempts'] = FALSE; // Track the number of failed login attempts for each user or ip. //CHECK: Should this be true? |
|
| 98 | +$config['track_login_ip_address'] = TRUE; // Track login attempts by IP Address, if FALSE will track based on identity. (Default: TRUE) |
|
| 99 | +$config['maximum_login_attempts'] = 3; // The maximum number of failed login attempts. |
|
| 100 | +$config['lockout_time'] = 600; // The number of seconds to lockout an account due to exceeded attempts |
|
| 101 | 101 | $config['forgot_password_expiration'] = 43200000; /*12HR*/ // The number of milliseconds after which a forgot password request will expire. If set to 0, forgot password requests will not expire. |
| 102 | -$config['recheck_timer'] = 0; // The number of seconds after which the session is checked again against database to see if the user still exists and is active. Leave 0 if you don't want session recheck. if you really think you need to recheck the session against database, we would recommend a higher value, as this would affect performance. |
|
| 102 | +$config['recheck_timer'] = 0; // The number of seconds after which the session is checked again against database to see if the user still exists and is active. Leave 0 if you don't want session recheck. if you really think you need to recheck the session against database, we would recommend a higher value, as this would affect performance. |
|
| 103 | 103 | |
| 104 | 104 | /* |
| 105 | 105 | | ------------------------------------------------------------------------- |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | | Message Delimiters. |
| 177 | 177 | | ------------------------------------------------------------------------- |
| 178 | 178 | */ |
| 179 | -$config['delimiters_source'] = 'config'; // "config" = use the settings defined here, "form_validation" = use the settings defined in CI's form validation library |
|
| 180 | -$config['message_start_delimiter'] = '<p>'; // Message start delimiter |
|
| 181 | -$config['message_end_delimiter'] = '</p>'; // Message end delimiter |
|
| 182 | -$config['error_start_delimiter'] = '<p>'; // Error message start delimiter |
|
| 183 | -$config['error_end_delimiter'] = '</p>'; // Error message end delimiter |
|
| 179 | +$config['delimiters_source'] = 'config'; // "config" = use the settings defined here, "form_validation" = use the settings defined in CI's form validation library |
|
| 180 | +$config['message_start_delimiter'] = '<p>'; // Message start delimiter |
|
| 181 | +$config['message_end_delimiter'] = '</p>'; // Message end delimiter |
|
| 182 | +$config['error_start_delimiter'] = '<p>'; // Error message start delimiter |
|
| 183 | +$config['error_end_delimiter'] = '</p>'; // Error message end delimiter |
|
| 184 | 184 | |
| 185 | 185 | /* End of file ion_auth.php */ |
| 186 | 186 | /* Location: ./application/config/ion_auth.php */ |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | class Bcrypt { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @param array $params |
| 12 | 12 | * @throws Exception |
| 13 | 13 | */ |
| 14 | - public function __construct($params=array('rounds'=>7, 'salt_prefix'=>'$2y$')) { |
|
| 14 | + public function __construct($params = array('rounds'=>7, 'salt_prefix'=>'$2y$')) { |
|
| 15 | 15 | |
| 16 | 16 | if(CRYPT_BLOWFISH != 1) { |
| 17 | 17 | throw new Exception("bcrypt not supported in this installation. See http://php.net/crypt"); |
@@ -52,30 +52,30 @@ discard block |
||
| 52 | 52 | private function hashEquals($known_string, $user_string) |
| 53 | 53 | { |
| 54 | 54 | // For CI3 or PHP >= 5.6 |
| 55 | - if (function_exists('hash_equals')) |
|
| 55 | + if(function_exists('hash_equals')) |
|
| 56 | 56 | { |
| 57 | 57 | return hash_equals($known_string, $user_string); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // For CI2 with PHP < 5.6 |
| 61 | 61 | // Code from CI3 https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/compat/hash.php |
| 62 | - if ( ! is_string($known_string)) |
|
| 62 | + if(!is_string($known_string)) |
|
| 63 | 63 | { |
| 64 | 64 | trigger_error('hash_equals(): Expected known_string to be a string, '.strtolower(gettype($known_string)).' given', E_USER_WARNING); |
| 65 | 65 | return FALSE; |
| 66 | 66 | } |
| 67 | - elseif ( ! is_string($user_string)) |
|
| 67 | + elseif(!is_string($user_string)) |
|
| 68 | 68 | { |
| 69 | 69 | trigger_error('hash_equals(): Expected user_string to be a string, '.strtolower(gettype($user_string)).' given', E_USER_WARNING); |
| 70 | 70 | return FALSE; |
| 71 | 71 | } |
| 72 | - elseif (($length = strlen($known_string)) !== strlen($user_string)) |
|
| 72 | + elseif(($length = strlen($known_string)) !== strlen($user_string)) |
|
| 73 | 73 | { |
| 74 | 74 | return FALSE; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $diff = 0; |
| 78 | - for ($i = 0; $i < $length; $i++) |
|
| 78 | + for($i = 0; $i < $length; $i++) |
|
| 79 | 79 | { |
| 80 | 80 | $diff |= ord($known_string[$i]) ^ ord($user_string[$i]); |
| 81 | 81 | } |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | for($i = 0; $i < $count; $i += 16) { |
| 128 | - $this->randomState = md5(microtime() . $this->randomState); |
|
| 128 | + $this->randomState = md5(microtime().$this->randomState); |
|
| 129 | 129 | |
| 130 | - if (PHP_VERSION >= '5') { |
|
| 130 | + if(PHP_VERSION >= '5') { |
|
| 131 | 131 | $bytes .= md5($this->randomState, true); |
| 132 | 132 | } else { |
| 133 | 133 | $bytes .= pack('H*', md5($this->randomState)); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $c1 = ord($input[$i++]); |
| 155 | 155 | $output .= $itoa64[$c1 >> 2]; |
| 156 | 156 | $c1 = ($c1 & 0x03) << 4; |
| 157 | - if ($i >= 16) { |
|
| 157 | + if($i >= 16) { |
|
| 158 | 158 | $output .= $itoa64[$c1]; |
| 159 | 159 | break; |
| 160 | 160 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $c1 |= $c2 >> 6; |
| 169 | 169 | $output .= $itoa64[$c1]; |
| 170 | 170 | $output .= $itoa64[$c2 & 0x3f]; |
| 171 | - } while (1); |
|
| 171 | + } while(1); |
|
| 172 | 172 | |
| 173 | 173 | return $output; |
| 174 | 174 | } |