Empty commit

This commit is contained in:
Git 2012-06-16 08:00:18 +00:00
parent 3a903daf04
commit dead2fa719
23 changed files with 202 additions and 434 deletions

View File

@ -786,18 +786,20 @@ function show_footer($Options=array()) {
* @param $ShowDots Show dots at the end
* @return string formatted string
*/
function cut_string($Str,$Length,$Hard = false,$ShowDots = true) {
if (strlen($Str)>$Length) {
if ($Hard==0) {
function cut_string($Str, $Length, $Hard = false, $ShowDots = true) {
if (mb_strlen($Str, 'UTF-8') > $Length) {
if ($Hard == 0) {
// Not hard, cut at closest word
$CutDesc=substr($Str,0,$Length);
$DescArr=explode(' ',$CutDesc);
$DescArr=array_slice($DescArr,0,count($DescArr)-1);
$CutDesc=implode($DescArr,' ');
if ($ShowDots==1) { $CutDesc.='...'; }
$CutDesc = mb_substr($Str, 0, $Length, 'UTF-8');
$DescArr = explode(' ', $CutDesc);
if (count($DescArr) > 1) {
array_pop($DescArr);
$CutDesc = implode(' ', $DescArr);
}
if ($ShowDots) { $CutDesc .= '...'; }
} else {
$CutDesc=substr($Str,0,$Length);
if ($ShowDots==1) { $CutDesc.='...'; }
$CutDesc = mb_substr($Str, 0, $Length, 'UTF-8');
if ($ShowDots) { $CutDesc .= '...'; }
}
return $CutDesc;
} else {
@ -1558,8 +1560,8 @@ function update_hash($GroupID) {
// if $ConvID is not set, it auto increments it, ie. starting a new conversation
function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
global $DB, $Cache, $Time;
if($ToID==0) {
// Don't allow users to send messages to the system
if($ToID == 0 || $ToID == $FromID) {
// Don't allow users to send messages to the system or themselves
return;
}
if($ConvID=='') {
@ -2122,7 +2124,7 @@ function get_tags($TagNames) {
return($TagIDs);
}
function torrent_info($Data, $ShowMedia = false) {
function torrent_info($Data, $ShowMedia = false, $ShowEdition = false) {
$Info = array();
if(!empty($Data['Format'])) { $Info[]=$Data['Format']; }
if(!empty($Data['Encoding'])) { $Info[]=$Data['Encoding']; }
@ -2134,8 +2136,14 @@ function torrent_info($Data, $ShowMedia = false) {
$Info[]=$Str;
}
if(!empty($Data['HasCue'])) { $Info[]='Cue'; }
if($ShowMedia && !empty($Data['Media'])) { $Info[]=$Data['Media']; }
if(!empty($Data['Scene'])) { $Info[]='Scene'; }
if(!empty($Data['Media']) && $ShowMedia) { $Info[]=$Data['Media']; }
if($ShowEdition) {
$EditionInfo = array();
if(!empty($Data['RemasterYear'])) { $EditionInfo[]=$Data['RemasterYear']; }
if(!empty($Data['RemasterTitle'])) { $EditionInfo[]=$Data['RemasterTitle']; }
if(count($EditionInfo)) { $Info[]=implode(' ',$EditionInfo); }
}
if($Data['FreeTorrent'] == '1') { $Info[]='<strong>Freeleech!</strong>'; }
if($Data['FreeTorrent'] == '2') { $Info[]='<strong>Neutral Leech!</strong>'; }
if($Data['PersonalFL'] == 1) { $Info[]='<strong>Personal Freeleech!</strong>'; }

View File

@ -79,8 +79,9 @@ CREATE TABLE `artists_tags` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `bad_passwords` (
`Password` char(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
`Password` char(32) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`Password`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci;
CREATE TABLE `blog` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,

View File

@ -1,246 +0,0 @@
<?
ini_set('memory_limit', -1);
//~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
authorize(true);
function compare($X, $Y){
return($Y['count'] - $X['count']);
}
if(!empty($_GET['userid'])) {
if(!check_perms('users_override_paranoia')) {
error(403);
}
$UserID = $_GET['userid'];
if(!is_number($UserID)) { error(404); }
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
$Sneaky = ($UserID != $LoggedUser['ID']);
$Data = $Cache->get_value('bookmarks_torrent_'.$UserID.'_full');
if($Data) {
$Data = unserialize($Data);
list($K, list($TorrentList, $CollageDataList)) = each($Data);
} else {
// Build the data for the collage and the torrent list
$DB->query("SELECT
bt.GroupID,
tg.WikiImage,
tg.CategoryID,
bt.Time
FROM bookmarks_torrents AS bt
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
WHERE bt.UserID='$UserID'
ORDER BY bt.Time");
$GroupIDs = $DB->collect('GroupID');
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
if(count($GroupIDs)>0) {
$TorrentList = get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
}
$Title = ($Sneaky)?"$Username's bookmarked torrents":'Your bookmarked torrents';
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
$Collage = array();
$TorrentTable = '';
$NumGroups = 0;
$Artists = array();
$Tags = array();
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID2, $Image, $GroupCategoryID, $AddedTime) = array_values($CollageDataList[$GroupID]);
// Handle stats and stuff
$NumGroups++;
if($GroupArtists) {
foreach($GroupArtists as $Artist) {
if(!isset($Artists[$Artist['id']])) {
$Artists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
} else {
$Artists[$Artist['id']]['count']++;
}
}
}
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
foreach($TagList as $Tag) {
if(!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else {
$Tags[$Tag]['count']++;
}
$TorrentTags[]='<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$PrimaryTag = $TagList[0];
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags='<br /><div class="tags">'.$TorrentTags.'</div>';
$DisplayName = '';
if(count($GroupArtists)>0) {
$DisplayName = display_artists(array('1'=>$GroupArtists));
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) {
// Grouped torrents
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
unset($FirstUnknown);
foreach ($Torrents as $TorrentID => $Torrent) {
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
$EditionID++;
if($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
$RemasterName = $Torrent['RemasterYear'];
$AddExtra = " - ";
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
} else {
$AddExtra = " / ";
if (!$Torrent['Remastered']) {
$MasterName = "Original Release";
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
} else {
$MasterName = "Unknown Release(s)";
}
$MasterName .= $AddExtra.display_str($Torrent['Media']);
}
}
$LastRemasterTitle = $Torrent['RemasterTitle'];
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
}
} else {
// Viewing a type that does not require grouping
list($TorrentID, $Torrent) = each($Torrents);
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if(!empty($Torrent['FreeTorrent'])) {
$DisplayName .=' <strong>Freeleech!</strong>';
}
}
$TorrentTable.=ob_get_clean();
// Album art
ob_start();
$DisplayName = '';
if(!empty($GroupArtists)) {
$DisplayName.= display_artists(array('1'=>$GroupArtists), false);
}
$DisplayName .= $GroupName;
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
$Collage[]=ob_get_clean();
}
uasort($Tags, 'compare');
$i = 0;
foreach ($Tags as $TagName => $Tag) {
$i++;
if($i>5) { break; }
uasort($Artists, 'compare');
$i = 0;
foreach ($Artists as $ID => $Artist) {
$i++;
if($i>10) { break; }
}
}
$JsonBookmarks = array();
foreach ($TorrentList as $Torrent) {
$JsonTorrents = array();
foreach ($Torrent['Torrents'] as $GroupTorrents) {
$JsonTorrents[] = array(
'id' => (int) $GroupTorrents['ID'],
'groupId' => (int) $GroupTorrents['GroupID'],
'media' => $GroupTorrents['Media'],
'format' => $GroupTorrents['Format'],
'encoding' => $GroupTorrents['Encoding'],
'remasterYear' => (int) $GroupTorrents['RemasterYear'],
'remastered' => $GroupTorrents['Remastered'] == 1,
'remasterTitle' => $GroupTorrents['RemasterTitle'],
'remasterRecordLabel' => $GroupTorrents['RemasterRecordLabel'],
'remasterCatalogueNumber' => $GroupTorrents['RemasterCatalogueNumber'],
'scene' => $GroupTorrents['Scene'] == 1,
'hasLog' => $GroupTorrents['HasLog'] == 1,
'hasCue' => $GroupTorrents['HasCue'] == 1,
'logScore' => (float) $GroupTorrents['LogScore'],
'fileCount' => (int) $GroupTorrents['FileCount'],
'freeTorrent' => $GroupTorrents['FreeTorrent'] == 1,
'size' => (float) $GroupTorrents['Size'],
'leechers' => (int) $GroupTorrents['Leechers'],
'seeders' => (int) $GroupTorrents['Seeders'],
'snatched' => (int) $GroupTorrents['Snatched'],
'time' => $GroupTorrents['Time'],
'hasFile' => (int) $GroupTorrents['HasFile']
);
}
$JsonBookmarks[] = array(
'id' => (int) $Torrent['ID'],
'name' => $Torrent['Name'],
'year' => (int) $Torrent['Year'],
'recordLabel' => $Torrent['RecordLabel'],
'catalogueNumber' => $Torrent['CatalogueNumber'],
'tagList' => $Torrent['TagList'],
'releaseType' => $Torrent['ReleaseType'],
'vanityHouse' => $Torrent['VanityHouse'] == 1,
'torrents' => $JsonTorrents
);
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'bookmarks' => $JsonBookmarks
)
)
);
?>

View File

@ -184,13 +184,13 @@ function compare($X, $Y){
foreach ($Tags as $TagName => $Tag) {
$i++;
if($i>5) { break; }
}
uasort($Artists, 'compare');
$i = 0;
foreach ($Artists as $ID => $Artist) {
$i++;
if($i>10) { break; }
}
}
$JsonBookmarks = array();
foreach ($TorrentList as $Torrent) {

View File

@ -53,7 +53,7 @@
WHERE t.ForumID = '$ForumID'
ORDER BY t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC);
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
if($Page==1) {
$DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'");
list($Stickies) = $DB->next_record();
@ -71,12 +71,13 @@
}
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
$ForumName = display_str($Forums[$ForumID]['Name']);
$JsonSpecificRules = array();
foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
$Thread = get_thread_info($ThreadIDs);
$JsonSpecificRules[] = array(
'threadId' => (int) $ThreadIDs,
'thread' => $Thread['Title']
'thread' => display_str($Thread['Title'])
);
}
@ -87,7 +88,7 @@
json_encode(
array(
'status' => 'success',
'forumName' => $Forums[$ForumID]['Name'],
'forumName' => $ForumName,
'threads' => array()
)
);
@ -125,7 +126,7 @@
$JsonTopics[] = array(
'topicId' => (int) $TopicID,
'title' => $Title,
'title' => display_str($Title),
'authorId' => (int) $AuthorID,
'authorName' => $AuthorName,
'locked' => $Locked == 1,
@ -146,7 +147,7 @@
array(
'status' => 'success',
'response' => array(
'forumName' => $Forums[$ForumID]['Name'],
'forumName' => $ForumName,
'specificRules' => $JsonSpecificRules,
'currentPage' => (int) $Page,
'pages' => ceil($Forums[$ForumID]['NumTopics']/TOPICS_PER_PAGE),

View File

@ -77,7 +77,7 @@
'lastTopicId' => (float) $LastTopicID,
'lastTime' => $LastTime,
'specificRules' => $SpecificRules,
'lastTopic' => $LastTopic,
'lastTopic' => display_str($LastTopic),
'read' => $Read == 1,
'locked' => $Locked == 1,
'sticky' => $Sticky == 1

View File

@ -248,7 +248,7 @@
'forumId' => (int) $ForumID,
'forumName' => $Forums[$ForumID]['Name'],
'threadId' => (int) $ThreadID,
'threadTitle' => $ThreadInfo['Title'],
'threadTitle' => display_str($ThreadInfo['Title']),
'subscribed' => in_array($ThreadID, $UserSubscriptions),
'locked' => $ThreadInfo['IsLocked'] == 1,
'sticky' => $ThreadInfo['IsSticky'] == 1,

View File

@ -15,115 +15,98 @@
define('NOTIFICATIONS_PER_PAGE', 50);
list($Page,$Limit) = page_limit(NOTIFICATIONS_PER_PAGE);
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
$TokenTorrents = $Cache->get_value('users_tokens_'.$LoggedUser['ID']);
if (empty($TokenTorrents)) {
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$LoggedUser[ID] AND Expired=FALSE");
$TokenTorrents = $DB->collect('TorrentID');
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
$Cache->cache_value('users_tokens_'.$LoggedUser['ID'], $TokenTorrents);
}
$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS
t.ID,
g.ID,
g.Name,
g.CategoryID,
g.TagList,
t.Size,
t.FileCount,
t.Format,
t.Encoding,
t.Media,
t.Scene,
t.RemasterYear,
g.Year,
t.RemasterYear,
t.RemasterTitle,
t.Snatched,
t.Seeders,
t.Leechers,
t.Time,
t.HasLog,
t.HasCue,
t.LogScore,
t.FreeTorrent,
tln.TorrentID AS LogInDB,
unt.UnRead,
unt.FilterID,
unf.Label
$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, unf.Label, t.GroupID
FROM users_notify_torrents AS unt
JOIN torrents AS t ON t.ID=unt.TorrentID
JOIN torrents_group AS g ON g.ID = t.GroupID
LEFT JOIN users_notify_filters AS unf ON unf.ID=unt.FilterID
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID=t.ID
WHERE unt.UserID='$LoggedUser[ID]'
GROUP BY t.ID
ORDER BY t.ID DESC LIMIT $Limit");
JOIN torrents AS t ON t.ID = unt.TorrentID
LEFT JOIN users_notify_filters AS unf ON unf.ID = unt.FilterID
WHERE unt.UserID=$LoggedUser[ID]".
((!empty($_GET['filterid']) && is_number($_GET['filterid']))
? " AND unf.ID='$_GET[filterid]'"
: "")."
ORDER BY TorrentID DESC LIMIT $Limit");
$GroupIDs = array_unique($DB->collect('GroupID'));
$DB->query('SELECT FOUND_ROWS()');
list($TorrentCount) = $DB->next_record();
// Only clear the alert if they've specified to.
if (isset($_GET['clear']) && $_GET['clear'] == "1") {
//Clear before header but after query so as to not have the alert bar on this page load
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']);
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
if(count($GroupIDs)) {
$TorrentGroups = get_groups($GroupIDs);
$TorrentGroups = $TorrentGroups['matches'];
// Need some extra info that get_groups() doesn't return
$DB->query("SELECT ID, CategoryID FROM torrents_group WHERE ID IN (".implode(',', $GroupIDs).")");
$GroupCategoryIDs = $DB->to_array('ID', MYSQLI_ASSOC, false);
// Only clear the alert if they've specified to.
if (isset($_GET['clear']) && $_GET['clear'] == "1") {
//Clear before header but after query so as to not have the alert bar on this page load
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']);
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
}
}
$DB->set_query_id($Results);
$Pages=get_pages($Page,$TorrentCount,NOTIFICATIONS_PER_PAGE,9);
$JsonNotifications = array();
$NumNew = 0;
$FilterGroups = array();
while($Result = $DB->next_record()) {
while($Result = $DB->next_record(MYSQLI_ASSOC)) {
if(!$Result['FilterID']) {
$Result['FilterID'] = 0;
}
if(!isset($FilterGroups[$Result['FilterID']])) {
$FilterGroups[$Result['FilterID']] = array();
$FilterGroups[$Result['FilterID']]['FilterLabel'] = ($Result['FilterID'] && !empty($Result['Label']) ? $Result['Label'] : 'unknown filter'.($Result['FilterID']?' ['.$Result['FilterID'].']':''));
$FilterGroups[$Result['FilterID']]['FilterLabel'] = $Result['Label'] ? $Result['Label'] : false;
}
array_push($FilterGroups[$Result['FilterID']], $Result);
}
unset($Result);
foreach($FilterGroups as $ID => $FilterResults) {
foreach($FilterGroups as $FilterID => $FilterResults) {
unset($FilterResults['FilterLabel']);
foreach($FilterResults as $Result) {
list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $TorrentTags, $Size, $FileCount, $Format, $Encoding,
$Media, $Scene, $RemasterYear, $GroupYear, $RemasterYear, $RemasterTitle, $Snatched, $Seeders,
$Leechers, $NotificationTime, $HasLog, $HasCue, $LogScore, $FreeTorrent, $LogInDB, $UnRead) = $Result;
$Artists = get_artist($GroupID);
if ($Unread) $NumNew++;
$TorrentID = $Result['TorrentID'];
$GroupID = $Result['GroupID'];
$GroupCategoryID = $GroupCategoryIDs[$GroupID]['CategoryID'];
$GroupInfo = $TorrentGroups[$Result['GroupID']];
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
if ($Result['UnRead'] == 1) $NumNew++;
$JsonNotifications[] = array(
'torrentId' => (int) $TorrentID,
'groupId' => (int) $GroupID,
'groupName' => $GroupName,
'groupName' => $GroupInfo['Name'],
'groupCategoryId' => (int) $GroupCategoryID,
'torrentTags' => $TorrentTags,
'size' => (float) $Size,
'fileCount' => (int) $FileCount,
'format' => $Format,
'encoding' => $Encoding,
'media' => $Media,
'scene' => $Scene == 1,
'groupYear' => (int) $GroupYear,
'remasterYear' => (int) $RemasterYear,
'remasterTitle' => $RemasterTitle,
'snatched' => (int) $Snatched,
'seeders' => (int) $Seeders,
'leechers' => (int) $Leechers,
'notificationTime' => $NotificationTime,
'hasLog' => $HasLog == 1,
'hasCue' => $HasCue == 1,
'logScore' => (float) $LogScore,
'freeTorrent' => $FreeTorrent == 1,
'logInDb' => $LogInDB,
'unread' => $UnRead == 1
'torrentTags' => $GroupInfo['TagList'],
'size' => (float) $TorrentInfo['Size'],
'fileCount' => (int) $TorrentInfo['FileCount'],
'format' => $TorrentInfo['Format'],
'encoding' => $TorrentInfo['Encoding'],
'media' => $TorrentInfo['Media'],
'scene' => $TorrentInfo['Scene'] == 1,
'groupYear' => (int) $GroupInfo['Year'],
'remasterYear' => (int) $TorrentInfo['RemasterYear'],
'remasterTitle' => $TorrentInfo['RemasterTitle'],
'snatched' => (int) $TorrentInfo['Snatched'],
'seeders' => (int) $TorrentInfo['Seeders'],
'leechers' => (int) $TorrentInfo['Leechers'],
'notificationTime' => $TorrentInfo['Time'],
'hasLog' => $TorrentInfo['HasLog'] == 1,
'hasCue' => $TorrentInfo['HasCue'] == 1,
'logScore' => (float) $TorrentInfo['LogScore'],
'freeTorrent' => $TorrentInfo['FreeTorrent'] == 1,
'logInDb' => $TorrentInfo['HasLog'] == 1,
'unread' => $Result['UnRead'] == 1
);
}
}

View File

@ -13,7 +13,7 @@
}
if($AliasName == '') {
error('Blank artist name');
error('Blank artist name.');
}
/*
@ -24,31 +24,47 @@
* 3. For foo, there's two, same ArtistID, diff names, no redirect
*/
$DB->query("SELECT AliasID, ArtistID, Name FROM artists_alias WHERE Name = '".$DBAliasName."'");
$DB->query("SELECT AliasID, ArtistID, Name, Redirect FROM artists_alias WHERE Name = '".$DBAliasName."'");
if($DB->record_count()) {
while(list($CloneAliasID, $CloneArtistID, $CloneAliasName) = $DB->next_record(MYSQLI_NUM, false)) {
while(list($CloneAliasID, $CloneArtistID, $CloneAliasName, $CloneRedirect) = $DB->next_record(MYSQLI_NUM, false)) {
if(!strcasecmp($CloneAliasName, $AliasName)) {
break;
}
}
if($CloneAliasID) {
if($Redirect == 0) {
$DB->query("UPDATE artists_alias SET ArtistID='".$ArtistID."', Redirect=0 WHERE AliasID='".$CloneAliasID."'");
if($ArtistID == $CloneArtistID && $Redirect == 0) {
if($CloneRedirect != 0) {
$DB->query("UPDATE artists_alias SET ArtistID='".$ArtistID."', Redirect=0 WHERE AliasID='".$CloneAliasID."'");
write_log("Redirection for the alias $CloneAliasID ($DBAliasName) for the artist $ArtistID was removed by user $LoggedUser[ID] ($LoggedUser[Username])");
} else {
error('No changes were made as the target alias did not redirect anywhere.');
}
} else {
error('An alias by that name already exists <a href="artist.php?id='.$CloneArtistID.'">here</a>. You can try renaming that artist to this one.');
}
}
}
if(!$CloneAliasID) {
$DB->query("SELECT ArtistID, Redirect FROM artists_alias WHERE AliasID = $Redirect");
if(!$DB->record_count()) {
error('Cannot redirect to a nonexistent artist alias.');
}
list($FoundArtistID, $FoundRedirect) = $DB->next_record();
if($ArtistID != $FoundArtistID) {
error('Redirection must target an alias for the current artist.');
}
if($FoundRedirect != 0) {
$Redirect = $FoundRedirect;
}
$DB->query("INSERT INTO artists_alias(ArtistID, Name, Redirect, UserID)
VALUES
(".$ArtistID.", '".$DBAliasName."', ".$Redirect.", ".$LoggedUser['ID'].")");
$AliasID = $DB->inserted_id();
$DB->query("SELECT Name FROM artists_group WHERE ArtistID=".$ArtistID);
list($ArtistName) = $DB->next_record();
$DB->query("SELECT Name FROM artists_group WHERE ArtistID = ".$ArtistID);
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
write_log("The alias ".$AliasID." (".$DBAliasName.") was added to the artist ".$ArtistID." (".$ArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_log("The alias ".$AliasID." (".$DBAliasName.") was added to the artist ".$ArtistID." (".db_string($ArtistName).") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
}
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

View File

@ -32,6 +32,6 @@
$DB->query("DELETE FROM artists_alias WHERE AliasID='$AliasID'");
$DB->query("UPDATE artists_alias SET Redirect='0' WHERE Redirect='$AliasID'");
write_log("The alias ".$AliasID." (".db_string($AliasName).") was removed from the artist ".$ArtistID." (".db_string($ArtistName).") by user ".$LoggedUser['ID']." (".db_string($LoggedUser['Username']).")");
write_log("The alias ".$AliasID." (".$AliasName.") was removed from the artist ".$ArtistID." (".$ArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
header('Location: '.$_SERVER['HTTP_REFERER']);

View File

@ -46,7 +46,7 @@
WHERE t.ForumID = '$ForumID'
ORDER BY t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC);
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
if($Page==1) {
$DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'");
list($Stickies) = $DB->next_record();
@ -60,13 +60,14 @@
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { error(403); }
}
$ForumName = display_str($Forums[$ForumID]['Name']);
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
// Start printing
show_header('Forums > '. $Forums[$ForumID]['Name']);
?>
<div class="thin">
<h2><a href="forums.php">Forums</a> &gt; <?=$Forums[$ForumID]['Name']?></h2>
<h2><a href="forums.php">Forums</a> &gt; <?=$ForumName?></h2>
<div class="linkbox">
<? if(check_forumperm($ForumID, 'Write') && check_forumperm($ForumID, 'Create')){ ?>
[<a href="forums.php?action=new&amp;forumid=<?=$ForumID?>">New Thread</a>]
@ -112,7 +113,7 @@
$Thread = get_thread_info($ThreadIDs);
?>
<br />
[<a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadIDs?>"><?=$Thread['Title']?></a>]
[<a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadIDs?>"><?=display_str($Thread['Title'])?></a>]
<? } ?>
</div>
<? } ?>
@ -223,7 +224,7 @@
} ?>
</table>
<!--<div class="breadcrumbs">
<a href="forums.php">Forums</a> &gt; <?=$Forums[$ForumID]['Name']?>
<a href="forums.php">Forums</a> &gt; <?=$ForumName?>
</div>-->
<div class="linkbox pager">
<?=$Pages?>

View File

@ -17,7 +17,7 @@ function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false) {
WHERE t.ID = '$ThreadID'
GROUP BY fp.TopicID");
if($DB->record_count()==0) { error(404); }
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC);
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC, false);
if($ThreadInfo['StickyPostID']) {
$ThreadInfo['Posts']--;
$DB->query("SELECT

View File

@ -75,7 +75,7 @@
WHERE t.ForumID='$ForumID'
GROUP BY t.ID
ORDER BY t.LastPostID DESC LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_BOTH, false);
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("UPDATE forums SET
NumTopics=NumTopics-1,
@ -134,7 +134,7 @@
if($ForumID!=$OldForumID) { // If we're moving a thread, change the forum stats
$DB->query("SELECT MinClassRead, MinClassWrite, Name FROM forums WHERE ID='$ForumID'");
list($MinClassRead, $MinClassWrite, $ForumName) = $DB->next_record();
list($MinClassRead, $MinClassWrite, $ForumName) = $DB->next_record(MYSQLI_NUM, false);
$Cache->begin_transaction('thread_'.$TopicID.'_info');
$UpdateArray = array(
'ForumName'=>$ForumName,
@ -205,7 +205,7 @@
LEFT JOIN users_main AS um ON um.ID=p.AuthorID
WHERE t.ForumID='$ForumID'
ORDER BY t.LastPostID DESC LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts) = $DB->next_record();
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("UPDATE forums SET
NumTopics=NumTopics+1,

View File

@ -49,12 +49,15 @@
// Thread information, constant across all pages
$ThreadInfo = get_thread_info($ThreadID, true, true);
$ForumID = $ThreadInfo['ForumID'];
// Make sure they're allowed to look at the page
if(!check_forumperm($ForumID)) {
error(403);
}
//Escape strings for later display
$ThreadTitle = display_str($ThreadInfo['Title']);
$ForumName = display_str($Forums[$ForumID]['Name']);
//Post links utilize the catalogue & key params to prevent issues with custom posts per page
if($ThreadInfo['Posts'] > $PerPage) {
if(isset($_GET['post']) && is_number($_GET['post'])) {
@ -134,8 +137,8 @@
<div class="thin">
<h2>
<a href="forums.php">Forums</a> &gt;
<a href="forums.php?action=viewforum&amp;forumid=<?=$ThreadInfo['ForumID']?>"><?=$Forums[$ForumID]['Name']?></a> &gt;
<?=display_str($ThreadInfo['Title'])?>
<a href="forums.php?action=viewforum&amp;forumid=<?=$ThreadInfo['ForumID']?>"><?=$ForumName?></a> &gt;
<?=$ThreadTitle?>
</h2>
<div class="linkbox">
<div class="center">
@ -433,8 +436,8 @@
<? } ?>
<div class="breadcrumbs">
<a href="forums.php">Forums</a> &gt;
<a href="forums.php?action=viewforum&amp;forumid=<?=$ThreadInfo['ForumID']?>"><?=$Forums[$ForumID]['Name']?></a> &gt;
<?=display_str($ThreadInfo['Title'])?>
<a href="forums.php?action=viewforum&amp;forumid=<?=$ThreadInfo['ForumID']?>"><?=$ForumName?></a> &gt;
<?=$ThreadTitle?>
</div>
<div class="linkbox">
<?=$Pages?>

View File

@ -118,8 +118,8 @@
$ReportType = $Types['master']['other'];
}
if ($ArtistID == 0 && empty($ArtistName)) {
$RawName = $GroupName.($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'> [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasCue ? " (Cue)" : '').($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$RawName = $GroupName.($Year ? " ($Year)" : "").($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'>".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasCue ? " (Cue)" : '').($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
$RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";

View File

@ -259,8 +259,8 @@
}
}
if ($ArtistID == 0 && empty($ArtistName)) {
$RawName = $GroupName.($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'> [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasCue ? " (Cue)" : '').($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$RawName = $GroupName.($Year ? " ($Year)" : "").($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'>".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasCue ? " (Cue)" : '').($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
$RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";

View File

@ -22,25 +22,20 @@
if(strlen($AliasName) > 0) {
$DB->query("SELECT AliasID, ArtistID, Redirect, Name FROM artists_alias WHERE Name = '".db_string($AliasName)."'");
if($DB->record_count() == 0) {
while(list($AliasID, $ArtistID, $Redirect, $FoundAliasName) = $DB->next_record(MYSQLI_NUM, false)) {
if(!strcasecmp($AliasName, $FoundAliasName)) {
if($Redirect) {
$AliasID = $Redirect;
}
break;
}
}
if(!$AliasID) {
$AliasName = db_string($AliasName);
$DB->query("INSERT INTO artists_group (Name) VALUES ('$AliasName')");
$ArtistID = $DB->inserted_id();
$DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$AliasName')");
$AliasID = $DB->inserted_id();
} else {
list($AliasID, $ArtistID, $Redirect, $FoundAliasName) = $DB->next_record(MYSQLI_NUM, false);
if($DB->record_count() > 1 && strcasecmp($AliasName, $FoundAliasName)) {
while($Result = $DB->next_record(MYSQLI_NUM, false)) {
list($AliasID, $ArtistID, $Redirect, $FoundAliasName) = $Result;
if(!strcasecmp($AliasName, $FoundAliasName)) {
break;
}
}
}
if($Redirect) {
$AliasID = $Redirect;
}
}
$DB->query("SELECT Name FROM torrents_group WHERE ID=".$GroupID);

View File

@ -113,8 +113,8 @@
$ReportType = $Types['master']['other'];
}
if ($ArtistID == 0 && empty($ArtistName)) {
$RawName = $GroupName.($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'> [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$RawName = $GroupName.($Year ? " ($Year)" : "").($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'>".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a>".($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
$RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";

View File

@ -18,9 +18,6 @@
$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'");
$Cache->delete_value('torrents_details_'.$GroupID); // Delete torrent group cache
update_hash($GroupID);
$DB->query("SELECT COUNT(GroupID) FROM torrents_tags WHERE TagID=".$TagID);

View File

@ -123,7 +123,7 @@
}
// append extra info to torrent title
$ExtraInfo = torrent_info($TorrentInfo, true);
$ExtraInfo = torrent_info($TorrentInfo, true, true);
$Debug->log_var($ExtraInfo, "Extra torrent info ($TorrentID)");
$TagLinks = array();
@ -137,6 +137,7 @@
$TagLinks = implode(', ', $TagLinks);
$TorrentTags = '<br /><div class="tags">'.$TagLinks.'</div>';
} else {
$TorrentTags = '';
$MainTag = $Categories[$GroupCategoryID-1];
}
@ -148,7 +149,7 @@
<td>
<span>
[<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<? if (($LoggedUser['FLTokens'] > 0) && ($Size < 1073741824)
<? if (($LoggedUser['FLTokens'] > 0) && ($TorrentInfo['Size'] < 1073741824)
&& !in_array($TorrentID, $TokenTorrents) && empty($TorrentInfo['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onClick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?>

View File

@ -35,6 +35,7 @@
</h3>
<? } ?>
<form action="user.php" method="post">
<input type="hidden" name="formid" value="<?=$i?>" />
<input type="hidden" name="action" value="notify_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table <?=($i<=$NumFilters)?'id="filter_'.$N['ID'].'" class="hidden"':''?>>
@ -42,7 +43,7 @@
<tr>
<td class="label"><strong>Label</strong></td>
<td>
<input type="text" name="label" style="width: 100%" />
<input type="text" name="label<?=$i?>" style="width: 100%" />
<p class="min_padding">A label for the filter set, to tell different filters apart.</p>
</td>
</tr>
@ -52,28 +53,28 @@
</td>
</tr>
<? } else { ?>
<input type="hidden" name="id" value="<?=$N['ID']?>" />
<input type="hidden" name="id<?=$i?>" value="<?=$N['ID']?>" />
<? } ?>
<tr>
<td class="label"><strong>One of these artists</strong></td>
<td>
<textarea name="artists" style="width:100%" rows="5"><?=display_str($N['Artists'])?></textarea>
<textarea name="artists<?=$i?>" style="width:100%" rows="5"><?=display_str($N['Artists'])?></textarea>
<p class="min_padding">Comma-separated list - eg. <em>Pink Floyd, Led Zeppelin, Neil Young</em></p>
<input type="checkbox" name="excludeva" id="excludeva_<?=$N['ID']?>"<? if($N['ExcludeVA']=="1") { echo ' checked="checked"';} ?> />
<input type="checkbox" name="excludeva<?=$i?>" id="excludeva_<?=$N['ID']?>"<? if($N['ExcludeVA']=="1") { echo ' checked="checked"';} ?> />
<label for="excludeva_<?=$N['ID']?>">Exclude Various Artists releases</label>
</td>
</tr>
<tr>
<td class="label"><strong>At least one of these tags</strong></td>
<td>
<textarea name="tags" style="width:100%" rows="2"><?=display_str($N['Tags'])?></textarea>
<textarea name="tags<?=$i?>" style="width:100%" rows="2"><?=display_str($N['Tags'])?></textarea>
<p class="min_padding">Comma-separated list - eg. <em>rock, jazz, pop</em></p>
</td>
</tr>
<tr>
<td class="label"><strong>None of these tags</strong></td>
<td>
<textarea name="nottags" style="width:100%" rows="2"><?=display_str($N['NotTags'])?></textarea>
<textarea name="nottags<?=$i?>" style="width:100%" rows="2"><?=display_str($N['NotTags'])?></textarea>
<p class="min_padding">Comma-separated list - eg. <em>rock, jazz, pop</em></p>
</td>
</tr>
@ -81,7 +82,7 @@
<td class="label"><strong>Only these categories</strong></td>
<td>
<? foreach($Categories as $Category){ ?>
<input type="checkbox" name="categories[]" id="<?=$Category?>_<?=$N['ID']?>" value="<?=$Category?>"<? if(in_array($Category, $N['Categories'])) { echo ' checked="checked"';} ?> />
<input type="checkbox" name="categories<?=$i?>[]" id="<?=$Category?>_<?=$N['ID']?>" value="<?=$Category?>"<? if(in_array($Category, $N['Categories'])) { echo ' checked="checked"';} ?> />
<label for="<?=$Category?>_<?=$N['ID']?>"><?=$Category?></label>
<? } ?>
</td>
@ -90,7 +91,7 @@
<td class="label"><strong>Only these types</strong></td>
<td>
<? foreach($ReleaseTypes as $ReleaseType){ ?>
<input type="checkbox" name="releasetypes[]" id="<?=$ReleaseType?>_<?=$N['ID']?>" value="<?=$ReleaseType?>"<? if(in_array($ReleaseType, $N['ReleaseTypes'])) { echo ' checked="checked"';} ?> />
<input type="checkbox" name="releasetypes<?=$i?>[]" id="<?=$ReleaseType?>_<?=$N['ID']?>" value="<?=$ReleaseType?>"<? if(in_array($ReleaseType, $N['ReleaseTypes'])) { echo ' checked="checked"';} ?> />
<label for="<?=$ReleaseType?>_<?=$N['ID']?>"><?=$ReleaseType?></label>
<? } ?>
</td>
@ -99,7 +100,7 @@
<td class="label"><strong>Only these formats</strong></td>
<td>
<? foreach($Formats as $Format){ ?>
<input type="checkbox" name="formats[]" id="<?=$Format?>_<?=$N['ID']?>" value="<?=$Format?>"<? if(in_array($Format, $N['Formats'])) { echo ' checked="checked"';} ?> />
<input type="checkbox" name="formats<?=$i?>[]" id="<?=$Format?>_<?=$N['ID']?>" value="<?=$Format?>"<? if(in_array($Format, $N['Formats'])) { echo ' checked="checked"';} ?> />
<label for="<?=$Format?>_<?=$N['ID']?>"><?=$Format?></label>
<? } ?>
</td>
@ -108,7 +109,7 @@
<td class="label"><strong>Only these bitrates</strong></td>
<td>
<? foreach($Bitrates as $Bitrate){ ?>
<input type="checkbox" name="bitrates[]" id="<?=$Bitrate?>_<?=$N['ID']?>" value="<?=$Bitrate?>"<? if(in_array($Bitrate, $N['Encodings'])) { echo ' checked="checked"';} ?> />
<input type="checkbox" name="bitrates<?=$i?>[]" id="<?=$Bitrate?>_<?=$N['ID']?>" value="<?=$Bitrate?>"<? if(in_array($Bitrate, $N['Encodings'])) { echo ' checked="checked"';} ?> />
<label for="<?=$Bitrate?>_<?=$N['ID']?>"><?=$Bitrate?></label>
<? } ?>
</td>
@ -117,7 +118,7 @@
<td class="label"><strong>Only these media</strong></td>
<td>
<? foreach($Media as $Medium){ ?>
<input type="checkbox" name="media[]" id="<?=$Medium?>_<?=$N['ID']?>" value="<?=$Medium?>"<? if(in_array($Medium, $N['Media'])) { echo ' checked="checked"';} ?> />
<input type="checkbox" name="media<?=$i?>[]" id="<?=$Medium?>_<?=$N['ID']?>" value="<?=$Medium?>"<? if(in_array($Medium, $N['Media'])) { echo ' checked="checked"';} ?> />
<label for="<?=$Medium?>_<?=$N['ID']?>"><?=$Medium?></label>
<? } ?>
</td>
@ -125,15 +126,15 @@
<tr>
<td class="label"><strong>Between the years</strong></td>
<td>
<input type="text" name="fromyear" value="<?=$N['FromYear']?>" size="6" />
<input type="text" name="fromyear<?=$i?>" value="<?=$N['FromYear']?>" size="6" />
and
<input type="text" name="toyear" value="<?=$N['ToYear']?>" size="6" />
<input type="text" name="toyear<?=$i?>" value="<?=$N['ToYear']?>" size="6" />
</td>
</tr>
<tr>
<td class="label"><strong>Only new releases</strong></td>
<td>
<input type="checkbox" name="newgroupsonly" id="newgroupsonly_<?=$N['ID']?>"<? if($N['NewGroupsOnly']=="1") { echo ' checked="checked"';} ?> />
<input type="checkbox" name="newgroupsonly<?=$i?>" id="newgroupsonly_<?=$N['ID']?>"<? if($N['NewGroupsOnly']=="1") { echo ' checked="checked"';} ?> />
<label for="newgroupsonly_<?=$N['ID']?>">Only notify for new releases, not new formats</label>
</td>
</tr>

View File

@ -2,6 +2,7 @@
if(!check_perms('site_torrents_notify')){ error(403); }
authorize();
$FormID = '';
$ArtistList = '';
$TagList = '';
$NotTagList = '';
@ -14,8 +15,12 @@
$ToYear = 0;
$HasFilter = false;
if($_POST['artists']){
$Artists = explode(',', $_POST['artists']);
if($_POST['formid'] && is_number($_POST['formid'])) {
$FormID = $_POST['formid'];
}
if($_POST['artists'.$FormID]){
$Artists = explode(',', $_POST['artists'.$FormID]);
$ParsedArtists = array();
foreach($Artists as $Artist){
if(trim($Artist) != "") {
@ -28,84 +33,84 @@
}
}
if($_POST['excludeva']){
if($_POST['excludeva'.$FormID]){
$ExcludeVA = '1';
$HasFilter = true;
} else {
$ExcludeVA = '0';
}
if($_POST['newgroupsonly']){
if($_POST['newgroupsonly'.$FormID]){
$NewGroupsOnly = '1';
$HasFilter = true;
} else {
$NewGroupsOnly = '0';
}
if($_POST['tags']){
if($_POST['tags'.$FormID]){
$TagList = '|';
$Tags = explode(',', $_POST['tags']);
$Tags = explode(',', $_POST['tags'.$FormID]);
foreach($Tags as $Tag){
$TagList.=db_string(trim($Tag)).'|';
}
$HasFilter = true;
}
if($_POST['nottags']){
if($_POST['nottags'.$FormID]){
$NotTagList = '|';
$Tags = explode(',', $_POST['nottags']);
$Tags = explode(',', $_POST['nottags'.$FormID]);
foreach($Tags as $Tag){
$NotTagList.=db_string(trim($Tag)).'|';
}
$HasFilter = true;
}
if($_POST['categories']){
if($_POST['categories'.$FormID]){
$CategoryList = '|';
foreach($_POST['categories'] as $Category){
foreach($_POST['categories'.$FormID] as $Category){
$CategoryList.=db_string(trim($Category)).'|';
}
$HasFilter = true;
}
if($_POST['releasetypes']){
if($_POST['releasetypes'.$FormID]){
$ReleaseTypeList = '|';
foreach($_POST['releasetypes'] as $ReleaseType){
foreach($_POST['releasetypes'.$FormID] as $ReleaseType){
$ReleaseTypeList.=db_string(trim($ReleaseType)).'|';
}
$HasFilter = true;
}
if($_POST['formats']){
if($_POST['formats'.$FormID]){
$FormatList = '|';
foreach($_POST['formats'] as $Format){
foreach($_POST['formats'.$FormID] as $Format){
$FormatList.=db_string(trim($Format)).'|';
}
$HasFilter = true;
}
if($_POST['bitrates']){
if($_POST['bitrates'.$FormID]){
$EncodingList = '|';
foreach($_POST['bitrates'] as $Bitrate){
foreach($_POST['bitrates'.$FormID] as $Bitrate){
$EncodingList.=db_string(trim($Bitrate)).'|';
}
$HasFilter = true;
}
if($_POST['media']){
if($_POST['media'.$FormID]){
$MediaList = '|';
foreach($_POST['media'] as $Medium){
foreach($_POST['media'.$FormID] as $Medium){
$MediaList.=db_string(trim($Medium)).'|';
}
$HasFilter = true;
}
if($_POST['fromyear'] && is_number($_POST['fromyear'])){
$FromYear = db_string(trim($_POST['fromyear']));
if($_POST['fromyear'.$FormID] && is_number($_POST['fromyear'.$FormID])){
$FromYear = trim($_POST['fromyear'.$FormID]);
$HasFilter = true;
if($_POST['toyear'] && is_number($_POST['toyear'])) {
$ToYear = db_string(trim($_POST['toyear']));
if($_POST['toyear'.$FormID] && is_number($_POST['toyear'.$FormID])) {
$ToYear = trim($_POST['toyear'.$FormID]);
} else {
$ToYear = date('Y')+3;
}
@ -113,7 +118,7 @@
if(!$HasFilter){
$Err = 'You must add at least one criterion to filter by';
} elseif(!$_POST['label'] && !$_POST['id']) {
} elseif(!$_POST['label'.$FormID] && !$_POST['id'.$FormID]) {
$Err = 'You must add a label for the filter set';
}
@ -127,7 +132,7 @@
$TagList = str_replace('||','|',$TagList);
$NotTagList = str_replace('||','|',$NotTagList);
if($_POST['id'] && is_number($_POST['id'])){
if($_POST['id'.$FormID] && is_number($_POST['id'.$FormID])){
$DB->query("UPDATE users_notify_filters SET
Artists='$ArtistList',
ExcludeVA='$ExcludeVA',
@ -141,16 +146,16 @@
Media='$MediaList',
FromYear='$FromYear',
ToYear='$ToYear'
WHERE ID='".db_string($_POST['id'])."' AND UserID='$LoggedUser[ID]'");
WHERE ID='".$_POST['id'.$FormID]."' AND UserID='$LoggedUser[ID]'");
} else {
$DB->query("INSERT INTO users_notify_filters
(UserID, Label, Artists, ExcludeVA, NewGroupsOnly, Tags, NotTags, ReleaseTypes, Categories, Formats, Encodings, Media, FromYear, ToYear)
VALUES
('$LoggedUser[ID]','".db_string($_POST['label'])."','$ArtistList','$ExcludeVA','$NewGroupsOnly','$TagList', '$NotTagList', '$ReleaseTypeList','$CategoryList','$FormatList','$EncodingList','$MediaList', '$FromYear', '$ToYear')");
('$LoggedUser[ID]','".db_string($_POST['label'.$FormID])."','$ArtistList','$ExcludeVA','$NewGroupsOnly','$TagList', '$NotTagList', '$ReleaseTypeList','$CategoryList','$FormatList','$EncodingList','$MediaList', '$FromYear', '$ToYear')");
}
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
if(($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === FALSE || $Notify['ID'] == $_POST['id']) {
if(($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) !== FALSE && $Notify['ID'] == $_POST['id'.$FormID]) {
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
}
header('Location: user.php?action=notify');

View File

@ -661,6 +661,8 @@ body#index #recommended .head {
body#index #recommended #vanityhouse {
margin-top: 21px;
margin-bottom: 0px;
width: 100%;
}
.hide_torrents a,.show_torrents a {