forked from Moc/mailbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread.php
More file actions
79 lines (70 loc) · 1.86 KB
/
Copy pathread.php
File metadata and controls
79 lines (70 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/*
* Mailbox - an e107 plugin by Tijn Kuyper
*
* Copyright (C) 2016-2017 Tijn Kuyper (http://www.tijnkuyper.nl)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
if(!defined('e107_INIT'))
{
require_once("../../class2.php");
}
if(!e107::isInstalled('mailbox'))
{
e107::redirect();
exit;
}
// Load the LAN files
e107::lan('mailbox', false, true);
// Load the header
require_once(HEADERF);
// Load template and shortcodes
$sc = e107::getScBatch('mailbox', TRUE);
$template = e107::getTemplate('mailbox');
$template = array_change_key_case($template);
// Define variables
$sql = e107::getDb();
$tp = e107::getParser();
$frm = e107::getForm();
$text = '';
$mid = (int) $_GET['id'];
/* Let's render some things now */
// Open container
$text .= '<div class="row">';
// Open left sidebar
$text .= '<div class="col-md-3">';
// Load left sidebar
$text .= $tp->parseTemplate($template['box_navigation'], true, $sc);
// Close left sidebar
$text .= '</div>';
// Open right content
$text .= '<div class="col-md-9">';
// Load right content
// Construct query
$query_getmessage = $sql->retrieve('mailbox_messages', '*', 'message_id='.$mid.'');
// Check if the message is there
if($query_getmessage)
{
if($query_getmessage['message_to'] == USERID || $query_getmessage['message_from'] == USERID)
{
$sc->setVars($query_getmessage);
$text .= $tp->parseTemplate($template['read_message'], true, $sc);
}
else
{
$text .= '<div class="mailbox-infomessage">'.LAN_MAILBOX_MESSAGENOTYOURS.'</div>';
}
}
else
{
$text .='<div class="mailbox-infomessage">'.LAN_MAILBOX_MESSAGENOTFOUND.'</div>';
}
// Close right content
$text .= '</div>';
// Close container
$text .= '</div>';
$ns->tablerender(LAN_MAILBOX_NAME, $text);
require_once(FOOTERF);
exit;