diff options
Diffstat (limited to 'mod/messages/read.php')
-rw-r--r-- | mod/messages/read.php | 108 |
1 files changed, 51 insertions, 57 deletions
diff --git a/mod/messages/read.php b/mod/messages/read.php index f09bd116f..2c3c5af50 100644 --- a/mod/messages/read.php +++ b/mod/messages/read.php @@ -1,64 +1,58 @@ <?php - - /** - * Elgg read a message page - * - * @package ElggMessages - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Load Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // If we're not logged in, forward to the front page - gatekeeper(); - - $mbox_type = get_input('type', 'inbox'); - - // Get the full message object to read - $message = get_entity(get_input("message")); - - // If no message, must have been deleted, send user to inbox/sent mail - if (!$message) { - $owner = get_loggedin_user(); - if ($mbox_type == 'sent') { - forward("mod/messages/sent.php"); - } else { - forward("pg/messages/{$owner->username}"); - } +/** +* Elgg read a message page +* +* @package ElggMessages +* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 +* @author Curverider Ltd <info@elgg.com> +* @copyright Curverider Ltd 2008-2010 +* @link http://elgg.com/ +*/ + +// Load Elgg engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// If we're not logged in, forward to the front page +gatekeeper(); + +$page_owner = get_loggedin_user(); +$mbox_type = get_input('type', 'inbox'); + +// Get the full message object to read +$message = get_entity(get_input("message")); + +// If no message, must have been deleted, send user to inbox/sent mail +if (!$message) { + if ($mbox_type == 'sent') { + forward("mod/messages/sent.php"); + } else { + forward("pg/messages/{$page_owner->username}"); } +} + +// If the message is being read from the inbox, mark it as read, otherwise don't. +// This stops a user who checks out a message they have sent having it being marked +// as read for the recipient +if($mbox_type != "sent"){ + // Mark the message as being read now + if ($message->getSubtype() == "messages") { + //set the message metadata to 1 which equals read + $message->readYet = 1; + } +} - // If the message is being read from the inbox, mark it as read, otherwise don't. - // This stops a user who checks out a message they have sent having it being marked - // as read for the recipient - if(get_input('type') != "sent"){ - - // Mark the message as being read now - if ($message->getSubtype() == "messages") { - - //set the message metadata to 1 which equals read - $message->readYet = 1; - - } - - } +set_page_owner($page_owner->getGUID()); - // Get the logged in user - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); +// Display it +$content = elgg_view("messages/messages",array( + 'entity' => $message, + 'entity_owner' => $page_owner, + 'full' => true + )); - // Display it - $area2 = elgg_view("messages/messages",array( - 'entity' => $message, - 'entity_owner' => $page_owner, - 'full' => true - )); - $body = elgg_view_layout("two_column_left_sidebar", '', $area2); +$sidebar = elgg_view("messages/menu_options"); - // Display page - page_draw(sprintf(elgg_echo('messages:message')),$body); +$body = elgg_view_layout("one_column_with_sidebar", $sidebar, $content); -?>
\ No newline at end of file +// Display page +page_draw(sprintf(elgg_echo('messages:message')),$body);
\ No newline at end of file |