array('unt' => 'unt.TorrentID'), 'size' => array('t' => 't.Size'), 'snatches' => array('t' => 't.Snatched'), 'seeders' => array('t' => 't.Seeders'), 'leechers' => array('t' => 't.Leechers'), 'year' => array('tg' => 'tnt.Year')); if (empty($_GET['order_by']) || !isset($OrderBys[$_GET['order_by']])) { $_GET['order_by'] = 'time'; } list($OrderTbl, $OrderCol) = each($OrderBys[$_GET['order_by']]); if (!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') { $OrderWay = 'ASC'; } else { $OrderWay = 'DESC'; } if (!empty($_GET['filterid']) && is_number($_GET['filterid'])) { $FilterID = $_GET['filterid']; } else { $FilterID = false; } list($Page, $Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE); // The "order by x" links on columns headers function header_link($SortKey, $DefaultWay = 'desc') { global $OrderWay; if ($SortKey == $_GET['order_by']) { if ($OrderWay == 'DESC') { $NewWay = 'asc'; } else { $NewWay = 'desc'; } } else { $NewWay = $DefaultWay; } return "?action=notify&order_way=$NewWay&order_by=$SortKey&".Format::get_url(array('page', 'order_way', 'order_by')); } //Perhaps this should be a feature at some point if (check_perms('users_mod') && !empty($_GET['userid']) && is_number($_GET['userid']) && $_GET['userid'] != $LoggedUser['ID']) { $UserID = $_GET['userid']; $Sneaky = true; } else { $Sneaky = false; $UserID = $LoggedUser['ID']; } // Sorting by release year requires joining torrents_group, which is slow. Using a temporary table // makes it speedy enough as long as there aren't too many records to create if ($OrderTbl == 'tg') { $DB->query(" SELECT COUNT(*) FROM users_notify_torrents AS unt JOIN torrents AS t ON t.ID=unt.TorrentID WHERE unt.UserID=$UserID". ($FilterID ? " AND FilterID=$FilterID" : '')); list($TorrentCount) = $DB->next_record(); if ($TorrentCount > NOTIFICATIONS_MAX_SLOWSORT) { error('Due to performance issues, torrent lists with more than '.number_format(NOTIFICATIONS_MAX_SLOWSORT).' items cannot be ordered by release year.'); } $DB->query(" CREATE TEMPORARY TABLE temp_notify_torrents (TorrentID int, GroupID int, UnRead tinyint, FilterID int, Year smallint, PRIMARY KEY(GroupID, TorrentID), KEY(Year)) ENGINE=MyISAM"); $DB->query(" INSERT IGNORE INTO temp_notify_torrents (TorrentID, GroupID, UnRead, FilterID) SELECT t.ID, t.GroupID, unt.UnRead, unt.FilterID FROM users_notify_torrents AS unt JOIN torrents AS t ON t.ID=unt.TorrentID WHERE unt.UserID=$UserID". ($FilterID ? " AND unt.FilterID=$FilterID" : '')); $DB->query(" UPDATE temp_notify_torrents AS tnt JOIN torrents_group AS tg ON tnt.GroupID = tg.ID SET tnt.Year = tg.Year"); $DB->query(" SELECT TorrentID, GroupID, UnRead, FilterID FROM temp_notify_torrents AS tnt ORDER BY $OrderCol $OrderWay, GroupID $OrderWay LIMIT $Limit"); $Results = $DB->to_array(false, MYSQLI_ASSOC, false); } else { $DB->query(" SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, t.GroupID FROM users_notify_torrents AS unt JOIN torrents AS t ON t.ID = unt.TorrentID WHERE unt.UserID = $UserID". ($FilterID ? " AND unt.FilterID = $FilterID" : '')." ORDER BY $OrderCol $OrderWay LIMIT $Limit"); $Results = $DB->to_array(false, MYSQLI_ASSOC, false); $DB->query('SELECT FOUND_ROWS()'); list($TorrentCount) = $DB->next_record(); } $GroupIDs = $FilterIDs = $UnReadIDs = array(); foreach ($Results as $Torrent) { $GroupIDs[$Torrent['GroupID']] = 1; $FilterIDs[$Torrent['FilterID']] = 1; if ($Torrent['UnRead']) { $UnReadIDs[] = $Torrent['TorrentID']; } } $Pages = Format::get_pages($Page, $TorrentCount, NOTIFICATIONS_PER_PAGE, 9); if (!empty($GroupIDs)) { $GroupIDs = array_keys($GroupIDs); $FilterIDs = array_keys($FilterIDs); $TorrentGroups = Torrents::get_groups($GroupIDs); $TorrentGroups = $TorrentGroups['matches']; // Get the relevant filter labels $DB->query(' SELECT ID, Label, Artists FROM users_notify_filters WHERE ID IN ('.implode(',', $FilterIDs).')'); $Filters = $DB->to_array('ID', MYSQLI_ASSOC, array('Artists')); foreach ($Filters as &$Filter) { $Filter['Artists'] = explode('|', trim($Filter['Artists'], '|')); foreach ($Filter['Artists'] as &$FilterArtist) { $FilterArtist = mb_strtolower($FilterArtist, 'UTF-8'); } $Filter['Artists'] = array_flip($Filter['Artists']); } unset($Filter); if (!empty($UnReadIDs)) { //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'].' AND TorrentID IN ('.implode(',', $UnReadIDs).')'); $Cache->delete_value('notifications_new_'.$LoggedUser['ID']); } } if ($Sneaky) { $UserInfo = Users::user_info($UserID); View::show_header($UserInfo['Username'].'\'s notifications', 'notifications'); } else { View::show_header('My notifications', 'notifications'); } ?>

Latest notifications

NOTIFICATIONS_PER_PAGE) { ?>
No new notifications found! Edit notification filters
$FilterResults) { ?>

Matches for "> Matches for unknown filter[]

" . $GroupInfo['Name'] . ''; $GroupCategoryID = $GroupInfo['CategoryID']; if ($GroupCategoryID == 1) { if ($GroupInfo['Year'] > 0) { $DisplayName .= " [$GroupInfo[Year]]"; } if ($GroupInfo['ReleaseType'] > 0) { $DisplayName .= ' ['.$ReleaseTypes[$GroupInfo['ReleaseType']].']'; } } // append extra info to torrent title $ExtraInfo = Torrents::torrent_info($TorrentInfo, true, true); $TorrentTags = new Tags($GroupInfo['TagList']); if ($GroupInfo['TagList'] == '') $TorrentTags->set_primary($Categories[$GroupCategoryID - 1]); // print row ?> >
NameYear' : ''?> Files Time Size Snatches Seeders Leechers
[ DL | FL | CL ]
format()?>