|
|
|
@ -2306,98 +2306,6 @@ class Aauth {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
######################## |
|
|
|
|
# Aauth System Variables |
|
|
|
|
######################## |
|
|
|
|
|
|
|
|
|
//tested |
|
|
|
|
/** |
|
|
|
|
* Set Aauth System Variable as key value |
|
|
|
|
* if variable not set before, it will be set |
|
|
|
|
* if set, overwrites the value |
|
|
|
|
* @param string $key |
|
|
|
|
* @param string $value |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public function set_system_var( $key, $value ) { |
|
|
|
|
|
|
|
|
|
// if var not set, set |
|
|
|
|
if ($this->get_system_var($key) === FALSE) { |
|
|
|
|
|
|
|
|
|
$data = array( |
|
|
|
|
'data_key' => $key, |
|
|
|
|
'value' => $value, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $this->aauth_db->insert( $this->config_vars['system_variables'] , $data); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// if var already set, overwrite |
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
$data = array( |
|
|
|
|
'data_key' => $key, |
|
|
|
|
'value' => $value, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->aauth_db->where( 'data_key', $key ); |
|
|
|
|
return $this->aauth_db->update( $this->config_vars['system_variables'], $data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//tested |
|
|
|
|
/** |
|
|
|
|
* Unset Aauth System Variable as key value |
|
|
|
|
* @param string $key |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public function unset_system_var( $key ) { |
|
|
|
|
|
|
|
|
|
$this->aauth_db->where('data_key', $key); |
|
|
|
|
|
|
|
|
|
return $this->aauth_db->delete( $this->config_vars['system_variables'] ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//tested |
|
|
|
|
/** |
|
|
|
|
* Get Aauth System Variable by key |
|
|
|
|
* Return string of variable value or FALSE |
|
|
|
|
* @param string $key |
|
|
|
|
* @return bool|string , FALSE if var is not set, the value of var if set |
|
|
|
|
*/ |
|
|
|
|
public function get_system_var( $key ){ |
|
|
|
|
|
|
|
|
|
$query = $this->aauth_db->where('data_key', $key); |
|
|
|
|
|
|
|
|
|
$query = $this->aauth_db->get( $this->config_vars['system_variables'] ); |
|
|
|
|
|
|
|
|
|
// if variable not set |
|
|
|
|
if ($query->num_rows() < 1) { return FALSE;} |
|
|
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
$row = $query->row(); |
|
|
|
|
return $row->value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* List System Variable Keys |
|
|
|
|
* Return array of variable keys or FALSE |
|
|
|
|
* @return bool|array , FALSE if var is not set, the value of var if set |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
public function list_system_var_keys(){ |
|
|
|
|
$query = $this->aauth_db->select('data_key'); |
|
|
|
|
$query = $this->aauth_db->get( $this->config_vars['system_variables'] ); |
|
|
|
|
// if variable not set |
|
|
|
|
if ($query->num_rows() < 1) { return FALSE;} |
|
|
|
|
else { |
|
|
|
|
return $query->result(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function generate_recaptcha_field(){ |
|
|
|
|
$content = ''; |
|
|
|
|
if($this->config_vars['ddos_protection'] && $this->config_vars['recaptcha_active']){ |
|
|
|
|