Gazelle/sections/staffpm/makedonor.php

52 lines
1.4 KiB
PHP
Raw Normal View History

2012-01-26 08:00:25 +00:00
<?
2013-08-28 23:08:41 +00:00
authorize();
if (!check_perms('users_give_donor')) {
error(403);
}
2013-10-02 08:01:00 +00:00
if (!is_number($_POST['id']) || !is_numeric($_POST['donation_amount']) || empty($_POST['donation_currency'])) {
2013-08-28 23:08:41 +00:00
error(404);
}
2013-02-22 08:00:24 +00:00
2013-10-23 08:01:03 +00:00
$ConvID = (int)$_POST['id'];
2013-02-22 08:00:24 +00:00
2013-10-23 08:01:03 +00:00
$DB->query("
SELECT c.Subject, c.UserID, c.Level, c.AssignedToUser, c.Unread, c.Status, u.Donor
FROM staff_pm_conversations AS c
JOIN users_info AS u ON u.UserID = c.UserID
WHERE ID = $ConvID");
2013-08-28 23:08:41 +00:00
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-08-28 23:08:41 +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
2013-08-28 23:08:41 +00:00
if ((int)$Donor === 0) {
$Message .= ' Enjoy your new love from us!';
} else {
$Message .= ' ';
}
2013-10-23 08:01:03 +00:00
/*
$DB->query("
INSERT INTO staff_pm_messages
(UserID, SentDate, Message, ConvID)
VALUES
(".$LoggedUser['ID'].", '".sqltime()."', '".db_string($Message)."', $ConvID)");
*/
$DB->query("
UPDATE staff_pm_conversations
SET Date = '".sqltime()."',
Unread = true,
Status = 'Resolved',
ResolverID = ".$LoggedUser['ID']."
WHERE ID = $ConvID");
2012-01-26 08:00:25 +00:00
2013-08-28 23:08:41 +00:00
Donations::donate($UserID, array(
2013-10-23 08:01:03 +00:00
"Source" => "Staff PM",
"Price" => $_POST['donation_amount'],
"Currency" => $_POST['donation_currency'],
"Reason" => $_POST['donation_reason'],
"SendPM" => true));
2013-08-28 23:08:41 +00:00
header('Location: staffpm.php');