@ -128,7 +128,7 @@ class Aauth {
if( !valid_email($email) or strlen($pass) < 5 or
if( !valid_email($email) or strlen($pass) < 5 or
strlen($pass) > $this->config_vars['max'] )
strlen($pass) > $this->config_vars['max'] )
{
{
$this->error($this->CI->lang->line('wrong '));
$this->error($this->CI->lang->line('aauth_error_login_failed '));
return false;
return false;
}
}
@ -139,9 +139,9 @@ class Aauth {
$row = $query->row();
$row = $query->row();
// only email found and login attempts exceeded
// only email found and login attempts exceeded
if ($query->num_rows() > 0 and $this->config_vars['ddos_protection'] and ! $this->update_login_attempts($row->email)) {
if ($query->num_rows() > 0 & & $this->config_vars['ddos_protection'] & & ! $this->update_login_attempts($row->email)) {
$this->error($this->CI->lang->line('exceeded'));
$this->error($this->CI->lang->line('aauth_error_login_attempts_ exceeded'));
return false;
return false;
}
}
@ -150,7 +150,7 @@ class Aauth {
$query = $this->CI->db->where('email', $email);
$query = $this->CI->db->where('email', $email);
$query = $this->CI->db->get($this->config_vars['users']);
$query = $this->CI->db->get($this->config_vars['users']);
$row = $query->row();
$row = $query->row();
if($query->num_rows() > 0 and $this->config_vars['ddos_protection'] and $this->config_vars['recaptcha_active'] and $row->login_attempts >= $this->config_vars['recaptcha_login_attempts']){
if($query->num_rows() > 0 & & $this->config_vars['ddos_protection'] & & $this->config_vars['recaptcha_active'] & & $row->login_attempts >= $this->config_vars['recaptcha_login_attempts']){
$reCAPTCHA_cookie = array(
$reCAPTCHA_cookie = array(
'name' => 'reCAPTCHA',
'name' => 'reCAPTCHA',
'value' => 'true',
'value' => 'true',
@ -168,7 +168,7 @@ class Aauth {
$query = $this->CI->db->get($this->config_vars['users']);
$query = $this->CI->db->get($this->config_vars['users']);
if ($query->num_rows() > 0) {
if ($query->num_rows() > 0) {
$this->error($this->CI->lang->line('not_verified'));
$this->error($this->CI->lang->line('aauth_error_account_ not_verified'));
return false;
return false;
}
}
@ -177,7 +177,7 @@ class Aauth {
$query = $this->CI->db->get($this->config_vars['users']);
$query = $this->CI->db->get($this->config_vars['users']);
if($query->num_rows() == 0){
if($query->num_rows() == 0){
$this->error($this->CI->lang->line('wrong '));
$this->error($this->CI->lang->line('aauth_error_login_failed '));
return false;
return false;
}
}
@ -198,7 +198,7 @@ class Aauth {
$resp = $reCaptcha->verifyResponse( $this->CI->input->server("REMOTE_ADDR"), $this->CI->input->post("g-recaptcha-response") );
$resp = $reCaptcha->verifyResponse( $this->CI->input->server("REMOTE_ADDR"), $this->CI->input->post("g-recaptcha-response") );
if(!$resp->success){
if(!$resp->success){
$this->error($this->CI->lang->line('recaptcha_not_correct'));
$this->error($this->CI->lang->line('aauth_error_ recaptcha_not_correct'));
return false;
return false;
}
}
}
}
@ -253,7 +253,7 @@ class Aauth {
// if not matches
// if not matches
else {
else {
$this->error($this->CI->lang->line('wrong '));
$this->error($this->CI->lang->line('aauth_error_login_failed '));
return FALSE;
return FALSE;
}
}
}
}
@ -323,11 +323,11 @@ class Aauth {
// if user or user's group not allowed
// if user or user's group not allowed
if ( ! $this->is_allowed($perm_id) or ! $this->is_group_allowed($perm_id) ){
if ( ! $this->is_allowed($perm_id) or ! $this->is_group_allowed($perm_id) ){
if( $this->config_vars['no_permission'] ) {
if( $this->config_vars['no_permission'] ) {
$this->error($this->CI->lang->line('no_access'));
$this->error($this->CI->lang->line('aauth_error_ no_access'));
redirect($this->config_vars['no_permission']);
redirect($this->config_vars['no_permission']);
}
}
else {
else {
echo $this->CI->lang->line('no_access');
echo $this->CI->lang->line('aauth_error_ no_access');
die();
die();
}
}
}
}
@ -420,9 +420,8 @@ class Aauth {
$this->CI->email->from( $this->config_vars['email'], $this->config_vars['name']);
$this->CI->email->from( $this->config_vars['email'], $this->config_vars['name']);
$this->CI->email->to($row->email);
$this->CI->email->to($row->email);
$this->CI->email->subject($this->CI->lang->line('reset'));
$this->CI->email->subject($this->CI->lang->line('aauth_email_reset_subject'));
$this->CI->email->message($this->CI->lang->line('remind') . ' ' .
$this->CI->email->message($this->CI->lang->line('aauth_email_reset_link') . $row->id . '/' . $ver_code );
$this->CI->lang->line('remind') . $row->id . '/' . $ver_code );
$this->CI->email->send();
$this->CI->email->send();
}
}
}
}
@ -457,8 +456,8 @@ class Aauth {
$this->CI->email->from( $this->config_vars['email'], $this->config_vars['name']);
$this->CI->email->from( $this->config_vars['email'], $this->config_vars['name']);
$this->CI->email->to($email);
$this->CI->email->to($email);
$this->CI->email->subject($this->CI->lang->line('reset'));
$this->CI->email->subject($this->CI->lang->line('aauth_email_ reset_success_subjec t'));
$this->CI->email->message($this->CI->lang->line('new_password') . $pass);
$this->CI->email->message($this->CI->lang->line('aauth_email_reset_success_ new_password') . $pass);
$this->CI->email->send();
$this->CI->email->send();
return true;
return true;
@ -566,28 +565,28 @@ class Aauth {
// if email is already exist
// if email is already exist
if ($this->user_exsist_by_email($email)) {
if ($this->user_exsist_by_email($email)) {
$this->error($this->CI->lang->line('email_taken '));
$this->error($this->CI->lang->line('aauth_error_email_exists '));
$valid = false;
$valid = false;
}
}
if ($this->user_exsist_by_name($name)) {
if ($this->user_exsist_by_name($name)) {
$this->error($this->CI->lang->line('name_taken '));
$this->error($this->CI->lang->line('aauth_error_username_exists '));
$valid = false;
$valid = false;
}
}
if ( ! valid_email($email)){
if ( ! valid_email($email)){
$this->error($this->CI->lang->line('email_invalid'));
$this->error($this->CI->lang->line('aauth_error_ email_invalid'));
$valid = false;
$valid = false;
}
}
if ( strlen($pass) < 5 or strlen ( $ pass ) > $this->config_vars['max'] ){
if ( strlen($pass) < 5 or strlen ( $ pass ) > $this->config_vars['max'] ){
$this->error($this->CI->lang->line('pass_invalid'));
$this->error($this->CI->lang->line('aauth_error_ password _invalid'));
$valid = false;
$valid = false;
}
}
if ($name !='' and !ctype_alnum(str_replace($this->config_vars['valid_chars'], '', $name))){
if ($name !='' and !ctype_alnum(str_replace($this->config_vars['valid_chars'], '', $name))){
$this->error($this->CI->lang->line('name_invalid'));
$this->error($this->CI->lang->line('aauth_error_user name_invalid'));
$valid = false;
$valid = false;
}
}
if (empty($name)){
if (empty($name)){
$this->error($this->CI->lang->line('name_invali d'));
$this->error($this->CI->lang->line('aauth_error_username_require d'));
$valid = false;
$valid = false;
}
}
@ -725,7 +724,7 @@ class Aauth {
$query = $this->CI->db->get($this->config_vars['users']);
$query = $this->CI->db->get($this->config_vars['users']);
if ($query->num_rows() < = 0){
if ($query->num_rows() < = 0){
$this->error($this->CI->lang->line('no_user'));
$this->error($this->CI->lang->line('aauth_error_ no_user'));
return FALSE;
return FALSE;
}
}
return $query->row();
return $query->row();
@ -782,9 +781,9 @@ class Aauth {
$this->CI->email->from( $this->config_vars['email'], $this->config_vars['name']);
$this->CI->email->from( $this->config_vars['email'], $this->config_vars['name']);
$this->CI->email->to($row->email);
$this->CI->email->to($row->email);
$this->CI->email->subject($this->CI->lang->line('verification_subject'));
$this->CI->email->subject($this->CI->lang->line('aauth_email_ verification_subject'));
$this->CI->email->message($this->CI->lang->line('code') . $ver_code .
$this->CI->email->message($this->CI->lang->line('aauth_email_verification_ code') . $ver_code .
$this->CI->lang->line(' link') . $user_id . '/' . $ver_code );
$this->CI->lang->line('aauth_email_verification_ link') . $user_id . '/' . $ver_code );
$this->CI->email->send();
$this->CI->email->send();
}
}
}
}
@ -942,7 +941,7 @@ class Aauth {
$query = $this->CI->db->get($this->config_vars['users']);
$query = $this->CI->db->get($this->config_vars['users']);
if ($query->num_rows() < = 0){
if ($query->num_rows() < = 0){
$this->error($this->CI->lang->line('no_user'));
$this->error($this->CI->lang->line('aauth_error_ no_user'));
return FALSE;
return FALSE;
}
}
return $query->row()->id;
return $query->row()->id;
@ -1025,7 +1024,7 @@ class Aauth {
return $this->CI->db->insert_id();
return $this->CI->db->insert_id();
}
}
$this->error($this->CI->lang->line('group_exist '));
$this->info($this->CI->lang->line('aauth_info_group_exists '));
return FALSE;
return FALSE;
}
}
@ -1087,7 +1086,7 @@ class Aauth {
if( ! $group_id ) {
if( ! $group_id ) {
$this->error( $this->CI->lang->line('no_group') );
$this->error( $this->CI->lang->line('aauth_error_ no_group') );
return false;
return false;
}
}
@ -1103,7 +1102,7 @@ class Aauth {
return $this->CI->db->insert($this->config_vars['user_to_group'], $data);
return $this->CI->db->insert($this->config_vars['user_to_group'], $data);
}
}
$this->info($this->CI->lang->line('already_member'));
$this->info($this->CI->lang->line('aauth_info_ already_member'));
return true;
return true;
}
}
@ -1243,7 +1242,7 @@ class Aauth {
$this->CI->db->insert($this->config_vars['perms'], $data);
$this->CI->db->insert($this->config_vars['perms'], $data);
return $this->CI->db->insert_id();
return $this->CI->db->insert_id();
}
}
$this->error($this->CI->lang->line('already_perm '));
$this->info($this->CI->lang->line('aauth_info_perm_exists '));
return FALSE;
return FALSE;
}
}
@ -1518,7 +1517,7 @@ class Aauth {
public function send_pm( $sender_id, $receiver_id, $title, $message ){
public function send_pm( $sender_id, $receiver_id, $title, $message ){
if ( !is_numeric($receiver_id) or $sender_id == $receiver_id ){
if ( !is_numeric($receiver_id) or $sender_id == $receiver_id ){
$this->error($this->CI->lang->line('self_pm'));
$this->error($this->CI->lang->line('aauth_error_ self_pm'));
return false;
return false;
}
}
@ -1529,7 +1528,7 @@ class Aauth {
// if user not exist or banned
// if user not exist or banned
if ( $query->num_rows() < 1 ) {
if ( $query->num_rows() < 1 ) {
$this->error($this->CI->lang->line('no_user'));
$this->error($this->CI->lang->line('aauth_error_ no_user'));
return false;
return false;
}
}
@ -1540,7 +1539,7 @@ class Aauth {
// if user not exist or banned
// if user not exist or banned
if ( $query->num_rows() < 1 ) {
if ( $query->num_rows() < 1 ) {
$this->error($this->CI->lang->line('no_user'));
$this->error($this->CI->lang->line('aauth_error_ no_user'));
return false;
return false;
}
}
@ -1597,7 +1596,7 @@ class Aauth {
$query = $this->CI->db->get( $this->config_vars['pms'] );
$query = $this->CI->db->get( $this->config_vars['pms'] );
if ($query->num_rows() < 1 ) {
if ($query->num_rows() < 1 ) {
$this->error( $this->CI->lang->line('no_pm') );
$this->error( $this->CI->lang->line('aauth_error_ no_pm') );
}
}
if ($set_as_read) $this->set_as_read_pm($pm_id);
if ($set_as_read) $this->set_as_read_pm($pm_id);
@ -1919,7 +1918,7 @@ class Aauth {
* List User Variable Keys by UserID
* List User Variable Keys by UserID
* Return array of variable keys or false
* Return array of variable keys or false
* @param int $user_id ; if not given current user
* @param int $user_id ; if not given current user
* @return bool|string , false if var is not set, the value of var if set
* @return bool|array, false if no user vars, otherwise array
*/
*/
public function list_user_var_keys($user_id = false){
public function list_user_var_keys($user_id = false){
@ -1940,9 +1939,12 @@ class Aauth {
// if variable not set
// if variable not set
if ($query->num_rows() < 1 ) { return false ; }
if ($query->num_rows() < 1 ) { return false ; }
else {
else {
return $query->result();
$key_list = array();
foreach( $query->result() as $row) {
$key_list[] = $row->key;
}
return $key_list;
}
}
}
}
########################
########################