This smallest modification in "messagespy" code allows you to see if messages are read or not.
If you want to see this, edit admincp.php and replace the "messagespy" code with this one:
If you want to see this, edit admincp.php and replace the "messagespy" code with this one:
if ($action=="messagespy"){
if ($do == "del") {
if ($_POST["delall"])
SQL_Query_exec("DELETE FROM `messages`");
else {
if (!@count($_POST["del"])) show_error_msg(T_("ERROR"), "Nothing selected", 1);
$ids = array_map("intval", $_POST["del"]);
$ids = implode(", ", $ids);
SQL_Query_exec("DELETE FROM `messages` WHERE `id` IN ($ids)");
}
header("Refresh: 2;url=admincp.php?action=messagespy");
stdhead();
show_error_msg("Success", "Entries deleted", 0);
stdfoot();
die;
}
stdhead("Message Spy");
navmenu();
$res2 = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE location in ('in', 'both')");
$row = mysql_fetch_array($res2);
$count = $row[0];
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "admincp.php?action=messagespy&");
begin_frame("Message Spy");
$res = SQL_Query_exec("SELECT * FROM messages WHERE location in ('in', 'both') ORDER BY id DESC $limit");
$mess = number_format(get_row_count("messages"),0);
$read = number_format(get_row_count("messages", "WHERE unread = 'no'"));
$unread = number_format(get_row_count("messages", "WHERE unread = 'yes'"));
print("<div style='margin-top:10px' align='center'><font size='2'>Messages: <b>$mess</b> | Read: <b>$read</b> | Unread: <b>$unread</b></font</div>");
print("<br /><br />");
echo $pagertop;
print("<form id='messagespy' method='post' action='?action=messagespy&do=del'><table border='0' cellspacing='0' cellpadding='3' align='center' class='table_table'>n");
print("<tr>
<th class='table_head' align='left'><input type='checkbox' name='checkall' onclick='checkAll(this.form.id);' /></th>
<th class='table_head' align='left'>INFO</th>
<th class='table_head' align='left'>Text</th>
<th class='table_head' align='center' width='10%'>Date</th>
</tr>n");
while ($arr = mysql_fetch_assoc($res)){
$res2 = SQL_Query_exec("SELECT username FROM users WHERE id=" . $arr["receiver"]);
if ($arr2 = mysql_fetch_assoc($res2))
$receiver = "<a href='account-details.php?id=" . $arr["receiver"] . "'><b>" . $arr2["username"] . "</b></a>";
else
$receiver = "<i>Deleted</i>";
$res3 = SQL_Query_exec("SELECT username FROM users WHERE id=" . $arr["sender"]);
$arr3 = mysql_fetch_assoc($res3);
$sender = "<a href='account-details.php?id=" . $arr["sender"] . "'><b>" . $arr3["username"] . "</b></a>";
if( $arr["sender"] == 0 )
$sender = "<b>System</b>";
$msg = format_comment($arr["msg"]);
$added = utc_to_tz($arr["added"]);
print("<tr>
<td class='table_col2'><input type='checkbox' name='del[]' value='$arr[id]' /></td>
<td align='left' class='table_col1'>
Sender: $sender
<div style='margin-top:5px; margin-bottom:5px'>Receiver: $receiver</div>
Read: ".($arr["unread"] != "yes" ? "<b><font color=limegreen>Yes</font></b>" : "<b><font color=red>No</font></b>")."
</td>
<td align='left' class='table_col1'>$msg</td>
<td align='center' class='table_col2'>$added</td>
</tr>");
}
print("</table><br />");
echo "<input type='submit' value='Delete Checked' /> <input type='submit' value='Delete All' name='delall' /></form>";
print($pagerbottom);
end_frame();
stdfoot();
}
