query("
SELECT ID, GroupID
FROM torrents
WHERE info_hash = '$InfoHash'");
if ($DB->has_results()) {
list($ID, $GroupID) = $DB->next_record();
header("Location: torrents.php?id=$GroupID&torrentid=$ID");
error();
}
}
}
// Setting default search options
if (!empty($_GET['setdefault'])) {
$UnsetList = ['page', 'setdefault'];
$UnsetRegexp = '/(&|^)('.implode('|', $UnsetList).')=.*?(&|$)/i';
$DB->query("
SELECT SiteOptions
FROM users_info
WHERE UserID = ?", $LoggedUser['ID']);
list($SiteOptions) = $DB->next_record(MYSQLI_NUM, false);
$SiteOptions = json_decode($SiteOptions, true) ?? [];
$SiteOptions['DefaultSearch'] = preg_replace($UnsetRegexp, '', $_SERVER['QUERY_STRING']);
$DB->query("
UPDATE users_info
SET SiteOptions = ?
WHERE UserID = ?", json_encode($SiteOptions), $LoggedUser['ID']);
$Cache->begin_transaction("user_info_heavy_$UserID");
$Cache->update_row(false, ['DefaultSearch' => $SiteOptions['DefaultSearch']]);
$Cache->commit_transaction(0);
// Clearing default search options
} elseif (!empty($_GET['cleardefault'])) {
$DB->query("
SELECT SiteOptions
FROM users_info
WHERE UserID = ?", $LoggedUser['ID']);
list($SiteOptions) = $DB->next_record(MYSQLI_NUM, false);
$SiteOptions = json_decode($SiteOptions, true) ?? [];
$SiteOptions['DefaultSearch'] = '';
$DB->query("
UPDATE users_info
SET SiteOptions = ?
WHERE UserID = ?", json_encode($SiteOptions), $LoggedUser['ID']);
$Cache->begin_transaction("user_info_heavy_$UserID");
$Cache->update_row(false, ['DefaultSearch' => '']);
$Cache->commit_transaction(0);
// Use default search options
} elseif (empty($_SERVER['QUERY_STRING']) || (count($_GET) === 1 && isset($_GET['page']))) {
if (!empty($LoggedUser['DefaultSearch'])) {
if (!empty($_GET['page'])) {
$Page = $_GET['page'];
parse_str($LoggedUser['DefaultSearch'], $_GET);
$_GET['page'] = $Page;
} else {
parse_str($LoggedUser['DefaultSearch'], $_GET);
}
}
}
// Terms were not submitted via the search form
if (isset($_GET['searchsubmit'])) {
$GroupResults = !empty($_GET['group_results']);
} else {
$GroupResults = !$LoggedUser['DisableGrouping2'];
}
if (!empty($_GET['order_way']) && $_GET['order_way'] === 'asc') {
$OrderWay = 'asc';
} else {
$OrderWay = 'desc';
}
if (empty($_GET['order_by']) || !isset(TorrentSearch::$SortOrders[$_GET['order_by']])) {
$OrderBy = 'time'; // For header links
} else {
$OrderBy = $_GET['order_by'];
}
$Page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$Search = new TorrentSearch($GroupResults, $OrderBy, $OrderWay, $Page, TORRENTS_PER_PAGE);
# Three profile toggle options
if (isset($LoggedUser['HideLolicon']) && $LoggedUser['HideLolicon'] === 1) {
$Search->insert_hidden_tags('!lolicon !shotacon !toddlercon');
}
# 2
if (isset($LoggedUser['HideScat']) && $LoggedUser['HideScat'] === 1) {
$Search->insert_hidden_tags('!scat');
}
# 3
if (isset($LoggedUser['HideSnuff']) && $LoggedUser['HideSnuff'] === 1) {
$Search->insert_hidden_tags('!snuff');
}
$Results = $Search->query($_GET);
$Groups = $Search->get_groups();
$NumResults = $Search->record_count();
$HideFilter = isset($LoggedUser['ShowTorFilter']) && $LoggedUser['ShowTorFilter'] === 0;
// This is kinda ugly, but the enormous if paragraph was really hard to read
$AdvancedSearch = !empty($_GET['action']) && $_GET['action'] === 'advanced';
$AdvancedSearch |= !empty($LoggedUser['SearchType']) && (empty($_GET['action']) || $_GET['action'] === 'advanced');
$AdvancedSearch &= check_perms('site_advanced_search');
if ($AdvancedSearch) {
$Action = 'action=advanced';
$HideBasic = ' hidden';
$HideAdvanced = '';
} else {
$Action = 'action=basic';
$HideBasic = '';
$HideAdvanced = ' hidden';
}
# Start the search form
# Fortunately it's very easy to search via
# torrentsearch.class.php
View::show_header('Browse Torrents', 'browse');
?>
Your search did not match anything
Make sure all names are spelled correctly, or try making your search less specific
The requested page contains no matches
You are requesting page =$Page?>, but the search returned only
=number_format($LastPage) ?> pages
Go to page =$Pages?>
=$Pages?>
|
|
Name / Year
|
Files |
Time
|
Size
|
↻
|
↑
|
↓
|
$GroupID) {
$GroupInfo = $Groups[$GroupID];
if (empty($GroupInfo['Torrents'])) {
continue;
}
$CategoryID = $GroupInfo['CategoryID'];
$GroupYear = $GroupInfo['Year'];
$Artists = $GroupInfo['Artists'];
$GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
$GroupStudio = $GroupInfo['Studio'];
$GroupName = empty($GroupInfo['Name']) ? (empty($GroupInfo['Title2']) ? $GroupInfo['NameJP'] : $GroupInfo['Title2']) : $GroupInfo['Name'];
$GroupTitle2 = $GroupInfo['Title2'];
$GroupNameJP = $GroupInfo['NameJP'];
if ($GroupResults) {
$Torrents = $GroupInfo['Torrents'];
$GroupTime = $MaxSize = $TotalLeechers = $TotalSeeders = $TotalSnatched = 0;
foreach ($Torrents as $T) {
$GroupTime = max($GroupTime, strtotime($T['Time']));
$MaxSize = max($MaxSize, $T['Size']);
$TotalLeechers += $T['Leechers'];
$TotalSeeders += $T['Seeders'];
$TotalSnatched += $T['Snatched'];
}
} else {
$TorrentID = $Key;
$Torrents = [$TorrentID => $GroupInfo['Torrents'][$TorrentID]];
}
$TorrentTags = new Tags($GroupInfo['TagList']);
# Start making $DisplayName (first torrent result line)
$DisplayName = '';
/*
if (isset($Artists)) {
$DisplayName = ''.Artists::display_artists($Artists).'
';
} else {
$DisplayName = '';
}
*/
$SnatchedGroupClass = $GroupInfo['Flags']['IsSnatched'] ? ' snatched_group' : '';
# Similar to the logic down the page, and on
# torrents.class.php and sections/artist/artist.php
if ($GroupResults && (count($Torrents) > 1 && isset($GroupedCategories[$CategoryID - 1]))) {
// These torrents are in a group
$CoverArt = $GroupInfo['WikiImage'];
$DisplayName .= "📅 ';
$DisplayName .= $Label."$GroupYear";
}
# Studio
if ($GroupStudio) {
$Label = ' 📍 ';
$DisplayName .= $Label."$GroupStudio";
}
# Catalogue Number
if ($GroupCatalogueNumber) {
$Label = ' 🔑 ';
$DisplayName .= $Label."$GroupCatalogueNumber";
}
# Organism
if ($GroupTitle2) {
$Label = ' 🦠 ';
$DisplayName .= $Label."$GroupTitle2";
}
# Strain/Variety
if ($GroupNameJP) {
$Label = ' ';
$DisplayName .= $Label."$GroupNameJP";
}
# Authors
if (isset($Artists)) {
# Emoji in classes/astists.class.php
$Label = ' ';
$DisplayName .= $Label.''.Artists::display_artists($Artists).'
';
}
?>
|
|
|
=time_diff($GroupTime, 1)?>
|
=Format::get_size($MaxSize)?>(Max) |
=number_format($TotalSnatched)?>
|
=number_format($TotalSeeders)?>
|
=number_format($TotalLeechers)?>
|
$Data) {
$Data['CategoryID'] = $CategoryID;
// All of the individual torrents in the group
// Get report info for each torrent, use the cache if available, if not, add to it
$Reported = false;
$Reports = Torrents::get_reports($TorrentID);
if (count($Reports) > 0) {
$Reported = true;
}
$SnatchedTorrentClass = $Data['IsSnatched'] ? ' snatched_torrent' : '';
$TorrentDL = "torrents.php?action=download&id=".$TorrentID."&authkey=".$LoggedUser['AuthKey']."&torrent_pass=".$LoggedUser['torrent_pass'];
if (!($TorrentFileName = $Cache->get_value('torrent_file_name_'.$TorrentID))) {
$TorrentFile = file_get_contents(TORRENT_STORE.$TorrentID.'.torrent');
$Tor = new BencodeTorrent($TorrentFile, false, false);
$TorrentFileName = $Tor->Dec['info']['name'];
$Cache->cache_value('torrent_file_name_'.$TorrentID, $TorrentFileName);
} ?>
[ =$Data['HasFile'] ? 'DL' : 'Missing'?>
| FL
| RP ]
Details
| =Torrents::torrent_info($Data)?>
| Reported
|
=$Data['FileCount']?>
|
=time_diff($Data['Time'], 1)?>
|
=Format::get_size($Data['Size'])?>
|
=number_format($Data['Snatched'])?>
|
=number_format($Data['Seeders'])?>
|
=number_format($Data['Leechers'])?>
|
0) {
$Reported = true;
}
# Main search result title link
# These are the main torrent search results
$Data['CategoryID'] = $CategoryID;
$CoverArt = $GroupInfo['WikiImage'];
$DisplayName .= "📅 ';
$DisplayName .= $Label."$GroupYear";
}
# Studio
if ($GroupStudio) {
$DisplayName .= " 📍 $GroupStudio";
}
# Catalogue Number
if ($GroupCatalogueNumber) {
$Label = ' 🔑 ';
$DisplayName .= $Label."$GroupCatalogueNumber";
}
# Organism
if ($GroupTitle2) {
$Label = ' 🦠 ';
$DisplayName .= $Label."$GroupTitle2";
}
# Strain/Variety
if ($GroupNameJP) {
$Label = ' ';
$DisplayName .= $Label."$GroupNameJP";
}
# Authors
if (isset($Artists)) {
# Emoji in classes/astists.class.php
$Label = ' ';
$DisplayName .= $Label.''.Artists::display_artists($Artists).'
';
}
$ExtraInfo = Torrents::torrent_info($Data, true, true);
} elseif ($Data['IsSnatched']) {
$ExtraInfo = Format::torrent_label('Snatched!');
} else {
$ExtraInfo = '';
}
$SnatchedTorrentClass = $Data['IsSnatched'] ? ' snatched_torrent' : '';
$TorrentDL = "torrents.php?action=download&id=".$TorrentID."&authkey=".$LoggedUser['AuthKey']."&torrent_pass=".$LoggedUser['torrent_pass'];
if (!($TorrentFileName = $Cache->get_value('torrent_file_name_'.$TorrentID))) {
$TorrentFile = file_get_contents(TORRENT_STORE.$TorrentID.'.torrent');
$Tor = new BencodeTorrent($TorrentFile, false, false);
$TorrentFileName = $Tor->Dec['info']['name'];
$Cache->cache_value('torrent_file_name_'.$TorrentID, $TorrentFileName);
} ?>
|
|
=$DisplayName?>
=$ExtraInfo?>
/ Reported
=$TorrentTags->format("torrents.php?$Action&taglist=")?>
|
=$Data['FileCount']?>
|
=time_diff($Data['Time'], 1)?>
|
=Format::get_size($Data['Size'])?>
|
=number_format($Data['Snatched'])?>
|
=number_format($Data['Seeders'])?>
|
=number_format($Data['Leechers'])?>
|
=$Pages?>