From b42202780dec0ea3ae3eeb1b0a61b629512996c4 Mon Sep 17 00:00:00 2001 From: Paul Canning Date: Wed, 1 Jun 2016 17:06:12 +0100 Subject: [PATCH] * 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) {