2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
|
|
|
|
/* replace
|
|
|
|
$UserID = $LoggedUser['ID'];
|
|
|
|
authorize();
|
|
|
|
replace */
|
|
|
|
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!isset($_POST['messages']) || !is_array($_POST['messages'])) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error('You forgot to select messages to delete.');
|
2013-06-12 08:00:46 +00:00
|
|
|
header('Location: ' . Inbox::get_inbox_link());
|
2011-03-28 14:21:28 +00:00
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
|
|
|
$Messages = $_POST['messages'];
|
2013-05-04 08:00:48 +00:00
|
|
|
foreach ($Messages AS $ConvID) {
|
2011-03-28 14:21:28 +00:00
|
|
|
$ConvID = trim($ConvID);
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!is_number($ConvID)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$ConvIDs = implode(',', $Messages);
|
2013-05-04 08:00:48 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT COUNT(ConvID)
|
|
|
|
FROM pm_conversations_users
|
|
|
|
WHERE ConvID IN ($ConvIDs)
|
|
|
|
AND UserID=$UserID");
|
2011-03-28 14:21:28 +00:00
|
|
|
list($MessageCount) = $DB->next_record();
|
2013-05-04 08:00:48 +00:00
|
|
|
if ($MessageCount != count($Messages)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(0);
|
|
|
|
}
|
|
|
|
|
2011-10-27 08:00:15 +00:00
|
|
|
if (isset($_POST['delete'])) {
|
2013-05-04 08:00:48 +00:00
|
|
|
$DB->query("
|
|
|
|
UPDATE pm_conversations_users
|
|
|
|
SET
|
|
|
|
InInbox='0',
|
|
|
|
InSentbox='0',
|
|
|
|
Sticky='0',
|
|
|
|
UnRead='0'
|
|
|
|
WHERE ConvID IN($ConvIDs)
|
|
|
|
AND UserID=$UserID");
|
2011-10-27 08:00:15 +00:00
|
|
|
} elseif (isset($_POST['unread'])) {
|
2013-06-05 08:01:01 +00:00
|
|
|
$DB->query("
|
|
|
|
UPDATE pm_conversations_users
|
|
|
|
SET Unread='1'
|
2011-10-27 08:00:15 +00:00
|
|
|
WHERE ConvID IN($ConvIDs) AND UserID=$UserID");
|
|
|
|
} elseif (isset($_POST['read'])) {
|
2013-06-05 08:01:01 +00:00
|
|
|
$DB->query("
|
|
|
|
UPDATE pm_conversations_users
|
|
|
|
SET Unread='0'
|
2011-10-27 08:00:15 +00:00
|
|
|
WHERE ConvID IN($ConvIDs) AND UserID=$UserID");
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
$Cache->delete_value('inbox_new_'.$UserID);
|
|
|
|
|
2013-06-12 08:00:46 +00:00
|
|
|
header('Location: ' . Inbox::get_inbox_link());
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|