mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 19:06:27 +00:00
Empty commit
This commit is contained in:
parent
1dee858d8f
commit
272646a349
@ -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);
|
$link .= display_artist($Composers[0], $MakeLink, $Escape).$ampersand.display_artist($Composers[1], $MakeLink, $Escape);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$ComposerStr .= $link;
|
|
||||||
|
|
||||||
if ((count($Composers) > 0) && (count($Composers) < 3) && (count($MainArtists) > 0)) {
|
if ((count($Composers) > 0) && (count($Composers) < 3) && (count($MainArtists) > 0)) {
|
||||||
$link .= ' performed by ';
|
$link .= ' performed by ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ComposerStr .= $link;
|
||||||
|
|
||||||
switch(count($MainArtists)) {
|
switch(count($MainArtists)) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
@ -1697,7 +1698,7 @@ function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Esc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((count($Composers) > 0) && (count($MainArtists) + count($Conductors) > 3) && (count($MainArtists) > 1) && (count($Conductors) > 1)) {
|
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
|
// DJs override everything else
|
||||||
|
89
sections/ajax/announcements.php
Normal file
89
sections/ajax/announcements.php
Normal 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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
?>
|
@ -197,39 +197,39 @@ function compare($X, $Y){
|
|||||||
$JsonTorrents = array();
|
$JsonTorrents = array();
|
||||||
foreach ($Torrent['Torrents'] as $GroupTorrents) {
|
foreach ($Torrent['Torrents'] as $GroupTorrents) {
|
||||||
$JsonTorrents[] = array(
|
$JsonTorrents[] = array(
|
||||||
'id' => $GroupTorrents['ID'],
|
'id' => (int) $GroupTorrents['ID'],
|
||||||
'groupId' => $GroupTorrents['GroupID'],
|
'groupId' => (int) $GroupTorrents['GroupID'],
|
||||||
'media' => $GroupTorrents['Media'],
|
'media' => $GroupTorrents['Media'],
|
||||||
'format' => $GroupTorrents['Format'],
|
'format' => $GroupTorrents['Format'],
|
||||||
'encoding' => $GroupTorrents['Encoding'],
|
'encoding' => $GroupTorrents['Encoding'],
|
||||||
'remasterYear' => $GroupTorrents['RemasterYear'],
|
'remasterYear' => $GroupTorrents['RemasterYear'],
|
||||||
'remastered' => $GroupTorrents['Remastered'],
|
'remastered' => $GroupTorrents['Remastered'] == 1,
|
||||||
'remasterTitle' => $GroupTorrents['RemasterTitle'],
|
'remasterTitle' => $GroupTorrents['RemasterTitle'],
|
||||||
'remasterRecordLabel' => $GroupTorrents['RemasterRecordLabel'],
|
'remasterRecordLabel' => $GroupTorrents['RemasterRecordLabel'],
|
||||||
'remasterCatalogueNumber' => $GroupTorrents['RemasterCatalogueNumber'],
|
'remasterCatalogueNumber' => $GroupTorrents['RemasterCatalogueNumber'],
|
||||||
'scene' => $GroupTorrents['Scene'],
|
'scene' => $GroupTorrents['Scene'] == 1,
|
||||||
'hasLog' => $GroupTorrents['HasLog'],
|
'hasLog' => $GroupTorrents['HasLog'] == 1,
|
||||||
'hasCue' => $GroupTorrents['HasCue'],
|
'hasCue' => $GroupTorrents['HasCue'] == 1,
|
||||||
'logScore' => $GroupTorrents['LogScore'],
|
'logScore' => (float) $GroupTorrents['LogScore'],
|
||||||
'fileCount' => $GroupTorrents['FileCount'],
|
'fileCount' => (int) $GroupTorrents['FileCount'],
|
||||||
'freeTorrent' => $GroupTorrents['FreeTorrent'],
|
'freeTorrent' => $GroupTorrents['FreeTorrent'] == 1,
|
||||||
'size' => $GroupTorrents['Size'],
|
'size' => (float) $GroupTorrents['Size'],
|
||||||
'leechers' => $GroupTorrents['Leechers'],
|
'leechers' => (int) $GroupTorrents['Leechers'],
|
||||||
'seeders' => $GroupTorrents['Seeders'],
|
'seeders' => (int) $GroupTorrents['Seeders'],
|
||||||
'snatched' => $GroupTorrents['Snatched'],
|
'snatched' => (int) $GroupTorrents['Snatched'],
|
||||||
'time' => $GroupTorrents['Time'],
|
'time' => $GroupTorrents['Time'],
|
||||||
'hasFile' => $GroupTorrents['HasFile']
|
'hasFile' => (int) $GroupTorrents['HasFile']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$JsonBookmarks[] = array(
|
$JsonBookmarks[] = array(
|
||||||
'id' => $Torrent['ID'],
|
'id' => (int) $Torrent['ID'],
|
||||||
'name' => $Torrent['Name'],
|
'name' => $Torrent['Name'],
|
||||||
'year' => $Torrent['Year'],
|
'year' => $Torrent['Year'],
|
||||||
'recordLabel' => $Torrent['RecordLabel'],
|
'recordLabel' => $Torrent['RecordLabel'],
|
||||||
'catalogueNumber' => $Torrent['CatalogueNumber'],
|
'catalogueNumber' => $Torrent['CatalogueNumber'],
|
||||||
'tagList' => $Torrent['TagList'],
|
'tagList' => $Torrent['TagList'],
|
||||||
'releaseType' => $Torrent['ReleaseType'],
|
'releaseType' => $Torrent['ReleaseType'],
|
||||||
'vanityHouse' => $Torrent['VanityHouse'],
|
'vanityHouse' => $Torrent['VanityHouse'] == 1,
|
||||||
'torrents' => $JsonTorrents
|
'torrents' => $JsonTorrents
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
authorize();
|
authorize(true);
|
||||||
|
|
||||||
/**********|| Page to show individual forums || ********************************\
|
/**********|| Page to show individual forums || ********************************\
|
||||||
|
|
||||||
@ -79,7 +79,7 @@
|
|||||||
foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
|
foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
|
||||||
$Thread = get_thread_info($ThreadIDs);
|
$Thread = get_thread_info($ThreadIDs);
|
||||||
$JsonSpecificRules[] = array(
|
$JsonSpecificRules[] = array(
|
||||||
'threadId' => $ThreadIDs,
|
'threadId' => (int) $ThreadIDs,
|
||||||
'thread' => $Thread['Title']
|
'thread' => $Thread['Title']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -124,19 +124,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$JsonTopics[] = array(
|
$JsonTopics[] = array(
|
||||||
'topicId' => $TopicID,
|
'topicId' => (int) $TopicID,
|
||||||
'title' => $Title,
|
'title' => $Title,
|
||||||
'authorId' => $AuthorID,
|
'authorId' => (int) $AuthorID,
|
||||||
'authorName' => $AuthorName,
|
'authorName' => $AuthorName,
|
||||||
'locked' => $Locked,
|
'locked' => $Locked == 1,
|
||||||
'sticky' => $Sticky,
|
'sticky' => $Sticky == 1,
|
||||||
'postCount' => $PostCount,
|
'postCount' => (int) $PostCount,
|
||||||
'lastID' => $LastID,
|
'lastID' => $LastID == null ? 0 : (int) $LastID,
|
||||||
'lastTime' => $LastTime,
|
'lastTime' => $LastTime,
|
||||||
'lastAuthorId' => $LastAuthorID,
|
'lastAuthorId' => $LastAuthorID == null ? 0 : (int) $LastAuthorID,
|
||||||
'lastAuthorName' => $LastAuthorName,
|
'lastAuthorName' => $LastAuthorName == null ? "" : $LastAuthorName,
|
||||||
'lastReadPage' => $LastRead[$TopicID]['Page'],
|
'lastReadPage' => $LastRead[$TopicID]['Page'] == null ? 0 : (int) $LastRead[$TopicID]['Page'],
|
||||||
'lastReadPostId' => $LastRead[$TopicID]['PostID']
|
'lastReadPostId' => $LastRead[$TopicID]['PostID'] == null ? 0 : (int) $LastRead[$TopicID]['PostID']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@
|
|||||||
'response' => array(
|
'response' => array(
|
||||||
'forumName' => $Forums[$ForumID]['Name'],
|
'forumName' => $Forums[$ForumID]['Name'],
|
||||||
'specificRules' => $JsonSpecificRules,
|
'specificRules' => $JsonSpecificRules,
|
||||||
'currentPage' => intval($Page),
|
'currentPage' => (int) $Page,
|
||||||
'pages' => ceil($Forums[$ForumID]['NumTopics']/TOPICS_PER_PAGE),
|
'pages' => ceil($Forums[$ForumID]['NumTopics']/TOPICS_PER_PAGE),
|
||||||
'threads' => $JsonTopics
|
'threads' => $JsonTopics
|
||||||
)
|
)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Already done in /sections/ajax/index.php
|
// Already done in /sections/ajax/index.php
|
||||||
//enforce_login();
|
//enforce_login();
|
||||||
|
|
||||||
authorize(true);
|
|
||||||
|
|
||||||
if (!empty($LoggedUser['DisableForums'])) {
|
if (!empty($LoggedUser['DisableForums'])) {
|
||||||
print json_encode(array('status' => 'failure'));
|
print json_encode(array('status' => 'failure'));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
authorize();
|
authorize(true);
|
||||||
|
|
||||||
if (isset($LoggedUser['PostsPerPage'])) {
|
if (isset($LoggedUser['PostsPerPage'])) {
|
||||||
$PerPage = $LoggedUser['PostsPerPage'];
|
$PerPage = $LoggedUser['PostsPerPage'];
|
||||||
@ -52,7 +52,7 @@
|
|||||||
}
|
}
|
||||||
$LastCategoryID = $CategoryID;
|
$LastCategoryID = $CategoryID;
|
||||||
$JsonCategory = array(
|
$JsonCategory = array(
|
||||||
'categoryID' => $CategoryID,
|
'categoryID' => (int) $CategoryID,
|
||||||
'categoryName' => $ForumCats[$CategoryID]
|
'categoryName' => $ForumCats[$CategoryID]
|
||||||
);
|
);
|
||||||
$JsonForums = array();
|
$JsonForums = array();
|
||||||
@ -65,21 +65,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$JsonForums[] = array(
|
$JsonForums[] = array(
|
||||||
'forumId' => $ForumID,
|
'forumId' => (int) $ForumID,
|
||||||
'forumName' => $ForumName,
|
'forumName' => $ForumName,
|
||||||
'forumDescription' => $ForumDescription,
|
'forumDescription' => $ForumDescription,
|
||||||
'numTopics' => $NumTopics,
|
'numTopics' => (float) $NumTopics,
|
||||||
'numPosts' => $NumPosts,
|
'numPosts' => (float) $NumPosts,
|
||||||
'lastPostId' => $LastPostID,
|
'lastPostId' => (float) $LastPostID,
|
||||||
'lastAuthorId' => $LastAuthorID,
|
'lastAuthorId' => (float) $LastAuthorID,
|
||||||
'lastPostAuthorName' => $LastPostAuthorName,
|
'lastPostAuthorName' => $LastPostAuthorName,
|
||||||
'lastTopicId' => $LastTopicID,
|
'lastTopicId' => (float) $LastTopicID,
|
||||||
'lastTime' => $LastTime,
|
'lastTime' => $LastTime,
|
||||||
'specificRules' => $SpecificRules,
|
'specificRules' => $SpecificRules,
|
||||||
'lastTopic' => $LastTopic,
|
'lastTopic' => $LastTopic,
|
||||||
'read' => $Read,
|
'read' => $Read == 1,
|
||||||
'locked' => $Locked,
|
'locked' => $Locked == 1,
|
||||||
'sticky' => $Sticky
|
'sticky' => $Sticky == 1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
//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 || ********************************\
|
/**********|| Page to show individual threads || ********************************\
|
||||||
@ -169,10 +169,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$JsonPoll['closed'] = $Closed;
|
$JsonPoll['closed'] = $Closed == 1;
|
||||||
$JsonPoll['featured'] = $Featured;
|
$JsonPoll['featured'] = $Featured;
|
||||||
$JsonPoll['question'] = $Question;
|
$JsonPoll['question'] = $Question;
|
||||||
$JsonPoll['maxVotes'] = $MaxVotes;
|
$JsonPoll['maxVotes'] = (int) $MaxVotes;
|
||||||
$JsonPoll['totalVotes'] = $TotalVotes;
|
$JsonPoll['totalVotes'] = $TotalVotes;
|
||||||
$JsonPollAnswers = array();
|
$JsonPollAnswers = array();
|
||||||
|
|
||||||
@ -215,19 +215,19 @@
|
|||||||
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
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));
|
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
|
||||||
$JsonPosts[] = array(
|
$JsonPosts[] = array(
|
||||||
'postId' => $PostID,
|
'postId' => (int) $PostID,
|
||||||
'addedTime' => $AddedTime,
|
'addedTime' => $AddedTime,
|
||||||
'body' => $Text->full_format($Body),
|
'body' => $Text->full_format($Body),
|
||||||
'editedUserId' => $EditedUserID,
|
'editedUserId' => (int) $EditedUserID,
|
||||||
'editedTime' => $EditedTime,
|
'editedTime' => $EditedTime,
|
||||||
'editedUsername' => $EditedUsername,
|
'editedUsername' => $EditedUsername,
|
||||||
'author' => array(
|
'author' => array(
|
||||||
'authorId' => $AuthorID,
|
'authorId' => (int) $AuthorID,
|
||||||
'authorName' => $Username,
|
'authorName' => $Username,
|
||||||
'paranoia' => $Paranoia,
|
'paranoia' => $Paranoia,
|
||||||
'artist' => $Artist,
|
'artist' => $Artist == 1,
|
||||||
'donor' => $Donor,
|
'donor' => $Donor == 1,
|
||||||
'warned' => $Warned,
|
'warned' => $Warned == 1,
|
||||||
'avatar' => $Avatar,
|
'avatar' => $Avatar,
|
||||||
'enabled' => $Enabled == 2 ? false : true,
|
'enabled' => $Enabled == 2 ? false : true,
|
||||||
'userTitle' => $UserTitle
|
'userTitle' => $UserTitle
|
||||||
@ -241,16 +241,16 @@
|
|||||||
array(
|
array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'response' => array(
|
'response' => array(
|
||||||
'forumId' => $ForumID,
|
'forumId' => (int) $ForumID,
|
||||||
'forumName' => $Forums[$ForumID]['Name'],
|
'forumName' => $Forums[$ForumID]['Name'],
|
||||||
'threadId' => $ThreadID,
|
'threadId' => (int) $ThreadID,
|
||||||
'threadTitle' => $ThreadInfo['Title'],
|
'threadTitle' => $ThreadInfo['Title'],
|
||||||
'subscribed' => in_array($ThreadID, $UserSubscriptions),
|
'subscribed' => in_array($ThreadID, $UserSubscriptions),
|
||||||
'locked' => $ThreadInfo['IsLocked'],
|
'locked' => $ThreadInfo['IsLocked'] == 1,
|
||||||
'sticky' => $ThreadInfo['IsSticky'],
|
'sticky' => $ThreadInfo['IsSticky'] == 1,
|
||||||
'currentPage' => intval($Page),
|
'currentPage' => (int) $Page,
|
||||||
'pages' => ceil($ThreadInfo['Posts']/$PerPage),
|
'pages' => ceil($ThreadInfo['Posts']/$PerPage),
|
||||||
'poll' => $JsonPoll,
|
'poll' => empty($JsonPoll) ? null : $JsonPoll,
|
||||||
'posts' => $JsonPosts
|
'posts' => $JsonPosts
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -82,16 +82,16 @@
|
|||||||
$JsonMessages = array();
|
$JsonMessages = array();
|
||||||
while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) {
|
while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) {
|
||||||
$JsonMessage = array(
|
$JsonMessage = array(
|
||||||
'convId' => $ConvID,
|
'convId' => (int) $ConvID,
|
||||||
'subject' => $Subject,
|
'subject' => $Subject,
|
||||||
'unread' => $Unread,
|
'unread' => $Unread == 1,
|
||||||
'sticky' => $Sticky,
|
'sticky' => $Sticky == 1,
|
||||||
'forwardedId' => $ForwardedID,
|
'forwardedId' => (int) $ForwardedID,
|
||||||
'forwardedName' => $ForwardedName,
|
'forwardedName' => $ForwardedName,
|
||||||
'senderId' => $SenderID,
|
'senderId' => (int) $SenderID,
|
||||||
'username' => $Username,
|
'username' => $Username,
|
||||||
'donor' => $Donor,
|
'donor' => $Donor == 1,
|
||||||
'warned' => $Warned,
|
'warned' => $Warned == 1,
|
||||||
'enabled' => ($Enabled == 2 ? false : true),
|
'enabled' => ($Enabled == 2 ? false : true),
|
||||||
'date' => $Date
|
'date' => $Date
|
||||||
);
|
);
|
||||||
@ -103,7 +103,7 @@
|
|||||||
array(
|
array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'response' => array(
|
'response' => array(
|
||||||
'currentPage' => intval($Page),
|
'currentPage' => (int) $Page,
|
||||||
'pages' => ceil($NumResults/MESSAGES_PER_PAGE),
|
'pages' => ceil($NumResults/MESSAGES_PER_PAGE),
|
||||||
'messages' => $JsonMessages
|
'messages' => $JsonMessages
|
||||||
)
|
)
|
||||||
|
@ -68,8 +68,8 @@
|
|||||||
$JsonMessages = array();
|
$JsonMessages = array();
|
||||||
while(list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
|
while(list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
|
||||||
$JsonMessage = array(
|
$JsonMessage = array(
|
||||||
'messageId' => $MessageID,
|
'messageId' => (int) $MessageID,
|
||||||
'senderId' => $SenderID,
|
'senderId' => (int) $SenderID,
|
||||||
'senderName' => $Users[(int)$SenderID]['Username'],
|
'senderName' => $Users[(int)$SenderID]['Username'],
|
||||||
'sentDate' => $SentDate,
|
'sentDate' => $SentDate,
|
||||||
'body' => $Text->full_format($Body)
|
'body' => $Text->full_format($Body)
|
||||||
@ -82,10 +82,11 @@
|
|||||||
array(
|
array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'response' => array(
|
'response' => array(
|
||||||
'convId' => $ConvID,
|
'convId' => (int) $ConvID,
|
||||||
'subject' => $Subject.($ForwardedID > 0 ? ' (Forwarded to '.$ForwardedName.')':''),
|
'subject' => $Subject.($ForwardedID > 0 ? ' (Forwarded to '.$ForwardedName.')':''),
|
||||||
'sticky' => $Sticky,
|
'sticky' => $Sticky == 1,
|
||||||
'messages' => $JsonMessages
|
'messages' => $JsonMessages
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
?>
|
||||||
|
@ -65,9 +65,15 @@
|
|||||||
case 'bookmarks':
|
case 'bookmarks':
|
||||||
require(SERVER_ROOT.'/sections/ajax/bookmarks.php');
|
require(SERVER_ROOT.'/sections/ajax/bookmarks.php');
|
||||||
break;
|
break;
|
||||||
|
case 'announcements':
|
||||||
|
require(SERVER_ROOT.'/sections/ajax/announcements.php');
|
||||||
|
break;
|
||||||
|
case 'notifications':
|
||||||
|
require(SERVER_ROOT.'/sections/ajax/notifications.php');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// If they're screwing around with the query string
|
// If they're screwing around with the query string
|
||||||
error(403);
|
print json_encode(array('status' => 'failure'));
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -42,10 +42,10 @@
|
|||||||
'authkey'=>$AuthKey,
|
'authkey'=>$AuthKey,
|
||||||
'passkey'=>$torrent_pass,
|
'passkey'=>$torrent_pass,
|
||||||
'userstats' => array(
|
'userstats' => array(
|
||||||
'uploaded' => $Uploaded,
|
'uploaded' => (int) $Uploaded,
|
||||||
'downloaded' => $Downloaded,
|
'downloaded' => (int) $Downloaded,
|
||||||
'ratio' => $Ratio,
|
'ratio' => (float) $Ratio,
|
||||||
'requiredratio' => $RequiredRatio,
|
'requiredratio' => (float) $RequiredRatio,
|
||||||
//'class' => $Class
|
//'class' => $Class
|
||||||
'class' => $ClassLevels[$Class]['Name']
|
'class' => $ClassLevels[$Class]['Name']
|
||||||
),
|
),
|
||||||
|
145
sections/ajax/notifications.php
Normal file
145
sections/ajax/notifications.php
Normal 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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
?>
|
@ -98,13 +98,13 @@
|
|||||||
$JsonPosts = array();
|
$JsonPosts = array();
|
||||||
while(list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()){
|
while(list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()){
|
||||||
$JsonPost = array(
|
$JsonPost = array(
|
||||||
'forumId' => $ForumID,
|
'forumId' => (int) $ForumID,
|
||||||
'forumName' => $ForumName,
|
'forumName' => $ForumName,
|
||||||
'threadId' => $TopicID,
|
'threadId' => (int) $TopicID,
|
||||||
'threadTitle' => $ThreadTitle,
|
'threadTitle' => $ThreadTitle,
|
||||||
'postId' => $PostID,
|
'postId' => (int) $PostID,
|
||||||
'lastPostId' => $LastPostID,
|
'lastPostId' => (int) $LastPostID,
|
||||||
'locked' => $Locked,
|
'locked' => $Locked == 1,
|
||||||
'new' => ($PostID<$LastPostID && !$Locked)
|
'new' => ($PostID<$LastPostID && !$Locked)
|
||||||
);
|
);
|
||||||
$JsonPosts[] = $JsonPost;
|
$JsonPosts[] = $JsonPost;
|
||||||
@ -115,7 +115,7 @@
|
|||||||
array(
|
array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'response' => array(
|
'response' => array(
|
||||||
'posts' => $JsonPosts
|
'threads' => $JsonPosts
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -38,10 +38,10 @@
|
|||||||
list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned) = $Result;
|
list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned) = $Result;
|
||||||
|
|
||||||
$JsonUsers[] = array(
|
$JsonUsers[] = array(
|
||||||
'userId' => $UserID,
|
'userId' => (int) $UserID,
|
||||||
'username' => $Username,
|
'username' => $Username,
|
||||||
'donor' => $Donor,
|
'donor' => $Donor == 1,
|
||||||
'warned' => $Warned,
|
'warned' => $Warned == 1,
|
||||||
'enabled' => ($Enabled == 2 ? false : true),
|
'enabled' => ($Enabled == 2 ? false : true),
|
||||||
'class' => make_class_string($PermissionID)
|
'class' => make_class_string($PermissionID)
|
||||||
);
|
);
|
||||||
@ -52,7 +52,7 @@
|
|||||||
array(
|
array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'response' => array(
|
'response' => array(
|
||||||
'currentPage' => $Page,
|
'currentPage' => (int) $Page,
|
||||||
'pages' => ceil($NumResults/USERS_PER_PAGE),
|
'pages' => ceil($NumResults/USERS_PER_PAGE),
|
||||||
'results' => $JsonUsers
|
'results' => $JsonUsers
|
||||||
)
|
)
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
if($_POST['submit'] == 'Remove') {
|
if($_POST['submit'] == 'Remove') {
|
||||||
$DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
$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('torrents_details_'.$GroupID);
|
||||||
$Cache->delete_value('torrent_collages_'.$GroupID);
|
$Cache->delete_value('torrent_collages_'.$GroupID);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user