2012-01-26 08:00:25 +00:00
|
|
|
<?
|
|
|
|
if (!is_number($_GET['id'])) {
|
|
|
|
error(404);
|
|
|
|
}
|
2013-02-22 08:00:24 +00:00
|
|
|
|
2012-01-26 08:00:25 +00:00
|
|
|
if (!check_perms('users_give_donor')) {
|
|
|
|
error(403);
|
|
|
|
}
|
2013-02-22 08:00:24 +00:00
|
|
|
|
2012-01-26 08:00:25 +00:00
|
|
|
$ConvID = (int)$_GET['id'];
|
|
|
|
$DB->query("SELECT c.Subject, c.UserID, c.Level, c.AssignedToUser, c.Unread, c.Status, u.Donor
|
|
|
|
FROM staff_pm_conversations AS c
|
2013-04-17 08:00:58 +00:00
|
|
|
JOIN users_info AS u ON u.UserID = c.UserID
|
2012-01-26 08:00:25 +00:00
|
|
|
WHERE ID=$ConvID");
|
|
|
|
list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status, $Donor) = $DB->next_record();
|
|
|
|
if ($DB->record_count() == 0) {
|
|
|
|
error(404);
|
|
|
|
}
|
2013-02-22 08:00:24 +00:00
|
|
|
|
2013-04-17 08:00:58 +00:00
|
|
|
$Message = "Thank for for helping to support the site. It's users like you who make all of this possible.";
|
2013-02-22 08:00:24 +00:00
|
|
|
|
2012-01-26 08:00:25 +00:00
|
|
|
if ((int)$Donor === 0) {
|
2013-04-17 08:00:58 +00:00
|
|
|
$Msg = db_string(sqltime() . ' - Donated: https://'.SSL_SITE_URL."/staffpm.php?action=viewconv&id=$ConvID\n\n");
|
2013-02-22 08:00:24 +00:00
|
|
|
$DB->query("UPDATE users_info
|
2012-01-26 08:00:25 +00:00
|
|
|
SET Donor='1',
|
2013-02-22 08:00:24 +00:00
|
|
|
AdminComment = CONCAT('$Msg',AdminComment)
|
2012-01-26 08:00:25 +00:00
|
|
|
WHERE UserID = $UserID");
|
2013-04-17 08:00:58 +00:00
|
|
|
$DB->query("UPDATE users_main
|
|
|
|
SET Invites=Invites+2
|
|
|
|
WHERE ID = $UserID");
|
2012-01-26 08:00:25 +00:00
|
|
|
|
|
|
|
$Cache->delete_value('user_info_'.$UserID);
|
|
|
|
$Cache->delete_value('user_info_heavy_'.$UserID);
|
2013-04-17 08:00:58 +00:00
|
|
|
$Message .= ' Enjoy your new love from us!';
|
2012-01-26 08:00:25 +00:00
|
|
|
} else {
|
2013-04-17 08:00:58 +00:00
|
|
|
$Message .= ' ';
|
2012-01-26 08:00:25 +00:00
|
|
|
}
|
|
|
|
$DB->query("INSERT INTO staff_pm_messages (UserID, SentDate, Message, ConvID)
|
|
|
|
VALUES (".$LoggedUser['ID'].", '".sqltime()."', '".db_string($Message)."', $ConvID)");
|
2013-02-22 08:00:24 +00:00
|
|
|
$DB->query("UPDATE staff_pm_conversations
|
2013-04-17 08:00:58 +00:00
|
|
|
SET Date='".sqltime()."',
|
|
|
|
Unread=true,
|
|
|
|
Status='Resolved',
|
|
|
|
ResolverID=".$LoggedUser['ID']."
|
|
|
|
WHERE ID=$ConvID");
|
2012-01-26 08:00:25 +00:00
|
|
|
header('Location: staffpm.php');
|
2012-09-09 08:00:26 +00:00
|
|
|
?>
|