diff --git a/classes/misc.class.php b/classes/misc.class.php index 8befd92e..c56c22dc 100644 --- a/classes/misc.class.php +++ b/classes/misc.class.php @@ -447,6 +447,26 @@ public static function display_array($Array, $Escape = array()) { return $Array; } + /** + * Searches for a key/value pair in an array. + * + * @return array of results + */ + public static function search_array($Array, $Key, $Value) { + $Results = array(); + if (is_array($Array)) + { + if (isset($Array[$Key]) && $Array[$Key] == $Value) { + $Results[] = $Array; + } + + foreach ($Array as $subarray) { + $Results = array_merge($Results, self::search_array($subarray, $Key, $Value)); + } + } + return $Results; + } + /** * Check for a : in the beginning of a torrent meta data string * to see if it's stored in the old base64-encoded format diff --git a/design/privateheader.php b/design/privateheader.php index 5c0e52d0..8189c2ce 100644 --- a/design/privateheader.php +++ b/design/privateheader.php @@ -19,6 +19,7 @@ + if (isset($LoggedUser['Notify'])) { diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 31ce48f8..5e39bc75 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -1,5 +1,11 @@ CHANGELOG +2013-06-15 by Ajax +Adding &artistreleases=1 to artist api url will display only releases by the current artist + +2013-06-15 by Ajax +Added artist and extended artist information to torrent groups in artist json output + 2013-06-14 by eth Adds option to load news posts using ajax diff --git a/gazelle.sql b/gazelle.sql index 3b95584f..40abb598 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -155,11 +155,11 @@ CREATE TABLE `bookmarks_torrents` ( ) 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, - `author` varchar(30) COLLATE utf8_swedish_ci DEFAULT NULL, - PRIMARY KEY (`id`) + `ID` int(11) NOT NULL AUTO_INCREMENT, + `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `Message` text COLLATE utf8_swedish_ci NOT NULL, + `Author` varchar(30) COLLATE utf8_swedish_ci NOT NULL, + PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci; CREATE TABLE `collages` ( diff --git a/sections/ajax/artist.php b/sections/ajax/artist.php index 907ec82f..44a8e046 100644 --- a/sections/ajax/artist.php +++ b/sections/ajax/artist.php @@ -7,6 +7,10 @@ function compare($X, $Y) { include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class $Text = new TEXT; +if (!empty($_GET['artistreleases'])) { + $OnlyArtistReleases = true; +} + if ($_GET['id'] && $_GET['artistname']) { json_die("failure", "bad parameters"); } @@ -169,6 +173,24 @@ function compare($X, $Y) { foreach ($TorrentList as $GroupID => $Group) { extract(Torrents::array_group($Group)); + foreach($Artists as &$Artist) { + $Artist['id'] = (int) $Artist['id']; + $Artist['aliasid'] = (int) $Artist['aliasid']; + } + + foreach($ExtendedArtists as &$ArtistGroup) { + foreach($ArtistGroup as &$Artist) { + $Artist['id'] = (int) $Artist['id']; + $Artist['aliasid'] = (int) $Artist['aliasid']; + + } + } + + $Found = Misc::search_array($Artists, 'id', $ArtistID); + if (isset($OnlyArtistReleases) && empty($Found)) { + continue; + } + $GroupVanityHouse = $Importances[$GroupID]['VanityHouse']; $TagList = explode(' ',str_replace('_','.',$TagList)); @@ -224,7 +246,10 @@ function compare($X, $Y) { 'wikiImage' => $WikiImage, 'groupVanityHouse' => $GroupVanityHouse == 1, 'hasBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), - 'torrent' => $InnerTorrents + 'artists' => $Artists, + 'extendedArtists' => $ExtendedArtists, + 'torrent' => $InnerTorrents, + ); } diff --git a/sections/feeds/index.php b/sections/feeds/index.php index 7c519707..557c0325 100644 --- a/sections/feeds/index.php +++ b/sections/feeds/index.php @@ -102,6 +102,22 @@ } } break; + case 'feed_changelog': + $Feed->channel('Gazelle Change Log', 'RSS feed for Gazelle\'s changelog.'); + if (!$Changelog = $Cache->get_value('changelog')) { + require(SERVER_ROOT.'/classes/mysql.class.php'); + require(SERVER_ROOT.'/classes/misc.class.php'); + + $DB = NEW DB_MYSQL; + $DB->query("SELECT Message, Author, Date(Time) FROM changelog ORDER BY Time DESC LIMIT 20"); + $Changelog = $DB->to_array(); + $Cache->cache_value('changelog', $Changelog, 86400); + } + foreach ($Changelog as $Change) { + list($Message, $Author, $Date) = $Change; + echo $Feed->item($Date . " by " . $Author, $Message, 'tools.php?action=change_log', SITE_NAME.' Staff','','',$Date); + } + break; case 'torrents_all': $Feed->channel('All Torrents', 'RSS feed for all new torrent uploads.'); $Feed->retrieve('torrents_all',$_GET['authkey'],$_GET['passkey']); diff --git a/sections/tools/managers/change_log.php b/sections/tools/managers/change_log.php index 9f30ef86..2ab5a943 100644 --- a/sections/tools/managers/change_log.php +++ b/sections/tools/managers/change_log.php @@ -45,49 +45,50 @@ echo "\t\t$Pages\n"; ?> -