-
Notifications
You must be signed in to change notification settings - Fork 2
/
pmView.php
60 lines (55 loc) · 1.43 KB
/
pmView.php
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
<?php
include("common.php");
$fileC = file("db/PMs/".$_SESSION['user']->getUserId().".dat",FILE_IGNORE_NEW_LINES);
$str = "";
$statusChange = false;
foreach ($fileC as $line)
{
$temp = new PM($line);
if ($temp->getMessageId() == $_GET['messageId'])
{
$pm = $temp;
if ($pm->isRead() == 'false')
{
$statusChange = true;
$lineArr = explode("~",$line);
$lineArr[4] = 'true';
$str .= implode("~",$lineArr)."\n";
}
}
else
{
$str .= $line."\n";
}
}
if ($statusChange)
{
file_put_contents("db/PMs/".$_SESSION['user']->getUserId().".dat",$str);
}
outHtml1("View Message");
outHtml2("View Message:","pmInbox.php");
?>
<table class="tbl">
<tr>
<td class="tblleft">Sender</td>
<td class="tblright"><?php echo "<a href='viewUser.php?userId=".$pm->getSender()->getUserId()."'>".$pm->getSender()->getUserId()."</a>" ?></td>
</tr>
<tr>
<td class="tblleft">Date</td>
<td class="tblright"><?php echo $pm->getDate() ?></td>
</tr>
<tr>
<td class="tblleft">Subject</td>
<td class="tblright"><?php echo $pm->getSubject() ?></td>
</tr>
<tr>
<td class="tblleft">Message</td>
<td class="tblright"><?php echo $pm->getMessage() ?></td>
</tr>
</table>
<div id="controlDiv">
<a href="pmDelete.php?&messageId=<?php echo htmlentities($_GET['messageId']) ?>">Delete</a>
</div>
<?php
outHtml3();
?>