Also the data of the message sender are not taken anymore via
the Person_model, but via the MessageToken_model, to avoid that
the login will be prompted
This commit is contained in:
Paolo
2017-03-30 16:43:35 +02:00
3 changed files with 69 additions and 19 deletions
+14 -5
View File
@@ -14,6 +14,10 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* NOTE: in this controller is not possible to include/call everything
* that automatically call the authentication system, like the most of models or libraries
*/
class ViewMessage extends CI_Controller
{
/**
@@ -22,11 +26,11 @@ class ViewMessage extends CI_Controller
public function __construct()
{
parent::__construct();
// Loading config file message
$this->config->load('message');
// Load model MessageToken_model
// Load model MessageToken_model, not calling the authentication system
$this->load->model('system/MessageToken_model', 'MessageTokenModel');
}
@@ -37,12 +41,12 @@ class ViewMessage extends CI_Controller
public function toHTML($token)
{
$msg = $this->MessageTokenModel->getMessageByToken($token);
if ($msg->error)
{
show_error($msg->retval);
}
if (is_array($msg->retval) && count($msg->retval) > 0)
{
$setReadMessageStatusByToken = $this->MessageTokenModel->setReadMessageStatusByToken($token);
@@ -52,7 +56,12 @@ class ViewMessage extends CI_Controller
show_error($msg->$setReadMessageStatusByToken);
}
$sender_id = $msg->retval[0]->sender_id;
$sender = $this->MessageTokenModel->getSenderData($sender_id);
$data = array (
'sender_id' => $sender_id,
'sender' => $sender->retval[0],
'message' => $msg->retval[0],
'href' => APP_ROOT . $this->config->item('redirect_view_message_url') . $token
);