Gazelle/sections/inbox/takeedit.php
2013-06-12 08:00:46 +00:00

47 lines
987 B
PHP

<?
authorize();
$UserID = $LoggedUser['ID'];
$ConvID = $_POST['convid'];
if (!is_number($ConvID)) {
error(404);
}
$DB->query("
SELECT UserID
FROM pm_conversations_users
WHERE UserID='$UserID' AND ConvID='$ConvID'");
if ($DB->record_count() == 0) {
error(403);
}
if (isset($_POST['delete'])) {
$DB->query("
UPDATE pm_conversations_users
SET
InInbox='0',
InSentbox='0',
Sticky='0'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
} else {
if (isset($_POST['sticky'])) {
$DB->query("
UPDATE pm_conversations_users
SET Sticky='1'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
} else {
$DB->query("
UPDATE pm_conversations_users
SET Sticky='0'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
}
if (isset($_POST['mark_unread'])) {
$DB->query("
UPDATE pm_conversations_users
SET Unread='1'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
$Cache->increment('inbox_new_'.$UserID);
}
}
header('Location: ' . Inbox::get_inbox_link());
?>