From 136ba686bdd6b71d72c3ad1a7002f91d85d74dbe Mon Sep 17 00:00:00 2001 From: Raphael Jackstadt Date: Tue, 28 Jul 2015 23:13:25 +0200 Subject: [PATCH 1/5] fix for #51 'is_allowed() bug ' --- application/libraries/Aauth.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index c893deb..3b5a660 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1472,13 +1472,20 @@ class Aauth { $query = $this->aauth_db->get( $this->config_vars['perm_to_user'] ); if( $query->num_rows() > 0){ - return TRUE; - } elseif ($this->is_group_allowed($perm_id)) { - return TRUE; + return TRUE; } else { - return FALSE; - } - + if( $user_id===FALSE){ + return $this->is_group_allowed($perm_id); + } else { + $g_allowed=FALSE; + foreach( $this->get_user_groups($user_id) as $group ){ + if ( $this->is_group_allowed($perm_id, $group->id) ){ + $g_allowed=TRUE; + } + } + return $g_allowed; + } + } } /** From a11bdbe5800b9d85d4bb01df08acc675e540cb26 Mon Sep 17 00:00:00 2001 From: Raphael Jackstadt Date: Tue, 28 Jul 2015 23:31:38 +0200 Subject: [PATCH 2/5] Reserved keyword conflict in MySQL. --- application/libraries/Aauth.php | 6 +++--- sql/Aauth_v2.sql | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 3b5a660..37e214c 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1714,7 +1714,7 @@ class Aauth { 'receiver_id' => $receiver_id, 'title' => $title, 'message' => $message, - 'date' => date('Y-m-d H:i:s') + 'date_sent' => date('Y-m-d H:i:s') ); return $query = $this->aauth_db->insert( $this->config_vars['pms'], $data ); @@ -1796,7 +1796,7 @@ class Aauth { } $query = $this->aauth_db->where('receiver_id', $receiver_id); - $query = $this->aauth_db->where('read', 0); + $query = $this->aauth_db->where('date_read', NULL); $query = $this->aauth_db->get( $this->config_vars['pms'] ); return $query->num_rows(); @@ -1811,7 +1811,7 @@ class Aauth { public function set_as_read_pm($pm_id){ $data = array( - 'read' => 1, + 'date_read' => date('Y-m-d H:i:s') ); $this->aauth_db->update( $this->config_vars['pms'], $data, "id = $pm_id"); diff --git a/sql/Aauth_v2.sql b/sql/Aauth_v2.sql index 86f9520..c8a52de 100644 --- a/sql/Aauth_v2.sql +++ b/sql/Aauth_v2.sql @@ -75,8 +75,8 @@ CREATE TABLE `aauth_pms` ( `receiver_id` int(11) unsigned NOT NULL, `title` varchar(255) NOT NULL, `message` text, - `date` datetime DEFAULT NULL, - `read` tinyint(1) DEFAULT '0', + `date_sent` datetime DEFAULT NULL, + `date_read` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `full_index` (`id`,`sender_id`,`receiver_id`,`read`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; From 4b530eda60f82c1f2a528635ce0dd593637b8e65 Mon Sep 17 00:00:00 2001 From: REJack Date: Tue, 4 Aug 2015 00:28:18 +0200 Subject: [PATCH 3/5] SQL error fixed --- sql/Aauth_v2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/Aauth_v2.sql b/sql/Aauth_v2.sql index c8a52de..1a84a64 100644 --- a/sql/Aauth_v2.sql +++ b/sql/Aauth_v2.sql @@ -126,7 +126,7 @@ CREATE TABLE `aauth_users` ( -- ---------------------------- -- Records of aauth_users -- ---------------------------- -INSERT INTO `aauth_users` VALUES ('1', 'admin@example.com', 'dd5073c93fb477a167fd69072e95455834acd93df8fed41a2c468c45b394bfe3', 'Admin', '0', null, null, null, null, null, null, null, null, '0'); +INSERT INTO `aauth_users` VALUES ('1', 'admin@example.com', 'dd5073c93fb477a167fd69072e95455834acd93df8fed41a2c468c45b394bfe3', 'Admin', '0', null, null, null, null, null, null, null, null, null, '0'); -- ---------------------------- -- Table structure for `aauth_user_to_group` From 39c893fcc436230dd10552ab5d711a5b42959562 Mon Sep 17 00:00:00 2001 From: REJack Date: Fri, 14 Aug 2015 17:24:19 +0200 Subject: [PATCH 4/5] fix for #58 sry for my mistake --- application/libraries/Aauth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 37e214c..d12e601 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -397,7 +397,7 @@ class Aauth { } } }else{ - if(!$this->CI->session->has_userdata('remember')){ + if(!isset($_SESSION('remember'))){ return FALSE; }else{ $session = explode('-', $this->CI->session->userdata('remember')); From 56202a2e7d30dbf54374e3f8e47e74b905344855 Mon Sep 17 00:00:00 2001 From: REJack Date: Fri, 14 Aug 2015 22:01:41 +0200 Subject: [PATCH 5/5] there was a mistake for #58 fix --- application/libraries/Aauth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index d12e601..0964335 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -397,7 +397,7 @@ class Aauth { } } }else{ - if(!isset($_SESSION('remember'))){ + if(!isset($_SESSION['remember'])){ return FALSE; }else{ $session = explode('-', $this->CI->session->userdata('remember'));