Empty commit

This commit is contained in:
Git 2013-06-05 08:01:01 +00:00
parent 5252527b74
commit 8016cb4277
7 changed files with 89 additions and 37 deletions

View File

@ -82,6 +82,13 @@
); );
$Torrent = $TorrentList[$TorrentID]; $Torrent = $TorrentList[$TorrentID];
$Reports = get_reports($TorrentID);
if (count($Reports) > 0) {
$Torrent['Reported'] = true;
} else {
$Torrent['Reported'] = false;
}
// Convert file list back to the old format // Convert file list back to the old format
$FileList = explode("\n", $Torrent['FileList']); $FileList = explode("\n", $Torrent['FileList']);
foreach ($FileList as &$File) { foreach ($FileList as &$File) {
@ -92,6 +99,7 @@
$Userinfo = Users::user_info($Torrent['UserID']); $Userinfo = Users::user_info($Torrent['UserID']);
$JsonTorrentList[] = array( $JsonTorrentList[] = array(
'id' => (int) $Torrent['ID'], 'id' => (int) $Torrent['ID'],
'infoHash' => $Torrent['InfoHash'],
'media' => $Torrent['Media'], 'media' => $Torrent['Media'],
'format' => $Torrent['Format'], 'format' => $Torrent['Format'],
'encoding' => $Torrent['Encoding'], 'encoding' => $Torrent['Encoding'],
@ -110,6 +118,7 @@
'leechers' => (int) $Torrent['Leechers'], 'leechers' => (int) $Torrent['Leechers'],
'snatched' => (int) $Torrent['Snatched'], 'snatched' => (int) $Torrent['Snatched'],
'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'freeTorrent' => $Torrent['FreeTorrent'] == 1,
'reported' => $Torrent['Reported'],
'time' => $Torrent['Time'], 'time' => $Torrent['Time'],
'description' => $Torrent['Description'], 'description' => $Torrent['Description'],
'fileList' => $FileList, 'fileList' => $FileList,

View File

@ -86,6 +86,12 @@
unset($File); unset($File);
$FileList = implode('|||', $FileList); $FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']); $Userinfo = Users::user_info($Torrent['UserID']);
$Reports = get_reports($Torrent['ID']);
if (count($Reports) > 0) {
$Torrent['Reported'] = true;
} else {
$Torrent['Reported'] = false;
}
$JsonTorrentList[] = array( $JsonTorrentList[] = array(
'id' => (int) $Torrent['ID'], 'id' => (int) $Torrent['ID'],
'media' => $Torrent['Media'], 'media' => $Torrent['Media'],
@ -106,6 +112,7 @@
'leechers' => (int) $Torrent['Leechers'], 'leechers' => (int) $Torrent['Leechers'],
'snatched' => (int) $Torrent['Snatched'], 'snatched' => (int) $Torrent['Snatched'],
'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'freeTorrent' => $Torrent['FreeTorrent'] == 1,
'reported' => $Torrent['Reported'],
'time' => $Torrent['Time'], 'time' => $Torrent['Time'],
'description' => $Torrent['Description'], 'description' => $Torrent['Description'],
'fileList' => $FileList, 'fileList' => $FileList,

View File

@ -4,7 +4,7 @@
$ToID = $_GET['to']; $ToID = $_GET['to'];
if ($ToID == $LoggedUser['ID']) { if ($ToID == $LoggedUser['ID']) {
error('You cannot start a conversation with yourself!'); error('You cannot start a conversation with yourself!');
header('Location: inbox.php'); header('Location: ' . Inbox::get_inbox_link($LoggedUser['ListUnreadPMsFirst']));
} }
} }
@ -16,7 +16,10 @@
error(403); error(403);
} }
$DB->query("SELECT Username FROM users_main WHERE ID='$ToID'"); $DB->query("
SELECT Username
FROM users_main
WHERE ID='$ToID'");
list($Username) = $DB->next_record(); list($Username) = $DB->next_record();
if (!$Username) { if (!$Username) {
error(404); error(404);
@ -46,7 +49,6 @@
</div> </div>
</form> </form>
</div> </div>
<? <?
View::show_footer(); View::show_footer();
?> ?>

View File

@ -34,9 +34,12 @@
(UserID, ConvID, InInbox, InSentbox, ReceivedDate) (UserID, ConvID, InInbox, InSentbox, ReceivedDate)
VALUES ('$ReceiverID', '$ConvID', '1', '0', NOW()) VALUES ('$ReceiverID', '$ConvID', '1', '0', NOW())
ON DUPLICATE KEY UPDATE ForwardedTo = 0, UnRead = 1"); ON DUPLICATE KEY UPDATE ForwardedTo = 0, UnRead = 1");
$DB->query("UPDATE pm_conversations_users SET ForwardedTo='$ReceiverID' WHERE ConvID='$ConvID' AND UserID='$UserID'"); $DB->query("
UPDATE pm_conversations_users
SET ForwardedTo='$ReceiverID'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
$Cache->delete_value('inbox_new_'.$ReceiverID); $Cache->delete_value('inbox_new_'.$ReceiverID);
header('Location: inbox.php'); header('Location: ' . Inbox::get_inbox_link($LoggedUser['ListUnreadPMsFirst']));
} else { } else {
error("$StaffIDs[$ReceiverID] already has this conversation in their inbox."); error("$StaffIDs[$ReceiverID] already has this conversation in their inbox.");
header('Location: inbox.php?action=viewconv&id='.$ConvID); header('Location: inbox.php?action=viewconv&id='.$ConvID);

View File

@ -7,7 +7,7 @@
if (!isset($_POST['messages']) || !is_array($_POST['messages'])) { if (!isset($_POST['messages']) || !is_array($_POST['messages'])) {
error('You forgot to select messages to delete.'); error('You forgot to select messages to delete.');
header('Location: inbox.php'); header('Location: ' . Inbox::get_inbox_link($LoggedUser['ListUnreadPMsFirst']));
die(); die();
} }
@ -40,13 +40,17 @@
WHERE ConvID IN($ConvIDs) WHERE ConvID IN($ConvIDs)
AND UserID=$UserID"); AND UserID=$UserID");
} elseif (isset($_POST['unread'])) { } elseif (isset($_POST['unread'])) {
$DB->query("UPDATE pm_conversations_users SET Unread='1' $DB->query("
UPDATE pm_conversations_users
SET Unread='1'
WHERE ConvID IN($ConvIDs) AND UserID=$UserID"); WHERE ConvID IN($ConvIDs) AND UserID=$UserID");
} elseif (isset($_POST['read'])) { } elseif (isset($_POST['read'])) {
$DB->query("UPDATE pm_conversations_users SET Unread='0' $DB->query("
UPDATE pm_conversations_users
SET Unread='0'
WHERE ConvID IN($ConvIDs) AND UserID=$UserID"); WHERE ConvID IN($ConvIDs) AND UserID=$UserID");
} }
$Cache->delete_value('inbox_new_'.$UserID); $Cache->delete_value('inbox_new_'.$UserID);
header('Location: inbox.php'); header('Location: ' . Inbox::get_inbox_link($LoggedUser['ListUnreadPMsFirst']));
?> ?>

View File

@ -41,7 +41,7 @@
} }
$Body = trim($_POST['body']); $Body = trim($_POST['body']);
if ($Body === '' || $Body === false) { if ($Body === '' || $Body === false) {
$Err = "You can't send a message without a body!"; $Err = "You can't send a message without a body.";
} }
if (!empty($Err)) { if (!empty($Err)) {
@ -55,5 +55,5 @@
$ConvID = Misc::send_pm($ToID, $LoggedUser['ID'], $Subject, $Body, $ConvID); $ConvID = Misc::send_pm($ToID, $LoggedUser['ID'], $Subject, $Body, $ConvID);
header('Location: inbox.php'); header('Location: ' . Inbox::get_inbox_link($LoggedUser['ListUnreadPMsFirst']));
?> ?>

View File

@ -159,9 +159,13 @@
// If we're deleting the user, we can ignore all the other crap // If we're deleting the user, we can ignore all the other crap
if ($_POST['UserStatus'] == 'delete' && check_perms('users_delete_users')) { if ($_POST['UserStatus'] == 'delete' && check_perms('users_delete_users')) {
Misc::write_log("User account ".$UserID." (".$Cur['Username'].") was deleted by ".$LoggedUser['Username']); Misc::write_log("User account $UserID (".$Cur['Username'].") was deleted by ".$LoggedUser['Username']);
$DB->query("DELETE FROM users_main WHERE id=".$UserID); $DB->query("
$DB->query("DELETE FROM users_info WHERE UserID=".$UserID); DELETE FROM users_main
WHERE id = $UserID");
$DB->query("
DELETE FROM users_info
WHERE UserID = $UserID");
$Cache->delete_value('user_info_'.$UserID); $Cache->delete_value('user_info_'.$UserID);
Tracker::update_tracker('remove_user', array('passkey' => $Cur['torrent_pass'])); Tracker::update_tracker('remove_user', array('passkey' => $Cur['torrent_pass']));
@ -176,9 +180,10 @@
$EditSummary = array(); $EditSummary = array();
if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) { if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
$DB->query("UPDATE users_info $DB->query("
SET RatioWatchEnds='0000-00-00 00:00:00', RatioWatchDownload='0', RatioWatchTimes='0' UPDATE users_info
WHERE UserID='$UserID'"); SET RatioWatchEnds='0000-00-00 00:00:00', RatioWatchDownload='0', RatioWatchTimes='0'
WHERE UserID='$UserID'");
$EditSummary[] = 'RatioWatch history reset'; $EditSummary[] = 'RatioWatch history reset';
} }
@ -196,13 +201,18 @@
if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) { if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) {
$DB->query("DELETE FROM users_history_emails WHERE UserID='$UserID'"); $DB->query("DELETE FROM users_history_emails WHERE UserID='$UserID'");
if ($_POST['ResetIPHistory']) { if ($_POST['ResetIPHistory']) {
$DB->query("INSERT INTO users_history_emails (UserID, Email, Time, IP) $DB->query("
VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','127.0.0.1')"); INSERT INTO users_history_emails (UserID, Email, Time, IP)
VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','127.0.0.1')");
} else { } else {
$DB->query("INSERT INTO users_history_emails (UserID, Email, Time, IP) $DB->query("
VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','".$Cur['IP']."')"); INSERT INTO users_history_emails (UserID, Email, Time, IP)
VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','".$Cur['IP']."')");
} }
$DB->query("UPDATE users_main SET Email='$Username@".SITE_URL."' WHERE ID='$UserID'"); $DB->query("
UPDATE users_main
SET Email='$Username@".SITE_URL."'
WHERE ID='$UserID'");
$EditSummary[] = 'Email history cleared'; $EditSummary[] = 'Email history cleared';
} }
@ -236,14 +246,15 @@
} }
if ($Logs095 !== 0) { if ($Logs095 !== 0) {
$TargetScore = $Logs095 === 100 ? 99 : 100; $TargetScore = (($Logs095 === 100) ? 99 : 100);
$Logs = $DB->query("SELECT DISTINCT TorrentID $Logs = $DB->query("
FROM torrents_logs_new SELECT DISTINCT TorrentID
JOIN torrents ON ID = TorrentID FROM torrents_logs_new
WHERE Log LIKE 'EAC extraction logfile%' JOIN torrents ON ID = TorrentID
AND UserID = $UserID WHERE Log LIKE 'EAC extraction logfile%'
AND Score = $TargetScore AND UserID = $UserID
AND (Adjusted = '0' OR Adjusted = '')"); AND Score = $TargetScore
AND (Adjusted = '0' OR Adjusted = '')");
while (list($TorrentID) = $DB->next_record()) { while (list($TorrentID) = $DB->next_record()) {
$Results = array(); $Results = array();
if ($Logs095 === 100) { if ($Logs095 === 100) {
@ -253,8 +264,14 @@
$Details = db_string(serialize($Results)); $Details = db_string(serialize($Results));
} }
$DB->query("UPDATE torrents SET LogScore = $Logs095 WHERE ID = $TorrentID"); $DB->query("
$DB->query("UPDATE torrents_logs_new SET Score = $Logs095, Details = '$Details' WHERE TorrentID = $TorrentID"); UPDATE torrents
SET LogScore = $Logs095
WHERE ID = $TorrentID");
$DB->query("
UPDATE torrents_logs_new
SET Score = $Logs095, Details = '$Details'
WHERE TorrentID = $TorrentID");
$DB->set_query_id($Logs); $DB->set_query_id($Logs);
} }
$EditSummary[] = 'EAC v0.95 logs rescored to '.$Logs095; $EditSummary[] = 'EAC v0.95 logs rescored to '.$Logs095;
@ -281,14 +298,21 @@
} }
if ($Username != $Cur['Username'] && check_perms('users_edit_usernames', $Cur['Class'] - 1)) { if ($Username != $Cur['Username'] && check_perms('users_edit_usernames', $Cur['Class'] - 1)) {
$DB->query("SELECT ID FROM users_main WHERE Username = '".$Username."'"); $DB->query("
SELECT ID
FROM users_main
WHERE Username = '$Username'");
if ($DB->next_record() > 0) { if ($DB->next_record() > 0) {
list($UsedUsernameID) = $DB->next_record(); list($UsedUsernameID) = $DB->next_record();
error('Username already in use by <a href="user.php?id='.$UsedUsernameID."\">$Username</a>"); error('Username already in use by <a href="user.php?id='.$UsedUsernameID."\">$Username</a>");
header('Location: user.php?id='.$UserID); header('Location: user.php?id='.$UserID);
die(); die();
} elseif ($Username == '0' || $Username == '1') {
error('You cannot set a username of "0" or "1".');
header('Location: user.php?id='.$UserID);
die();
} else { } else {
$UpdateSet[] = "Username='".$Username."'"; $UpdateSet[] = "Username='$Username'";
$EditSummary[] = "username changed from ".$Cur['Username']." to ".$Username; $EditSummary[] = "username changed from ".$Cur['Username']." to ".$Username;
$LightUpdates['Username'] = $Username; $LightUpdates['Username'] = $Username;
} }
@ -297,7 +321,7 @@
if ($Title != db_string($Cur['Title']) && check_perms('users_edit_titles')) { if ($Title != db_string($Cur['Title']) && check_perms('users_edit_titles')) {
// Using the unescaped value for the test to avoid confusion // Using the unescaped value for the test to avoid confusion
if (strlen($_POST['Title']) > 1024) { if (strlen($_POST['Title']) > 1024) {
error("Custom titles can be at most 1024 characters."); error("Custom titles have a maximum length of 1,024 characters.");
header("Location: user.php?id=".$UserID); header("Location: user.php?id=".$UserID);
die(); die();
} else { } else {
@ -323,7 +347,10 @@
$ClassChanges[] = $Classes[$PermID]['Name']; $ClassChanges[] = $Classes[$PermID]['Name'];
} }
$EditSummary[] = 'Secondary classes dropped: '.implode(', ',$ClassChanges); $EditSummary[] = 'Secondary classes dropped: '.implode(', ',$ClassChanges);
$DB->query("DELETE FROM users_levels WHERE UserID = '$UserID' AND PermissionID IN (".implode(',',$DroppedClasses).")"); $DB->query("
DELETE FROM users_levels
WHERE UserID = '$UserID'
AND PermissionID IN (".implode(',', $DroppedClasses).')');
if (count($SecondaryClasses) > 0) { if (count($SecondaryClasses) > 0) {
$LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1); $LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1);
} else { } else {
@ -349,7 +376,7 @@
if ($Visible != $Cur['Visible'] && check_perms('users_make_invisible')) { if ($Visible != $Cur['Visible'] && check_perms('users_make_invisible')) {
$UpdateSet[] = "Visible='$Visible'"; $UpdateSet[] = "Visible='$Visible'";
$EditSummary[] = "visibility changed"; $EditSummary[] = 'visibility changed';
$LightUpdates['Visible'] = $Visible; $LightUpdates['Visible'] = $Visible;
} }