Empty commit

This commit is contained in:
Git 2012-01-24 08:00:19 +00:00
parent 87b0cf6d9f
commit d07f2a1a67
16 changed files with 113 additions and 16 deletions

View File

@ -1067,6 +1067,12 @@ function make_class_string($ClassID) {
return $Classes[$ClassID]['Name'];
}
//Write to the group log
function write_group_log($GroupID, $TorrentID, $UserID, $Message, $Hidden) {
global $DB,$Time;
$DB->query("INSERT INTO group_log (GroupID, TorrentID, UserID, Info, Time, Hidden) VALUES (".$GroupID.", ".$TorrentID.", ".$UserID.", '".db_string($Message)."', '".sqltime()."', ".$Hidden.")");
}
// Write a message to the system log
function write_log($Message) {
global $DB,$Time;
@ -1161,6 +1167,7 @@ function delete_group($GroupID) {
global $DB, $Cache;
write_log("Group ".$GroupID." automatically deleted (No torrents have this group).");
//$DB->query("DELETE FROM group_log WHERE GroupID = ".$GroupID);
//Never call this unless you're certain the group is no longer used by any torrents
$DB->query("SELECT CategoryID FROM torrents_group WHERE ID='$GroupID'");
@ -2167,6 +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);
}
foreach($GroupIDs as $GroupID) {

View File

@ -323,6 +323,20 @@ CREATE TABLE `geoip_country` (
PRIMARY KEY (`StartIP`,`EndIP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `group_log` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`GroupID` int(10) NOT NULL,
`TorrentID` int(10) NOT NULL,
`UserID` int(10) NOT NULL DEFAULT '0',
`Info` mediumtext,
`Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Hidden` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
KEY `GroupID` (`GroupID`),
KEY `TorrentID` (`TorrentID`),
KEY `UserID` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `invite_tree` (
`UserID` int(10) NOT NULL DEFAULT '0',
`InviterID` int(10) NOT NULL DEFAULT '0',

View File

@ -178,8 +178,11 @@
if(isset($Escaped['log_message']) && $Escaped['log_message'] != "") {
$Log .= " ( ".$Escaped['log_message']." )";
}
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$TorrentID);
list($GroupID) = $DB->next_record();
delete_torrent($TorrentID);
write_log($Log);
write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "deleted torrent", 0);
} else {
$Log = "No log message (Torrent wasn't deleted)";
}

View File

@ -23,9 +23,6 @@
case 'created':
$Title = 'My requests';
$SS->set_filter('userid', array($LoggedUser['ID']));
if(empty($_GET['show_filled'])) {
$SS->set_filter('torrentid', array(0));
}
break;
case 'voted':
if(!empty($_GET['userid'])) {
@ -40,9 +37,6 @@
$Title = "Requests I've voted on";
$SS->set_filter('voter', array($LoggedUser['ID']));
}
if(empty($_GET['show_filled']) && $Submitted) {
$SS->set_filter('torrentid', array(0));
}
break;
case 'filled':
if(empty($_GET['userid']) || !is_number($_GET['userid'])) {

View File

@ -60,6 +60,7 @@
NumArtists=VALUES(NumArtists);");
write_log("Artist ".$ArtistID." (".$ArtistName.") was added to the group ".$GroupID." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_group_log($GroupID, 0, $LoggedUser['ID'], "added artist ".$ArtistName, 0);
} else {
list($OldAliasID) = $DB->next_record();
if($OldAliasID == 0) {

View File

@ -49,6 +49,7 @@
$Cache->delete_value('torrents_details_'.$GroupID); // Delete torrent group cache
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
write_log("Artist ".$ArtistID." (".$ArtistName.") was removed from the group ".$GroupID." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_group_log($GroupID, 0, $LoggedUser['ID'], "removed artist ".$ArtistName, 0);
update_hash($GroupID);

View File

@ -105,6 +105,7 @@ function compare($X, $Y){
if(check_perms('site_submit_requests')) { ?>
<a href="requests.php?action=new&amp;groupid=<?=$GroupID?>">[Request format]</a>
<? }?>
<a href="torrents.php?action=grouplog&amp;groupid=<?=$GroupID?>">[View log]</a>
</div>
<div class="sidebar">

View File

@ -84,6 +84,8 @@
}
write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']); // TODO: this is probably broken
write_group_log($GroupID, 0, $LoggedUser['ID'], "merged group ".$OldGroupID, 0);
$DB->query("UPDATE group_log SET GroupID = ".$GroupID." WHERE GroupID = ".$OldGroupID);
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_download_'.$TorrentID);

View File

@ -0,0 +1,53 @@
<?
$GroupID = $_GET['groupid'];
if (!is_number($GroupID)) { error(404); }
show_header("History for Group $GroupID");
?>
<div class="thin">
<h2>History for Group <?=$GroupID?></h2>
<table>
<tr class="colhead">
<td>Date</td>
<td>Torrent</td>
<td>User</td>
<td>Info</td>
</tr>
<?
$Log = $DB->query("SELECT TorrentID, UserID, Info, Time FROM group_log WHERE GroupID = ".$GroupID." ORDER BY Time DESC");
while (list($TorrentID, $UserID, $Info, $Time) = $DB->next_record())
{
?>
<tr class="rowa">
<td><?=$Time?></td>
<?
if ($TorrentID != 0) {
$DB->query("SELECT Media, Format, Encoding FROM torrents WHERE ID=".$TorrentID);
list($Media, $Format, $Encoding) = $DB->next_record();
if ($Media == "") { ?>
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)</td><?
} else { ?>
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (<?=$Format?>/<?=$Encoding?>/<?=$Media?>)</td>
<? }
} else { ?>
<td />
<? }
$DB->query("SELECT Username FROM users_main WHERE ID = ".$UserID);
list($Username) = $DB->next_record();
$DB->set_query_id($Log);
?>
<td><?=format_username($UserID, $Username)?></td>
<td><?=$Info?></td>
</tr>
<?
}
?>
</table>
</div>
<?
show_footer();
?>

View File

@ -18,11 +18,12 @@
if($Categories[$CategoryID-1] != 'Music') {
error('Only music groups can be merged.');
}
$DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID);
list($Name) = $DB->next_record();
//Everything is legit, let's just confim they're not retarded
if(empty($_POST['confirm'])) {
$DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID);
list($Name) = $DB->next_record();
$Artists = get_artists(array($GroupID, $NewGroupID));
show_header();
@ -54,6 +55,9 @@
$DB->query("UPDATE torrents_comments SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
delete_group($GroupID);
write_group_log($NewGroupID, 0, $LoggedUser['ID'], "Merged Group ".$GroupID." (".$Name.") to ".$NewGroupID." (".$NewName.")", 0);
$DB->query("UPDATE group_log SET GroupID = ".$NewGroupID." WHERE GroupID = ".$GroupID);
$GroupID=$NewGroupID;

View File

@ -27,5 +27,6 @@
update_hash($GroupID);
write_log("Torrent Group ".$GroupID." (".$OldName.") was renamed to '".$NewName."' by ".$LoggedUser['Username']);
write_group_log($GroupID, 0, $LoggedUser['ID'], "renamed to ".$NewName." from ".$OldName, 0);
header('Location: torrents.php?id='.$GroupID);

View File

@ -40,6 +40,7 @@
$InfoHash = unpack("H*", $InfoHash);
delete_torrent($TorrentID, $GroupID);
write_log('Torrent '.$TorrentID.' ('.$Name.') ('.number_format($Size/(1024*1024), 2).' MB) ('.strtoupper($InfoHash[1]).') was deleted by '.$LoggedUser['Username'].': ' .$_POST['reason'].' '.$_POST['extra']);
write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "deleted torrent (".number_format($Size/(1024*1024), 2)."' MB, ".strtoupper($InfoHash[1]).") for reason: ".$_POST['reason']." ".$_POST['extra'], 0);
show_header('Torrent deleted');
?>

View File

@ -395,6 +395,7 @@
list($Name) = $DB->next_record();
write_log("Torrent $TorrentID ($Name) in group $GroupID was edited by ".$LoggedUser['Username']." (".$LogDetails.")"); // TODO: this is probably broken
write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $LogDetails, 0);
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_download_'.$TorrentID);

View File

@ -649,6 +649,7 @@
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($TorrentID, '".db_string($Tor->dump_data())."')");
write_log("Torrent $TorrentID ($LogName) (".number_format($TotalSize/(1024*1024), 2)." MB) was uploaded by " . $LoggedUser['Username']);
write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "uploaded (".number_format($TotalSize/(1024*1024), 2)." MB)", 0);
update_hash($GroupID);

View File

@ -208,7 +208,7 @@
$Cache->delete_value('users_sessions_'.$UserID);
$DB->query("DELETE FROM users_sessions WHERE UserID="'$UserID'");
$DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'");
}
}
@ -404,7 +404,7 @@
if ($DisableLeech!=$Cur['can_leech'] && check_perms('users_disable_any')) {
$UpdateSet[]="can_leech='$DisableLeech'";
$EditSummary[]="leeching status changed";
$EditSummary[]="leeching status changed (".translateLeechStatus($Cur['can_leech'])." -> ".translateLeechStatus($DisableLeech).")";
$HeavyUpdates['DisableLeech']=$DisableLeech;
$HeavyUpdates['CanLeech']=$DisableLeech;
if (!empty($UserReason)) {
@ -675,4 +675,15 @@ function translateUserStatus($status) {
return $status;
}
}
function translateLeechStatus($status) {
switch ($status) {
case 0:
return "Disabled";
case 1:
return "Enabled";
default:
return $status;
}
}
?>

View File

@ -231,14 +231,15 @@ function check_paranoia_here($Setting) {
if (check_paranoia_here('requestsfilled_count') || check_paranoia_here('requestsfilled_bounty')) {
$DB->query("SELECT COUNT(DISTINCT r.ID), SUM(rv.Bounty) FROM requests AS r LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID WHERE r.FillerID = ".$UserID);
list($RequestsFilled, $TotalBounty) = $DB->next_record();
} else {
$RequestsFilled = $TotalBounty = 0;
}
if (check_paranoia_here('requestsvoted_count') || check_paranoia_here('requestsvoted_bounty')) {
$DB->query("SELECT COUNT(rv.RequestID), SUM(rv.Bounty) FROM requests_votes AS rv WHERE rv.UserID = ".$UserID);
list($RequestsVoted, $TotalSpent) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM torrents WHERE UserID='$UserID'");
list($Uploads) = $DB->next_record();
} else {
$RequestsVoted = 0;
$TotalSpent = 0;
$RequestsVoted = $TotalSpent = 0;
}
if(check_paranoia_here('uploads+')) {