diff --git a/classes/torrents.class.php b/classes/torrents.class.php index 8cf9417b..c630ad35 100644 --- a/classes/torrents.class.php +++ b/classes/torrents.class.php @@ -3,7 +3,7 @@ class Torrents { const FILELIST_DELIM = 0xF7; // Hex for ÷ Must be the same as phrase_boundary in sphinx.conf! const SNATCHED_UPDATE_INTERVAL = 3600; // How often we want to update users' snatch lists - /* + /** * Function to get data and torrents for an array of GroupIDs. Order of keys doesn't matter * * @param array $GroupIDs @@ -882,6 +882,68 @@ public static function has_snatched($TorrentID, $AllUsers = false) { return isset($CurSnatchedTorrents[$TorrentID]); } + // Some constants for self::display_string's $Mode parameter + const DISPLAYSTRING_HTML = 1; // Whether or not to use HTML for the output (e.g. VH tooltip) + const DISPLAYSTRING_ARTISTS = 2; // Whether or not to display artists + const DISPLAYSTRING_YEAR = 4; // Whether or not to display the group's year + const DISPLAYSTRING_VH = 8; // Whether or not to display the VH flag + const DISPLAYSTRING_RELEASETYPE = 16; // Whether or not to display the release type + const DISPLAYSTRING_LINKED = 33; // Whether or not to link artists and the group + // The constant for linking is 32, but because linking only works with HTML, this constant is defined as 32|1 = 33, i.e. LINKED also includes HTML + // Keep this in mind when defining presets below! + + // Presets to facilitate the use of $Mode + const DISPLAYSTRING_DEFAULT = 63; // HTML|ARTISTS|YEAR|VH|RELEASETYPE|LINKED = 63 + const DISPLAYSTRING_SHORT = 6; // Very simple format, only artists and year, no linking (e.g. for forum thread titles) + + /** + * Return the display string for a given torrent group $GroupID. + * @param int $GroupID + * @return string + */ + public static function display_string($GroupID, $Mode = self::DISPLAYSTRING_DEFAULT) { + global $ReleaseTypes; // I hate this + + $GroupInfo = self::get_groups(array($GroupID), true, true, false)[$GroupID]; + $ExtendedArtists = $GroupInfo['ExtendedArtists']; + + if ($Mode & self::DISPLAYSTRING_ARTISTS) { + if (!empty($ExtendedArtists[1]) + || !empty($ExtendedArtists[4]) + || !empty($ExtendedArtists[5]) + || !empty($ExtendedArtists[6]) + ) { + unset($ExtendedArtists[2], $ExtendedArtists[3]); + $DisplayName = Artists::display_artists($ExtendedArtists, ($Mode & self::DISPLAYSTRING_LINKED)); + } else { + $DisplayName = ''; + } + } + + if ($Mode & self::DISPLAYSTRING_LINKED) { + $DisplayName .= "$GroupInfo[Name]"; + } else { + $DisplayName .= $GroupInfo['Name']; + } + + if (($Mode & self::DISPLAYSTRING_YEAR) && $GroupInfo['Year'] > 0) { + $DisplayName .= " [$GroupInfo[Year]]"; + } + + if (($Mode & self::DISPLAYSTRING_VH) && $GroupInfo['VanityHouse']) { + if ($Mode & self::DISPLAYSTRING_HTML) { + $DisplayName .= ' [VH]'; + } else { + $DisplayName .= ' [VH]'; + } + } + + if (($Mode & self::DISPLAYSTRING_RELEASETYPE) && $GroupInfo['ReleaseType'] > 0) { + $DisplayName .= ' ['.$ReleaseTypes[$GroupInfo['ReleaseType']].']'; + } + + return $DisplayName; + } public static function edition_string(array $Torrent, array $Group) { if ($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) { diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 3977e9c2..3b1813bd 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -1,5 +1,14 @@ CHANGE LOG +2013-12-25 by Ajax +Custom date input for manual additions to the changelog + +2013-12-24 by Y +Split the "Wiki" class (which has nothing to do with the wiki but deals with revisions on artist and torrent pages) into RevisionHistory + RevisionHistoryView + +2013-12-24 by Y +New Wiki class that handles the stuff ALIAS did before; various changes to the horrible wiki system, including the deletion of some obsolete files + 2013-12-23 by alderaan Clear "user_info_$UserID" for each user that gets disabled for having never logged in diff --git a/sections/forums/mod_thread.php b/sections/forums/mod_thread.php index af23629e..51952c71 100644 --- a/sections/forums/mod_thread.php +++ b/sections/forums/mod_thread.php @@ -121,6 +121,7 @@ LastPostAuthorID = '$NewLastAuthorID', LastPostTime = '$NewLastAddedTime' WHERE ID = '$ForumID'"); + $Cache->delete_value("forums_$ForumID"); $Cache->delete_value("thread_$TopicID"); diff --git a/sections/reportsv2/takereport.php b/sections/reportsv2/takereport.php index 833100a5..30f6731c 100644 --- a/sections/reportsv2/takereport.php +++ b/sections/reportsv2/takereport.php @@ -99,12 +99,13 @@ } $DB->query(" - SELECT ID + SELECT GroupID FROM torrents WHERE ID = $TorrentID"); if (!$DB->has_results()) { $Err = "A torrent with that ID doesn't exist!"; } +list($GroupID) = $DB->next_record(); if (!empty($Err)) { error($Err); diff --git a/sections/tools/managers/change_log.php b/sections/tools/managers/change_log.php index 460e30a2..95f8f656 100644 --- a/sections/tools/managers/change_log.php +++ b/sections/tools/managers/change_log.php @@ -9,9 +9,13 @@ if ($_POST['perform'] === 'add' && !empty($_POST['message'])) { $Message = db_string($_POST['message']); $Author = db_string($_POST['author']); + $Date = db_string($_POST['date']); + if (!is_valid_date($Date)) { + $Date = sqltime(); + } $DB->query(" INSERT INTO changelog (Message, Author, Time) - VALUES ('$Message', '$Author', NOW())"); + VALUES ('$Message', '$Author', '$Date')"); $ID = $DB->inserted_id(); // SiteHistory::add_event(sqltime(), "Change log $ID", "tools.php?action=change_log", 1, 3, "", $Message, $LoggedUser['ID']); @@ -30,15 +34,15 @@ ID, Message, Author, - Date(Time) as Time + Date(Time) as Time2 FROM changelog - ORDER BY ID DESC + ORDER BY Time DESC LIMIT $Limit"); $ChangeLog = $DB->to_array(); $DB->query('SELECT FOUND_ROWS()'); list($NumResults) = $DB->next_record(); -View::show_header('Gazelle Change Log'); +View::show_header('Gazelle Change Log', 'datetime_picker', 'datetime_picker'); ?>

Gazelle Change Log

@@ -62,6 +66,11 @@
+
+ Date: +
+ +
Author:
@@ -80,7 +89,7 @@ ?>
- by + by
diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 7384c703..238de1e0 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -601,7 +601,7 @@ function filelist($Str) {
File Names' . $RegenLink . '
' . ($FilePath ? "/$FilePath/" : '') . '
- + Size '; @@ -614,13 +614,13 @@ function filelist($Str) { $Name = str_replace(' ', ' ', substr($Name, 0, $Spaces)) . substr($Name, $Spaces); } $FileSize = substr($File, $NameEnd + 3, -3); - $FileTable .= sprintf("\n%s%s", $Name, Format::get_size($FileSize)); + $FileTable .= sprintf("\n%s%s", $Name, Format::get_size($FileSize)); } } else { $FileListSplit = explode("\n", $FileList); foreach ($FileListSplit as $File) { $FileInfo = Torrents::filelist_get_file($File); - $FileTable .= sprintf("\n%s%s", $FileInfo['name'], Format::get_size($FileInfo['size'])); + $FileTable .= sprintf("\n%s%s", $FileInfo['name'], Format::get_size($FileInfo['size'])); } } $FileTable .= '