mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-12 18:36:29 +00:00
Empty commit
This commit is contained in:
parent
b1db2e6185
commit
c05d706ce2
@ -174,6 +174,9 @@
|
||||
case 'Tracker':
|
||||
$FileName = 'tracker.class';
|
||||
break;
|
||||
case 'UserRank':
|
||||
$FileName = 'user_rank.class';
|
||||
break;
|
||||
case 'Users':
|
||||
$FileName = 'users.class';
|
||||
break;
|
||||
|
@ -10,7 +10,7 @@ class Tracker {
|
||||
* @param array $Updates An associative array of key->value pairs to send to the tracker
|
||||
* @param boolean $ToIRC Sends a message to the channel #tracker with the GET URL.
|
||||
*/
|
||||
function update_tracker($Action, $Updates, $ToIRC = false) {
|
||||
public static function update_tracker($Action, $Updates, $ToIRC = false) {
|
||||
global $Cache;
|
||||
//Build request
|
||||
$Get = '/update?action='.$Action;
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
define('PREFIX', 'percentiles_'); // Prefix for memcache keys, to make life easier
|
||||
|
||||
class USER_RANK {
|
||||
class UserRank {
|
||||
|
||||
// Returns a 101 row array (101 percentiles - 0 - 100), with the minimum value for that percentile as the value for each row
|
||||
// BTW - ingenious
|
||||
function build_table($MemKey, $Query) {
|
||||
private static function build_table($MemKey, $Query) {
|
||||
global $Cache, $DB;
|
||||
|
||||
$DB->query("
|
||||
@ -40,7 +40,7 @@ function build_table($MemKey, $Query) {
|
||||
return $Table;
|
||||
}
|
||||
|
||||
function table_query($TableName) {
|
||||
private static function table_query($TableName) {
|
||||
switch ($TableName) {
|
||||
case 'uploaded':
|
||||
$Query = "
|
||||
@ -109,7 +109,7 @@ function table_query($TableName) {
|
||||
return $Query;
|
||||
}
|
||||
|
||||
function get_rank($TableName, $Value) {
|
||||
public static function get_rank($TableName, $Value) {
|
||||
if ($Value == 0) {
|
||||
return 0;
|
||||
}
|
||||
@ -123,7 +123,7 @@ function get_rank($TableName, $Value) {
|
||||
return false;
|
||||
} else {
|
||||
$Cache->cache_value(PREFIX.$TableName."_lock", '1', 300);
|
||||
$Table = $this->build_table(PREFIX.$TableName, $this->table_query($TableName));
|
||||
$Table = self::build_table(PREFIX.$TableName, self::table_query($TableName));
|
||||
$Cache->delete_value(PREFIX.$TableName."_lock");
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ function get_rank($TableName, $Value) {
|
||||
return 100; // 100th percentile
|
||||
}
|
||||
|
||||
function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bounty, $Artists, $Ratio) {
|
||||
public static function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bounty, $Artists, $Ratio) {
|
||||
// We can do this all in 1 line, but it's easier to read this way
|
||||
if ($Ratio > 1) {
|
||||
$Ratio = 1;
|
||||
|
@ -130,37 +130,34 @@ function check_paranoia_here($Setting) {
|
||||
}
|
||||
|
||||
// Do the ranks.
|
||||
include(SERVER_ROOT.'/classes/user_rank.class.php');
|
||||
$Rank = new USER_RANK;
|
||||
|
||||
if (check_paranoia_here('uploaded')) {
|
||||
$UploadedRank = $Rank->get_rank('uploaded', $Uploaded);
|
||||
$UploadedRank = UserRank::get_rank('uploaded', $Uploaded);
|
||||
} else {
|
||||
$UploadedRank = null;
|
||||
}
|
||||
if (check_paranoia_here('downloaded')) {
|
||||
$DownloadedRank = $Rank->get_rank('downloaded', $Downloaded);
|
||||
$DownloadedRank = UserRank::get_rank('downloaded', $Downloaded);
|
||||
} else {
|
||||
$DownloadedRank = null;
|
||||
}
|
||||
if (check_paranoia_here('uploads+')) {
|
||||
$UploadsRank = $Rank->get_rank('uploads', $Uploads);
|
||||
$UploadsRank = UserRank::get_rank('uploads', $Uploads);
|
||||
} else {
|
||||
$UploadsRank = null;
|
||||
}
|
||||
if (check_paranoia_here('requestsfilled_count')) {
|
||||
$RequestRank = $Rank->get_rank('requests', $RequestsFilled);
|
||||
$RequestRank = UserRank::get_rank('requests', $RequestsFilled);
|
||||
} else {
|
||||
$RequestRank = null;
|
||||
}
|
||||
$PostRank = $Rank->get_rank('posts', $ForumPosts);
|
||||
$PostRank = UserRank::get_rank('posts', $ForumPosts);
|
||||
if (check_paranoia_here('requestsvoted_bounty')) {
|
||||
$BountyRank = $Rank->get_rank('bounty', $TotalSpent);
|
||||
$BountyRank = UserRank::get_rank('bounty', $TotalSpent);
|
||||
} else {
|
||||
$BountyRank = null;
|
||||
}
|
||||
if (check_paranoia_here('artistsadded')) {
|
||||
$ArtistsRank = $Rank->get_rank('artists', $ArtistsAdded);
|
||||
$ArtistsRank = UserRank::get_rank('artists', $ArtistsAdded);
|
||||
} else {
|
||||
$ArtistsRank = null;
|
||||
}
|
||||
@ -173,7 +170,7 @@ function check_paranoia_here($Setting) {
|
||||
$Ratio = round($Uploaded / $Downloaded, 2);
|
||||
}
|
||||
if (check_paranoia_here(array('uploaded', 'downloaded', 'uploads+', 'requestsfilled_count', 'requestsvoted_bounty', 'artistsadded'))) {
|
||||
$OverallRank = floor($Rank->overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio));
|
||||
$OverallRank = floor(UserRank::overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio));
|
||||
} else {
|
||||
$OverallRank = null;
|
||||
}
|
||||
|
@ -10,24 +10,44 @@
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT Name FROM tags WHERE ID='$TagID'");
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM tags
|
||||
WHERE ID = '$TagID'");
|
||||
if (list($TagName) = $DB->next_record()) {
|
||||
$DB->query("INSERT INTO group_log (GroupID, UserID, Time, Info)
|
||||
VALUES ('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Tag "'.$TagName.'" removed from group')."')");
|
||||
$DB->query("
|
||||
INSERT INTO group_log
|
||||
(GroupID, UserID, Time, Info)
|
||||
VALUES
|
||||
('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Tag "'.$TagName.'" removed from group')."')");
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM torrents_tags_votes WHERE GroupID='$GroupID' AND TagID='$TagID'");
|
||||
$DB->query("DELETE FROM torrents_tags WHERE GroupID='$GroupID' AND TagID='$TagID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_tags_votes
|
||||
WHERE GroupID = '$GroupID'
|
||||
AND TagID = '$TagID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_tags
|
||||
WHERE GroupID = '$GroupID'
|
||||
AND TagID = '$TagID'");
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
$DB->query("SELECT COUNT(GroupID) FROM torrents_tags WHERE TagID=".$TagID);
|
||||
$DB->query("
|
||||
SELECT COUNT(GroupID)
|
||||
FROM torrents_tags
|
||||
WHERE TagID = $TagID");
|
||||
list($Count) = $DB->next_record();
|
||||
if ($Count < 1) {
|
||||
$DB->query("SELECT Name FROM tags WHERE ID=".$TagID);
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM tags
|
||||
WHERE ID = $TagID");
|
||||
list($TagName) = $DB->next_record();
|
||||
|
||||
$DB->query("DELETE FROM tags WHERE ID=".$TagID);
|
||||
$DB->query("
|
||||
DELETE FROM tags
|
||||
WHERE ID = $TagID");
|
||||
}
|
||||
// Cache the deleted tag for 5 minutes
|
||||
$Cache->cache_value('deleted_tags_'.$GroupID.'_'.$LoggedUser['ID'], $TagName, 300);
|
||||
|
@ -19,28 +19,30 @@
|
||||
}
|
||||
|
||||
// Get the artist name and the body of the last revision
|
||||
$DB->query("SELECT
|
||||
tg.Name,
|
||||
wt.Image,
|
||||
wt.Body,
|
||||
tg.WikiImage,
|
||||
tg.WikiBody,
|
||||
tg.Year,
|
||||
tg.RecordLabel,
|
||||
tg.CatalogueNumber,
|
||||
tg.ReleaseType,
|
||||
tg.CategoryID,
|
||||
tg.VanityHouse
|
||||
$DB->query("
|
||||
SELECT
|
||||
tg.Name,
|
||||
wt.Image,
|
||||
wt.Body,
|
||||
tg.WikiImage,
|
||||
tg.WikiBody,
|
||||
tg.Year,
|
||||
tg.RecordLabel,
|
||||
tg.CatalogueNumber,
|
||||
tg.ReleaseType,
|
||||
tg.CategoryID,
|
||||
tg.VanityHouse
|
||||
FROM torrents_group AS tg
|
||||
LEFT JOIN wiki_torrents AS wt ON wt.RevisionID=tg.RevisionID
|
||||
WHERE tg.ID='$GroupID'");
|
||||
LEFT JOIN wiki_torrents AS wt ON wt.RevisionID = tg.RevisionID
|
||||
WHERE tg.ID = '$GroupID'");
|
||||
if ($DB->record_count() == 0) {
|
||||
error(404);
|
||||
}
|
||||
list($Name, $Image, $Body, $WikiImage, $WikiBody, $Year, $RecordLabel, $CatalogueNumber, $ReleaseType, $CategoryID, $VanityHouse) = $DB->next_record();
|
||||
|
||||
if (!$Body) {
|
||||
$Body = $WikiBody; $Image = $WikiImage;
|
||||
$Body = $WikiBody;
|
||||
$Image = $WikiImage;
|
||||
}
|
||||
|
||||
View::show_header('Edit torrent group');
|
||||
@ -69,9 +71,13 @@
|
||||
</select>
|
||||
<? if (check_perms('torrents_edit_vanityhouse')) { ?>
|
||||
<br />
|
||||
<h3>Vanity House <input type="checkbox" name="vanity_house" value="1" <?=($VanityHouse ? 'checked="checked" ' : '')?>/></h3>
|
||||
<? }
|
||||
} ?>
|
||||
<h3>
|
||||
<label>Vanity House: <input type="checkbox" name="vanity_house" value="1" <?=($VanityHouse ? 'checked="checked" ' : '')?>/></label>
|
||||
</h3>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h3>Edit summary</h3>
|
||||
<input type="text" name="summary" size="92" /><br />
|
||||
<div style="text-align: center;">
|
||||
@ -80,7 +86,11 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<? $DB->query("SELECT UserID FROM torrents WHERE GroupID = ".$GroupID);
|
||||
<?
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
FROM torrents
|
||||
WHERE GroupID = $GroupID");
|
||||
//Users can edit the group info if they've uploaded a torrent to the group or have torrents_edit
|
||||
if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit')) { ?>
|
||||
<h3>Non-wiki group editing</h3>
|
||||
@ -111,7 +121,7 @@
|
||||
<input type="text" name="catalogue_number" size="40" value="<?=$CatalogueNumber?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<? if (check_perms('torrents_freeleech')) { ?>
|
||||
<? if (check_perms('torrents_freeleech')) { ?>
|
||||
<tr>
|
||||
<td class="label">Torrent <strong>group</strong> leech status</td>
|
||||
<td>
|
||||
@ -120,14 +130,14 @@
|
||||
<input type="checkbox" id="neutralleech" name="neutralleech" /><label for="neutralleech"> Neutral Leech</label>
|
||||
because
|
||||
<select name="freeleechtype">
|
||||
<? $FL = array("N/A", "Staff Pick", "Perma-FL", "Vanity House");
|
||||
<? $FL = array('N/A', 'Staff Pick', 'Perma-FL', 'Vanity House');
|
||||
foreach ($FL as $Key => $FLType) { ?>
|
||||
<option value="<?=$Key?>"<?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$FLType?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
</table>
|
||||
<input type="submit" value="Edit" />
|
||||
</form>
|
||||
@ -147,7 +157,6 @@
|
||||
<div style="text-align: center;">
|
||||
<input type="submit" value="Rename" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -163,7 +172,6 @@
|
||||
<div style="text-align: center;">
|
||||
<input type="submit" value="Merge" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -27,7 +27,11 @@
|
||||
<td>Info</td>
|
||||
</tr>
|
||||
<?
|
||||
$Log = $DB->query("SELECT TorrentID, UserID, Info, Time FROM group_log WHERE GroupID = ".$GroupID." ORDER BY Time DESC");
|
||||
$Log = $DB->query("
|
||||
SELECT TorrentID, UserID, Info, Time
|
||||
FROM group_log
|
||||
WHERE GroupID = $GroupID
|
||||
ORDER BY Time DESC");
|
||||
$LogEntries = $DB->to_array(false, MYSQL_NUM);
|
||||
foreach ($LogEntries AS $LogEntry) {
|
||||
list($TorrentID, $UserID, $Info, $Time) = $LogEntry;
|
||||
@ -36,7 +40,10 @@
|
||||
<td><?=$Time?></td>
|
||||
<?
|
||||
if ($TorrentID != 0) {
|
||||
$DB->query("SELECT Media, Format, Encoding FROM torrents WHERE ID=".$TorrentID);
|
||||
$DB->query("
|
||||
SELECT Media, Format, Encoding
|
||||
FROM torrents
|
||||
WHERE ID = $TorrentID");
|
||||
list($Media, $Format, $Encoding) = $DB->next_record();
|
||||
if ($DB->record_count() == 0) { ?>
|
||||
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)</td><?
|
||||
|
@ -8,13 +8,13 @@
|
||||
authorize();
|
||||
|
||||
$GroupID = $_POST['groupid'];
|
||||
$Artists = explode(',',$_POST['artists']);
|
||||
$Artists = explode(',', $_POST['artists']);
|
||||
$CleanArtists = array();
|
||||
$ArtistIDs = array();
|
||||
$ArtistsString = '0';
|
||||
|
||||
foreach ($Artists as $i => $Artist) {
|
||||
list($Importance, $ArtistID) = explode(';',$Artist);
|
||||
list($Importance, $ArtistID) = explode(';', $Artist);
|
||||
if (is_number($ArtistID) && is_number($Importance)) {
|
||||
$CleanArtists[] = array($Importance, $ArtistID);
|
||||
$ArtistIDs[] = $ArtistID;
|
||||
@ -22,37 +22,51 @@
|
||||
}
|
||||
|
||||
if (count($CleanArtists) > 0) {
|
||||
$ArtistsString = implode(',', $ArtistIDs);;
|
||||
$ArtistsString = implode(',', $ArtistIDs);
|
||||
if ($_POST['manager_action'] == 'delete') {
|
||||
$DB->query("SELECT Name FROM torrents_group WHERE ID = '".$_POST['groupid']."'");
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM torrents_group
|
||||
WHERE ID = '".$_POST['groupid']."'");
|
||||
list($GroupName) = $DB->next_record();
|
||||
$DB->query("SELECT ArtistID, Name FROM artists_group WHERE ArtistID IN (".$ArtistsString.")");
|
||||
$DB->query("
|
||||
SELECT ArtistID, Name
|
||||
FROM artists_group
|
||||
WHERE ArtistID IN ($ArtistsString)");
|
||||
$ArtistNames = $DB->to_array('ArtistID', MYSQLI_ASSOC, false);
|
||||
foreach ($CleanArtists as $Artist) {
|
||||
list($Importance,$ArtistID) = $Artist;
|
||||
Misc::write_log("Artist (".$ArtistTypes[$Importance].") ".$ArtistID." (".$ArtistNames[$ArtistID]['Name'].") was removed from the group ".$_POST['groupid']." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
||||
list($Importance, $ArtistID) = $Artist;
|
||||
Misc::write_log('Artist ('.$ArtistTypes[$Importance].") $ArtistID (".$ArtistNames[$ArtistID]['Name'].") was removed from the group ".$_POST['groupid']." ($GroupName) by user ".$LoggedUser['ID'].' ('.$LoggedUser['Username'].')');
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "Removed artist ".$ArtistNames[$ArtistID]['Name']." (".$ArtistTypes[$Importance].")", 0);
|
||||
$DB->query("DELETE FROM torrents_artists WHERE GroupID = '$GroupID' AND ArtistID = '$ArtistID' AND Importance = '$Importance'");
|
||||
$Cache->delete_value('artist_groups_'.$ArtistID);
|
||||
$DB->query("
|
||||
DELETE FROM torrents_artists
|
||||
WHERE GroupID = '$GroupID'
|
||||
AND ArtistID = '$ArtistID'
|
||||
AND Importance = '$Importance'");
|
||||
$Cache->delete_value("artist_groups_$ArtistID");
|
||||
}
|
||||
$DB->query("
|
||||
SELECT ArtistID
|
||||
FROM requests_artists
|
||||
WHERE ArtistID IN (".$ArtistsString.")
|
||||
WHERE ArtistID IN ($ArtistsString)
|
||||
UNION
|
||||
SELECT ArtistID
|
||||
FROM torrents_artists
|
||||
WHERE ArtistID IN (".$ArtistsString.")");
|
||||
WHERE ArtistID IN ($ArtistsString)");
|
||||
$Items = $DB->collect('ArtistID');
|
||||
$EmptyArtists = array_diff($ArtistIDs, $Items);
|
||||
foreach ($EmptyArtists as $ArtistID) {
|
||||
Artists::delete_artist($ArtistID);
|
||||
}
|
||||
} else {
|
||||
$DB->query("UPDATE IGNORE torrents_artists SET Importance = '".$_POST['importance']."' WHERE GroupID = '$GroupID' AND ArtistID IN (".$ArtistsString.")");
|
||||
$DB->query("
|
||||
UPDATE IGNORE torrents_artists
|
||||
SET Importance = '".$_POST['importance']."'
|
||||
WHERE GroupID = '$GroupID'
|
||||
AND ArtistID IN ($ArtistsString)");
|
||||
}
|
||||
$Cache->delete_value('groups_artists_'.$GroupID);
|
||||
$Cache->delete_value("groups_artists_$GroupID");
|
||||
Torrents::update_hash($GroupID);
|
||||
header("Location: torrents.php?id=".$GroupID);
|
||||
header("Location: torrents.php?id=$GroupID");
|
||||
}
|
||||
?>
|
||||
|
@ -10,22 +10,28 @@
|
||||
}
|
||||
|
||||
if (empty($NewName)) {
|
||||
error('Albums must have a name');
|
||||
error('Torrent groups must have a name');
|
||||
}
|
||||
|
||||
if (!check_perms('torrents_edit')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID);
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM torrents_group
|
||||
WHERE ID = $GroupID");
|
||||
list($OldName) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
$DB->query("UPDATE torrents_group SET Name='".db_string($NewName)."' WHERE ID='$GroupID'");
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$DB->query("
|
||||
UPDATE torrents_group
|
||||
SET Name = '".db_string($NewName)."'
|
||||
WHERE ID = '$GroupID'");
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
Misc::write_log("Torrent Group ".$GroupID." (".$OldName.") was renamed to '".$NewName."' by ".$LoggedUser['Username']);
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "renamed to ".$NewName." from ".$OldName, 0);
|
||||
Misc::write_log("Torrent Group $GroupID ($OldName) was renamed to \"$NewName\" by ".$LoggedUser['Username']);
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "renamed to \"$NewName\" from $OldName", 0);
|
||||
|
||||
header('Location: torrents.php?id='.$GroupID);
|
||||
header("Location: torrents.php?id=$GroupID");
|
||||
|
@ -26,12 +26,19 @@
|
||||
error(0);
|
||||
}
|
||||
$SearchText = "$ArtistName $Title $Year";
|
||||
$DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name LIKE '$ArtistName'");
|
||||
$DB->query("
|
||||
SELECT ArtistID, AliasID, Redirect, Name
|
||||
FROM artists_alias
|
||||
WHERE Name LIKE '$ArtistName'");
|
||||
if ($DB->record_count() == 0) {
|
||||
$Redirect = 0;
|
||||
$DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')");
|
||||
$DB->query("
|
||||
INSERT INTO artists_group (Name)
|
||||
VALUES ('$ArtistName')");
|
||||
$ArtistID = $DB->inserted_id();
|
||||
$DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$ArtistName')");
|
||||
$DB->query("
|
||||
INSERT INTO artists_alias (ArtistID, Name)
|
||||
VALUES ('$ArtistID', '$ArtistName')");
|
||||
$AliasID = $DB->inserted_id();
|
||||
} else {
|
||||
list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record();
|
||||
@ -40,15 +47,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
$DB->query("INSERT INTO torrents_group
|
||||
(ArtistID, NumArtists, CategoryID, Name, Year, ReleaseType, Time, WikiBody, WikiImage, SearchText)
|
||||
$DB->query("
|
||||
INSERT INTO torrents_group
|
||||
(ArtistID, NumArtists, CategoryID, Name, Year, ReleaseType, Time, WikiBody, WikiImage, SearchText)
|
||||
VALUES
|
||||
($ArtistID, '1', '1', '$Title', '$Year', '$ReleaseType', '".sqltime()."', '', '', '$SearchText')");
|
||||
($ArtistID, '1', '1', '$Title', '$Year', '$ReleaseType', '".sqltime()."', '', '', '$SearchText')");
|
||||
$GroupID = $DB->inserted_id();
|
||||
|
||||
$DB->query("INSERT INTO torrents_artists
|
||||
(GroupID, ArtistID, AliasID, Importance, UserID) VALUES
|
||||
('$GroupID', '$ArtistID', '$AliasID', '1', '$LoggedUser[ID]')");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_artists
|
||||
(GroupID, ArtistID, AliasID, Importance, UserID)
|
||||
VALUES
|
||||
('$GroupID', '$ArtistID', '$AliasID', '1', '$LoggedUser[ID]')");
|
||||
break;
|
||||
case 'Audiobooks':
|
||||
case 'Comedy':
|
||||
@ -57,10 +67,11 @@
|
||||
error(0);
|
||||
}
|
||||
$SearchText = "$Title $Year";
|
||||
$DB->query("INSERT INTO torrents_group
|
||||
(CategoryID, Name, Year, Time, WikiBody, WikiImage, SearchText)
|
||||
$DB->query("
|
||||
INSERT INTO torrents_group
|
||||
(CategoryID, Name, Year, Time, WikiBody, WikiImage, SearchText)
|
||||
VALUES
|
||||
($NewCategoryID, '$Title', '$Year', '".sqltime()."', '', '', '$SearchText')");
|
||||
($NewCategoryID, '$Title', '$Year', '".sqltime()."', '', '', '$SearchText')");
|
||||
$GroupID = $DB->inserted_id();
|
||||
break;
|
||||
case 'Applications':
|
||||
@ -68,35 +79,46 @@
|
||||
case 'E-Books':
|
||||
case 'E-Learning Videos':
|
||||
$SearchText = $Title;
|
||||
$DB->query("INSERT INTO torrents_group
|
||||
(CategoryID, Name, Time, WikiBody, WikiImage, SearchText)
|
||||
$DB->query("
|
||||
INSERT INTO torrents_group
|
||||
(CategoryID, Name, Time, WikiBody, WikiImage, SearchText)
|
||||
VALUES
|
||||
($NewCategoryID, '$Title', '".sqltime()."', '', '', '$SearchText')");
|
||||
($NewCategoryID, '$Title', '".sqltime()."', '', '', '$SearchText')");
|
||||
$GroupID = $DB->inserted_id();
|
||||
break;
|
||||
}
|
||||
|
||||
$DB->query("UPDATE torrents SET
|
||||
GroupID='$GroupID'
|
||||
WHERE ID='$TorrentID'");
|
||||
$DB->query("
|
||||
UPDATE torrents
|
||||
SET GroupID = '$GroupID'
|
||||
WHERE ID = '$TorrentID'");
|
||||
|
||||
// Delete old group if needed
|
||||
$DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM torrents
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
if ($DB->record_count() == 0) {
|
||||
$DB->query("UPDATE torrents_comments SET GroupID='$GroupID' WHERE GroupID='$OldGroupID'");
|
||||
$DB->query("
|
||||
UPDATE torrents_comments
|
||||
SET GroupID = '$GroupID'
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
Torrents::delete_group($OldGroupID);
|
||||
$Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_0');
|
||||
$Cache->delete_value("torrent_comments_{$GroupID}_catalogue_0");
|
||||
} else {
|
||||
Torrents::update_hash($OldGroupID);
|
||||
}
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
$Cache->delete_value('torrent_download_'.$TorrentID);
|
||||
$Cache->delete_value("torrent_download_$TorrentID");
|
||||
|
||||
Misc::write_log("Torrent $TorrentID was edited by $LoggedUser[Username]");
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "merged from group $OldGroupID", 0);
|
||||
$DB->query("UPDATE group_log SET GroupID = $GroupID WHERE GroupID = $OldGroupID");
|
||||
$DB->query("
|
||||
UPDATE group_log
|
||||
SET GroupID = $GroupID
|
||||
WHERE GroupID = $OldGroupID");
|
||||
|
||||
header("Location: torrents.php?id=$GroupID");
|
||||
?>
|
||||
|
@ -20,13 +20,16 @@
|
||||
$GroupID = $_REQUEST['groupid'];
|
||||
|
||||
// Get information for the group log
|
||||
$DB->query("SELECT VanityHouse FROM torrents_group WHERE ID = '$GroupID'");
|
||||
$DB->query("
|
||||
SELECT VanityHouse
|
||||
FROM torrents_group
|
||||
WHERE ID = '$GroupID'");
|
||||
if (!(list($OldVH) = $DB->next_record())) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
if (!empty($_GET['action']) && $_GET['action'] == 'revert') { // if we're reverting to a previous revision
|
||||
$RevisionID=$_GET['revisionid'];
|
||||
$RevisionID = $_GET['revisionid'];
|
||||
if (!is_number($RevisionID)) {
|
||||
error(0);
|
||||
}
|
||||
@ -46,7 +49,7 @@
|
||||
<input type="hidden" name="confirm" value="true" />
|
||||
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
|
||||
<input type="hidden" name="revisionid" value="<?=$RevisionID?>" />
|
||||
<h3>You are attempting to revert to the revision <a href="torrents.php?id=<?=$GroupID?>&revisionid=<?=$RevisionID?>"><?=$RevisionID?></a>.</h3>
|
||||
<h3>You are attempting to revert to the revision <a href="torrents.php?id=<?=$GroupID?>&revisionid=<?=$RevisionID?>"><?=$RevisionID?></a>.</h3>
|
||||
<input type="submit" value="Confirm" />
|
||||
</form>
|
||||
</div>
|
||||
@ -59,8 +62,8 @@
|
||||
$Body = $_POST['body'];
|
||||
$Image = $_POST['image'];
|
||||
$ReleaseType = (int)$_POST['releasetype'];
|
||||
if ( $_POST['vanity_house'] && check_perms('torrents_edit_vanityhouse') ) {
|
||||
$VanityHouse = ( isset($_POST['vanity_house']) ? 1 : 0 );
|
||||
if (check_perms('torrents_edit_vanityhouse')) {
|
||||
$VanityHouse = (isset($_POST['vanity_house']) ? 1 : 0);
|
||||
} else {
|
||||
$VanityHouse = $OldVH;
|
||||
}
|
||||
@ -68,7 +71,10 @@
|
||||
if (($GroupInfo = $Cache->get_value('torrents_details_'.$GroupID)) && !isset($GroupInfo[0][0])) {
|
||||
$GroupCategoryID = $GroupInfo[0]['CategoryID'];
|
||||
} else {
|
||||
$DB->query("SELECT CategoryID FROM torrents_group WHERE ID='$GroupID'");
|
||||
$DB->query("
|
||||
SELECT CategoryID
|
||||
FROM torrents_group
|
||||
WHERE ID = '$GroupID'");
|
||||
list($GroupCategoryID) = $DB->next_record();
|
||||
}
|
||||
if ($GroupCategoryID == 1 && !isset($ReleaseTypes[$ReleaseType]) || $GroupCategoryID != 1 && $ReleaseType) {
|
||||
@ -85,25 +91,37 @@
|
||||
|
||||
// Insert revision
|
||||
if (empty($RevisionID)) { // edit
|
||||
$DB->query("INSERT INTO wiki_torrents (PageID, Body, Image, UserID, Summary, Time)
|
||||
VALUES ('$GroupID', '".db_string($Body)."', '".db_string($Image)."', '$UserID', '$Summary', '".sqltime()."')");
|
||||
$DB->query("
|
||||
INSERT INTO wiki_torrents
|
||||
(PageID, Body, Image, UserID, Summary, Time)
|
||||
VALUES
|
||||
('$GroupID', '".db_string($Body)."', '".db_string($Image)."', '$UserID', '$Summary', '".sqltime()."')");
|
||||
|
||||
$DB->query("UPDATE torrents_group SET ReleaseType='$ReleaseType' WHERE ID='$GroupID'");
|
||||
$DB->query("
|
||||
UPDATE torrents_group
|
||||
SET ReleaseType = '$ReleaseType'
|
||||
WHERE ID = '$GroupID'");
|
||||
Torrents::update_hash($GroupID);
|
||||
}
|
||||
else { // revert
|
||||
$DB->query("SELECT PageID,Body,Image FROM wiki_torrents WHERE RevisionID='$RevisionID'");
|
||||
$DB->query("
|
||||
SELECT PageID, Body, Image
|
||||
FROM wiki_torrents
|
||||
WHERE RevisionID = '$RevisionID'");
|
||||
list($PossibleGroupID, $Body, $Image) = $DB->next_record();
|
||||
if ($PossibleGroupID != $GroupID) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("INSERT INTO wiki_torrents (PageID, Body, Image, UserID, Summary, Time)
|
||||
$DB->query("
|
||||
INSERT INTO wiki_torrents
|
||||
(PageID, Body, Image, UserID, Summary, Time)
|
||||
SELECT '$GroupID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
|
||||
FROM wiki_artists WHERE RevisionID='$RevisionID'");
|
||||
FROM wiki_artists
|
||||
WHERE RevisionID = '$RevisionID'");
|
||||
}
|
||||
|
||||
$RevisionID=$DB->inserted_id();
|
||||
$RevisionID = $DB->inserted_id();
|
||||
|
||||
$Body = db_string($Body);
|
||||
$Image = db_string($Image);
|
||||
@ -112,22 +130,27 @@
|
||||
$DB->query("
|
||||
UPDATE torrents_group
|
||||
SET
|
||||
RevisionID='$RevisionID',
|
||||
".((isset($VanityHouse)) ? "VanityHouse='$VanityHouse'," : '')."
|
||||
WikiBody='$Body',
|
||||
WikiImage='$Image'
|
||||
RevisionID = '$RevisionID',
|
||||
".((isset($VanityHouse)) ? "VanityHouse = '$VanityHouse'," : '')."
|
||||
WikiBody = '$Body',
|
||||
WikiImage = '$Image'
|
||||
WHERE ID='$GroupID'");
|
||||
// Log VH changes
|
||||
if ($OldVH != $VanityHouse && check_perms('torrents_edit_vanityhouse')) {
|
||||
$DB->query("
|
||||
INSERT INTO group_log (GroupID, UserID, Time, Info)
|
||||
VALUES ('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Vanity house status changed to '.($VanityHouse ? 'true' : 'false'))."')");
|
||||
INSERT INTO group_log
|
||||
(GroupID, UserID, Time, Info)
|
||||
VALUES
|
||||
('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Vanity House status changed to '.($VanityHouse ? 'true' : 'false'))."')");
|
||||
}
|
||||
|
||||
// There we go, all done!
|
||||
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'");
|
||||
$DB->query("
|
||||
SELECT CollageID
|
||||
FROM collages_torrents
|
||||
WHERE GroupID = '$GroupID'");
|
||||
if ($DB->record_count() > 0) {
|
||||
while (list($CollageID) = $DB->next_record()) {
|
||||
$Cache->delete_value('collage_'.$CollageID);
|
||||
@ -158,10 +181,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
$DB->query("SELECT ID FROM torrents WHERE GroupID = ".$GroupID);
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM torrents
|
||||
WHERE GroupID = $GroupID");
|
||||
if ($DB->record_count()) {
|
||||
$TorrentIDs = implode(',', $DB->collect('ID'));
|
||||
$DB->query("SELECT DISTINCT uid FROM xbt_snatched WHERE fid IN (".$TorrentIDs.")");
|
||||
$DB->query("
|
||||
SELECT DISTINCT uid
|
||||
FROM xbt_snatched
|
||||
WHERE fid IN ($TorrentIDs)");
|
||||
$Snatchers = $DB->collect('uid');
|
||||
foreach ($Snatchers as $UserID) {
|
||||
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
|
||||
@ -180,5 +209,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: torrents.php?id=".$GroupID);
|
||||
header("Location: torrents.php?id=$GroupID");
|
||||
?>
|
||||
|
@ -11,16 +11,30 @@
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT TagID FROM torrents_tags_votes WHERE TagID='$TagID' AND GroupID='$GroupID' AND UserID='$UserID' AND Way='$Way'");
|
||||
$DB->query("
|
||||
SELECT TagID
|
||||
FROM torrents_tags_votes
|
||||
WHERE TagID = '$TagID'
|
||||
AND GroupID = '$GroupID'
|
||||
AND UserID = '$UserID'
|
||||
AND Way = '$Way'");
|
||||
if ($DB->record_count() == 0) {
|
||||
if ($Way == 'down') {
|
||||
$Change = 'NegativeVotes=NegativeVotes+1';
|
||||
$Change = 'NegativeVotes = NegativeVotes + 1';
|
||||
} else {
|
||||
$Change = 'PositiveVotes=PositiveVotes+2';
|
||||
$Change = 'PositiveVotes = PositiveVotes + 2';
|
||||
}
|
||||
$DB->query("UPDATE torrents_tags SET $Change WHERE TagID='$TagID' AND GroupID='$GroupID'");
|
||||
$DB->query("INSERT INTO torrents_tags_votes (GroupID, TagID, UserID, Way) VALUES ('$GroupID', '$TagID', '$UserID', '$Way')");
|
||||
$Cache->delete_value('torrents_details_'.$GroupID); // Delete torrent group cache
|
||||
$DB->query("
|
||||
UPDATE torrents_tags
|
||||
SET $Change
|
||||
WHERE TagID = '$TagID'
|
||||
AND GroupID = '$GroupID'");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_tags_votes
|
||||
(GroupID, TagID, UserID, Way)
|
||||
VALUES
|
||||
('$GroupID', '$TagID', '$UserID', '$Way')");
|
||||
$Cache->delete_value("torrents_details_$GroupID"); // Delete torrent group cache
|
||||
}
|
||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||
?>
|
||||
|
@ -175,7 +175,7 @@
|
||||
if ($Override = check_paranoia_here('seeding+')) {
|
||||
?>
|
||||
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Seeding:
|
||||
<span class="user_commstats" id="user_commstats_seeding"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Stats</a></span>
|
||||
<span class="user_commstats" id="user_commstats_seeding"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
|
||||
<?
|
||||
if ($AOverride = check_paranoia_here('seeding')) {
|
||||
if ($Override = check_paranoia_here('snatched')) {
|
||||
@ -194,10 +194,10 @@
|
||||
}
|
||||
if ($Override = check_paranoia_here('leeching+')) {
|
||||
?>
|
||||
<li<?=$Override === 2 ? ' class="paranoia_override"' : ''?>>Leeching:
|
||||
<span class="user_commstats" id="user_commstats_leeching"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Stats</a></span>
|
||||
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Leeching:
|
||||
<span class="user_commstats" id="user_commstats_leeching"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
|
||||
<? if ($Override = check_paranoia_here('leeching')) { ?>
|
||||
<a href="torrents.php?type=leeching&userid=<?=$UserID?>" class="brackets<?=$Override === 2 ? ' paranoia_override' : ''?>" title="View">View</a>
|
||||
<a href="torrents.php?type=leeching&userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" title="View">View</a>
|
||||
<?
|
||||
}
|
||||
if ($DisableLeech == 0 && check_perms('users_view_ips')) {
|
||||
@ -209,9 +209,9 @@
|
||||
}
|
||||
if ($Override = check_paranoia_here('snatched+')) { ?>
|
||||
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Snatched:
|
||||
<span class="user_commstats" id="user_commstats_snatched"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Stats</a></span>
|
||||
<span class="user_commstats" id="user_commstats_snatched"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
|
||||
<? if ($Override = check_perms('site_view_torrent_snatchlist', $Class)) { ?>
|
||||
<span id="user_commstats_usnatched"<?=$Override === 2 ? ' class="paranoia_override"' : ''?>></span>
|
||||
<span id="user_commstats_usnatched"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>></span>
|
||||
<? }
|
||||
}
|
||||
if ($Override = check_paranoia_here('snatched')) { ?>
|
||||
@ -224,7 +224,7 @@
|
||||
if (check_perms('site_view_torrent_snatchlist', $Class)) {
|
||||
?>
|
||||
<li>Downloaded:
|
||||
<span class="user_commstats" id="user_commstats_downloaded"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Stats</a></span>
|
||||
<span class="user_commstats" id="user_commstats_downloaded"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
|
||||
<span id="user_commstats_udownloaded"></span>
|
||||
<a href="torrents.php?type=downloaded&userid=<?=$UserID?>" class="brackets" title="View">View</a>
|
||||
</li>
|
||||
|
@ -321,16 +321,14 @@ function check_paranoia_here($Setting) {
|
||||
$ArtistsAdded = 0;
|
||||
}
|
||||
|
||||
include(SERVER_ROOT.'/classes/user_rank.class.php');
|
||||
$Rank = new USER_RANK;
|
||||
|
||||
$UploadedRank = $Rank->get_rank('uploaded', $Uploaded);
|
||||
$DownloadedRank = $Rank->get_rank('downloaded', $Downloaded);
|
||||
$UploadsRank = $Rank->get_rank('uploads', $Uploads);
|
||||
$RequestRank = $Rank->get_rank('requests', $RequestsFilled);
|
||||
$PostRank = $Rank->get_rank('posts', $ForumPosts);
|
||||
$BountyRank = $Rank->get_rank('bounty', $TotalSpent);
|
||||
$ArtistsRank = $Rank->get_rank('artists', $ArtistsAdded);
|
||||
//Do the ranks
|
||||
$UploadedRank = UserRank::get_rank('uploaded', $Uploaded);
|
||||
$DownloadedRank = UserRank::get_rank('downloaded', $Downloaded);
|
||||
$UploadsRank = UserRank::get_rank('uploads', $Uploads);
|
||||
$RequestRank = UserRank::get_rank('requests', $RequestsFilled);
|
||||
$PostRank = UserRank::get_rank('posts', $ForumPosts);
|
||||
$BountyRank = UserRank::get_rank('bounty', $TotalSpent);
|
||||
$ArtistsRank = UserRank::get_rank('artists', $ArtistsAdded);
|
||||
|
||||
if ($Downloaded == 0) {
|
||||
$Ratio = 1;
|
||||
@ -339,7 +337,7 @@ function check_paranoia_here($Setting) {
|
||||
} else {
|
||||
$Ratio = round($Uploaded / $Downloaded, 2);
|
||||
}
|
||||
$OverallRank = $Rank->overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio);
|
||||
$OverallRank = UserRank::overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio);
|
||||
|
||||
?>
|
||||
<div class="box box_info box_userinfo_percentile">
|
||||
|
@ -129,6 +129,10 @@ ul.thin li {
|
||||
padding: 1em 0;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
color: #DDDDDD;
|
||||
}
|
||||
|
||||
#logo {
|
||||
width: 15%;
|
||||
height: 75px;
|
||||
|
Loading…
Reference in New Issue
Block a user