Gazelle/sections/staffpm/unresolve.php

37 lines
891 B
PHP
Raw Normal View History

2012-02-27 08:00:22 +00:00
<?
if ($ID = (int)($_GET['id'])) {
// Check if conversation belongs to user
2013-05-22 08:01:02 +00:00
$DB->query("
SELECT UserID, Level, AssignedToUser
FROM staff_pm_conversations
2013-07-02 08:01:37 +00:00
WHERE ID = $ID");
2012-02-27 08:00:22 +00:00
list($UserID, $Level, $AssignedToUser) = $DB->next_record();
2013-02-22 08:00:24 +00:00
2013-08-28 23:08:41 +00:00
if ($UserID == $LoggedUser['ID']
|| ($IsFLS && $Level == 0)
|| $AssignedToUser == $LoggedUser['ID']
|| ($IsStaff && $Level <= $LoggedUser['EffectiveClass'])
) {
2013-04-17 08:00:58 +00:00
/*if ($Level != 0 && $IsStaff == false) {
2012-02-27 08:00:22 +00:00
error(403);
}*/
// Conversation belongs to user or user is staff, unresolve it
2013-05-22 08:01:02 +00:00
$DB->query("
UPDATE staff_pm_conversations
2013-07-02 08:01:37 +00:00
SET Status = 'Unanswered'
WHERE ID = $ID");
2012-02-27 08:00:22 +00:00
// Clear cache for user
$Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']);
2013-02-22 08:00:24 +00:00
2012-02-27 08:00:22 +00:00
header('Location: staffpm.php');
} else {
// Conversation does not belong to user
error(403);
}
} else {
2013-04-17 08:00:58 +00:00
// No ID
2012-02-27 08:00:22 +00:00
header('Location: staffpm.php');
}
?>