Empty commit

This commit is contained in:
Git 2012-01-26 08:00:25 +00:00
parent 0c52e30873
commit 5f916db48e
9 changed files with 201 additions and 145 deletions

View File

@ -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) {

View File

@ -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);
}

View File

@ -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']) {

View File

@ -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)";
}

View File

@ -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;
}
?>

View File

@ -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');
?>

View File

@ -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
");

View File

@ -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');
}
?>

View File

@ -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 @@
<input type="submit" value="Send message" />
<? } else { ?>
<input type="button" value="Unresolve" onClick="location.href='staffpm.php?action=unresolve&id=<?=$ConvID?>';" />
<? }
if (check_perms('users_give_donor')) { ?>
<br />
<input type="button" value="Make Donor" onClick="location.href='staffpm.php?action=make_donor&id=<?=$ConvID?>';" />
<? } ?>
</form>
</div>