diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 6ef1650e..31ce48f8 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -1,155 +1,11 @@ CHANGELOG -2013-03-01 --This log is extremely out-of-date, and the log is unlikely to be maintained in the future; however, the Gazelle project is still alive and well. --This log is being kept for historical purposes only. +2013-06-14 by eth +Adds option to load news posts using ajax -2010-08-28 --Upgrade Sphinx to 1.10b +2013-06-14 by Ajax +Show number of subscribers and last updated in collage stats -2010-08-25 --Better handling of special characters in torrent searches --Improved file name search --Add negations to request searches +2013-06-14 by Ajax +Hello Change Log -2010-08-11 --Fixed long standing IE Bug. Turns out that IE fails to handle unicode data in the Content-disposition header so this value is now urlencoded ensuring compatibility. - -2010-08-10 --Added check for CustomPerms IP protection on login - -2010-07-30 --Add collage stats to user profiles - -2010-07-04 --Updated sphinx.conf - -2010-06-26 --Fixed IP bans and added to public repo --Added catch for missing system 'host' command --Logged in users can't hit register.php --Fix in URL_REGEX to allow URLs of the form http://foo.com/ - -2010-06-09 --Delete torrent files when torrent is deleted - -2010-06-04 --User proper names on bookmark/notify links if a group is already bookmarked or in the notifications - -2010-05-21 --Sortable invitee list - -2010-05-16 --Escape tag links on user torrent pages - -2010-05-12 --Make the "view tags" button change to "hide tags" if tags are shown --Make editing upload/download amounts work on 32bit systems --Fix a typo in class_cache, not major --Add default values to schedule table - -2010-05-09 --Add catchup link to subscriptions page - -2010-05-05 --Move $Classes fetching code to somewhere globally accessible so that schedule can fetch it - -2010-05-03 --Fixed bug in 32bit parser that would allow clients to set private=0 - -2010-05-01 --Add preview functionality to thread creation page - -2010-04-30 --Fix various subscription bugs - -2010-04-29 --Properly update cache and database when a forum post is removed - -2010-04-28 --Alias IDs now show next to artists in the artist box --Users with an infinite ratio now get promoted along with those who have a -ratio of 1.05 or higher - -2010-04-26 --Fixed bug where snatchlists were not visible to other users at paranoia level -1 (should be 2 or higher) - -2010-04-19 --Add requests to sphinx.conf - -2010-04-18 --Fix request sorting - -2010-04-15 --Added clickable staff notes - -2010-04-14 --Add stylesheet and avatar search to advanced user search - -2010-04-13 --Require authorization to manually run schedule --Fix minor bbcode bug which didn't allow question marks in filenames - -2010-04-11 --Add "visible" checkbox to user profiles. Unticked, this will remove a user from a peer list. --Add option to disable PM privileges of user - -2010-04-07 --Fix critical bug where users can view staff forum posts by changing the ID on the reports page - -2010-03-18 --Clear notifications per torrent or filter - -2010-03-16 --Notifications groups actually work now --Post history and subscriptions pages now default to unread posts with collapsed post bodies - -2010-03-14 --Group notifications by filter - -2010-03-13 --Added ability to view a user's downloaded torrents as well as snatched - -2010-03-12 --Thread subscriptions --Various bugfixes, see resolved gazelle bug forum --Standardised Email and Image regexes across gazelle - -2010-03-10 --Completed requestsv2, feel free to use it now - -2010-03-09 --Add size and files column to notifications page and clone the browse layout --Don't redirect if ssl url == nonssl url --Fix some more warnings when calling sphinxapi.php --Year filter in notifications also checks remaster year - -2010-03-07 --Change INSERT INTO to REPLACE INTO to avoid errors when updating the sphinx*_delta tables - -2010-03-04 --Added initial version of requestsv2, will need more updates so not advised to -update yet - -2010-03-02 --Fixed bug in notifications by tags - -2010-03-01 --Fixed bug in notifications by release type - -2010-02-28 --Fixed bug which causes stats to be altered if the tracker updates while someone with stat editing powers moderates a profile --Fixed artist permission --Fixed two permission bugs --Removed references to What.CD in takemoderate.php --Fixed E_NOTICE with regards to taglist on browse2.php --Removed geodistribution from stats, fixed stats so they don't whitepage --Fixed the user geodistribution stats and geoip database updater, and added a function for an unsigned ip2long --Kill poll manager, it doesn't work anymore - use the forums - -Fix width of poll replies, don't display poll if there aren't any --Re-add reports folder --Fixed "database schema" tool --Fix upscale pool blank message --Fix number of posts in a forum after a thread has been moved out of it --Strip out SVN revision echo diff --git a/gazelle.sql b/gazelle.sql index 65f5210d..5a90926f 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -154,13 +154,6 @@ CREATE TABLE `bookmarks_torrents` ( KEY `GroupID` (`GroupID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -CREATE TABLE `changelog` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `time` datetime DEFAULT NULL, - `message` text COLLATE utf8_swedish_ci, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci; - CREATE TABLE `collages` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `Name` varchar(100) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL DEFAULT '', diff --git a/sections/ajax/index.php b/sections/ajax/index.php index fe7cda46..213c66e4 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -13,7 +13,7 @@ /* AJAX_LIMIT = array(x,y) = 'x' requests every 'y' seconds. e.g. array(5,10) = 5 requests every 10 seconds */ $AJAX_LIMIT = array(5,10); -$Limited_Pages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup'); +$Limited_Pages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup','news_ajax'); header('Content-Type: application/json; charset=utf-8'); @@ -144,6 +144,9 @@ case 'get_friends': require(SERVER_ROOT . '/sections/ajax/get_friends.php'); break; + case 'news_ajax': + require(SERVER_ROOT . '/sections/ajax/news_ajax.php'); + break; default: // If they're screwing around with the query string json_die("failure"); diff --git a/sections/ajax/news_ajax.php b/sections/ajax/news_ajax.php new file mode 100644 index 00000000..188d9542 --- /dev/null +++ b/sections/ajax/news_ajax.php @@ -0,0 +1,42 @@ + $SizeLimit) { + json_die('failure'); +} + +include(SERVER_ROOT . '/classes/text.class.php'); +$Text = new TEXT(true); + +global $DB; +$DB->query(" + SELECT + ID, + Title, + Body, + Time + FROM news + ORDER BY Time DESC + LIMIT " . $Offset . "," . $Count); +$News = $DB->to_array(false, MYSQLI_NUM, false); + +$NewsResponse = array(); +foreach ($News as $NewsItem) { + list($NewsID, $Title, $Body, $NewsTime) = $NewsItem; + array_push( + $NewsResponse, + array( + $NewsID, + $Text->full_format($Title), + time_diff($NewsTime), + $Text->full_format($Body) + ) + ); +} + +json_die('success', json_encode($NewsResponse)); \ No newline at end of file diff --git a/sections/collages/artist_collage.php b/sections/collages/artist_collage.php index 4f6e9b43..86edee21 100644 --- a/sections/collages/artist_collage.php +++ b/sections/collages/artist_collage.php @@ -142,7 +142,9 @@
Stats
diff --git a/sections/collages/collage.php b/sections/collages/collage.php index 7c1f82ad..b348d2f5 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -21,11 +21,11 @@ function compare($X, $Y) { $Data = $Cache->get_value('collage_'.$CollageID); if ($Data) { - list($K, list($Name, $Description, , , $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)) = each($Data); + list($K, list($Name, $Description, , , $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers)) = each($Data); } else { - $DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'"); + $DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser, Updated, Subscribers FROM collages WHERE ID='$CollageID'"); if ($DB->record_count() > 0) { - list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record(); + list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $DB->next_record(); $TorrentList = ''; $CollageList = ''; } else { diff --git a/sections/collages/torrent_collage.php b/sections/collages/torrent_collage.php index df7481ca..19a7f8ea 100644 --- a/sections/collages/torrent_collage.php +++ b/sections/collages/torrent_collage.php @@ -385,7 +385,9 @@
  • Artists:
  • +
  • Subscribers:
  • Built by user 1 ? 's' : '')?>
  • +
  • Last updated:
  • diff --git a/sections/index/private.php b/sections/index/private.php index 5bc4e921..e1c43af9 100644 --- a/sections/index/private.php +++ b/sections/index/private.php @@ -2,6 +2,7 @@ include(SERVER_ROOT.'/classes/text.class.php'); $Text = new TEXT(true); +$NewsCount = 5; if (!$News = $Cache->get_value('news')) { $DB->query(" SELECT @@ -11,7 +12,7 @@ Time FROM news ORDER BY Time DESC - LIMIT 5"); + LIMIT " . $NewsCount); $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); @@ -25,7 +26,7 @@ $LoggedUser['LastReadNews'] = $News[0][0]; } -View::show_header('News','bbcode'); +View::show_header('News','bbcode,jquery,news_ajax'); ?>
    -
    full_format($Body)?>
    + +
    full_format($Body)?>
    4) { + if (++$Count > ($NewsCount-1)) { break; } } ?>
    - For older news posts, click here. + Click to load more news. To browse old news posts, click here.
    diff --git a/sections/tools/index.php b/sections/tools/index.php index b76ab12d..b3b86e43 100644 --- a/sections/tools/index.php +++ b/sections/tools/index.php @@ -193,6 +193,7 @@ case 'label_aliases': include('managers/label_aliases.php'); break; + case 'permissions': if (!check_perms('admin_manage_permissions')) { error(403); diff --git a/sections/tools/tools.php b/sections/tools/tools.php index 7916f25e..c54b3f36 100644 --- a/sections/tools/tools.php +++ b/sections/tools/tools.php @@ -33,6 +33,7 @@ Label aliases +
    diff --git a/sections/userhistory/collage_subscribe.php b/sections/userhistory/collage_subscribe.php index 34b2fb41..bcd5660f 100644 --- a/sections/userhistory/collage_subscribe.php +++ b/sections/userhistory/collage_subscribe.php @@ -25,3 +25,4 @@ } $Cache->replace_value('collage_subs_user_'.$LoggedUser['ID'], $UserSubscriptions, 0); $Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']); +$Cache->delete_value('collage_'.$CollageID); diff --git a/static/functions/news_ajax.js b/static/functions/news_ajax.js new file mode 100644 index 00000000..7e512c7f --- /dev/null +++ b/static/functions/news_ajax.js @@ -0,0 +1,55 @@ +function news_ajax(event, count, offset, privileged){ + /* + * event - The click event, passed to hide the element when necessary. + * count - Number of news items to fetch. + * offset - Database offset for fetching news. + * privilege - Gotta check your privilege (used to show/hide [Edit] on news). + * + * This function isn't wrapped in jQuery, be sure we use it + * instead of the mix-mashed Gazelle $ function. + */ + var $ = jQuery.noConflict(); + //Unbind onclick to avoid spamclicks. + $(event.target).attr('onclick', 'return false;'); + //Fetch news data, check for errors etc. + $.get("ajax.php", { + action: "news_ajax", + count: count, + offset: offset + }) + .done(function(data) { + var response = $.parseJSON(data.response); + if (typeof data == 'undefined' || data == null || data.status != "success" || typeof response == 'undefined' || response == null){ + console.log("ERR ajax_news("+(new Error).lineNumber+"): Unknown data or failure returned."); + //Return to original paremeters, no news were added. + $(event.target).attr('onclick', 'news_ajax(event, ' + count + ', '+ offset +', '+privileged+'); return false;'); + } else { + if(response.length == 0){ + $(event.target).parent().remove(); + } else { + var targetClass = $('#more_news').prev().attr('class'); + $.each(response, function(){ + //Create a new element, insert the news. + $('#more_news').before($('
    ', { + id: 'news'+this[0], + Class: targetClass + })); + //I'm so happy with this condition statement. + if(privileged){ + $('#news'+this[0]).append('
    '+this[1]+' '+this[2]+' - Edit
    '); + } else { + $('#news'+this[0]).append('
    '+this[1]+' '+this[2]+'
    '); + } + $('#news'+this[0]).append('
    '+this[3]+'
    '); + }); + //Update the onclick parameters to appropriate offset. + $(event.target).attr('onclick', 'news_ajax(event, ' + count + ', '+ (count+offset) +', '+privileged+'); return false;'); + } + } + }) + .fail(function() { + console.log("WARN ajax_news("+(new Error).lineNumber+"): Ajax get failed."); + //Return to original paremeters, no news were added. + $(event.target).attr('onclick', 'news_ajax(event, ' + count + ', '+ offset +', '+privileged+'); return false;'); + }); +} \ No newline at end of file