Empty commit

This commit is contained in:
Git 2012-02-07 08:00:20 +00:00
parent 4cb0d2b905
commit 73409741fe
13 changed files with 144 additions and 64 deletions

View File

@ -278,7 +278,11 @@ function compare($X, $Y){
?>
<li class="image_group_<?=$GroupID?>">
<a href="#group_<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
<? if($Image) { ?>
<? if($Image) {
if(check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<img src="<?=$Image?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div>

View File

@ -4,9 +4,35 @@
include(SERVER_ROOT.'/classes/class_validate.php');
$Val = new VALIDATE;
function AddTorrent($CollageID, $GroupID) {
global $Cache, $LoggedUser, $DB;
$DB->query("SELECT MAX(Sort) FROM collages_torrents WHERE CollageID='$CollageID'");
list($Sort) = $DB->next_record();
$Sort+=10;
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
if($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO collages_torrents
(CollageID, GroupID, UserID, Sort, AddedOn)
VALUES
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_collages_'.$GroupID);
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID");
while (list($CacheUserID) = $DB->next_record()) {
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID);
}
}
}
$CollageID = $_POST['collageid'];
if(!is_number($CollageID)) { error(404); }
$DB->query("SELECT UserID, CategoryID, Locked, NumTorrents, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'");
list($UserID, $CategoryID, $Locked, $NumTorrents, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
@ -19,54 +45,68 @@
}
}
if ($_REQUEST['action'] == 'add_torrent') {
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
$Val->SetFields('url', '1','regex','The URL must be a link to a torrent on the site.',array('regex'=>$URLRegex));
$Err = $Val->ValidateForm($_POST);
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
$Val->SetFields('url', '1','regex','The URL must be a link to a torrent on the site.',array('regex'=>$URLRegex));
$Err = $Val->ValidateForm($_POST);
if($Err) {
error($Err);
header('Location: collages.php?id='.$CollageID);
die();
}
$URL = $_POST['url'];
// Get torrent ID
$URLRegex = '/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
preg_match($URLRegex, $URL, $Matches);
$TorrentID=$Matches[2];
if(!$TorrentID || (int)$TorrentID == 0) { error(404); }
$DB->query("SELECT ID FROM torrents_group WHERE ID='$TorrentID'");
list($GroupID) = $DB->next_record();
if(!$GroupID) {
error('The torrent was not found in the database.');
}
$DB->query("SELECT MAX(Sort) FROM collages_torrents WHERE CollageID='$CollageID'");
list($Sort) = $DB->next_record();
$Sort+=10;
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
if($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO collages_torrents
(CollageID, GroupID, UserID, Sort, AddedOn)
VALUES
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_collages_'.$GroupID);
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID");
while (list($CacheUserID) = $DB->next_record()) {
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID);
if($Err) {
error($Err);
header('Location: collages.php?id='.$CollageID);
die();
}
$URL = $_POST['url'];
// Get torrent ID
$URLRegex = '/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
preg_match($URLRegex, $URL, $Matches);
$TorrentID=$Matches[2];
if(!$TorrentID || (int)$TorrentID == 0) { error(404); }
$DB->query("SELECT ID FROM torrents_group WHERE ID='$TorrentID'");
list($GroupID) = $DB->next_record();
if(!$GroupID) {
error('The torrent was not found in the database.');
}
AddTorrent($CollageID, $GroupID);
} else {
error('Torrent already in collage!');
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
$URLs = explode("\n",$_REQUEST['urls']);
$GroupIDs = array();
$Err = '';
foreach ($URLs as $URL) {
$URL = trim($URL);
if ($URL == '') { continue; }
$Matches = array();
if (preg_match($URLRegex, $URL, $Matches)) {
$GroupIDs[] = $Matches[3];
$GroupID = $Matches[3];
} else {
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site.";
break;
}
$DB->query("SELECT ID FROM torrents_group WHERE ID='$GroupID'");
if(!$DB->record_count()) {
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site.";
break;
}
}
if($Err) {
error($Err);
header('Location: collages.php?id='.$CollageID);
die();
}
foreach ($GroupIDs as $GroupID) {
AddTorrent($CollageID, $GroupID);
}
}
header('Location: collages.php?id='.$CollageID);

View File

@ -317,7 +317,11 @@ function compare($X, $Y){
?>
<li class="image_group_<?=$GroupID?>">
<a href="#group_<?=$GroupID?>">
<? if($Image) { ?>
<? if($Image) {
if(check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<img src="<?=$Image?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div>
@ -521,8 +525,8 @@ function compare($X, $Y){
</div>
<? if(check_perms('site_collages_manage') && !$Locked) { ?>
<div class="box">
<div class="head"><strong>Add torrent</strong></div>
<div class="pad">
<div class="head"><strong>Add torrent</strong><span style="float: right"><a href="#" onClick="$('#addtorrent').toggle(); $('#batchadd').toggle(); this.innerHTML = (this.innerHTML == '[Batch Add]'?'[Individual Add]':'[Batch Add]'); return false;">[Batch Add]</a></span></div>
<div class="pad" id="addtorrent">
<form action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
@ -533,6 +537,17 @@ function compare($X, $Y){
<i>Enter the URL of a torrent on the site.</i>
</form>
</div>
<div class="pad hidden" id="batchadd">
<form action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent_batch" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<textarea name="urls" rows="5" cols="25" wrap="off"></textarea><br />
<input type="submit" value="Add" />
<br />
<i>Enter the URLs of torrents on the site, one to a line.</i>
</form>
</div>
</div>
<? } ?>
<h3>Comments</h3>

View File

@ -13,6 +13,7 @@
require(SERVER_ROOT.'/sections/collages/new_handle.php');
break;
case 'add_torrent':
case 'add_torrent_batch':
if(!check_perms('site_collages_manage')) { error(403); }
require(SERVER_ROOT.'/sections/collages/add_torrent.php');
break;

View File

@ -106,12 +106,13 @@
tg.Year,
tg.ReleaseType,
tg.WikiImage,
GROUP_CONCAT(t.Name SEPARATOR ', ')
GROUP_CONCAT(t.Name SEPARATOR ', '),
tg.CategoryID
FROM torrents_group AS tg
JOIN torrents_tags AS tt ON tt.GroupID=tg.ID
JOIN tags AS t ON t.ID=tt.TagID
WHERE tg.ID = ".$_GET['groupid']);
if(list($Title, $Year, $ReleaseType, $Image, $Tags) = $DB->next_record()) {
if(list($Title, $Year, $ReleaseType, $Image, $Tags, $CategoryID) = $DB->next_record()) {
$GroupID = trim($_REQUEST['groupid']);
}
}
@ -324,7 +325,7 @@
If this request matches a torrent group <span style="font-weight: bold;">already existing</span> on the site, please indicate that here.
</td>
</tr>
<? } elseif ($GroupID) {
<? } elseif ($GroupID && ($CategoryID == 1)) {
?>
<tr>
<td class="label">Torrent Group</td>

View File

@ -182,12 +182,12 @@
$GroupID = $Matches[3];
}
if (is_number($GroupID)) {
$DB->query("SELECT 1 FROM torrents_group WHERE ID = '$GroupID'");
$DB->query("SELECT 1 FROM torrents_group WHERE ID = '$GroupID' AND CategoryID = 1");
if ($DB->record_count() == 0) {
$Err = "Torrent Group, if entered, must correspond to a group on the site.";
$Err = "Torrent Group, if entered, must correspond to a music group on the site.";
}
} else {
$Err = "Torrent Group, if entered, must correspond to a group on the site.";
$Err = "Torrent Group, if entered, must correspond to a music group on the site.";
}
}

View File

@ -6,6 +6,7 @@
$UserLevel = $LoggedUser['Class'];
// Setup for current view mode
$SortStr = "IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, ";
switch ($View) {
case 'unanswered':
$ViewString = "Unanswered";
@ -14,10 +15,12 @@
case 'open':
$ViewString = "All open";
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status IN ('Open', 'Unanswered')";
$SortStr = '';
break;
case 'resolved':
$ViewString = "Resolved";
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Resolved'";
$SortStr = '';
break;
case 'my':
$ViewString = "My unanswered";
@ -51,7 +54,7 @@
ResolverID
FROM staff_pm_conversations
$WhereCondition
ORDER BY IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, Level DESC, Date DESC
ORDER BY $SortStr Level DESC, Date DESC
LIMIT $Limit
");

View File

@ -138,7 +138,8 @@
t.Snatched,
t.Seeders,
t.Leechers,
((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data
((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
g.ReleaseType
FROM torrents AS t
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID ";
@ -225,7 +226,8 @@
}
if(($Details=='all' || $Details=='seeded') && !$Filtered) {
if (!$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum)) {
$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum);
if ($TopTorrentsSeeded === FALSE) {
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= "
@ -245,7 +247,7 @@
// generate a table based on data from most recent query to $DB
function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
global $LoggedUser,$Categories,$Debug;
global $LoggedUser,$Categories,$Debug,$ReleaseTypes;
?>
<h3>Top <?=$Limit.' '.$Caption?>
<? if(empty($_GET['advanced'])){ ?>
@ -288,7 +290,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
foreach ($Details as $Detail) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Detail;
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType) = $Detail;
// highlight every other row
$Rank++;
@ -307,6 +309,9 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
if($GroupCategoryID==1 && $GroupYear>0) {
$DisplayName.= " [$GroupYear]";
}
if($GroupCategoryID==1 && $ReleaseType > 0) {
$DisplayName.= ' ['.$ReleaseTypes[$ReleaseType].']';
}
// append extra info to torrent title
$ExtraInfo='';

View File

@ -712,6 +712,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
?>
<tr class="group">
<?

View File

@ -113,6 +113,9 @@ function compare($X, $Y){
<div class="head"><strong>Cover</strong></div>
<?
if ($WikiImage!="") {
if(check_perms('site_proxy_images')) {
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
}
?>
<p align="center"><img style="max-width: 220px;" src="<?=$WikiImage?>" alt="<?=$AltName?>" onclick="lightbox.init(this,220);" /></p>
<?
@ -584,6 +587,9 @@ function filelist($Str) {
$BitrateString = implode(", ", explode("|", $Request['BitrateList']));
$FormatString = implode(", ", explode("|", $Request['FormatList']));
$MediaString = implode(", ", explode("|", $Request['MediaList']));
if ($Request['LogCue']) {
$FormatString .= ' - '.$Request['LogCue'];
}
} else {
$BitrateString = "Unknown";
$FormatString = "Unknown";

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<? authorize(); include(SERVER_ROOT.'/sections/user/linkedfunctions.php'); if (!check_perms('users_mod')) { error(403); } $UserID = $_REQUEST['userid']; switch ($_REQUEST['dupeaction']) { case 'remove': unlink_user($_REQUEST['removeid']); break; case 'add': $Target = $_REQUEST['target']; $DB->query("SELECT ID FROM users_main WHERE Username LIKE '".db_string($Target)."'"); if (list($TargetID) = $DB->next_record()) { link_users($UserID, $TargetID); } else { error("User '$Target' not found."); } break; add': add': add': add': $Target = $_REQUEST['target']; break; default: error(403); } echo '\o/'; header("Location: user.php?id=$UserID"); ?>
<? authorize(); include(SERVER_ROOT.'/sections/user/linkedfunctions.php'); if (!check_perms('users_mod')) { error(403); } $UserID = $_REQUEST['userid']; switch ($_REQUEST['dupeaction']) { case 'remove': unlink_user($_REQUEST['removeid']); break; case 'add': $DB->query("SELECT ID FROM users_main WHERE Username LIKE '".db_string($Target)."'"); add': if (list($TargetID) = $DB->next_record()) { add': link_users($UserID, $TargetID); add': } else { add': error("User '$Target' not found."); add': } add': break; $Target = $_REQUEST['target']; $Target = $_REQUEST['target']; add': } add': $DB->query("SELECT GroupID FROM users_dupes WHERE UserID = '$UserID'"); list($GroupID) = $DB->next_record(); add': $Target = $_REQUEST['target']; if (list($TargetID) = $DB->next_record()) { dupe_comments($GroupID, $_REQUEST['dupecomments']); } break; default: error(403); } echo '\o/'; header("Location: user.php?id=$UserID"); ?>

View File

@ -146,7 +146,11 @@
</td>
<? if (!$LoggedUser['HideCollage']) {?>
<td style="width: 60px; padding: 0;">
<? if ($Image) { ?>
<? if ($Image) {
if(check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<img style="max-width: 60px; max-height: 60px" src="<?=$Image?>" alt="<?=$AltName?>" onclick="lightbox.init(this,60);" />
<? } else { ?>
<img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$GroupCategoryID-1]?>" alt="<?=$Categories[$GroupCategoryID-1]?>" title="<?=$Categories[$GroupCategoryID-1]?>" width="60" height="60" border="0" />