diff --git a/classes/script_start.php b/classes/script_start.php
index 346ebd89..f9b6c76d 100644
--- a/classes/script_start.php
+++ b/classes/script_start.php
@@ -645,7 +645,7 @@ function authorize($Ajax = false) {
// ex: 'somefile,somdire/somefile'
function show_header($PageTitle='',$JSIncludes='') {
- global $Document, $Cache, $DB, $LoggedUser, $Mobile;
+ global $Document, $Cache, $DB, $LoggedUser, $Mobile, $Classes;
if($PageTitle!='') { $PageTitle.=' :: '; }
$PageTitle .= SITE_NAME;
@@ -2174,7 +2174,7 @@ function freeleech_torrents($TorrentIDs, $FreeNeutral = 1, $FreeLeechType = 0) {
update_tracker('update_torrent', array('info_hash' => rawurlencode($InfoHash), 'freetorrent' => $FreeNeutral));
$Cache->delete_value('torrent_download_'.$TorrentID);
write_log($LoggedUser['Username']." marked torrent ".$TorrentID." freeleech type ".$FreeLeechType."!");
- write_group_log($GroupID, $TorrentID, $LoggedUser['UserID'], "marked as freeleech type ".$FreeLeechType."!", 0);
+ write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "marked as freeleech type ".$FreeLeechType."!", 0);
}
foreach($GroupIDs as $GroupID) {
diff --git a/design/privateheader.php b/design/privateheader.php
index 841e1f1e..33dac4d8 100644
--- a/design/privateheader.php
+++ b/design/privateheader.php
@@ -263,7 +263,7 @@
$NumStaffPMs = $Cache->get_value('num_staff_pms_'.$LoggedUser['ID']);
if ($NumStaffPMs === false) {
- $DB->query("SELECT COUNT(ID) FROM staff_pm_conversations WHERE Status='Unanswered' AND (AssignedToUser=".$LoggedUser['ID']." OR Level=".$LoggedUser['Class'].")");
+ $DB->query("SELECT COUNT(ID) FROM staff_pm_conversations WHERE Status='Unanswered' AND (AssignedToUser=".$LoggedUser['ID']." OR (Level >= ".$Classes[MOD]['Level']." AND Level <=".$LoggedUser['Class']."))");
list($NumStaffPMs) = $DB->next_record();
$Cache->cache_value('num_staff_pms_'.$LoggedUser['ID'], $NumStaffPMs , 1000);
}
diff --git a/sections/register/index.php b/sections/register/index.php
index 12a2946b..f5008a50 100644
--- a/sections/register/index.php
+++ b/sections/register/index.php
@@ -7,6 +7,7 @@
}
include(SERVER_ROOT.'/classes/class_validate.php');
+
$Val=NEW VALIDATE;
if(!empty($_REQUEST['confirm'])) {
@@ -187,6 +188,8 @@
send_email($_REQUEST['email'],'New account confirmation at '.SITE_NAME,$TPL->get(),'noreply');
update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));
$Sent=1;
+
+
}
} elseif($_GET['invite']) {
diff --git a/sections/reportsv2/takeresolve.php b/sections/reportsv2/takeresolve.php
index 28fc1f24..2af4de68 100644
--- a/sections/reportsv2/takeresolve.php
+++ b/sections/reportsv2/takeresolve.php
@@ -182,7 +182,8 @@
list($GroupID) = $DB->next_record();
delete_torrent($TorrentID);
write_log($Log);
- write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "deleted torrent", 0);
+ $Log = "deleted torrent for the reason: ".$ResolveType['title'].". ( ".$Escaped['log_message']." )";
+ write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $Log, 0);
} else {
$Log = "No log message (Torrent wasn't deleted)";
}
diff --git a/sections/staffpm/index.php b/sections/staffpm/index.php
index a66b981d..fdd3749d 100644
--- a/sections/staffpm/index.php
+++ b/sections/staffpm/index.php
@@ -1,66 +1,69 @@
-
-enforce_login();
-
-if(!isset($_REQUEST['action']))
- $_REQUEST['action'] = '';
-
-// Get user level
-$DB->query("
- SELECT
- i.SupportFor,
- p.DisplayStaff
- FROM users_info as i
- JOIN users_main as m ON m.ID = i.UserID
- JOIN permissions as p ON p.ID = m.PermissionID
- WHERE i.UserID = ".$LoggedUser['ID']
-);
-list($SupportFor, $DisplayStaff) = $DB->next_record();
-// Logged in user is staff
-$IsStaff = ($DisplayStaff == 1);
-// Logged in user is Staff or FLS
-$IsFLS = ($SupportFor != '' || $IsStaff);
-
-switch($_REQUEST['action']) {
- case 'viewconv':
- require('viewconv.php');
- break;
- case 'takepost':
- require('takepost.php');
- break;
- case 'resolve':
- require('resolve.php');
- break;
- case 'unresolve':
- require('unresolve.php');
- break;
- case 'multiresolve':
- require('multiresolve.php');
- break;
- case 'assign':
- require('assign.php');
- break;
- case 'responses':
- require('common_responses.php');
- break;
- case 'get_response':
- require('ajax_get_response.php');
- break;
- case 'delete_response':
- require('ajax_delete_response.php');
- break;
- case 'edit_response':
- require('ajax_edit_response.php');
- break;
- case 'preview':
- require('ajax_preview_response.php');
- break;
- default:
- if ($IsStaff || $IsFLS) {
- require('staff_inbox.php');
- } else {
- require('user_inbox.php');
- }
- break;
-}
-
-?>
+
+enforce_login();
+
+if(!isset($_REQUEST['action']))
+ $_REQUEST['action'] = '';
+
+// Get user level
+$DB->query("
+ SELECT
+ i.SupportFor,
+ p.DisplayStaff
+ FROM users_info as i
+ JOIN users_main as m ON m.ID = i.UserID
+ JOIN permissions as p ON p.ID = m.PermissionID
+ WHERE i.UserID = ".$LoggedUser['ID']
+);
+list($SupportFor, $DisplayStaff) = $DB->next_record();
+// Logged in user is staff
+$IsStaff = ($DisplayStaff == 1);
+// Logged in user is Staff or FLS
+$IsFLS = ($SupportFor != '' || $IsStaff);
+
+switch($_REQUEST['action']) {
+ case 'viewconv':
+ require('viewconv.php');
+ break;
+ case 'takepost':
+ require('takepost.php');
+ break;
+ case 'resolve':
+ require('resolve.php');
+ break;
+ case 'unresolve':
+ require('unresolve.php');
+ break;
+ case 'multiresolve':
+ require('multiresolve.php');
+ break;
+ case 'assign':
+ require('assign.php');
+ break;
+ case 'make_donor':
+ require('makedonor.php');
+ break;
+ case 'responses':
+ require('common_responses.php');
+ break;
+ case 'get_response':
+ require('ajax_get_response.php');
+ break;
+ case 'delete_response':
+ require('ajax_delete_response.php');
+ break;
+ case 'edit_response':
+ require('ajax_edit_response.php');
+ break;
+ case 'preview':
+ require('ajax_preview_response.php');
+ break;
+ default:
+ if ($IsStaff || $IsFLS) {
+ require('staff_inbox.php');
+ } else {
+ require('user_inbox.php');
+ }
+ break;
+}
+
+?>
diff --git a/sections/staffpm/makedonor.php b/sections/staffpm/makedonor.php
new file mode 100644
index 00000000..8d8b3001
--- /dev/null
+++ b/sections/staffpm/makedonor.php
@@ -0,0 +1,43 @@
+
+ if (!is_number($_GET['id'])) {
+ error(404);
+ }
+
+ if (!check_perms('users_give_donor')) {
+ error(403);
+ }
+
+ $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
+ JOIN users_info AS u ON u.UserID = c.UserID
+ WHERE ID=$ConvID");
+ list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status, $Donor) = $DB->next_record();
+ if ($DB->record_count() == 0) {
+ error(404);
+ }
+
+ $Message = "Thank for for helping to support the site. It's users like you who make all of this possible.";
+
+ if ((int)$Donor === 0) {
+ $Msg = db_string(sqltime() . ' - Donated: http://'.NONSSL_SITE_URL."/staffpm.php?action=viewconv&id=$ConvID\n\n");
+ $DB->query("UPDATE users_info
+ SET Donor='1',
+ AdminComment = CONCAT('$Msg',AdminComment)
+ WHERE UserID = $UserID");
+ $DB->query("UPDATE users_main SET Invites=Invites+2 WHERE ID = $UserID");
+
+ $Cache->delete_value('user_info_'.$UserID);
+ $Cache->delete_value('user_info_heavy_'.$UserID);
+ $Message .= " Enjoy your new love from us!";
+ } else {
+ $Message .= " ";
+ }
+ $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");
+ header('Location: staffpm.php');
+?>
\ No newline at end of file
diff --git a/sections/staffpm/staff_inbox.php b/sections/staffpm/staff_inbox.php
index 1888b843..ee37815a 100644
--- a/sections/staffpm/staff_inbox.php
+++ b/sections/staffpm/staff_inbox.php
@@ -26,7 +26,7 @@
default:
if ($IsStaff) {
$ViewString = "My unanswered";
- $WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
+ $WhereCondition = "WHERE ((Level >= ".$Classes[MOD]['Level']." AND Level <= $UserLevel) OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
} else {
// FLS
$ViewString = "Unanswered";
@@ -51,7 +51,7 @@
ResolverID
FROM staff_pm_conversations
$WhereCondition
- ORDER BY Date DESC
+ ORDER BY IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, Level DESC, Date DESC
LIMIT $Limit
");
diff --git a/sections/staffpm/takepost.php b/sections/staffpm/takepost.php
index ffd94281..91d0fbd2 100644
--- a/sections/staffpm/takepost.php
+++ b/sections/staffpm/takepost.php
@@ -1,73 +1,73 @@
-
-if ($Message = db_string($_POST['message'])) {
- if ($Subject = db_string($_POST['subject'])) {
- // New staff pm conversation
- $Level = db_string($_POST['level']);
- $DB->query("
- INSERT INTO staff_pm_conversations
- (Subject, Status, Level, UserID, Date)
- VALUES
- ('$Subject', 'Unanswered', $Level, ".$LoggedUser['ID'].", '".sqltime()."')"
- );
-
- // New message
- $ConvID = $DB->inserted_id();
- $DB->query("
- INSERT INTO staff_pm_messages
- (UserID, SentDate, Message, ConvID)
- VALUES
- (".$LoggedUser['ID'].", '".sqltime()."', '$Message', $ConvID)"
- );
-
- header('Location: staffpm.php');
-
- } elseif ($ConvID = (int)$_POST['convid']) {
- // Check if conversation belongs to user
- $DB->query("SELECT UserID, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID");
- list($UserID, $AssignedToUser) = $DB->next_record();
-
- if ($UserID == $LoggedUser['ID'] || $IsFLS || $UserID == $AssignedToUser) {
- // Response to existing conversation
- $DB->query("
- INSERT INTO staff_pm_messages
- (UserID, SentDate, Message, ConvID)
- VALUES
- (".$LoggedUser['ID'].", '".sqltime()."', '$Message', $ConvID)"
- );
-
- // Update conversation
- if ($IsFLS) {
- // FLS/Staff
- $DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Open' WHERE ID=$ConvID");
- $Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']);
- } else {
- // User
- $DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Unanswered' WHERE ID=$ConvID");
- }
-
- // Clear cache for user
- $Cache->delete_value('staff_pm_new_'.$UserID);
- $Cache->delete_value('staff_pm_new_'.$LoggedUser['ID']);
-
- header("Location: staffpm.php?action=viewconv&id=$ConvID");
- } else {
- // User is trying to respond to conversation that does no belong to them
- error(403);
- }
-
- } else {
- // Message but no subject or conversation id
- header("Location: staffpm.php?action=viewconv&id=$ConvID");
-
- }
-} elseif ($ConvID = (int)$_POST['convid']) {
- // No message, but conversation id
- header("Location: staffpm.php?action=viewconv&id=$ConvID");
-
-} else {
- // No message or conversation id
- header('Location: staffpm.php');
-}
-
-
-?>
+
+if ($Message = db_string($_POST['message'])) {
+ if ($Subject = db_string($_POST['subject'])) {
+ // New staff pm conversation
+ $Level = db_string($_POST['level']);
+ $DB->query("
+ INSERT INTO staff_pm_conversations
+ (Subject, Status, Level, UserID, Date)
+ VALUES
+ ('$Subject', 'Unanswered', $Level, ".$LoggedUser['ID'].", '".sqltime()."')"
+ );
+
+ // New message
+ $ConvID = $DB->inserted_id();
+ $DB->query("
+ INSERT INTO staff_pm_messages
+ (UserID, SentDate, Message, ConvID)
+ VALUES
+ (".$LoggedUser['ID'].", '".sqltime()."', '$Message', $ConvID)"
+ );
+
+ header('Location: staffpm.php');
+
+ } elseif ($ConvID = (int)$_POST['convid']) {
+ // Check if conversation belongs to user
+ $DB->query("SELECT UserID, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID");
+ list($UserID, $AssignedToUser) = $DB->next_record();
+
+ if ($UserID == $LoggedUser['ID'] || $IsFLS || $UserID == $AssignedToUser) {
+ // Response to existing conversation
+ $DB->query("
+ INSERT INTO staff_pm_messages
+ (UserID, SentDate, Message, ConvID)
+ VALUES
+ (".$LoggedUser['ID'].", '".sqltime()."', '$Message', $ConvID)"
+ );
+
+ // Update conversation
+ if ($IsFLS) {
+ // FLS/Staff
+ $DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Open' WHERE ID=$ConvID");
+ $Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']);
+ } else {
+ // User
+ $DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Unanswered' WHERE ID=$ConvID");
+ }
+
+ // Clear cache for user
+ $Cache->delete_value('staff_pm_new_'.$UserID);
+ $Cache->delete_value('staff_pm_new_'.$LoggedUser['ID']);
+
+ header("Location: staffpm.php?action=viewconv&id=$ConvID");
+ } else {
+ // User is trying to respond to conversation that does no belong to them
+ error(403);
+ }
+
+ } else {
+ // Message but no subject or conversation id
+ header("Location: staffpm.php?action=viewconv&id=$ConvID");
+
+ }
+} elseif ($ConvID = (int)$_POST['convid']) {
+ // No message, but conversation id
+ header("Location: staffpm.php?action=viewconv&id=$ConvID");
+
+} else {
+ // No message or conversation id
+ header('Location: staffpm.php');
+}
+
+
+?>
diff --git a/sections/staffpm/viewconv.php b/sections/staffpm/viewconv.php
index e2aec5ef..614913e8 100644
--- a/sections/staffpm/viewconv.php
+++ b/sections/staffpm/viewconv.php
@@ -6,6 +6,8 @@
// Get conversation info
$DB->query("SELECT Subject, UserID, Level, AssignedToUser, Unread, Status FROM staff_pm_conversations WHERE ID=$ConvID");
list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status) = $DB->next_record();
+ $DB->query("SELECT Subject, UserID, Level, AssignedToUser, Unread, Status FROM staff_pm_conversations WHERE ID=$ConvID");
+ list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status) = $DB->next_record();
if (!(($UserID == $LoggedUser['ID']) || ($AssignedToUser == $LoggedUser['ID']) || (($Level > 0 && $Level <= $LoggedUser['Class']) || ($Level == 0 && $IsFLS)))) {
// User is trying to view someone else's conversation
@@ -206,6 +208,10 @@
} else { ?>
+ }
+ if (check_perms('users_give_donor')) { ?>
+
+
} ?>