$SphQL = new SphinxqlQuery(); $SphQL->select('id, votes, bounty')->from('requests, requests_delta'); $SortOrders = array('votes' => 'votes', 'bounty' => 'bounty', 'lastvote' => 'lastvote', 'filled' => 'timefilled', 'year' => 'year', 'created' => 'timeadded', 'random' => false); if (empty($_GET['order']) || !isset($SortOrders[$_GET['order']])) { $_GET['order'] = 'created'; } $OrderBy = $_GET['order']; if (!empty($_GET['sort']) && $_GET['sort'] === 'asc') { $OrderWay = 'asc'; } else { $_GET['sort'] = 'desc'; $OrderWay = 'desc'; } $NewSort = $_GET['sort'] === 'asc' ? 'desc' : 'asc'; if ($OrderBy === 'random') { $SphQL->order_by('RAND()', ''); unset($_GET['page']); } else { $SphQL->order_by($SortOrders[$OrderBy], $OrderWay); } $Submitted = !empty($_GET['submit']); //Paranoia if (!empty($_GET['userid'])) { if (!is_number($_GET['userid'])) { error('User ID must be an integer'); } $UserInfo = Users::user_info($_GET['userid']); if (empty($UserInfo)) { error('That user does not exist'); } $Perms = Permissions::get_permissions($UserInfo['PermissionID']);