set_filter('visible', array(1)); } } else { switch ($_GET['type']) { case 'created': if (!empty($_GET['userid'])) { if (is_number($_GET['userid'])) { if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { error(403); } $Title = 'Requests created by ' . $UserInfo['Username']; $SS->set_filter('userid', array($_GET['userid'])); } else { error(404); } } else { $Title = 'My requests'; $SS->set_filter('userid', array($LoggedUser['ID'])); } break; case 'voted': if (!empty($_GET['userid'])) { if (is_number($_GET['userid'])) { if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { error(403); } $Title = "Requests voted for by ".$UserInfo['Username']; $SS->set_filter('voter', array($_GET['userid'])); } else { error(404); } } else { $Title = "Requests I've voted on"; $SS->set_filter('voter', array($LoggedUser['ID'])); } break; case 'filled': if (empty($_GET['userid']) || !is_number($_GET['userid'])) { error(404); } else { if (!check_paranoia('requestsfilled_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { error(403); } $Title = "Requests filled by ".$UserInfo['Username']; $SS->set_filter('fillerid', array($_GET['userid'])); } break; case 'bookmarks': $Title = 'Your bookmarked requests'; $BookmarkView = true; $SS->set_filter('bookmarker', array($LoggedUser['ID'])); break; default: error(404); } } if ($Submitted && empty($_GET['show_filled'])) { $SS->set_filter('torrentid', array(0)); } $EnableNegation = false; // Sphinx needs at least one positive search condition to support the NOT operator if (!empty($_GET['formats'])) { $FormatArray = $_GET['formats']; if (count($FormatArray) != count($Formats)) { $FormatNameArray = array(); foreach ($FormatArray as $Index => $MasterIndex) { if (isset($Formats[$MasterIndex])) { $FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"'; } } if (count($FormatNameArray) >= 1) { $EnableNegation = true; if (!empty($_GET['formats_strict'])) { $Queries[]='@formatlist ('.implode(' | ', $FormatNameArray).')'; } else { $Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')'; } } } } if (!empty($_GET['media'])) { $MediaArray = $_GET['media']; if (count($MediaArray) != count($Media)) { $MediaNameArray = array(); foreach ($MediaArray as $Index => $MasterIndex) { if (isset($Media[$MasterIndex])) { $MediaNameArray[$Index] = '"'.strtr($Media[$MasterIndex], '-.', ' ').'"'; } } if (count($MediaNameArray) >= 1) { $EnableNegation = true; if (!empty($_GET['media_strict'])) { $Queries[]='@medialist ('.implode(' | ', $MediaNameArray).')'; } else { $Queries[]='@medialist (any | '.implode(' | ', $MediaNameArray).')'; } } } } if (!empty($_GET['bitrates'])) { $BitrateArray = $_GET['bitrates']; if (count($BitrateArray) != count($Bitrates)) { $BitrateNameArray = array(); foreach ($BitrateArray as $Index => $MasterIndex) { if (isset($Bitrates[$MasterIndex])) { $BitrateNameArray[$Index] = '"'.strtr($SS->EscapeString($Bitrates[$MasterIndex]), '-.', ' ').'"'; } } if (count($BitrateNameArray) >= 1) { $EnableNegation = true; if (!empty($_GET['bitrate_strict'])) { $Queries[]='@bitratelist ('.implode(' | ', $BitrateNameArray).')'; } else { $Queries[]='@bitratelist (any | '.implode(' | ', $BitrateNameArray).')'; } } } } if (!empty($_GET['search'])) { $SearchString = trim($_GET['search']); if ($SearchString != '') { $SearchWords = array('include' => array(), 'exclude' => array()); $Words = explode(' ', $SearchString); foreach ($Words as $Word) { $Word = trim($Word); // Skip isolated hyphens to enable "Artist - Title" searches if ($Word == '-') { continue; } if ($Word[0] == '!' && strlen($Word) >= 2) { if (strpos($Word,'!',1) === false) { $SearchWords['exclude'][] = $Word; } else { $SearchWords['include'][] = $Word; $EnableNegation = true; } } elseif ($Word != '') { $SearchWords['include'][] = $Word; $EnableNegation = true; } } $QueryParts = array(); if (!$EnableNegation && !empty($SearchWords['exclude'])) { $SearchWords['include'] = array_merge($SearchWords['include'], $SearchWords['exclude']); unset($SearchWords['exclude']); } foreach ($SearchWords['include'] as $Word) { $QueryParts[] = $SS->EscapeString($Word); } if (!empty($SearchWords['exclude'])) { foreach ($SearchWords['exclude'] as $Word) { $QueryParts[] = '!'.$SS->EscapeString(substr($Word,1)); } } if (!empty($QueryParts)) { $Queries[] = "@* ".implode(' ', $QueryParts); } } } if (!empty($_GET['tags'])) { $Tags = explode(',', $_GET['tags']); $TagNames = array(); if (!isset($_GET['tags_type']) || $_GET['tags_type'] == 1) { $TagType = 1; $_GET['tags_type'] = '1'; } else { $TagType = 0; $_GET['tags_type'] = '0'; } foreach ($Tags as $Tag) { $Tag = ltrim($Tag); $Exclude = ($Tag[0] == '!'); $Tag = Misc::sanitize_tag($Tag); if (!empty($Tag)) { $TagNames[] = $Tag; $TagsExclude[$Tag] = $Exclude; } } $AllNegative = !in_array(false, $TagsExclude); $Tags = Misc::get_tags($TagNames); // Replace the ! characters that sanitize_tag removed if ($TagType == 1 || $AllNegative) { foreach ($TagNames as &$TagName) { if ($TagsExclude[$TagName]) { $TagName = '!'.$TagName; } } unset($TagName); } } elseif (!isset($_GET['tags_type']) || $_GET['tags_type'] != 0) { $_GET['tags_type'] = 1; } else { $_GET['tags_type'] = 0; } // 'All' tags if ($TagType == 1 && !empty($Tags)) { foreach ($Tags as $TagID => $TagName) { $SS->set_filter('tagid', array($TagID), $TagsExclude[$TagName]); } } elseif (!empty($Tags)) { $SS->set_filter('tagid', array_keys($Tags), $AllNegative); } if (!empty($_GET['filter_cat'])) { $CategoryArray = array_keys($_GET['filter_cat']); $Debug->log_var(array($CategoryArray, $Categories)); if (count($CategoryArray) != count($Categories)) { foreach ($CategoryArray as $Key => $Index) { if (!isset($Categories[$Index-1])) { unset($CategoryArray[$Key]); } } if (count($CategoryArray) >= 1) { $SS->set_filter('categoryid', $CategoryArray); } } } if (!empty($_GET['releases'])) { $ReleaseArray = $_GET['releases']; if (count($ReleaseArray) != count($ReleaseTypes)) { foreach ($ReleaseArray as $Index => $Value) { if (!isset($ReleaseTypes[$Value])) { unset($ReleaseArray[$Index]); } } if (count($ReleaseArray) >= 1) { $SS->set_filter('releasetype', $ReleaseArray); } } } if (!empty($_GET['requestor']) && check_perms('site_see_old_requests')) { if (is_number($_GET['requestor'])) { $SS->set_filter('userid', array($_GET['requestor'])); } else { error(404); } } if (isset($_GET['year'])) { if (is_number($_GET['year']) || $_GET['year'] == 0) { $SS->set_filter('year', array($_GET['year'])); } else { error(404); } } if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) { $Page = $_GET['page']; $SS->limit(($Page - 1) * REQUESTS_PER_PAGE, REQUESTS_PER_PAGE); } else { $Page = 1; $SS->limit(0, REQUESTS_PER_PAGE); } if (empty($_GET['order'])) { $CurrentOrder = 'created'; $CurrentSort = 'desc'; $Way = SPH_SORT_ATTR_DESC; $NewSort = 'asc'; } else { if (in_array($_GET['order'], $OrderWays)) { $CurrentOrder = $_GET['order']; if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') { $CurrentSort = $_GET['sort']; $Way = ($CurrentSort == 'asc' ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC); $NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc'); } else { error(404); } } else { error(404); } } switch($CurrentOrder) { case 'votes' : $OrderBy = "Votes"; break; case 'bounty' : $OrderBy = "Bounty"; break; case 'created' : $OrderBy = "TimeAdded"; break; case 'lastvote' : $OrderBy = "LastVote"; break; case 'filled' : $OrderBy = "TimeFilled"; break; case 'year' : $OrderBy = "Year"; break; default : $OrderBy = "TimeAdded"; break; } //print($Way); print($OrderBy); die(); $SS->SetSortMode($Way, $OrderBy); if (count($Queries) > 0) { $Query = implode(' ',$Queries); } else { $Query=''; } $SS->set_index('requests requests_delta'); $SphinxResults = $SS->search($Query, '', 0, array(), '', ''); $NumResults = $SS->TotalResults; if ($NumResults && $NumResults < ($Page - 1) * REQUESTS_PER_PAGE + 1) { $PageLinks = Format::get_pages(0, $NumResults, REQUESTS_PER_PAGE); } else { $PageLinks = Format::get_pages($Page, $NumResults, REQUESTS_PER_PAGE); } $CurrentURL = Format::get_url(array('order', 'sort')); View::show_header($Title, 'requests'); ?>

Search terms:
Tags (comma-separated):   />   />
Include filled: checked="checked" />
Include old: checked="checked" />
Requested by:
$CatName) { if ($x % 8 == 0 || $x == 1) { ?>
checked="checked" />
Release types /> $Val) { if ($i % 8 == 0) { echo '
'; } ?> />
Formats /> /> $Val) { if ($Key % 8 == 0) { echo '
'; } ?> />
Bitrates /> /> $Val) { if ($Key % 8 == 0) { echo '
'; } ?> />
Media /> /> $Val) { if ($Key % 8 == 0) { echo '
'; } ?> />
$SQLResult) { $SphinxResults['matches'][$ID] = $SQLResult; //$Requests['matches'][$ID] = array_merge($Requests['matches'][$ID], $SQLResult); //We ksort because depending on the filter modes, we're given our data in an unpredictable order //ksort($Requests['matches'][$ID]); } } $Requests = $SphinxResults['matches']; $Row = 'a'; $TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18 foreach ($Requests as $RequestID => $Request) { //list($BitrateList, $CatalogueNumber, $CategoryID, $Description, $FillerID, $FormatList, $RequestID, $Image, $LogCue, $MediaList, $ReleaseType, // $Tags, $TimeAdded, $TimeFilled, $Title, $TorrentID, $RequestorID, $RequestorName, $Year, $RequestID, $Categoryid, $FillerID, $LastVote, // $ReleaseType, $TagIDs, $TimeAdded, $TimeFilled, $TorrentID, $RequestorID, $Voters) = array_values($Request); list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel, $ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request; $RequestVotes = get_votes_array($RequestID); $VoteCount = count($RequestVotes['Voters']); if ($CategoryID == 0) { $CategoryName = 'Unknown'; } else { $CategoryName = $Categories[$CategoryID - 1]; } $IsFilled = ($TorrentID != 0); if ($CategoryName == 'Music') { $ArtistForm = get_request_artists($RequestID); $ArtistLink = Artists::display_artists($ArtistForm, true, true); $FullName = $ArtistLink."$Title [$Year]"; } elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') { $FullName = "$Title [$Year]"; } else { $FullName ="$Title"; } $Row = ($Row == 'a') ? 'b' : 'a'; $Tags = $Request['Tags']; ?>
Request name / Year Votes Bounty Filled Filled by Requested by Created Last vote
Nothing found!
The requested page contains no matches!
$TagName) { $TagList[] = ''.display_str($TagName).''; } $TagList = implode(', ', $TagList); ?>
   + No --