From b42202780dec0ea3ae3eeb1b0a61b629512996c4 Mon Sep 17 00:00:00 2001 From: Paul Canning Date: Wed, 1 Jun 2016 17:06:12 +0100 Subject: [PATCH 1/5] * Fixed PM's not being decrypted with `list_pms()` https://github.com/emreakay/CodeIgniter-Aauth/issues/145 * Fixed `get_pm()` method to fetch correct PM https://github.com/emreakay/CodeIgniter-Aauth/issues/145 --- application/libraries/Aauth.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 5b21697..76914a8 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1992,7 +1992,20 @@ class Aauth { $query = $this->aauth_db->order_by('id','DESC'); $query = $this->aauth_db->get( $this->config_vars['pms'], $limit, $offset); - return $query->result(); + + $result = $query->result(); + + if ($this->config_vars['pm_encryption']){ + $this->CI->load->library('encrypt'); + + foreach ($result as $k => $r) + { + $result[$k]->title = $this->CI->encrypt->decode($r->title); + $result[$k]->message = $this->CI->encrypt->decode($r->message); + } + } + + return $result; } //tested @@ -2015,7 +2028,7 @@ class Aauth { $query = $this->aauth_db->where('id', $pm_id); $query = $this->aauth_db->where('receiver_id', $user_id); - $query = $this->aauth_db->or_where('sender_id', $user_id); + //$query = $this->aauth_db->or_where('sender_id', $user_id); $query = $this->aauth_db->get( $this->config_vars['pms'] ); if ($query->num_rows() < 1) { From 2e08204bce4944e56da9b365f6d297de6d75cab0 Mon Sep 17 00:00:00 2001 From: REJack Date: Wed, 1 Jun 2016 18:45:12 +0200 Subject: [PATCH 2/5] fixed `get_pm()` & `delete_pm()` --- application/libraries/Aauth.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 76914a8..76e46bd 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -2027,8 +2027,10 @@ class Aauth { } $query = $this->aauth_db->where('id', $pm_id); + $query = $this->aauth_db->group_start(); $query = $this->aauth_db->where('receiver_id', $user_id); - //$query = $this->aauth_db->or_where('sender_id', $user_id); + $query = $this->aauth_db->or_where('sender_id', $user_id); + $query = $this->aauth_db->group_end(); $query = $this->aauth_db->get( $this->config_vars['pms'] ); if ($query->num_rows() < 1) { @@ -2068,8 +2070,10 @@ class Aauth { } $query = $this->aauth_db->where('id', $pm_id); + $query = $this->aauth_db->group_start(); $query = $this->aauth_db->where('receiver_id', $user_id); $query = $this->aauth_db->or_where('sender_id', $user_id); + $query = $this->aauth_db->group_end(); $query = $this->aauth_db->get( $this->config_vars['pms'] ); $result = $query->row(); if ($user_id == $result->sender_id){ From 89e715e48e58edee3e5da63bac8b968ec9a0f0e8 Mon Sep 17 00:00:00 2001 From: REJack Date: Wed, 1 Jun 2016 18:49:39 +0200 Subject: [PATCH 3/5] changed version tag --- 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 76e46bd..9cc4874 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -13,7 +13,7 @@ * * @copyright 2014-2016 Emre Akay * - * @version 2.5.0 + * @version 2.5.1 * * @license LGPL * @license http://opensource.org/licenses/LGPL-3.0 Lesser GNU Public License From 330028b5f75aaea4722d8d0390ecbad3bad84698 Mon Sep 17 00:00:00 2001 From: REJack Date: Thu, 2 Jun 2016 10:23:40 +0200 Subject: [PATCH 4/5] fixed error with `user_exist_by_name()` --- 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 9cc4874..5111879 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1098,7 +1098,7 @@ class Aauth { * @return bool */ public function user_exist_by_name( $name ) { - return $this->user_exist_by_name($name); + return $this->user_exist_by_username($name); } /** From 35e3a41f29e3035998451436ca1a1b4b9e304a44 Mon Sep 17 00:00:00 2001 From: REJack Date: Thu, 2 Jun 2016 10:24:25 +0200 Subject: [PATCH 5/5] changed version to 2.5.2 --- 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 5111879..e9547d4 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -13,7 +13,7 @@ * * @copyright 2014-2016 Emre Akay * - * @version 2.5.1 + * @version 2.5.2 * * @license LGPL * @license http://opensource.org/licenses/LGPL-3.0 Lesser GNU Public License