Empty commit

This commit is contained in:
Git 2013-04-24 08:00:23 +00:00
parent d87697541d
commit 8c49cf9de7
47 changed files with 909 additions and 737 deletions

View File

@ -729,7 +729,7 @@ private function to_html ($Array) {
$Exploded = explode('|', $this->to_html($Block['Attr']));
if (isset($Exploded[1]) && is_numeric($Exploded[1])) {
$PostID = trim($Exploded[1]);
$Str.= '<a href="#" onclick="QuoteJump('.$PostID.'); return false;"><strong class="quoteheader">'.$Exploded[0].'</strong> wrote: </a>';
$Str.='<a href="forums.php?action=viewthread&postid='.$PostID.'" onclick="QuoteJump(event, '.$PostID.'); return false;"><strong class="quoteheader">'.$Exploded[0].'</strong> wrote: </a>';
}
else {
$Str.='<strong class="quoteheader">'.$Exploded[0].'</strong> wrote: ';

View File

@ -108,7 +108,6 @@ function foot() {
$Torrent = $this->Torrent;
?>
</div>
<table cellpadding="3" cellspacing="1" border="0" class="layout border slice" width="100%">
<? if (!$this->NewTorrent) {
if (check_perms('torrents_freeleech')) {
@ -324,7 +323,7 @@ function show() {
echo "</option>\n";
}
?>
</select> Please take the time to fill this out properly (try searching <a href="http://musicbrainz.org/search.html" target="_blank">MusicBrainz</a>).
</select> Please take the time to fill this out properly. Need help? Try reading <a href="wiki.php?action=article&amp;id=202" target="_blank">this wiki article</a> or searching <a href="http://musicbrainz.org/search.html" target="_blank">MusicBrainz</a>.
</td>
</tr>
<? } ?>
@ -347,7 +346,7 @@ function show() {
$LastLine = '';
foreach ($GroupRemasters as $Index => $Remaster) {
$Line = $Remaster['RemasterYear']." / ".$Remaster['RemasterTitle']." / ".$Remaster['RemasterRecordLabel']." / ".$Remaster['RemasterCatalogueNumber'];
$Line = $Remaster['RemasterYear'].' / '.$Remaster['RemasterTitle'].' / '.$Remaster['RemasterRecordLabel'].' / '.$Remaster['RemasterCatalogueNumber'];
if ($Line != $LastLine) {
$LastLine = $Line;
@ -423,10 +422,12 @@ function show() {
<td>
<select id="bitrate" name="bitrate" onchange="Bitrate()">
<option value="">---</option>
<? if ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates)) {
<?
if ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates)) {
$OtherBitrate = true;
if (substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(" (VBR)")) == " (VBR)") {
$Torrent['Bitrate'] = substr($Torrent['Bitrate'], 0, strlen($Torrent['Bitrate'])-6);
if (substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(' (VBR)')) == ' (VBR)') {
$Torrent['Bitrate'] = substr($Torrent['Bitrate'], 0, strlen($Torrent['Bitrate']) - 6);
$VBR = true;
}
} else {
@ -441,7 +442,7 @@ function show() {
foreach (Misc::display_array($this->Bitrates) as $Bitrate) {
echo '<option value="'.$Bitrate.'"';
if (($SimpleBitrate && preg_match('/^'.$SimpleBitrate.'.*/', $Bitrate)) || ($OtherBitrate && $Bitrate == "Other")) {
if (($SimpleBitrate && preg_match('/^'.$SimpleBitrate.'.*/', $Bitrate)) || ($OtherBitrate && $Bitrate == 'Other')) {
echo ' selected="selected"';
}
echo '>';
@ -455,7 +456,7 @@ function show() {
</span>
</td>
</tr>
<?
<?
if ($this->NewTorrent) { ?>
<tr id="upload_logs" class="hidden">
<td class="label">
@ -763,7 +764,6 @@ function simple_form($CategoryID) {
</td>
</tr>
<? } ?>
</table>
<? }//function simple_form
}//class

View File

@ -97,4 +97,18 @@ function check_perms($PermissionName, $MinClass = 0) {
return Permissions::check_perms($PermissionName, $MinClass);
}
/*
* Print json status result with an optional message and die.
*/
function json_die($Status, $Message) {
if ($Status == "success" && $Message) {
print json_encode(array('status' => $Status, 'response' => $Message));
} else if ($Message) {
print json_encode(array('status' => $Status, 'error' => $Message));
} else {
print json_encode(array('status' => $Status));
}
die();
}
?>

View File

@ -73,15 +73,9 @@
}
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'announcements' => $JsonAnnouncements,
'blogPosts' => $JsonBlog
)
)
);
json_die("success", array(
'announcements' => $JsonAnnouncements,
'blogPosts' => $JsonBlog
));
?>

View File

@ -6,14 +6,17 @@ function compare($X, $Y){
// Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/sections/requests/functions.php');
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
if ($_GET['id'] && $_GET['artistname']) {
json_die("failure", "bad parameters");
}
$ArtistID = $_GET['id'];
if (!is_number($ArtistID)) {
print json_encode(array('status' => 'failure'));
die();
if ($ArtistID && !is_number($ArtistID)) {
json_die("failure");
}
if (empty($ArtistID)) {
@ -22,8 +25,7 @@ function compare($X, $Y){
$DB->query("SELECT ArtistID FROM artists_alias WHERE Name LIKE '$Name'");
if (!(list($ArtistID) = $DB->next_record(MYSQLI_NUM, false))) {
//if (list($ID) = $DB->next_record(MYSQLI_NUM, false)) {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
// If we get here, we got the ID!
}
@ -71,7 +73,7 @@ function compare($X, $Y){
$DB->query($sql);
if ($DB->record_count() == 0) {
print json_encode(array('status' => 'failure'));
json_die("failure");
}
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
@ -260,6 +262,16 @@ function compare($X, $Y){
);
}
$NumSimilar = count($SimilarArray);
} else {
//If data already exists, use it
foreach ($SimilarArray as $Similar) {
$JsonSimilar[] = array(
'artistId' => (int) $Similar['ArtistID'],
'name' => $Similar['Name'],
'score' => (int) $Similar['Score'],
'similarId' => (int) $Similar['SimilarID']
);
}
}
$JsonRequests = array();
@ -291,33 +303,6 @@ function compare($X, $Y){
}
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'id' => (int) $ArtistID,
'name' => $Name,
'notificationsEnabled' => $notificationsEnabled,
'hasBookmarked' => Bookmarks::has_bookmarked('artist', $ArtistID),
'image' => $Image,
'body' => $Text->full_format($Body),
'vanityHouse' => $VanityHouseArtist == 1,
'tags' => array_values($Tags),
'similarArtists' => $JsonSimilar,
'statistics' => array(
'numGroups' => $NumGroups,
'numTorrents' => $NumTorrents,
'numSeeders' => $NumSeeders,
'numLeechers' => $NumLeechers,
'numSnatches' => $NumSnatches
),
'torrentgroup' => $JsonTorrents,
'requests' => $JsonRequests
)
)
);
// Cache page for later use
if ($RevisionID) {
@ -329,4 +314,26 @@ function compare($X, $Y){
$Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, array(), array(), $VanityHouseArtist));
$Cache->cache_value($Key, $Data, 3600);
json_die("success", array(
'id' => (int) $ArtistID,
'name' => $Name,
'notificationsEnabled' => $notificationsEnabled,
'hasBookmarked' => has_bookmarked('artist', $ArtistID),
'image' => $Image,
'body' => $Text->full_format($Body),
'vanityHouse' => $VanityHouseArtist == 1,
'tags' => array_values($Tags),
'similarArtists' => $JsonSimilar,
'statistics' => array(
'numGroups' => $NumGroups,
'numTorrents' => $NumTorrents,
'numSeeders' => $NumSeeders,
'numLeechers' => $NumLeechers,
'numSnatches' => $NumSnatches
),
'torrentgroup' => $JsonTorrents,
'requests' => $JsonRequests
));
?>

View File

@ -17,7 +17,7 @@
$_GET['type'] = display_str($_GET['type']);
}
}
$SphQL = new SphinxqlQuery();
$SphQL = new SphinxQL_Query();
$SphQL->select('id, groupid')
->from('better_transcode')
->where('logscore', 100)

View File

@ -515,17 +515,10 @@ function header_link($SortKey,$DefaultWay = 'desc') {
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'results' => array(),
'youMightLike' => $JsonYouMightLike
)
)
);
die();
json_die("success", array(
'results' => array(),
'youMightLike' => $JsonYouMightLike
));
}
$Bookmarks = Bookmarks::all_bookmarks('torrent');
@ -617,6 +610,26 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|| $FirstUnknown
|| $Data['Media'] != $LastMedia) {
$EditionID++;
if ($Data['Remastered'] && $Data['RemasterYear'] != 0) {
$RemasterName = $Data['RemasterYear'];
$AddExtra = " - ";
if ($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; }
if ($Data['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Data['RemasterCatalogueNumber']); $AddExtra=' / '; }
if ($Data['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Data['RemasterTitle']); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Data['Media']);
} else {
$AddExtra = " / ";
if (!$Data['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($Data['Media']);
}
}
$LastRemasterTitle = $Data['RemasterTitle'];
$LastRemasterYear = $Data['RemasterYear'];
@ -696,14 +709,8 @@ function header_link($SortKey,$DefaultWay = 'desc') {
}
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'currentPage' => intval($Page),
'pages' => ceil($TorrentCount / TORRENTS_PER_PAGE),
'results' => $JsonGroups
)
)
);
json_die("success", array(
'currentPage' => intval($Page),
'pages' => ceil($TorrentCount / TORRENTS_PER_PAGE),
'results' => $JsonGroups
));

View File

@ -1,4 +1,7 @@
<?
include(SERVER_ROOT.'/classes/class_bencodetorrent.php');
$TorrentID = $_GET['torrentid'];
if (!is_number($TorrentID)) {
echo('Invalid TorrentID');
@ -24,4 +27,4 @@
} else {
echo '<span style="color: #c00; font-weight: bold;">Public</span>';
}
?>
?>

View File

@ -60,17 +60,16 @@
}
if (!isset($Forums[$ForumID])) {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
// Make sure they're allowed to look at the page
if (!check_perms('site_moderate_forums')) {
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) {
error(403);
}
json_die("failure", "unsufficient permissions to view page");
}
}
if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) {
error(403);
json_die("failure", "unsufficient permissions to view page");
}
$ForumName = display_str($Forums[$ForumID]['Name']);

View File

@ -24,6 +24,7 @@
$DB->query("SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]");
list($ThreadID) = $DB->next_record();
if ($ThreadID) {
//Redirect postid to threadid when necessary.
header("Location: ajax.php?action=forum&type=viewthread&threadid=$ThreadID&postid=$_GET[postid]");
die();
} else {
@ -49,7 +50,7 @@
//---------- Get some data to start processing
// Thread information, constant across all pages
$ThreadInfo = get_thread_info($ThreadID, true, true);
$ThreadInfo = get_thread_info($ThreadID, true, true, true);
$ForumID = $ThreadInfo['ForumID'];
// Make sure they're allowed to look at the page

View File

@ -16,7 +16,7 @@
$Limited_Pages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup');
header('Content-Type: application/json; charset=utf-8');
// Enforce rate limiting everywhere except info.php
if (isset($_GET['action']) && in_array($_GET['action'],$Limited_Pages)) {
if (!$userrequests = $Cache->get_value('ajax_requests_'.$UserID)) {
@ -31,7 +31,7 @@
)
);
die();
json_die("failure", "rate limit exceeded");
} else {
$Cache->increment_value('ajax_requests_'.$UserID);
}
@ -63,6 +63,9 @@
include('checkprivate.php');
break;
// things not yet used on the site
case 'torrent':
require('torrent.php');
break;
case 'torrentgroup':
require('torrentgroup.php');
break;
@ -143,7 +146,7 @@
break;
default:
// If they're screwing around with the query string
print json_encode(array('status' => 'failure'));
json_die("failure");
}
function pullmediainfo($Array) {

View File

@ -91,30 +91,25 @@
$Cache->cache_value('subscriptions_user_new_' . $LoggedUser['ID'], $NewSubscriptions, 0);
}
print json_encode(
array(
'status' => 'success',
'response' => array(
'username' => $LoggedUser['Username'],
'id' => (int)$LoggedUser['ID'],
'authkey' => $LoggedUser['AuthKey'],
'passkey' => $LoggedUser['torrent_pass'],
'notifications' => array(
'messages' => (int) $NewMessages,
'notifications' => (int) $NewNotifications,
'newAnnouncement' => $MyNews < $CurrentNews,
'newBlog' => $MyBlog < $CurrentBlog,
'newSubscriptions' => $NewSubscriptions == 1
),
'userstats' => array(
'uploaded' => (int)$LoggedUser['BytesUploaded'],
'downloaded' => (int)$LoggedUser['BytesDownloaded'],
'ratio' => (float)$Ratio,
'requiredratio' => (float)$LoggedUser['RequiredRatio'],
'class' => $ClassLevels[$LoggedUser['Class']]['Name']
)
)
)
);
json_die("success", array(
'username' => $LoggedUser['Username'],
'id' => (int) $LoggedUser['ID'],
'authkey' => $LoggedUser['AuthKey'],
'passkey' => $LoggedUser['torrent_pass'],
'notifications' => array(
'messages' => (int) $NewMessages,
'notifications' => (int) $NewNotifications,
'newAnnouncement' => $MyNews < $CurrentNews,
'newBlog' => $MyBlog < $CurrentBlog,
'newSubscriptions' => $NewSubscriptions == 1
),
'userstats' => array(
'uploaded' => (int) $LoggedUser['BytesUploaded'],
'downloaded' => (int) $LoggedUser['BytesDownloaded'],
'ratio' => (float) $Ratio,
'requiredratio' => (float) $LoggedUser['RequiredRatio'],
'class' => $ClassLevels[$LoggedUser['Class']]['Name']
)
));
?>

View File

@ -2,13 +2,7 @@
if(!check_perms('site_torrents_notify')) {
print
json_encode(
array(
'status' => 'failure'
)
);
die();
json_die("failure");
}
define('NOTIFICATIONS_PER_PAGE', 50);
@ -96,15 +90,9 @@
}
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'currentPages' => intval($Page),
'pages' => ceil($TorrentCount/NOTIFICATIONS_PER_PAGE),
'numNew' => $NumNew,
'results' => $JsonNotifications
)
)
);
json_die("success", array(
'currentPages' => intval($Page),
'pages' => ceil($TorrentCount / NOTIFICATIONS_PER_PAGE),
'numNew' => $NumNew,
'results' => $JsonNotifications
));

View File

@ -16,14 +16,8 @@
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
if (empty($_GET['id']) || !is_number($_GET['id'])) {
print
json_encode(
array(
'status' => 'failure'
)
);
die();
if(empty($_GET['id']) || !is_number($_GET['id'])) {
json_die("failure");
}
$RequestID = $_GET['id'];
@ -32,14 +26,8 @@
$Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID];
if (empty($Request)) {
print
json_encode(
array(
'status' => 'failure'
)
);
die();
if(empty($Request)) {
json_die("failure");
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType,
@ -99,7 +87,6 @@
$UserCanEdit = (!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2);
$CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests'));
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
$JsonMusicInfo = array(
/*'composers' => $ArtistForm[4] != null ? $ArtistForm[4] : array(),
@ -116,6 +103,8 @@
'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]),
'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7])
);
} else {
$JsonMusicInfo = new stdClass; //json_encodes into an empty object: {}
}
$JsonTopContributors = array();
@ -198,48 +187,42 @@
$JsonTags[] = $Tag;
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'requestId' => (int) $RequestID,
'requestorId' => (int) $RequestorID,
'requestorName' => $RequestorName,
'requestTax' => $RequestTax,
'timeAdded' => $TimeAdded,
'canEdit' => $CanEdit,
'canVote' => $CanVote,
'minimumVote' => $MinimumVote,
'voteCount' => $VoteCount,
'lastVote' => $LastVote,
'topContributors' => $JsonTopContributors,
'totalBounty' => (int) $RequestVotes['TotalBounty'],
'categoryId' => (int) $CategoryID,
'categoryName' => $CategoryName,
'title' => $Title,
'year' => (int) $Year,
'image' => $Image,
'description' => $Text->full_format($Description),
'musicInfo' => $JsonMusicInfo,
'catalogueNumber' => $CatalogueNumber,
'releaseType' => (int) $ReleaseType,
'releaseName' => $ReleaseName,
'bitrateList' => $BitrateList,
'formatList' => $FormatList,
'mediaList' => $MediaList,
'logCue' => $LogCue,
'isFilled' => $IsFilled,
'fillerId' => (int) $FillerID,
'fillerName' => $FillerName,
'torrentId' => (int) $TorrentID,
'timeFilled' => $TimeFilled,
'tags' => $JsonTags,
'comments' => $JsonRequestComments,
'commentPage' => (int) $Page,
'commentPages' => (int) ceil($Results / TORRENT_COMMENTS_PER_PAGE)
)
)
);
json_die("success", array(
'requestId' => (int) $RequestID,
'requestorId' => (int) $RequestorID,
'requestorName' => $RequestorName,
'requestTax' => $RequestTax,
'timeAdded' => $TimeAdded,
'canEdit' => $CanEdit,
'canVote' => $CanVote,
'minimumVote' => $MinimumVote,
'voteCount' => $VoteCount,
'lastVote' => $LastVote,
'topContributors' => $JsonTopContributors,
'totalBounty' => (int) $RequestVotes['TotalBounty'],
'categoryId' => (int) $CategoryID,
'categoryName' => $CategoryName,
'title' => $Title,
'year' => (int) $Year,
'image' => $Image,
'description' => $Text->full_format($Description),
'musicInfo' => $JsonMusicInfo,
'catalogueNumber' => $CatalogueNumber,
'releaseType' => (int) $ReleaseType,
'releaseName' => $ReleaseName,
'bitrateList' => $BitrateList,
'formatList' => $FormatList,
'mediaList' => $MediaList,
'logCue' => $LogCue,
'isFilled' => $IsFilled,
'fillerId' => (int) $FillerID,
'fillerName' => $FillerName,
'torrentId' => (int) $TorrentID,
'timeFilled' => $TimeFilled,
'tags' => $JsonTags,
'comments' => $JsonRequestComments,
'commentPage' => (int) $Page,
'commentPages' => (int) ceil($Results / TORRENT_COMMENTS_PER_PAGE)
));
?>

View File

@ -30,14 +30,12 @@
if (!empty($_GET['userid'])) {
if (is_number($_GET['userid'])) {
if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
$Title = "Requests voted for by ".$UserInfo['Username'];
$SS->set_filter('voter', array($_GET['userid']));
} else {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
} else {
$Title = "Requests I've voted on";
@ -45,13 +43,11 @@
}
break;
case 'filled':
if (empty($_GET['userid']) || !is_number($_GET['userid'])) {
print json_encode(array('status' => 'failure'));
die();
if(empty($_GET['userid']) || !is_number($_GET['userid'])) {
json_die("failure");
} else {
if (!check_paranoia('requestsfilled_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
$Title = "Requests filled by ".$UserInfo['Username'];
$SS->set_filter('fillerid', array($_GET['userid']));
@ -63,8 +59,7 @@
$SS->set_filter('bookmarker', array($LoggedUser['ID']));
break;
default:
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
}
@ -196,8 +191,7 @@
if (is_number($_GET['requestor'])) {
$SS->set_filter('userid', array($_GET['requestor']));
} else {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
}
@ -205,8 +199,7 @@
if (is_number($_GET['year']) || $_GET['year'] == 0) {
$SS->set_filter('year', array($_GET['year']));
} else {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
}
@ -231,12 +224,10 @@
$Way = ($CurrentSort == 'asc' ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC);
$NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
} else {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
} else {
print json_encode(array('status' => 'failure'));
die();
json_die("failure");
}
}
@ -301,17 +292,11 @@
$Requests = $SphinxResults['matches'];
if ($NumResults == 0) {
print json_encode(
array(
'status' => 'success',
'response' => array(
'currentPage' => 1,
'pages' => 1,
'results' => array()
)
)
);
die();
json_die("success", array(
'currentPage' => 1,
'pages' => 1,
'results' => array()
));
} else {
$JsonResults = array();
$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
@ -370,17 +355,10 @@
'timeFilled' => $TimeFilled == 0 ? "" : $TimeFilled
);
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'currentPage' => intval($Page),
'pages' => ceil($NumResults/REQUESTS_PER_PAGE),
'results' => $JsonResults
)
)
);
json_die("success", array(
'currentPage' => intval($Page),
'pages' => ceil($NumResults / REQUESTS_PER_PAGE),
'results' => $JsonResults
));
}
?>

View File

@ -6,13 +6,7 @@
*/
if(!empty($LoggedUser['DisableForums'])) {
print
json_encode(
array(
'status' => 'failure'
)
);
die();
json_die("failure");
}
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
@ -109,13 +103,7 @@
$JsonPosts[] = $JsonPost;
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'threads' => $JsonPosts
)
)
);
json_die("success", array(
'threads' => $JsonPosts
));
?>

View File

@ -79,14 +79,8 @@
);
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'page' => (int) $Page,
'pages' => ceil($Results/TORRENT_COMMENTS_PER_PAGE),
'comments' => $JsonComments
)
)
);
json_die("success", array(
'page' => (int) $Page,
'pages' => ceil($Results / TORRENT_COMMENTS_PER_PAGE),
'comments' => $JsonComments
));

View File

@ -22,7 +22,6 @@
g.ID,
g.Name,
g.CategoryID,
g.wikiImage,
g.TagList,
t.Format,
t.Encoding,
@ -47,117 +46,87 @@
if ($Details == 'all' || $Details == 'day') {
if (!$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) {
$DayAgo = time_minus(86400);
$Query = $BaseQuery.' WHERE t.Seeders>0 AND ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$DayAgo'
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_day_'.$Limit.$WhereSum,$TopTorrentsActiveLastDay,3600*2);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastDay = false;
}
$DayAgo = time_minus(86400);
$Query = $BaseQuery.' WHERE t.Seeders>0 AND ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$DayAgo'
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastDay = $DB->to_array();
$Cache->cache_value('top10tor_day_'.$Limit.$WhereSum,$TopTorrentsActiveLastDay,3600*2);
}
$OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
}
if ($Details == 'all' || $Details == 'week') {
if (!$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) {
$WeekAgo = time_minus(604800);
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$WeekAgo'
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_week_'.$Limit.$WhereSum,$TopTorrentsActiveLastWeek,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastWeek = false;
}
$WeekAgo = time_minus(604800);
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$WeekAgo'
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastWeek = $DB->to_array();
$Cache->cache_value('top10tor_week_'.$Limit.$WhereSum,$TopTorrentsActiveLastWeek,3600*6);
}
$OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
}
if ($Details == 'all' || $Details == 'overall') {
if (!$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
elseif ($Details=='all') { $Query .= " WHERE t.Seeders>500 "; }
$Query .= "
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum,$TopTorrentsActiveAllTime,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveAllTime = false;
}
// IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
elseif ($Details=='all') { $Query .= " WHERE t.Seeders>500 "; }
$Query .= "
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveAllTime = $DB->to_array();
$Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum,$TopTorrentsActiveAllTime,3600*6);
}
$OuterResults[] = generate_torrent_json('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
}
if (($Details == 'all' || $Details == 'snatched') && empty($Where)) {
if (!$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery;
$Query .= "
ORDER BY t.Snatched DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum,$TopTorrentsSnatched,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSnatched = false;
}
$Query = $BaseQuery;
$Query .= "
ORDER BY t.Snatched DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSnatched = $DB->to_array();
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum,$TopTorrentsSnatched,3600*6);
}
$OuterResults[] = generate_torrent_json('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
}
if (($Details == 'all' || $Details == 'data') && empty($Where)) {
if (!$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if ($Details=='all') { $Query .= " WHERE t.Snatched>100 "; }
$Query .= "
ORDER BY Data DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum,$TopTorrentsTransferred,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsTransferred = false;
}
// IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if ($Details=='all') { $Query .= " WHERE t.Snatched>100 "; }
$Query .= "
ORDER BY Data DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsTransferred = $DB->to_array();
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum,$TopTorrentsTransferred,3600*6);
}
$OuterResults[] = generate_torrent_json('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
}
if (($Details == 'all' || $Details == 'seeded') && empty($Where)) {
if (!$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery."
ORDER BY t.Seeders DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum,$TopTorrentsSeeded,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSeeded = false;
}
$Query = $BaseQuery."
ORDER BY t.Seeders DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSeeded = $DB->to_array();
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum,$TopTorrentsSeeded,3600*6);
}
$OuterResults[] = generate_torrent_json('Best Seeded Torrents', 'seeded', $TopTorrentsSeeded, $Limit);
}
@ -174,17 +143,8 @@
function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
global $LoggedUser,$Categories;
$results = array();
if ($Details === false) {
// Failed to get cache lock; server is (hopefully) already processing a top10 request
return array(
'caption' => $Caption,
'tag' => $Tag,
'limit' => (int) $Limit,
'results' => array()
);
}
foreach ($Details as $Detail) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TorrentTags,
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail;

View File

@ -39,7 +39,7 @@
if (!$TopUserUploads = $Cache->get_value('topuser_ul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Uploaded DESC LIMIT $Limit;");
$TopUserUploads = $DB->to_array();
$Cache->cache_value('topuser_ul_'.$Limit,$TopUserUploads,3600 * 12);
$Cache->cache_value('topuser_ul_'.$Limit,$TopUserUploads,3600*12);
}
$OuterResults[] = generate_user_json('Uploaders', 'ul', $TopUserUploads, $Limit);
}
@ -48,7 +48,7 @@
if (!$TopUserDownloads = $Cache->get_value('topuser_dl_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Downloaded DESC LIMIT $Limit;");
$TopUserDownloads = $DB->to_array();
$Cache->cache_value('topuser_dl_'.$Limit,$TopUserDownloads,3600 * 12);
$Cache->cache_value('topuser_dl_'.$Limit,$TopUserDownloads,3600*12);
}
$OuterResults[] = generate_user_json('Downloaders', 'dl', $TopUserDownloads, $Limit);
}
@ -57,7 +57,7 @@
if (!$TopUserNumUploads = $Cache->get_value('topuser_numul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY NumUploads DESC LIMIT $Limit;");
$TopUserNumUploads = $DB->to_array();
$Cache->cache_value('topuser_numul_'.$Limit,$TopUserNumUploads,3600 * 12);
$Cache->cache_value('topuser_numul_'.$Limit,$TopUserNumUploads,3600*12);
}
$OuterResults[] = generate_user_json('Torrents Uploaded', 'numul', $TopUserNumUploads, $Limit);
}
@ -66,7 +66,7 @@
if (!$TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY UpSpeed DESC LIMIT $Limit;");
$TopUserUploadSpeed = $DB->to_array();
$Cache->cache_value('topuser_ulspeed_'.$Limit,$TopUserUploadSpeed,3600 * 12);
$Cache->cache_value('topuser_ulspeed_'.$Limit,$TopUserUploadSpeed,3600*12);
}
$OuterResults[] = generate_user_json('Fastest Uploaders', 'uls', $TopUserUploadSpeed, $Limit);
}
@ -75,7 +75,7 @@
if (!$TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY DownSpeed DESC LIMIT $Limit;");
$TopUserDownloadSpeed = $DB->to_array();
$Cache->cache_value('topuser_dlspeed_'.$Limit,$TopUserDownloadSpeed,3600 * 12);
$Cache->cache_value('topuser_dlspeed_'.$Limit,$TopUserDownloadSpeed,3600*12);
}
$OuterResults[] = generate_user_json('Fastest Downloaders', 'dls', $TopUserDownloadSpeed, $Limit);
}
@ -90,7 +90,7 @@
function generate_user_json($Caption, $Tag, $Details, $Limit) {
$results = array();
foreach ($Details as $Details) {
foreach ($Details as $Detail) {
$results[] = array(
'id' => (int) $Detail['ID'],
'username' => $Detail['Username'],

118
sections/ajax/torrent.php Normal file
View File

@ -0,0 +1,118 @@
<?php
require(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
$GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'RecordLabel', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time', 'VanityHouse');
$TorrentAllowed = array('ID', 'Media', 'Format', 'Encoding', 'Remastered', 'RemasterYear', 'RemasterTitle', 'RemasterRecordLabel', 'RemasterCatalogueNumber', 'Scene', 'HasLog', 'HasCue', 'LogScore', 'FileCount', 'Size', 'Seeders', 'Leechers', 'Snatched', 'FreeTorrent', 'Time', 'Description', 'FileList', 'FilePath', 'UserID', 'Username');
$TorrentID = (int)$_GET['id'];
$TorrentHash = (string)$_GET['hash'];
if ($GroupID && $TorrentHash) {
json_die("failure", "bad parameters");
}
if ($TorrentHash) {
if (!is_valid_torrenthash($TorrentHash)) {
json_die("failure", "bad hash parameter");
} else {
$TorrentID = (int)torrenthash_to_torrentid($TorrentHash);
if (!$TorrentID){
json_die("failure", "bad hash parameter");
}
}
}
if ($TorrentID <= 0) {
json_die("failure", "bad id parameter");
}
$TorrentCache = get_torrent_info($TorrentID, true, 0, true, true);
if (!$TorrentCache) {
json_die("failure", "bad id parameter");
}
list($TorrentDetails, $TorrentList) = $TorrentCache;
$ArtistForm = Artists::get_artist($GroupID);
if($TorrentDetails['CategoryID'] == 0) {
$CategoryName = "Unknown";
} else {
$CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
$JsonMusicInfo = array(
'composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]),
'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]),
'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]),
'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]),
'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]),
'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]),
'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7])
);
}
else {
$JsonMusicInfo = NULL;
}
$JsonTorrentDetails = array(
'wikiBody' => $Text->full_format($TorrentDetails['WikiBody']),
'wikiImage' => $TorrentDetails['WikiImage'],
'id' => (int) $TorrentDetails['ID'],
'name' => $TorrentDetails['Name'],
'year' => (int) $TorrentDetails['Year'],
'recordLabel' => $TorrentDetails['RecordLabel'],
'catalogueNumber' => $TorrentDetails['CatalogueNumber'],
'releaseType' => (int) $TorrentDetails['ReleaseType'],
'categoryId' => (int) $TorrentDetails['CategoryID'],
'categoryName' => $CategoryName,
'time' => $TorrentDetails['Time'],
'vanityHouse' => $TorrentDetails['VanityHouse'] == 1,
'isBookmarked' => has_bookmarked('torrent', $GroupID),
'musicInfo' => $JsonMusicInfo
);
$Torrent = array_pop($TorrentList);
// Convert file list back to the old format
$FileList = explode("\n", $Torrent['FileList']);
foreach ($FileList as &$File) {
$File = Torrents::filelist_old_format($File);
}
unset($File);
$FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']);
$JsonTorrentList[] = array(
'id' => (int) $Torrent['ID'],
'media' => $Torrent['Media'],
'format' => $Torrent['Format'],
'encoding' => $Torrent['Encoding'],
'remastered' => $Torrent['Remastered'] == 1,
'remasterYear' => (int) $Torrent['RemasterYear'],
'remasterTitle' => $Torrent['RemasterTitle'],
'remasterRecordLabel' => $Torrent['RemasterRecordLabel'],
'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'],
'scene' => $Torrent['Scene'] == 1,
'hasLog' => $Torrent['HasLog'] == 1,
'hasCue' => $Torrent['HasCue'] == 1,
'logScore' => (int) $Torrent['LogScore'],
'fileCount' => (int) $Torrent['FileCount'],
'size' => (int) $Torrent['Size'],
'seeders' => (int) $Torrent['Seeders'],
'leechers' => (int) $Torrent['Leechers'],
'snatched' => (int) $Torrent['Snatched'],
'freeTorrent' => $Torrent['FreeTorrent'] == 1,
'time' => $Torrent['Time'],
'description' => $Torrent['Description'],
'fileList' => $FileList,
'filePath' => $Torrent['FilePath'],
'userId' => (int) $Torrent['UserID'],
'username' => $Userinfo['Username']
);
json_die("success", array('group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)));

View File

@ -9,12 +9,33 @@
$TorrentAllowed = array('ID', 'Media', 'Format', 'Encoding', 'Remastered', 'RemasterYear', 'RemasterTitle', 'RemasterRecordLabel', 'RemasterCatalogueNumber', 'Scene', 'HasLog', 'HasCue', 'LogScore', 'FileCount', 'Size', 'Seeders', 'Leechers', 'Snatched', 'FreeTorrent', 'Time', 'Description', 'FileList', 'FilePath', 'UserID', 'Username');
$GroupID = (int)$_GET['id'];
$TorrentHash = (string)$_GET['hash'];
if ($GroupID == 0) {
error('bad id parameter', true);
if ($GroupID && $TorrentHash) {
json_die("failure", "bad parameters");
}
if ($TorrentHash) {
if (!is_valid_torrenthash($TorrentHash)) {
json_die("failure", "bad hash parameter");
} else {
$GroupID = (int)torrenthash_to_groupid($TorrentHash);
if (!$GroupID){
json_die("failure", "bad hash parameter");
}
}
}
if ($GroupID <= 0) {
json_die("failure", "bad id parameter");
}
$TorrentCache = get_group_info($GroupID, true, 0, true, true);
if (!$TorrentCache) {
json_die("failure", "bad id parameter");
}
$TorrentCache = get_group_info($GroupID, true, 0);
list($TorrentDetails, $TorrentList) = $TorrentCache;
$ArtistForm = Artists::get_artist($GroupID);
@ -94,4 +115,4 @@
);
}
print json_encode(array('status' => 'success', 'response' => array('group' => $JsonTorrentDetails, 'torrents' => $JsonTorrentList)));
json_die("success", array('group' => $JsonTorrentDetails, 'torrents' => $JsonTorrentList));

View File

@ -11,11 +11,6 @@
$Image = STATIC_SERVER.'common/noartwork/'.$CategoryIcons[$TorrentDetails['CategoryID']-1];
}
print json_encode(
array(
'status' => 'success',
'response' => array(
'wikiImage' => $Image
)
)
);
json_die("success", array(
'wikiImage' => $Image
));

View File

@ -5,7 +5,9 @@
require(SERVER_ROOT.'/sections/requests/functions.php');
if (empty($_GET['id']) || !is_numeric($_GET['id'])) { error(0); }
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
json_die("failure", "bad id parameter");
}
$UserID = $_GET['id'];
@ -48,10 +50,8 @@
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID
WHERE m.ID = $UserID GROUP BY AuthorID");
//TODO: Handle this more gracefully.
if ($DB->record_count() == 0) { // If user doesn't exist
die();
//header("Location: log.php?search=User+".$UserID);
json_die("failure", "no such user");
}
list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass, $DisableLeech, $JoinDate, $Info, $Avatar, $Country, $Donor, $Warned, $ForumPosts, $InviterID, $DisableInvites, $InviterName, $RatioWatchEnds, $RatioWatchDownload) = $DB->next_record(MYSQLI_NUM, array(9,11));
@ -233,58 +233,60 @@ function check_paranoia_here($Setting) {
$ParanoiaLevelText = 'Very high';
}
//Bugfix for no access time available
if ($LastAccess == "0000-00-00 00:00:00"){
$LastAccess = "";
}
header('Content-Type: text/plain; charset=utf-8');
print json_encode(array('status' => 'success',
'response' => array(
'username' => $Username,
'avatar' => $Avatar,
'isFriend' => $Friend,
'profileText' => $Text->full_format($Info),
'stats' => array(
'joinedDate' => $JoinDate,
'lastAccess' => $LastAccess,
'uploaded' => $Uploaded == null ? null : (int) $Uploaded,
'downloaded' => $Downloaded == null ? null: (int) $Downloaded,
'ratio' => $Ratio,
'requiredRatio' => $RequiredRatio == null ? null : (float) $RequiredRatio
),
'ranks' => array(
'uploaded' => $UploadedRank,
'downloaded' => $DownloadedRank,
'uploads' => $UploadsRank,
'requests' => $RequestRank,
'bounty' => $BountyRank,
'posts' => $PostRank,
'artists' => $ArtistsRank,
'overall' => $OverallRank == null ? 0 : $OverallRank
),
'personal' => array(
'class' => $ClassLevels[$Class]['Name'],
'paranoia' => $ParanoiaLevel,
'paranoiaText' => $ParanoiaLevelText,
'donor' => $Donor == 1,
'warned' => ($Warned != '0000-00-00 00:00:00'),
'enabled' => ($Enabled == '1' || $Enabled == '0' || !$Enabled),
'passkey' => $torrent_pass
),
'community' => array(
'posts' => (int) $ForumPosts,
'torrentComments' => (int)$NumComments,
'collagesStarted' => $NumCollages == null ? null : (int) $NumCollages,
'collagesContrib' => $NumCollageContribs == null ? null : (int) $NumCollageContribs,
'requestsFilled' => $RequestsFilled == null ? null : (int) $RequestsFilled,
'requestsVoted' => $RequestsVoted == null ? null : (int) $RequestsVoted,
'perfectFlacs' => $PerfectFLACs == null ? null : (int) $PerfectFLACs,
'uploaded' => $Uploads == null ? null : (int) $Uploads,
'groups' => $UniqueGroups == null ? null : (int) $UniqueGroups,
'seeding' => $Seeding == null ? null : (int) $Seeding,
'leeching' => $Leeching == null ? null : (int) $Leeching,
'snatched' => $Snatched == null ? null : (int) $Snatched,
'invited' => $Invited == null ? null : (int) $Invited
)
)
)
); // <- He's sad.
json_die("success", array(
'username' => $Username,
'avatar' => $Avatar,
'isFriend' => $Friend,
'profileText' => $Text->full_format($Info),
'stats' => array(
'joinedDate' => $JoinDate,
'lastAccess' => $LastAccess,
'uploaded' => $Uploaded == null ? null : (int) $Uploaded,
'downloaded' => $Downloaded == null ? null : (int) $Downloaded,
'ratio' => $Ratio,
'requiredRatio' => $RequiredRatio == null ? null : (float) $RequiredRatio
),
'ranks' => array(
'uploaded' => $UploadedRank,
'downloaded' => $DownloadedRank,
'uploads' => $UploadsRank,
'requests' => $RequestRank,
'bounty' => $BountyRank,
'posts' => $PostRank,
'artists' => $ArtistsRank,
'overall' => $OverallRank == null ? 0 : $OverallRank
),
'personal' => array(
'class' => $ClassLevels[$Class]['Name'],
'paranoia' => $ParanoiaLevel,
'paranoiaText' => $ParanoiaLevelText,
'donor' => $Donor == 1,
'warned' => ($Warned != '0000-00-00 00:00:00'),
'enabled' => ($Enabled == '1' || $Enabled == '0' || !$Enabled),
'passkey' => $torrent_pass
),
'community' => array(
'posts' => (int) $ForumPosts,
'torrentComments' => (int) $NumComments,
'collagesStarted' => $NumCollages == null ? null : (int) $NumCollages,
'collagesContrib' => $NumCollageContribs == null ? null : (int) $NumCollageContribs,
'requestsFilled' => $RequestsFilled == null ? null : (int) $RequestsFilled,
'requestsVoted' => $RequestsVoted == null ? null : (int) $RequestsVoted,
'perfectFlacs' => $PerfectFLACs == null ? null : (int) $PerfectFLACs,
'uploaded' => $Uploads == null ? null : (int) $Uploads,
'groups' => $UniqueGroups == null ? null : (int) $UniqueGroups,
'seeding' => $Seeding == null ? null : (int) $Seeding,
'leeching' => $Leeching == null ? null : (int) $Leeching,
'snatched' => $Snatched == null ? null : (int) $Snatched,
'invited' => $Invited == null ? null : (int) $Invited
)
));
?>

View File

@ -3,8 +3,9 @@
*>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
**********************************************************************/
if (!empty($_GET['search'])) {
if (empty($_GET['search'])) {
json_die("failure", "no search terms");
} else {
$_GET['username'] = $_GET['search'];
}
@ -46,14 +47,8 @@
);
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'currentPage' => (int) $Page,
'pages' => ceil($NumResults/USERS_PER_PAGE),
'results' => $JsonUsers
)
)
);
json_die("success", array(
'currentPage' => (int) $Page,
'pages' => ceil($NumResults / USERS_PER_PAGE),
'results' => $JsonUsers
));

View File

@ -10,56 +10,32 @@
} elseif ($_GET['name'] != '') { //Retrieve article ID via alias.
$ArticleID = $Alias->to_id($_GET['name']);
} else {
print json_encode(
array(
'status' => 'error',
)
);
die();
json_die("failure");
}
if (!$ArticleID) { //No article found
print json_encode(
array(
'status' => 'not found',
)
);
die();
json_die("failure", "article not found");
}
$Article = $Alias->article($ArticleID, false);
if (!$Article) {
print json_encode(
array(
'status' => 'not found',
)
);
die();
json_die("failure", "article not found");
}
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
if ($Read > $LoggedUser['EffectiveClass']) {
print json_encode(
array(
'status' => 'You must be a higher user class to view this wiki article',
)
);
die();
json_die("failure", "higher user class required to view article");
}
$TextBody = $Text->full_format($Body, false);
print json_encode(
array(
'status' => 'success',
'response' => array(
'title' => $Title,
'bbBody' => $Body,
'body' => $TextBody,
'aliases' => $Aliases,
'authorID' => (int)$AuthorID,
'authorName' => $AuthorName,
'date' => $Date,
'revision' => (int)$Revision
)
));
json_die("success", array(
'title' => $Title,
'bbBody' => $Body,
'body' => $TextBody,
'aliases' => $Aliases,
'authorID' => (int) $AuthorID,
'authorName' => $AuthorName,
'date' => $Date,
'revision' => (int) $Revision
));
?>

View File

@ -528,13 +528,14 @@ function compare($X, $Y) {
<? /* Misc::display_recommend($ArtistID, "artist"); */ ?>
<div class="sidebar">
<? if ($Image) {
$WikiImage = $Image;
if (check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
} ?>
<div class="box box_image">
<div class="head"><strong><?=$Name?></strong></div>
<div style="text-align: center; padding: 10px 0px;">
<img style="max-width: 220px;" src="<?=ImageTools::thumbnail($Image)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=$Image?>',220);" />
<img style="max-width: 220px;" src="<?=ImageTools::thumbnail($WikiImage)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=$WikiImage?>',220);" />
</div>
</div>
<? } ?>

View File

@ -0,0 +1,44 @@
<?
function can_bookmark($Type) {
return in_array($Type, array('torrent', 'artist', 'collage', 'request'));
}
// Recommended usage:
// list($Table, $Col) = bookmark_schema('torrent');
function bookmark_schema($Type) {
switch ($Type) {
case 'torrent':
return array('bookmarks_torrents', 'GroupID');
break;
case 'artist':
return array('bookmarks_artists', 'ArtistID');
break;
case 'collage':
return array('bookmarks_collages', 'CollageID');
break;
case 'request':
return array('bookmarks_requests', 'RequestID');
break;
default:
die('HAX');
}
}
function has_bookmarked($Type, $ID) {
return in_array($ID, all_bookmarks($Type));
}
function all_bookmarks($Type, $UserID = false) {
global $DB, $Cache, $LoggedUser;
if ($UserID === false) { $UserID = $LoggedUser['ID']; }
$CacheKey = 'bookmarks_'.$Type.'_'.$UserID;
if(($Bookmarks = $Cache->get_value($CacheKey)) === FALSE) {
list($Table, $Col) = bookmark_schema($Type);
$DB->query("SELECT $Col FROM $Table WHERE UserID = '$UserID'");
$Bookmarks = $DB->collect($Col);
$Cache->cache_value($CacheKey, $Bookmarks, 0);
}
return $Bookmarks;
}
?>

View File

@ -338,7 +338,7 @@
<li id="r2.3.9"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.9">2.3.9.</a> <strong>All lossless analog rips should include clear information about source lineage.</strong> All lossless SACD digital layer analog rips and vinyl rips must include clear information about recording equipment used (see <a href="#h2.8">2.8</a>). If you used a USB turntable for a vinyl rip, clearly indicate this in your lineage information. Also include all intermediate steps up to lossless encoding, such as the program used for mastering, sound card used, etc. Lossless analog rips missing rip information can be trumped by better documented lossless analog rips of equal or better quality. In order to trump a lossless analog rip without a lineage, this lineage must be included as a .txt or .log file within the new torrent.</li>
<li id="r2.3.10"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.10">2.3.10.</a> <strong>All lossless soundboard recordings must include clear information about source lineage.</strong> This information should be displayed in the torrent description. Optionally, the uploader may include the information in a .txt or .log file within the torrent. Lossless soundboard recordings missing lineage information will be deleted if reported (see <a href="#r2.6.7">2.6.7</a>).</li>
<li id="r2.3.11"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.11">2.3.11.</a> <strong>File names must accurately reflect the song titles.</strong> You may not have file names like 01track.mp3, 02track.mp3, etc. Torrents containing files that are named with incorrect song titles can be trumped by properly labeled torrents. Also, torrents that are sourced from the scene but do not have the Scene label must comply with site naming rules (no release group names in the file names, no advertisements in the file names, etc.). Note that these must be substantial improvements such as the removal of garbage characters. Small changes such as diacritical marks are insufficient grounds for trumping. English translations of song titles in file names are encouraged, but not necessary for foreign language song titles. If all the letters in the track titles are capitalized, the torrent is trumpable. Exceptions: Rare albums featuring no track listing or untitled tracks may have file names like 01track.mp3, 02track.mp3, and so forth. Please note this tracklist in the Album description. If foreign language characters create playback problems for some systems and cannot be coherently translated, file names such as "01track" are acceptable for those few cases.</li>
<li id="r2.3.12"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.12">2.3.12.</a> <strong>The maximum character length for audio files is 180 characters.</strong> Path length values must not be so long that they cause incompatibility problems with operating systems and media players. For example, "My Artist Name - My Album Name (2012) - FLAC/01 - Long Track Name for the First Track.flac" is a typical torrent folder that contains the audio files. This path name consists of 91 characters. As of September 01, 2012, new torrents will be trumpable if their path lengths exceed 180 characters. This limit includes the number of characters in the main torrent folder (in this case, 46 characters) and any sub-folders and audio files within that torrent folder. For example, unnecessary nested folders will count towards this limit; and lengthy classical music file names will count towards this limit. Torrents that were uploaded prior to September 01, 2012 with character lengths that are longer than 180 characters may remain on the site. However, torrents with exceedingly long path lengths will only remain on the site at the discretion of staff.</li>
<li id="r2.3.12"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.12">2.3.12.</a> <strong>The maximum character length for audio files is 180 characters.</strong> Path length values must not be so long that they cause incompatibility problems with operating systems and media players. For example, "My Artist Name - My Album Name (2012) - FLAC/01 - Long Track Name for the First Track.flac" is a typical torrent folder that contains the audio files. This path name consists of 90 characters. As of September 01, 2012, new torrents will be trumpable if their path lengths exceed 180 characters. This limit includes the number of characters in the main torrent folder (in this case, 46 characters) and any sub-folders and audio files within that torrent folder. For example, unnecessary nested folders will count towards this limit; and lengthy classical music file names will count towards this limit. Torrents that were uploaded prior to September 01, 2012 with character lengths that are longer than 180 characters may remain on the site. However, torrents with exceedingly long path lengths will only remain on the site at the discretion of staff.</li>
<li id="r2.3.13"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.13">2.3.13.</a> <strong>Track numbers are required in file names (e.g., "01 - TrackName.mp3").</strong> If a torrent without track numbers in the file names is uploaded, then a torrent with the track numbers in the file names can take its place. When formatted properly, file names will sort in order by track number or playing order. Also see <a href="#r2.3.14">2.3.14</a>. Exception: Track numbers are not required for single-track torrents.</li>
<li id="r2.3.14"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.14">2.3.14.</a> <strong>When formatted properly, file names will alphabetically sort into the original playing order of the release.</strong>
<ul>

View File

@ -27,13 +27,13 @@
die();
}
if (substr($_REQUEST['action'],0,7) == 'sandbox' && !isset($argv[1])) {
if (substr($_REQUEST['action'], 0, 7) == 'sandbox' && !isset($argv[1])) {
if (!check_perms('site_debug')) {
error(403);
}
}
if (substr($_REQUEST['action'],0,12) == 'update_geoip' && !isset($argv[1])) {
if (substr($_REQUEST['action'], 0, 12) == 'update_geoip' && !isset($argv[1])) {
if (!check_perms('site_debug')) {
error(403);
}
@ -45,7 +45,7 @@
include(SERVER_ROOT.'/classes/class_feed.php');
$Feed = new FEED;
switch ($_REQUEST['action']){
switch ($_REQUEST['action']) {
case 'phpinfo':
if (!check_perms('site_debug')) {
error(403);
@ -125,7 +125,7 @@
if (!check_perms('admin_manage_news')) {
error(403);
}
if (is_number($_POST['newsid'])){
if (is_number($_POST['newsid'])) {
$DB->query("UPDATE news
SET Title='".db_string($_POST['title'])."',
Body='".db_string($_POST['body'])."'
@ -140,7 +140,7 @@
if (!check_perms('admin_manage_news')) {
error(403);
}
if (is_number($_GET['id'])){
if (is_number($_GET['id'])) {
authorize();
$DB->query("DELETE FROM news WHERE ID='".db_string($_GET['id'])."'");
$Cache->delete_value('news');

View File

@ -1,12 +1,16 @@
<?
if(!check_perms('admin_manage_ipbans')) { error(403); }
if (!check_perms('admin_manage_ipbans')) {
error(403);
}
if (isset($_POST['submit'])) {
authorize();
$IPA = substr($_POST['start'], 0, strcspn($_POST['start'], '.'));
if ($_POST['submit'] == 'Delete') { //Delete
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
$DB->query('DELETE FROM ip_bans WHERE ID='.$_POST['id']);
$Cache->delete_value('ip_bans_'.$IPA);
} else { //Edit & Create, Shared Validation
@ -14,14 +18,16 @@
$Val->SetFields('end', '1','regex','You must include the ending IP address.',array('regex'=>'/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/i'));
$Val->SetFields('notes', '1','string','You must include the reason for the ban.');
$Err=$Val->ValidateForm($_POST); // Validate the form
if($Err){ error($Err); }
if ($Err) {
error($Err);
}
$Notes = db_string($_POST['notes']);
$Start = Tools::ip_to_unsigned($_POST['start']); //Sanitized by Validation regex
$End = Tools::ip_to_unsigned($_POST['end']); //See above
if($_POST['submit'] == 'Edit'){ //Edit
if(empty($_POST['id']) || !is_number($_POST['id'])) {
if ($_POST['submit'] == 'Edit') { //Edit
if (empty($_POST['id']) || !is_number($_POST['id'])) {
error(404);
}
$DB->query("UPDATE ip_bans SET
@ -43,11 +49,11 @@
$sql = "SELECT SQL_CALC_FOUND_ROWS ID, FromIP, ToIP, Reason FROM ip_bans AS i ";
if(!empty($_REQUEST['notes'])) {
if (!empty($_REQUEST['notes'])) {
$sql .= "WHERE Reason LIKE '%".db_string($_REQUEST['notes'])."%' ";
}
if(!empty($_REQUEST['ip']) && preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $_REQUEST['ip'])) {
if (!empty($_REQUEST['ip']) && preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $_REQUEST['ip'])) {
if (!empty($_REQUEST['notes'])) {
$sql .= "AND '".Tools::ip_to_unsigned($_REQUEST['ip'])."' BETWEEN FromIP AND ToIP ";
} else {

View File

@ -1,27 +1,37 @@
<?
if(!check_perms('admin_dnu')) { error(403); }
if (!check_perms('admin_dnu')) {
error(403);
}
authorize();
if($_POST['submit'] == 'Delete'){ //Delete
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
if ($_POST['submit'] == 'Delete') { //Delete
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
$DB->query('DELETE FROM do_not_upload WHERE ID='.$_POST['id']);
} else { //Edit & Create, Shared Validation
$Val->SetFields('name', '1','string','The name must be set, and has a max length of 40 characters', array('maxlength'=>40, 'minlength'=>1));
$Val->SetFields('comment', '0','string','The description has a max length of 255 characters', array('maxlength'=>255));
$Err=$Val->ValidateForm($_POST); // Validate the form
if($Err){ error($Err); }
$Err = $Val->ValidateForm($_POST); // Validate the form
if ($Err) {
error($Err);
}
$P=array();
$P=db_array($_POST); // Sanitize the form
$P = array();
$P = db_array($_POST); // Sanitize the form
if($_POST['submit'] == 'Edit'){ //Edit
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
$DB->query("UPDATE do_not_upload SET
Name='$P[name]',
Comment='$P[comment]',
UserID='$LoggedUser[ID]',
Time='".sqltime()."'
if ($_POST['submit'] == 'Edit') { //Edit
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
$DB->query("
UPDATE do_not_upload
SET
Name='$P[name]',
Comment='$P[comment]',
UserID='$LoggedUser[ID]',
Time='".sqltime()."'
WHERE ID='$P[id]'");
} else { //Create
$DB->query("INSERT INTO do_not_upload

View File

@ -1,15 +1,18 @@
<?
if(!check_perms('admin_dnu')) { error(403); }
if (!check_perms('admin_dnu')) {
error(403);
}
View::show_header('Manage do not upload list');
$DB->query("SELECT
d.ID,
d.Name,
d.Comment,
d.UserID,
d.Time
View::show_header('Manage "Do Not Upload" list');
$DB->query("
SELECT
d.ID,
d.Name,
d.Comment,
d.UserID,
d.Time
FROM do_not_upload as d
LEFT JOIN users_main AS um ON um.ID=d.UserID
LEFT JOIN users_main AS um ON um.ID=d.UserID
ORDER BY d.Time DESC");
?>
<div class="header">
@ -22,7 +25,7 @@
<td>Added</td>
<td>Submit</td>
</tr>
<? while(list($ID, $Name, $Comment, $UserID, $DNUTime) = $DB->next_record()){ ?>
<? while (list($ID, $Name, $Comment, $UserID, $DNUTime) = $DB->next_record()) { ?>
<tr>
<form class="manage_form dnu" action="tools.php" method="post">
<td>
@ -44,7 +47,7 @@
</td>
</form>
</tr>
<? } ?>
<? } ?>
<tr class="colhead">
<td colspan="4">Add Do Not Upload</td>
</tr>

View File

@ -1,10 +1,14 @@
<?
authorize();
if(!check_perms('admin_manage_forums')) { error(403); }
if (!check_perms('admin_manage_forums')) {
error(403);
}
$P = db_array($_POST);
if($_POST['submit'] == 'Delete'){ //Delete
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
if ($_POST['submit'] == 'Delete') { //Delete
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
$DB->query('DELETE FROM forums WHERE ID='.$_POST['id']);
} else { //Edit & Create, Shared Validation
$Val->SetFields('name', '1','string','The name must be set, and has a max length of 40 characters', array('maxlength'=>40, 'minlength'=>1));
@ -14,36 +18,42 @@
$Val->SetFields('minclassread', '1','number','MinClassRead must be set');
$Val->SetFields('minclasswrite', '1','number','MinClassWrite must be set');
$Val->SetFields('minclasscreate', '1','number','MinClassCreate must be set');
$Err=$Val->ValidateForm($_POST); // Validate the form
if($Err){ error($Err); }
$Err = $Val->ValidateForm($_POST); // Validate the form
if ($Err) {
error($Err);
}
if($P['minclassread'] > $LoggedUser['Class'] || $P['minclasswrite'] > $LoggedUser['Class'] || $P['minclasscreate'] > $LoggedUser['Class']) {
if ($P['minclassread'] > $LoggedUser['Class'] || $P['minclasswrite'] > $LoggedUser['Class'] || $P['minclasscreate'] > $LoggedUser['Class']) {
error(403);
}
$P['autolock'] = isset($_POST['autolock'])?'1':'0';
$P['autolock'] = isset($_POST['autolock']) ? '1' : '0';
if($_POST['submit'] == 'Edit'){ //Edit
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
$DB->query("SELECT MinClassRead FROM forums WHERE ID=".$P['id']);
if($DB->record_count() < 1) {
if ($_POST['submit'] == 'Edit') { //Edit
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
$DB->query('SELECT MinClassRead FROM forums WHERE ID=' . $P['id']);
if ($DB->record_count() < 1) {
error(404);
} else {
list($MinClassRead) = $DB->next_record();
if($MinClassRead > $LoggedUser['Class']) {
if ($MinClassRead > $LoggedUser['Class']) {
error(403);
}
}
$DB->query("UPDATE forums SET
Sort='$P[sort]',
CategoryID='$P[categoryid]',
Name='$P[name]',
Description='$P[description]',
MinClassRead='$P[minclassread]',
MinClassWrite='$P[minclasswrite]',
MinClassCreate='$P[minclasscreate]',
AutoLock='$P[autolock]',
AutoLockWeeks='$P[autolockweeks]'
$DB->query("
UPDATE forums
SET
Sort='$P[sort]',
CategoryID='$P[categoryid]',
Name='$P[name]',
Description='$P[description]',
MinClassRead='$P[minclassread]',
MinClassWrite='$P[minclasswrite]',
MinClassCreate='$P[minclasscreate]',
AutoLock='$P[autolock]',
AutoLockWeeks='$P[autolockweeks]'
WHERE ID='$P[id]'");
} else { //Create
$DB->query("INSERT INTO forums

View File

@ -1,15 +1,19 @@
<?
enforce_login();
if(!check_perms('admin_manage_news')){ error(403); }
if (!check_perms('admin_manage_news')) {
error(403);
}
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
View::show_header('Manage news','bbcode');
switch($_GET['action']) {
switch ($_GET['action']) {
case 'takeeditnews':
if(!check_perms('admin_manage_news')){ error(403); }
if(is_number($_POST['newsid'])){
if (!check_perms('admin_manage_news')) {
error(403);
}
if (is_number($_POST['newsid'])) {
authorize();
$DB->query("UPDATE news SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."' WHERE ID='".db_string($_POST['newsid'])."'");
@ -19,34 +23,34 @@
header('Location: index.php');
break;
case 'editnews':
if(is_number($_GET['id'])){
$NewsID = $_GET['id'];
$DB->query("SELECT Title, Body FROM news WHERE ID=$NewsID");
list($Title, $Body) = $DB->next_record();
}
if (is_number($_GET['id'])) {
$NewsID = $_GET['id'];
$DB->query("SELECT Title, Body FROM news WHERE ID=$NewsID");
list($Title, $Body) = $DB->next_record();
}
}
?>
<div class="thin">
<div class="header">
<h2><?= ($_GET['action'] == 'news')? 'Create a news post' : 'Edit news post';?></h2>
<h2><?= ($_GET['action'] == 'news') ? 'Create a news post' : 'Edit news post';?></h2>
</div>
<form class="<?= ($_GET['action'] == 'news')? 'create_form' : 'edit_form';?>" name="news_post" action="tools.php" method="post">
<form class="<?= ($_GET['action'] == 'news') ? 'create_form' : 'edit_form';?>" name="news_post" action="tools.php" method="post">
<div class="box pad">
<input type="hidden" name="action" value="<?= ($_GET['action'] == 'news')? 'takenewnews' : 'takeeditnews';?>" />
<input type="hidden" name="action" value="<?= ($_GET['action'] == 'news') ? 'takenewnews' : 'takeeditnews';?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<? if($_GET['action'] == 'editnews'){?>
<? if ($_GET['action'] == 'editnews') { ?>
<input type="hidden" name="newsid" value="<?=$NewsID; ?>" />
<? }?>
<? } ?>
<h3>Title</h3>
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> />
<input type="text" name="title" size="95" <? if (!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> />
<!-- Why did someone add this? <input type="datetime" name="datetime" value="<?=sqltime()?>" /> -->
<br />
<h3>Body</h3>
<textarea name="body" cols="95" rows="15"><? if(!empty($Body)) { echo display_str($Body); } ?></textarea> <br /><br />
<textarea name="body" cols="95" rows="15"><? if (!empty($Body)) { echo display_str($Body); } ?></textarea> <br /><br />
<div class="center">
<input type="submit" value="<?= ($_GET['action'] == 'news')? 'Create news post' : 'Edit news post';?>" />
<input type="submit" value="<?= ($_GET['action'] == 'news') ? 'Create news post' : 'Edit news post';?>" />
</div>
</div>
</form>
@ -54,8 +58,8 @@
<h2>News archive</h2>
<?
$DB->query("SELECT n.ID,n.Title,n.Body,n.Time FROM news AS n ORDER BY n.Time DESC");// LIMIT 20
while(list($NewsID,$Title,$Body,$NewsTime)=$DB->next_record()) {
$DB->query('SELECT n.ID,n.Title,n.Body,n.Time FROM news AS n ORDER BY n.Time DESC');// LIMIT 20
while (list($NewsID, $Title, $Body, $NewsTime) = $DB->next_record()) {
?>
<div class="box vertical_space">
<div class="head">
@ -63,7 +67,6 @@
- <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>" class="brackets">Edit</a>
<a href="tools.php?action=deletenews&amp;id=<?=$NewsID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
</div>
<div class="pad"><?=$Text->full_format($Body) ?></div>
</div>
<? } ?>

View File

@ -2,24 +2,25 @@
//******************************************************************************//
//--------------- Delete a recommendation --------------------------------------//
if(!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')){
if (!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')) {
error(403);
}
$GroupID=$_GET['groupid'];
if(!$GroupID || !is_number($GroupID)) { error(404); }
$GroupIDi = $_GET['groupid'];
if (!$GroupID || !is_number($GroupID)) {
error(404);
}
if(!check_perms('site_manage_recommendations')){
if (!check_perms('site_manage_recommendations')) {
$DB->query("SELECT UserID FROM torrents_recommended WHERE GroupID='$GroupID'");
list($UserID) = $DB->next_record();
if($UserID != $LoggedUser['ID']){
if ($UserID != $LoggedUser['ID']) {
error(403);
}
}
$DB->query("DELETE FROM torrents_recommended WHERE GroupID='$GroupID'");
$Cache->delete_value('recommend');
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

View File

@ -3,7 +3,7 @@
if (!check_perms('users_view_invites') && !check_perms('users_disable_users') && !check_perms('users_edit_invites') && !check_perms('users_disable_any')) {
error(404);
}
View::show_header("Manipulate Invite Tree");
View::show_header('Manipulate Invite Tree');
if ($_POST['id']) {
authorize();
@ -19,17 +19,22 @@
$Comment .= "\n" . "Manipulate Tree used by " . $LoggedUser['Username'];
}
$UserID = $_POST['id'];
$DB->query("SELECT
t1.TreePosition,
t1.TreeID,
t1.TreeLevel,
(SELECT
t2.TreePosition FROM invite_tree AS t2
WHERE TreeID=t1.TreeID AND TreeLevel=t1.TreeLevel AND t2.TreePosition>t1.TreePosition
ORDER BY TreePosition LIMIT 1
) AS MaxPosition
FROM invite_tree AS t1
WHERE t1.UserID=$UserID");
$DB->query("
SELECT
t1.TreePosition,
t1.TreeID,
t1.TreeLevel,
( SELECT
t2.TreePosition
FROM invite_tree AS t2
WHERE TreeID=t1.TreeID
AND TreeLevel=t1.TreeLevel
AND t2.TreePosition>t1.TreePosition
ORDER BY TreePosition
LIMIT 1
) AS MaxPosition
FROM invite_tree AS t1
WHERE t1.UserID=$UserID");
list ($TreePosition, $TreeID, $TreeLevel, $MaxPosition) = $DB->next_record();
if (!$MaxPosition) {
$MaxPosition = 1000000;
@ -39,12 +44,12 @@
}
$DB->query("
SELECT
UserID
UserID
FROM invite_tree
WHERE TreeID=$TreeID
AND TreePosition>$TreePosition
AND TreePosition<$MaxPosition
AND TreeLevel>$TreeLevel
AND TreePosition>$TreePosition
AND TreePosition<$MaxPosition
AND TreeLevel>$TreeLevel
ORDER BY TreePosition");
$BanList = array();
@ -77,11 +82,11 @@
?>
<div class="thin">
<? if($Msg) { ?>
<? if ($Msg) { ?>
<div class="center">
<p style="color: red; text-align: center;"><?=$Msg?></p>
</div>
<? } ?>
<? } ?>
<form class="manage_form" name="user" action="" method="post">
<input type="hidden" id="action" name="action" value="manipulate_tree" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
@ -94,21 +99,20 @@
</tr>
<tr>
<td class="label"><strong>Action: </strong></td>
<td colspan="2"><select name="perform">
<option value="nothing"
<? if($_POST['perform']==='nothing'){echo ' selected="selected"';}?>>Do
nothing</option>
<option value="disable"
<? if($_POST['perform']==='disable'){echo ' selected="selected"';}?>>Disable
entire tree</option>
<option value="inviteprivs"
<? if($_POST['perform']==='inviteprivs'){echo ' selected="selected"';}?>>Disable
invites privileges</option>
</select></td>
<td colspan="2">
<select name="perform">
<option value="nothing"<?
if ($_POST['perform'] === 'nothing') { echo ' selected="selected"'; } ?>>Do nothing</option>
<option value="disable"<?
if ($_POST['perform'] === 'disable') { echo ' selected="selected"'; } ?>>Disable entire tree</option>
<option value="inviteprivs"<?
if ($_POST['perform'] === 'inviteprivs') { echo ' selected="selected"'; } ?>>Disable invites privileges</option>
</select>
</td>
<td align="left"><input type="submit" value="Go" /></td>
</tr>
</table>
</form>
</div>
<? View::show_footer(); ?>
<? View::show_footer(); ?>

View File

@ -148,7 +148,7 @@ function compare($X, $Y) {
?>
<li class="artists_composers">
<?=Artists::display_artist($Artist).' &lrm;'?>
<? if (check_perms('torrents_edit')){
<? if (check_perms('torrents_edit')) {
$DB->query("SELECT AliasID FROM artists_alias WHERE ArtistID = ".$Artist['id']." AND ArtistID != AliasID AND Name = '".db_string($Artist['name'])."'");
list($AliasID) = $DB->next_record();
if (empty($AliasID)) {
@ -167,7 +167,7 @@ function compare($X, $Y) {
?>
<li class="artists_dj">
<?=Artists::display_artist($Artist).' &lrm;'?>
<? if (check_perms('torrents_edit')){
<? if (check_perms('torrents_edit')) {
$DB->query("SELECT AliasID FROM artists_alias WHERE ArtistID = ".$Artist['id']." AND ArtistID != AliasID AND Name = '".db_string($Artist['name'])."'");
list($AliasID) = $DB->next_record();
if (empty($AliasID)) {
@ -190,7 +190,7 @@ function compare($X, $Y) {
?>
<li class="artist_main">
<?=Artists::display_artist($Artist).' &lrm;'?>
<? if (check_perms('torrents_edit')){
<? if (check_perms('torrents_edit')) {
$AliasID = $Artist['aliasid'];
if (empty($AliasID)) {
$AliasID = $Artist['id'];
@ -208,7 +208,7 @@ function compare($X, $Y) {
?>
<li class="artist_guest">
<?=Artists::display_artist($Artist).' &lrm;'?>
<? if (check_perms('torrents_edit')){
<? if (check_perms('torrents_edit')) {
$DB->query("SELECT AliasID FROM artists_alias WHERE ArtistID = ".$Artist['id']." AND ArtistID != AliasID AND Name = '".db_string($Artist['name'])."'");
list($AliasID) = $DB->next_record();
if (empty($AliasID)) {
@ -228,7 +228,7 @@ function compare($X, $Y) {
?>
<li class="artists_conductors">
<?=Artists::display_artist($Artist).' &lrm;'?>
<? if (check_perms('torrents_edit')){
<? if (check_perms('torrents_edit')) {
$DB->query("SELECT AliasID FROM artists_alias WHERE ArtistID = ".$Artist['id']." AND ArtistID != AliasID AND Name = '".db_string($Artist['name'])."'");
list($AliasID) = $DB->next_record();
if (empty($AliasID)) {
@ -248,7 +248,7 @@ function compare($X, $Y) {
?>
<li class="artists_remix">
<?=Artists::display_artist($Artist).' &lrm;'?>
<? if (check_perms('torrents_edit')){
<? if (check_perms('torrents_edit')) {
$DB->query("SELECT AliasID FROM artists_alias WHERE ArtistID = ".$Artist['id']." AND ArtistID != AliasID AND Name = '".db_string($Artist['name'])."'");
list($AliasID) = $DB->next_record();
if (empty($AliasID)) {

View File

@ -1,10 +1,12 @@
<?
if(!isset($_GET['torrentid']) || !is_number($_GET['torrentid']) || !check_perms('site_view_torrent_snatchlist')) { error(404); }
if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid']) || !check_perms('site_view_torrent_snatchlist')) {
error(404);
}
$TorrentID = $_GET['torrentid'];
if(!empty($_GET['page']) && is_number($_GET['page'])) {
if (!empty($_GET['page']) && is_number($_GET['page'])) {
$Page = $_GET['page'];
$Limit = (string)(($Page-1)*100) .', 100';
$Limit = (string)(($Page - 1) * 100) .', 100';
} else {
$Page = 1;
$Limit = 100;
@ -12,20 +14,21 @@
$DB->query("SELECT SQL_CALC_FOUND_ROWS
$DB->query("
SELECT SQL_CALC_FOUND_ROWS
ud.UserID,
ud.Time
FROM users_downloads AS ud
WHERE ud.TorrentID='$TorrentID'
ORDER BY ud.Time DESC
LIMIT $Limit");
FROM users_downloads AS ud
WHERE ud.TorrentID='$TorrentID'
ORDER BY ud.Time DESC
LIMIT $Limit");
$UserIDs = $DB->collect('UserID');
$Results = $DB->to_array('UserID', MYSQLI_ASSOC);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($NumResults) = $DB->next_record();
if(count($UserIDs)>0) {
if (count($UserIDs) > 0) {
$UserIDs = implode(',',$UserIDs);
$DB->query("SELECT uid FROM xbt_snatched WHERE fid='$TorrentID' AND uid IN($UserIDs)");
$Snatched = $DB->to_array('uid');
@ -37,7 +40,7 @@
?>
<h4 title="List of users that have clicked the &quot;DL&quot; button">List of Downloaders</h4>
<? if($NumResults>100) { ?>
<? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_downloads', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>
<table>
@ -53,18 +56,18 @@
$i = 0;
foreach($Results as $ID=>$Data) {
foreach ($Results as $ID=>$Data) {
list($SnatcherID, $Timestamp) = array_values($Data);
$User = Users::format_username($SnatcherID, true, true, true, true);
if(!array_key_exists($SnatcherID, $Snatched) && $SnatcherID!=$UserID) {
if (!array_key_exists($SnatcherID, $Snatched) && $SnatcherID != $UserID) {
$User = '<span style="font-style: italic;">'.$User.'</span>';
if(array_key_exists($SnatcherID, $Seeding)) {
if (array_key_exists($SnatcherID, $Seeding)) {
$User = '<strong>'.$User.'</strong>';
}
}
if($i % 2 == 0 && $i>0){ ?>
if ($i % 2 == 0 && $i > 0) { ?>
</tr>
<tr>
<?
@ -78,6 +81,6 @@
?>
</tr>
</table>
<? if($NumResults>100) { ?>
<? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_downloads', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>

View File

@ -1,7 +1,7 @@
<?
include(SERVER_ROOT.'/sections/requests/functions.php'); // get_request_tags()
function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProperties = true) {
function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProperties = true, $ApiCall = false) {
global $Cache, $DB;
if (!$RevisionID) {
$TorrentCache = $Cache->get_value('torrents_details_'.$GroupID);
@ -123,9 +123,11 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
t.ID");
$TorrentList = $DB->to_array('ID', MYSQLI_ASSOC);
if (count($TorrentList) == 0) {
if (count($TorrentList) == 0 && $ApiCall == false) {
header("Location: log.php?search=".(empty($_GET['torrentid']) ? "Group+$GroupID" : "Torrent+$_GET[torrentid]"));
die();
} else if (count($TorrentList) == 0 && $ApiCall == true) {
return NULL;
}
if (in_array(0, $DB->collect('Seeders'))) {
$CacheTime = 600;
@ -154,6 +156,27 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
}
}
function get_torrent_info($TorrentID, $Return = true, $RevisionID = 0, $PersonalProperties = true, $ApiCall = false) {
global $Cache, $DB;
$GroupID = (int)torrentid_to_groupid($TorrentID);
$GroupInfo = get_group_info($GroupID, $Return, $RevisionID, $PersonalProperties, $ApiCall);
if ($GroupInfo) {
foreach ($GroupInfo[1] as &$Torrent) {
//Remove unneeded entries
if ($Torrent['ID'] != $TorrentID) {
unset($GroupInfo[1][$Torrent['ID']]);
}
if ($Return) {
return $GroupInfo;
}
}
} else {
if ($Return) {
return NULL;
}
}
}
//Check if a givin string can be validated as a torrenthash
function is_valid_torrenthash($Str) {
//6C19FF4C 6C1DD265 3B25832C 0F6228B2 52D743D5
@ -163,6 +186,37 @@ function is_valid_torrenthash($Str) {
return false;
}
//Functionality for the API to resolve input into other data.
function torrenthash_to_torrentid($Str) {
global $Cache, $DB;
$DB->query("SELECT t.ID FROM torrents AS t WHERE HEX(t.info_hash)='".db_string($Str)."'");
$TorrentID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($TorrentID) {
return $TorrentID;
}
return NULL;
}
function torrenthash_to_groupid($Str) {
global $Cache, $DB;
$DB->query("SELECT t.GroupID FROM torrents AS t WHERE HEX(t.info_hash)='".db_string($Str)."'");
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($GroupID) {
return $GroupID;
}
return NULL;
}
function torrentid_to_groupid($TorrentID) {
global $Cache, $DB;
$DB->query("SELECT t.GroupID FROM torrents AS t WHERE t.ID='".db_string($TorrentID)."'");
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($GroupID) {
return $GroupID;
}
return NULL;
}
//After adjusting / deleting logs, recalculate the score for the torrent.
function set_torrent_logscore($TorrentID) {
@ -187,7 +241,7 @@ function get_group_requests($GroupID) {
}
//Used to get reports info on a unison cache in both browsing pages and torrent pages.
function get_reports($TorrentID){
function get_reports($TorrentID) {
global $Cache, $DB;
$Reports = $Cache->get_value('reports_torrent_' . $TorrentID);
if ($Reports === false) {

View File

@ -1,9 +1,9 @@
<?
//******************************************************************************//
//--------------- Take mass pm -------------------------------------------------//
// This pages handles the backend of the 'send mass pm' function. It checks //
// the data, and if it all validates, it sends a pm to everyone who snatched //
// the torrent. //
//--------------- Take mass PM -------------------------------------------------//
// This pages handles the backend of the 'Send Mass PM' function. It checks //
// the data, and if it all validates, it sends a PM to everyone who snatched //
// the torrent. //
//******************************************************************************//
authorize();
@ -22,7 +22,7 @@
//--------------- Validate data in edit form -----------------------------------//
// FIXME: Still need a better perm name
if(!check_perms('site_moderate_requests')) {
if (!check_perms('site_moderate_requests')) {
error(403);
}
@ -32,7 +32,7 @@
$Validate->SetFields('message','0','string','Invalid message.',array('maxlength'=>10000, 'minlength'=>1));
$Err = $Validate->ValidateForm($_POST); // Validate the form
if($Err){
if ($Err) {
error($Err);
header('Location: '.$_SERVER['HTTP_REFERER']);
die();
@ -43,7 +43,7 @@
$DB->query('SELECT uid FROM xbt_snatched WHERE fid='.$TorrentID);
if ($DB->record_count()>0) {
if ($DB->record_count() > 0) {
// Save this because send_pm uses $DB to run its own query... Oops...
$Snatchers = $DB->to_array();
foreach ($Snatchers as $UserID) {
@ -51,7 +51,7 @@
}
}
Misc::write_log($LoggedUser['Username']." sent mass notice to snatches of torrent $TorrentID in group $GroupID");
Misc::write_log($LoggedUser['Username']." sent mass notice to snatchers of torrent $TorrentID in group $GroupID");
header("Location: torrents.php?id=$GroupID");

View File

@ -6,7 +6,7 @@
$ThisInsert =& $ExtraTorrentsInsert[$Name];
$ExtraTor = new BencodeTorrent($Name, true);
if (isset($ExtraTor->Dec['encrypted_files'])) {
$Err = "At least one of the torrents contain an encrypted file list which is not supported here";
$Err = 'At least one of the torrents contain an encrypted file list which is not supported here';
break;
}
if (!$ExtraTor->is_private()) {
@ -16,7 +16,7 @@
// File list and size
list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list();
$ExtraDirName = isset($ExtraTor->Dec['info']['files']) ? Format::make_utf8($ExtraTor->get_name()) : "";
$ExtraDirName = isset($ExtraTor->Dec['info']['files']) ? Format::make_utf8($ExtraTor->get_name()) : '';
$ExtraTmpFileList = array();
foreach ($ExtraFileList as $ExtraFile) {
@ -24,9 +24,9 @@
check_file($ExtraType, $ExtraName);
// Make sure the filename is not too long
// Make sure the file name is not too long
if (mb_strlen($ExtraName, 'UTF-8') + mb_strlen($ExtraDirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
$Err = "The torrent contained one or more files with too long a name: <br />$ExtraDirName/$ExtraName";
$Err = "The torrent contained one or more files with too long of a name: <br />$ExtraDirName/$ExtraName";
break;
}
// Add file and size to array
@ -45,7 +45,7 @@
$DB->query("SELECT ID FROM torrents WHERE info_hash='" . db_string($ThisInsert['InfoHash']) . "'");
if ($DB->record_count() > 0) {
list($ExtraID) = $DB->next_record();
$DB->query("SELECT TorrentID FROM torrents_files WHERE TorrentID = " . $ExtraID);
$DB->query('SELECT TorrentID FROM torrents_files WHERE TorrentID = ' . $ExtraID);
if ($DB->record_count() > 0) {
$Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">The exact same torrent file already exists on the site!</a>';
} else {

View File

@ -11,23 +11,23 @@
$ExtraTorrentName = $ExtraFile['tmp_name'];
if (!is_uploaded_file($ExtraTorrentName) || !filesize($ExtraTorrentName)) {
$Err = 'No extra torrent file uploaded, or file is empty.';
} else if (substr(strtolower($ExtraFile['name']), strlen($ExtraFile['name']) - strlen(".torrent")) !== ".torrent") {
$Err = "You seem to have put something other than an extra torrent file into the upload field. (" . $ExtraFile['name'] . ").";
} else if (in_array($ExtraFile['name'], $DupeNames)) {
$Err = "One or more torrents has been entered into the form twice.";
} elseif (substr(strtolower($ExtraFile['name']), strlen($ExtraFile['name']) - strlen('.torrent')) !== '.torrent') {
$Err = 'You seem to have put something other than an extra torrent file into the upload field. (' . $ExtraFile['name'] . ').';
} elseif (in_array($ExtraFile['name'], $DupeNames)) {
$Err = 'One or more torrents has been entered into the form twice.';
} else {
$j = $i - 1;
$ExtraTorrents[$ExtraTorrentName]['Name'] = $ExtraTorrentName;
$ExtraFormat = $_POST['extra_format'][$j];
if (empty($ExtraFormat)) {
$Err = "Missing format for extra torrent.";
$Err = 'Missing format for extra torrent.';
break;
} else {
$ExtraTorrents[$ExtraTorrentName]['Format'] = db_string(trim($ExtraFormat));
}
$ExtraBitrate = $_POST['extra_bitrate'][$j];
if (empty($ExtraBitrate)) {
$Err = "Missing bitrate for extra torrent.";
$Err = 'Missing bitrate for extra torrent.';
break;
} else {
$ExtraTorrents[$ExtraTorrentName]['Encoding'] = db_string(trim($ExtraBitrate));
@ -40,4 +40,4 @@
}
}
?>
?>

View File

@ -1,12 +1,14 @@
<?
enforce_login();
if(!check_perms('site_upload')) { error(403); }
if($LoggedUser['DisableUpload']) {
if (!check_perms('site_upload')) {
error(403);
}
if ($LoggedUser['DisableUpload']) {
error('Your upload privileges have been revoked.');
}
//build the page
// build the page
if(!empty($_POST['submit'])) {
if (!empty($_POST['submit'])) {
include('upload_handle.php');
} else {
include(SERVER_ROOT.'/sections/upload/upload.php');

View File

@ -35,30 +35,30 @@
Torrents::update_hash($GroupID);
//IRC
$Announce = "";
$Announce = '';
$Announce .= Artists::display_artists($ArtistForm, false);
$Announce .= trim($Properties['Title']) . " ";
$Announce .= trim($Properties['Title']) . ' ';
$Announce .= '[' . trim($Properties['Year']) . ']';
if (($Properties['ReleaseType'] > 0)) {
$Announce .= ' [' . $ReleaseTypes[$Properties['ReleaseType']] . ']';
}
$Announce .= " - ";
$Announce .= trim(str_replace("'", "", $ExtraTorrent['Format'])) . " / " . trim(str_replace("'", "", $ExtraTorrent['Encoding']));
$Announce .= " / " . trim($Properties['Media']);
if ($T['FreeLeech'] == "1") {
$Announce .= " / Freeleech!";
$Announce .= ' - ';
$Announce .= trim(str_replace("'", '', $ExtraTorrent['Format'])) . ' / ' . trim(str_replace("'", '', $ExtraTorrent['Encoding']));
$Announce .= ' / ' . trim($Properties['Media']);
if ($T['FreeLeech'] == '1') {
$Announce .= ' / Freeleech!';
}
$Title = $Announce;
$AnnounceSSL = $Announce . " - https://" . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
$Announce .= " - https://" . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
$AnnounceSSL = $Announce . ' - https://' . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
$Announce .= ' - https://' . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
$AnnounceSSL .= " - " . trim($Properties['TagList']);
$Announce .= " - " . trim($Properties['TagList']);
$AnnounceSSL .= ' - ' . trim($Properties['TagList']);
$Announce .= ' - ' . trim($Properties['TagList']);
send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce :' . html_entity_decode($Announce));
send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce-ssl :' . $AnnounceSSL);
send_irc('PRIVMSG #' . SSL_SITE_URL . '-announce-ssl :' . $AnnounceSSL);
//send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce :'.html_entity_decode($Announce));
}
?>
?>

View File

@ -12,31 +12,34 @@
ini_set('max_file_uploads','100');
View::show_header('Upload','upload,jquery,validate_upload,valid_tags,musicbrainz,multiformat_uploader');
if(empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
$DB->query("SELECT
tg.ID as GroupID,
tg.CategoryID,
tg.Name AS Title,
tg.Year,
tg.RecordLabel,
tg.CatalogueNumber,
tg.WikiImage AS Image,
tg.WikiBody AS GroupDescription,
tg.ReleaseType,
tg.VanityHouse
if (empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
$DB->query('
SELECT
tg.ID as GroupID,
tg.CategoryID,
tg.Name AS Title,
tg.Year,
tg.RecordLabel,
tg.CatalogueNumber,
tg.WikiImage AS Image,
tg.WikiBody AS GroupDescription,
tg.ReleaseType,
tg.VanityHouse
FROM torrents_group AS tg
LEFT JOIN torrents AS t ON t.GroupID = tg.ID
WHERE tg.ID=".$_GET['groupid']."
GROUP BY tg.ID");
LEFT JOIN torrents AS t ON t.GroupID = tg.ID
WHERE tg.ID='.$_GET['groupid'].'
GROUP BY tg.ID');
if ($DB->record_count()) {
list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
$UploadForm = $Categories[$Properties['CategoryID']-1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID']-1];
list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
$UploadForm = $Categories[$Properties['CategoryID'] - 1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
$Properties['Artists'] = Artists::get_artist($_GET['groupid']);
$DB->query("SELECT
GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
FROM torrents_tags AS tt JOIN tags ON tags.ID=tt.TagID
$DB->query("
SELECT
GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
FROM torrents_tags AS tt
JOIN tags ON tags.ID=tt.TagID
WHERE tt.GroupID='$_GET[groupid]'");
list($Properties['TagList']) = $DB->next_record();
@ -48,78 +51,82 @@
}
} elseif (empty($Properties) && !empty($_GET['requestid']) && is_number($_GET['requestid'])) {
include(SERVER_ROOT.'/sections/requests/functions.php');
$DB->query("SELECT
r.ID AS RequestID,
r.CategoryID,
r.Title AS Title,
r.Year,
r.RecordLabel,
r.CatalogueNumber,
r.ReleaseType,
r.Image
$DB->query('
SELECT
r.ID AS RequestID,
r.CategoryID,
r.Title AS Title,
r.Year,
r.RecordLabel,
r.CatalogueNumber,
r.ReleaseType,
r.Image
FROM requests AS r
WHERE r.ID=".$_GET['requestid']);
WHERE r.ID='.$_GET['requestid']);
list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
$UploadForm = $Categories[$Properties['CategoryID']-1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID']-1];
$UploadForm = $Categories[$Properties['CategoryID'] - 1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
$Properties['Artists'] = get_request_artists($_GET['requestid']);
$Properties['TagList'] = implode(", ", get_request_tags($_GET['requestid']));
$Properties['TagList'] = implode(', ', get_request_tags($_GET['requestid']));
}
if(!empty($ArtistForm)) {
if (!empty($ArtistForm)) {
$Properties['Artists'] = $ArtistForm;
}
require(SERVER_ROOT.'/classes/class_torrent_form.php');
$TorrentForm = new TORRENT_FORM($Properties, $Err);
if(!isset($Text)) {
if (!isset($Text)) {
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
}
$GenreTags = $Cache->get_value('genre_tags');
if(!$GenreTags) {
if (!$GenreTags) {
$DB->query("SELECT Name FROM tags WHERE TagType='genre' ORDER BY Name");
$GenreTags = $DB->collect('Name');
$Cache->cache_value('genre_tags', $GenreTags, 3600*6);
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
}
$DB->query("SELECT
d.Name,
d.Comment,
d.Time
$DB->query('
SELECT
d.Name,
d.Comment,
d.Time
FROM do_not_upload as d
ORDER BY d.Time DESC");
ORDER BY d.Time DESC');
$DNU = $DB->to_array();
list($Name,$Comment,$Updated) = reset($DNU);
list($Name, $Comment, $Updated) = reset($DNU);
reset($DNU);
$DB->query("SELECT IF(MAX(t.Time) < '$Updated' OR MAX(t.Time) IS NULL,1,0) FROM torrents AS t
WHERE UserID = ".$LoggedUser['ID']);
$DB->query("
SELECT IF(MAX(t.Time) < '$Updated' OR MAX(t.Time) IS NULL,1,0)
FROM torrents AS t
WHERE UserID = ".$LoggedUser['ID']);
list($NewDNU) = $DB->next_record();
$HideDNU = check_perms('torrents_hide_dnu') && !$NewDNU;
?>
<div class="<?=(check_perms('torrents_hide_dnu')?'box pad':'')?>" style="margin:0px auto;width:700px">
<div class="<?=(check_perms('torrents_hide_dnu') ? 'box pad' : '')?>" style="margin: 0px auto; width: 700px;">
<h3 id="dnu_header">Do not upload</h3>
<p><?=$NewDNU?'<strong class="important_text">':''?>Last Updated: <?=time_diff($Updated)?><?=$NewDNU?'</strong>':''?></p>
<p><?=$NewDNU ? '<strong class="important_text">' : '' ?>Last updated: <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?></p>
<p>The following releases are currently forbidden from being uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comment.
<? if ($HideDNU) { ?>
<span id="showdnu"><a href="#" onclick="$('#dnulist').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;">(Show)</a></span>
<span id="showdnu"><a href="#" onclick="$('#dnulist').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets">Show</a></span>
<? } ?>
</p>
<table id="dnulist" class="<?=($HideDNU?'hidden':'')?>">
<table id="dnulist" class="<?=($HideDNU ? 'hidden' : '')?>">
<tr class="colhead">
<td width="50%"><strong>Name</strong></td>
<td><strong>Comment</strong></td>
</tr>
<? $TimeDiff = strtotime('-1 month', strtotime('now'));
foreach($DNU as $BadUpload) {
foreach ($DNU as $BadUpload) {
list($Name, $Comment, $Updated) = $BadUpload;
?>
<tr>
<td><?=$Text->full_format($Name)?>
<? if($TimeDiff < strtotime($Updated)) { ?>
<? if ($TimeDiff < strtotime($Updated)) { ?>
<strong class="important_text">(New!)</strong>
<? } ?>
</td>
@ -127,7 +134,7 @@
</tr>
<? } ?>
</table>
</div><?=($HideDNU?'<br />':'')?>
</div><?=($HideDNU ? '<br />' : '')?>
<?
$TorrentForm->head();
switch ($UploadForm) {
@ -156,7 +163,6 @@
Bitrate();
Media();
</script>
<?
View::show_footer();
?>

View File

@ -250,9 +250,6 @@
}
$LogScoreAverage = 0;
$SendPM = 0;
$LogMessage = '';
$CheckStamp='';
if (!$Err && $Properties['Format'] == 'FLAC') {
foreach ($_FILES['logfiles']['name'] as $FileName) {
@ -287,7 +284,7 @@
5 => array(),
6 => array()
);
for($i = 0, $il = count($Artists); $i < $il; $i++) {
for ($i = 0, $il = count($Artists); $i < $il; $i++) {
if (trim($Artists[$i]) != '') {
if (!in_array($Artists[$i], trim($ArtistNames))) {
$ArtistForm[$Importance[$i]][] = array('name' => Artists::normalise_artist_name($Artists[$i]));

View File

@ -3,9 +3,9 @@
error(403);
}
$UnreadSQL = "AND q.UnRead";
$UnreadSQL = 'AND q.UnRead';
if ($_GET['showall']) {
$UnreadSQL = "";
$UnreadSQL = '';
}
if ($_GET['catchup']) {
@ -19,11 +19,20 @@
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
}
$sql = "SELECT SQL_CALC_FOUND_ROWS f.ID as ForumID, f.Name as ForumName, t.Title, q.PageID, q.PostID, q.QuoterID
FROM users_notify_quoted AS q
LEFT JOIN forums_topics AS t ON t.ID = q.PageID
LEFT JOIN forums AS f ON f.ID = t.ForumID
WHERE q.UserID = $LoggedUser[ID] AND q.Page = 'forums' AND ((f.MinClassRead <= '$LoggedUser[Class]'";
$sql = "
SELECT
SQL_CALC_FOUND_ROWS f.ID as ForumID,
f.Name as ForumName,
t.Title,
q.PageID,
q.PostID,
q.QuoterID
FROM users_notify_quoted AS q
LEFT JOIN forums_topics AS t ON t.ID = q.PageID
LEFT JOIN forums AS f ON f.ID = t.ForumID
WHERE q.UserID = $LoggedUser[ID]
AND q.Page = 'forums'
AND ((f.MinClassRead <= '$LoggedUser[Class]'";
if (!empty($RestrictedForums)) {
$sql .= ' AND f.ID NOT IN (\'' . $RestrictedForums . '\')';
@ -35,46 +44,44 @@
$sql .= ") $UnreadSQL ORDER BY q.Date DESC LIMIT $Limit";
$DB->query($sql);
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($NumResults) = $DB->next_record();
//Start printing page
View::show_header('Quote Notifications');
?>
<div class="thin">
<div class="header">
<h2>
Quote notifications
<?=$NumResults && !empty($UnreadSQL) ? " ($NumResults new)" : "" ?>
<?=$NumResults && !empty($UnreadSQL) ? " ($NumResults new)" : '' ?>
</h2>
<div class="linkbox pager">
<br />
<? if ($UnreadSQL) { ?>
<? if ($UnreadSQL) { ?>
<a href="userhistory.php?action=quote_notifications&amp;showall=1" class="brackets">Show all quotes</a>&nbsp;&nbsp;&nbsp;
<? } else { ?>
<? } else { ?>
<a href="userhistory.php?action=quote_notifications" class="brackets">Show unread quotes</a>&nbsp;&nbsp;&nbsp;
<? } ?>
<? } ?>
<a href="userhistory.php?action=subscriptions" class="brackets">Show subscriptions</a>&nbsp;&nbsp;&nbsp;
<a href="userhistory.php?action=quote_notifications&amp;catchup=1" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;
<br /> <br />
<?
<?
$Pages = Format::get_pages($Page, $NumResults, TOPICS_PER_PAGE, 9);
echo $Pages;
?>
</div>
</div>
<?
if (!$NumResults) {
?>
<?
if (!$NumResults) { ?>
<div class="center">No<?=($UnreadSQL ? ' new' : '')?> quotes.</div>
<? } ?>
<? } ?>
<br />
<?
<?
foreach ($Results as $Result) {
?>
<table class='forum_post box vertical_margin noavatar'>
<tr class='colhead_dark'>
<table class="forum_post box vertical_margin noavatar">
<tr class="colhead_dark">
<td colspan="2">
<span style="float: left;">
<a href="forums.php?action=viewforum&amp;forumid=<?=$Result['ForumID'] ?>"><?=$Result['ForumName'] ?></a>
@ -91,6 +98,6 @@
</td>
</tr>
</table>
<? } ?>
<? } ?>
</div>
<? View::show_footer(); ?>