Browse Source

changed __key__ to __data_key__ in ``user_variables`` & ``system_variables`` (fix for #68)

develop
REJack 10 years ago
parent
commit
e6aa1f6a05
  1. 24
      application/libraries/Aauth.php
  2. 4
      sql/Aauth_v2.sql

24
application/libraries/Aauth.php

@ -2025,7 +2025,7 @@ class Aauth {
if ($this->get_user_var($key,$user_id) ===FALSE) { if ($this->get_user_var($key,$user_id) ===FALSE) {
$data = array( $data = array(
'key' => $key, 'data_key' => $key,
'value' => $value, 'value' => $value,
'user_id' => $user_id 'user_id' => $user_id
); );
@ -2036,12 +2036,12 @@ class Aauth {
else { else {
$data = array( $data = array(
'key' => $key, 'data_key' => $key,
'value' => $value, 'value' => $value,
'user_id' => $user_id 'user_id' => $user_id
); );
$this->aauth_db->where( 'key', $key ); $this->aauth_db->where( 'data_key', $key );
$this->aauth_db->where( 'user_id', $user_id); $this->aauth_db->where( 'user_id', $user_id);
return $this->aauth_db->update( $this->config_vars['user_variables'], $data); return $this->aauth_db->update( $this->config_vars['user_variables'], $data);
@ -2066,7 +2066,7 @@ class Aauth {
return FALSE; return FALSE;
} }
$this->aauth_db->where('key', $key); $this->aauth_db->where('data_key', $key);
$this->aauth_db->where('user_id', $user_id); $this->aauth_db->where('user_id', $user_id);
return $this->aauth_db->delete( $this->config_vars['user_variables'] ); return $this->aauth_db->delete( $this->config_vars['user_variables'] );
@ -2092,7 +2092,7 @@ class Aauth {
} }
$query = $this->aauth_db->where('user_id', $user_id); $query = $this->aauth_db->where('user_id', $user_id);
$query = $this->aauth_db->where('key', $key); $query = $this->aauth_db->where('data_key', $key);
$query = $this->aauth_db->get( $this->config_vars['user_variables'] ); $query = $this->aauth_db->get( $this->config_vars['user_variables'] );
@ -2124,7 +2124,7 @@ class Aauth {
if ( ! $this->get_user($user_id)){ if ( ! $this->get_user($user_id)){
return FALSE; return FALSE;
} }
$query = $this->aauth_db->select('key'); $query = $this->aauth_db->select('data_key');
$query = $this->aauth_db->where('user_id', $user_id); $query = $this->aauth_db->where('user_id', $user_id);
@ -2156,7 +2156,7 @@ class Aauth {
if ($this->get_system_var($key) === FALSE) { if ($this->get_system_var($key) === FALSE) {
$data = array( $data = array(
'key' => $key, 'data_key' => $key,
'value' => $value, 'value' => $value,
); );
@ -2167,11 +2167,11 @@ class Aauth {
else { else {
$data = array( $data = array(
'key' => $key, 'data_key' => $key,
'value' => $value, 'value' => $value,
); );
$this->aauth_db->where( 'key', $key ); $this->aauth_db->where( 'data_key', $key );
return $this->aauth_db->update( $this->config_vars['system_variables'], $data); return $this->aauth_db->update( $this->config_vars['system_variables'], $data);
} }
@ -2185,7 +2185,7 @@ class Aauth {
*/ */
public function unset_system_var( $key ) { public function unset_system_var( $key ) {
$this->aauth_db->where('key', $key); $this->aauth_db->where('data_key', $key);
return $this->aauth_db->delete( $this->config_vars['system_variables'] ); return $this->aauth_db->delete( $this->config_vars['system_variables'] );
} }
@ -2199,7 +2199,7 @@ class Aauth {
*/ */
public function get_system_var( $key ){ public function get_system_var( $key ){
$query = $this->aauth_db->where('key', $key); $query = $this->aauth_db->where('data_key', $key);
$query = $this->aauth_db->get( $this->config_vars['system_variables'] ); $query = $this->aauth_db->get( $this->config_vars['system_variables'] );
@ -2220,7 +2220,7 @@ class Aauth {
*/ */
public function list_system_var_keys(){ public function list_system_var_keys(){
$query = $this->aauth_db->select('key'); $query = $this->aauth_db->select('data_key');
$query = $this->aauth_db->get( $this->config_vars['system_variables'] ); $query = $this->aauth_db->get( $this->config_vars['system_variables'] );
// if variable not set // if variable not set
if ($query->num_rows() < 1) { return FALSE;} if ($query->num_rows() < 1) { return FALSE;}

4
sql/Aauth_v2.sql

@ -91,7 +91,7 @@ CREATE TABLE `aauth_pms` (
DROP TABLE IF EXISTS `aauth_system_variables`; DROP TABLE IF EXISTS `aauth_system_variables`;
CREATE TABLE `aauth_system_variables` ( CREATE TABLE `aauth_system_variables` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`key` varchar(100) NOT NULL, `data_key` varchar(100) NOT NULL,
`value` text, `value` text,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -151,7 +151,7 @@ DROP TABLE IF EXISTS `aauth_user_variables`;
CREATE TABLE `aauth_user_variables` ( CREATE TABLE `aauth_user_variables` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL, `user_id` int(11) unsigned NOT NULL,
`key` varchar(100) NOT NULL, `data_key` varchar(100) NOT NULL,
`value` text, `value` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `user_id_index` (`user_id`) KEY `user_id_index` (`user_id`)

Loading…
Cancel
Save