Empty commit

This commit is contained in:
Git 2011-11-26 08:00:20 +00:00
parent 1dee858d8f
commit 272646a349
15 changed files with 331 additions and 90 deletions

View File

@ -1650,12 +1650,13 @@ function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Esc
$link .= display_artist($Composers[0], $MakeLink, $Escape).$ampersand.display_artist($Composers[1], $MakeLink, $Escape);
break;
}
$ComposerStr .= $link;
if ((count($Composers) > 0) && (count($Composers) < 3) && (count($MainArtists) > 0)) {
$link .= ' performed by ';
}
$ComposerStr .= $link;
switch(count($MainArtists)) {
case 0:
break;
@ -1697,9 +1698,9 @@ function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Esc
}
if ((count($Composers) > 0) && (count($MainArtists) + count($Conductors) > 3) && (count($MainArtists) > 1) && (count($Conductors) > 1)) {
$link = $ComposerStr . ' performed by Various Artists';
$link = $ComposerStr . 'Various Artists';
}
// DJs override everything else
switch(count($DJs)) {
case 0:

View File

@ -0,0 +1,89 @@
<?
authorize(true);
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
if (!$News = $Cache->get_value('news')) {
$DB->query("SELECT
ID,
Title,
Body,
Time
FROM news
ORDER BY Time DESC
LIMIT 5");
$News = $DB->to_array(false,MYSQLI_NUM,false);
$Cache->cache_value('news',$News,3600*24*30);
$Cache->cache_value('news_latest_id', $News[0][0], 0);
}
if ($LoggedUser['LastReadNews'] != $News[0][0]) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('LastReadNews' => $News[0][0]));
$Cache->commit_transaction(0);
$DB->query("UPDATE users_info SET LastReadNews = '".$News[0][0]."' WHERE UserID = ".$UserID);
$LoggedUser['LastReadNews'] = $News[0][0];
}
if(($Blog = $Cache->get_value('blog')) === false) {
$DB->query("SELECT
b.ID,
um.Username,
b.Title,
b.Body,
b.Time,
b.ThreadID
FROM blog AS b LEFT JOIN users_main AS um ON b.UserID=um.ID
ORDER BY Time DESC
LIMIT 20");
$Blog = $DB->to_array();
$Cache->cache_value('blog',$Blog,1209600);
}
$JsonBlog = array();
for ($i = 0; $i < $Limit; $i++) {
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
$JsonBlog[] = array(
'blogId' => (int) $BlogID,
'author' => $Author,
'title' => $Title,
'body' => $Text->full_format($Body),
'blogTime' => $BlogTime,
'threadId' => (int) $ThreadID
);
}
$JsonAnnouncements = array();
$Count = 0;
foreach ($News as $NewsItem) {
list($NewsID,$Title,$Body,$NewsTime) = $NewsItem;
if (strtotime($NewsTime) > time()) {
continue;
}
$JsonAnnouncements[] = array(
'newsId' => (int) $NewsID,
'title' => $Title,
'body' => $Text->full_format($Body),
'newsTime' => $NewsTime
);
if (++$Count > 4) {
break;
}
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'announcements' => $JsonAnnouncements,
'blogPosts' => $JsonBlog
)
)
);
?>

View File

@ -197,39 +197,39 @@ function compare($X, $Y){
$JsonTorrents = array();
foreach ($Torrent['Torrents'] as $GroupTorrents) {
$JsonTorrents[] = array(
'id' => $GroupTorrents['ID'],
'groupId' => $GroupTorrents['GroupID'],
'id' => (int) $GroupTorrents['ID'],
'groupId' => (int) $GroupTorrents['GroupID'],
'media' => $GroupTorrents['Media'],
'format' => $GroupTorrents['Format'],
'encoding' => $GroupTorrents['Encoding'],
'remasterYear' => $GroupTorrents['RemasterYear'],
'remastered' => $GroupTorrents['Remastered'],
'remastered' => $GroupTorrents['Remastered'] == 1,
'remasterTitle' => $GroupTorrents['RemasterTitle'],
'remasterRecordLabel' => $GroupTorrents['RemasterRecordLabel'],
'remasterCatalogueNumber' => $GroupTorrents['RemasterCatalogueNumber'],
'scene' => $GroupTorrents['Scene'],
'hasLog' => $GroupTorrents['HasLog'],
'hasCue' => $GroupTorrents['HasCue'],
'logScore' => $GroupTorrents['LogScore'],
'fileCount' => $GroupTorrents['FileCount'],
'freeTorrent' => $GroupTorrents['FreeTorrent'],
'size' => $GroupTorrents['Size'],
'leechers' => $GroupTorrents['Leechers'],
'seeders' => $GroupTorrents['Seeders'],
'snatched' => $GroupTorrents['Snatched'],
'scene' => $GroupTorrents['Scene'] == 1,
'hasLog' => $GroupTorrents['HasLog'] == 1,
'hasCue' => $GroupTorrents['HasCue'] == 1,
'logScore' => (float) $GroupTorrents['LogScore'],
'fileCount' => (int) $GroupTorrents['FileCount'],
'freeTorrent' => $GroupTorrents['FreeTorrent'] == 1,
'size' => (float) $GroupTorrents['Size'],
'leechers' => (int) $GroupTorrents['Leechers'],
'seeders' => (int) $GroupTorrents['Seeders'],
'snatched' => (int) $GroupTorrents['Snatched'],
'time' => $GroupTorrents['Time'],
'hasFile' => $GroupTorrents['HasFile']
'hasFile' => (int) $GroupTorrents['HasFile']
);
}
$JsonBookmarks[] = array(
'id' => $Torrent['ID'],
'id' => (int) $Torrent['ID'],
'name' => $Torrent['Name'],
'year' => $Torrent['Year'],
'recordLabel' => $Torrent['RecordLabel'],
'catalogueNumber' => $Torrent['CatalogueNumber'],
'tagList' => $Torrent['TagList'],
'releaseType' => $Torrent['ReleaseType'],
'vanityHouse' => $Torrent['VanityHouse'],
'vanityHouse' => $Torrent['VanityHouse'] == 1,
'torrents' => $JsonTorrents
);
}

View File

@ -1,6 +1,6 @@
<?
authorize();
authorize(true);
/**********|| Page to show individual forums || ********************************\
@ -79,7 +79,7 @@
foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
$Thread = get_thread_info($ThreadIDs);
$JsonSpecificRules[] = array(
'threadId' => $ThreadIDs,
'threadId' => (int) $ThreadIDs,
'thread' => $Thread['Title']
);
}
@ -124,19 +124,19 @@
}
$JsonTopics[] = array(
'topicId' => $TopicID,
'topicId' => (int) $TopicID,
'title' => $Title,
'authorId' => $AuthorID,
'authorId' => (int) $AuthorID,
'authorName' => $AuthorName,
'locked' => $Locked,
'sticky' => $Sticky,
'postCount' => $PostCount,
'lastID' => $LastID,
'locked' => $Locked == 1,
'sticky' => $Sticky == 1,
'postCount' => (int) $PostCount,
'lastID' => $LastID == null ? 0 : (int) $LastID,
'lastTime' => $LastTime,
'lastAuthorId' => $LastAuthorID,
'lastAuthorName' => $LastAuthorName,
'lastReadPage' => $LastRead[$TopicID]['Page'],
'lastReadPostId' => $LastRead[$TopicID]['PostID']
'lastAuthorId' => $LastAuthorID == null ? 0 : (int) $LastAuthorID,
'lastAuthorName' => $LastAuthorName == null ? "" : $LastAuthorName,
'lastReadPage' => $LastRead[$TopicID]['Page'] == null ? 0 : (int) $LastRead[$TopicID]['Page'],
'lastReadPostId' => $LastRead[$TopicID]['PostID'] == null ? 0 : (int) $LastRead[$TopicID]['PostID']
);
}
@ -147,11 +147,11 @@
'response' => array(
'forumName' => $Forums[$ForumID]['Name'],
'specificRules' => $JsonSpecificRules,
'currentPage' => intval($Page),
'currentPage' => (int) $Page,
'pages' => ceil($Forums[$ForumID]['NumTopics']/TOPICS_PER_PAGE),
'threads' => $JsonTopics
)
)
);
}
?>
?>

View File

@ -2,8 +2,6 @@
// Already done in /sections/ajax/index.php
//enforce_login();
authorize(true);
if (!empty($LoggedUser['DisableForums'])) {
print json_encode(array('status' => 'failure'));
}

View File

@ -1,6 +1,6 @@
<?
authorize();
authorize(true);
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
@ -52,7 +52,7 @@
}
$LastCategoryID = $CategoryID;
$JsonCategory = array(
'categoryID' => $CategoryID,
'categoryID' => (int) $CategoryID,
'categoryName' => $ForumCats[$CategoryID]
);
$JsonForums = array();
@ -65,21 +65,21 @@
}
$JsonForums[] = array(
'forumId' => $ForumID,
'forumId' => (int) $ForumID,
'forumName' => $ForumName,
'forumDescription' => $ForumDescription,
'numTopics' => $NumTopics,
'numPosts' => $NumPosts,
'lastPostId' => $LastPostID,
'lastAuthorId' => $LastAuthorID,
'numTopics' => (float) $NumTopics,
'numPosts' => (float) $NumPosts,
'lastPostId' => (float) $LastPostID,
'lastAuthorId' => (float) $LastAuthorID,
'lastPostAuthorName' => $LastPostAuthorName,
'lastTopicId' => $LastTopicID,
'lastTopicId' => (float) $LastTopicID,
'lastTime' => $LastTime,
'specificRules' => $SpecificRules,
'lastTopic' => $LastTopic,
'read' => $Read,
'locked' => $Locked,
'sticky' => $Sticky
'read' => $Read == 1,
'locked' => $Locked == 1,
'sticky' => $Sticky == 1
);
}

View File

@ -1,6 +1,6 @@
<?
authorize();
authorize(true);
//TODO: Normalize thread_*_info don't need to waste all that ram on things that are already in other caches
/**********|| Page to show individual threads || ********************************\
@ -169,10 +169,10 @@
}
}
$JsonPoll['closed'] = $Closed;
$JsonPoll['closed'] = $Closed == 1;
$JsonPoll['featured'] = $Featured;
$JsonPoll['question'] = $Question;
$JsonPoll['maxVotes'] = $MaxVotes;
$JsonPoll['maxVotes'] = (int) $MaxVotes;
$JsonPoll['totalVotes'] = $TotalVotes;
$JsonPollAnswers = array();
@ -215,19 +215,19 @@
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
$JsonPosts[] = array(
'postId' => $PostID,
'postId' => (int) $PostID,
'addedTime' => $AddedTime,
'body' => $Text->full_format($Body),
'editedUserId' => $EditedUserID,
'editedUserId' => (int) $EditedUserID,
'editedTime' => $EditedTime,
'editedUsername' => $EditedUsername,
'author' => array(
'authorId' => $AuthorID,
'authorId' => (int) $AuthorID,
'authorName' => $Username,
'paranoia' => $Paranoia,
'artist' => $Artist,
'donor' => $Donor,
'warned' => $Warned,
'artist' => $Artist == 1,
'donor' => $Donor == 1,
'warned' => $Warned == 1,
'avatar' => $Avatar,
'enabled' => $Enabled == 2 ? false : true,
'userTitle' => $UserTitle
@ -241,16 +241,16 @@
array(
'status' => 'success',
'response' => array(
'forumId' => $ForumID,
'forumId' => (int) $ForumID,
'forumName' => $Forums[$ForumID]['Name'],
'threadId' => $ThreadID,
'threadId' => (int) $ThreadID,
'threadTitle' => $ThreadInfo['Title'],
'subscribed' => in_array($ThreadID, $UserSubscriptions),
'locked' => $ThreadInfo['IsLocked'],
'sticky' => $ThreadInfo['IsSticky'],
'currentPage' => intval($Page),
'locked' => $ThreadInfo['IsLocked'] == 1,
'sticky' => $ThreadInfo['IsSticky'] == 1,
'currentPage' => (int) $Page,
'pages' => ceil($ThreadInfo['Posts']/$PerPage),
'poll' => $JsonPoll,
'poll' => empty($JsonPoll) ? null : $JsonPoll,
'posts' => $JsonPosts
)
)

View File

@ -82,16 +82,16 @@
$JsonMessages = array();
while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) {
$JsonMessage = array(
'convId' => $ConvID,
'convId' => (int) $ConvID,
'subject' => $Subject,
'unread' => $Unread,
'sticky' => $Sticky,
'forwardedId' => $ForwardedID,
'unread' => $Unread == 1,
'sticky' => $Sticky == 1,
'forwardedId' => (int) $ForwardedID,
'forwardedName' => $ForwardedName,
'senderId' => $SenderID,
'senderId' => (int) $SenderID,
'username' => $Username,
'donor' => $Donor,
'warned' => $Warned,
'donor' => $Donor == 1,
'warned' => $Warned == 1,
'enabled' => ($Enabled == 2 ? false : true),
'date' => $Date
);
@ -103,7 +103,7 @@
array(
'status' => 'success',
'response' => array(
'currentPage' => intval($Page),
'currentPage' => (int) $Page,
'pages' => ceil($NumResults/MESSAGES_PER_PAGE),
'messages' => $JsonMessages
)

View File

@ -68,8 +68,8 @@
$JsonMessages = array();
while(list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
$JsonMessage = array(
'messageId' => $MessageID,
'senderId' => $SenderID,
'messageId' => (int) $MessageID,
'senderId' => (int) $SenderID,
'senderName' => $Users[(int)$SenderID]['Username'],
'sentDate' => $SentDate,
'body' => $Text->full_format($Body)
@ -82,10 +82,11 @@
array(
'status' => 'success',
'response' => array(
'convId' => $ConvID,
'convId' => (int) $ConvID,
'subject' => $Subject.($ForwardedID > 0 ? ' (Forwarded to '.$ForwardedName.')':''),
'sticky' => $Sticky,
'sticky' => $Sticky == 1,
'messages' => $JsonMessages
)
)
);
);
?>

View File

@ -65,9 +65,15 @@
case 'bookmarks':
require(SERVER_ROOT.'/sections/ajax/bookmarks.php');
break;
case 'announcements':
require(SERVER_ROOT.'/sections/ajax/announcements.php');
break;
case 'notifications':
require(SERVER_ROOT.'/sections/ajax/notifications.php');
break;
default:
// If they're screwing around with the query string
error(403);
print json_encode(array('status' => 'failure'));
}
?>

View File

@ -42,10 +42,10 @@
'authkey'=>$AuthKey,
'passkey'=>$torrent_pass,
'userstats' => array(
'uploaded' => $Uploaded,
'downloaded' => $Downloaded,
'ratio' => $Ratio,
'requiredratio' => $RequiredRatio,
'uploaded' => (int) $Uploaded,
'downloaded' => (int) $Downloaded,
'ratio' => (float) $Ratio,
'requiredratio' => (float) $RequiredRatio,
//'class' => $Class
'class' => $ClassLevels[$Class]['Name']
),

View File

@ -0,0 +1,145 @@
<?
authorize(true);
if(!check_perms('site_torrents_notify')) {
print
json_encode(
array(
'status' => 'failure'
)
);
die();
}
define('NOTIFICATIONS_PER_PAGE', 50);
list($Page,$Limit) = page_limit(NOTIFICATIONS_PER_PAGE);
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
if (empty($TokenTorrents)) {
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
$TokenTorrents = $DB->collect('TorrentID');
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
}
$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS
t.ID,
g.ID,
g.Name,
g.CategoryID,
g.TagList,
t.Size,
t.FileCount,
t.Format,
t.Encoding,
t.Media,
t.Scene,
t.RemasterYear,
g.Year,
t.RemasterYear,
t.RemasterTitle,
t.Snatched,
t.Seeders,
t.Leechers,
t.Time,
t.HasLog,
t.HasCue,
t.LogScore,
t.FreeTorrent,
tln.TorrentID AS LogInDB,
unt.UnRead,
unt.FilterID,
unf.Label
FROM users_notify_torrents AS unt
JOIN torrents AS t ON t.ID=unt.TorrentID
JOIN torrents_group AS g ON g.ID = t.GroupID
LEFT JOIN users_notify_filters AS unf ON unf.ID=unt.FilterID
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID=t.ID
WHERE unt.UserID='$LoggedUser[ID]'
GROUP BY t.ID
ORDER BY t.ID DESC LIMIT $Limit");
$DB->query('SELECT FOUND_ROWS()');
list($TorrentCount) = $DB->next_record();
// Only clear the alert if they've specified to.
if (isset($_GET['clear']) && $_GET['clear'] == "1") {
//Clear before header but after query so as to not have the alert bar on this page load
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']);
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
}
$DB->set_query_id($Results);
$Pages=get_pages($Page,$TorrentCount,NOTIFICATIONS_PER_PAGE,9);
$JsonNotifications = array();
$NumNew = 0;
$FilterGroups = array();
while($Result = $DB->next_record()) {
if(!$Result['FilterID']) {
$Result['FilterID'] = 0;
}
if(!isset($FilterGroups[$Result['FilterID']])) {
$FilterGroups[$Result['FilterID']] = array();
$FilterGroups[$Result['FilterID']]['FilterLabel'] = ($Result['FilterID'] && !empty($Result['Label']) ? $Result['Label'] : 'unknown filter'.($Result['FilterID']?' ['.$Result['FilterID'].']':''));
}
array_push($FilterGroups[$Result['FilterID']], $Result);
}
unset($Result);
foreach($FilterGroups as $ID => $FilterResults) {
unset($FilterResults['FilterLabel']);
foreach($FilterResults as $Result) {
list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $TorrentTags, $Size, $FileCount, $Format, $Encoding,
$Media, $Scene, $RemasterYear, $GroupYear, $RemasterYear, $RemasterTitle, $Snatched, $Seeders,
$Leechers, $NotificationTime, $HasLog, $HasCue, $LogScore, $FreeTorrent, $LogInDB, $UnRead) = $Result;
$Artists = get_artist($GroupID);
if ($Unread) $NumNew++;
$JsonNotifications[] = array(
'torrentId' => (int) $TorrentID,
'groupId' => (int) $GroupID,
'groupName' => $GroupName,
'groupCategoryId' => (int) $GroupCategoryID,
'torrentTags' => $TorrentTags,
'size' => (float) $Size,
'fileCount' => (int) $FileCount,
'format' => $Format,
'encoding' => $Encoding,
'media' => $Media,
'scene' => $Scene == 1,
'remasterYear' => $RemasterYear,
'groupYear' => $GroupYear,
'remasterYear' => $RemasterYear,
'remasterTitle' => $RemasterTitle,
'snatched' => (int) $Snatched,
'seeders' => (int) $Seeders,
'leechers' => (int) $Leechers,
'notificationTime' => $NotificationTime,
'hasLog' => $HasLog == 1,
'hasCue' => $HasCue == 1,
'logScore' => (float) $LogScore,
'freeTorrent' => $FreeTorrent == 1,
'logInDb' => $LogInDB,
'unread' => $UnRead == 1
);
}
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'currentPages' => intval($Page),
'pages' => ceil($TorrentCount/NOTIFICATIONS_PER_PAGE),
'numNew' => $NumNew,
'results' => $JsonNotifications
)
)
);
?>

View File

@ -98,13 +98,13 @@
$JsonPosts = array();
while(list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()){
$JsonPost = array(
'forumId' => $ForumID,
'forumId' => (int) $ForumID,
'forumName' => $ForumName,
'threadId' => $TopicID,
'threadId' => (int) $TopicID,
'threadTitle' => $ThreadTitle,
'postId' => $PostID,
'lastPostId' => $LastPostID,
'locked' => $Locked,
'postId' => (int) $PostID,
'lastPostId' => (int) $LastPostID,
'locked' => $Locked == 1,
'new' => ($PostID<$LastPostID && !$Locked)
);
$JsonPosts[] = $JsonPost;
@ -115,7 +115,7 @@
array(
'status' => 'success',
'response' => array(
'posts' => $JsonPosts
'threads' => $JsonPosts
)
)
);

View File

@ -38,10 +38,10 @@
list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned) = $Result;
$JsonUsers[] = array(
'userId' => $UserID,
'userId' => (int) $UserID,
'username' => $Username,
'donor' => $Donor,
'warned' => $Warned,
'donor' => $Donor == 1,
'warned' => $Warned == 1,
'enabled' => ($Enabled == 2 ? false : true),
'class' => make_class_string($PermissionID)
);
@ -52,7 +52,7 @@
array(
'status' => 'success',
'response' => array(
'currentPage' => $Page,
'currentPage' => (int) $Page,
'pages' => ceil($NumResults/USERS_PER_PAGE),
'results' => $JsonUsers
)

View File

@ -14,7 +14,8 @@
if($_POST['submit'] == 'Remove') {
$DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-1 WHERE ID='$CollageID'");
$Rows = $DB->affected_rows();
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_collages_'.$GroupID);
} else {