Exemplo n.º 1
0
    $key = "";
    $limit = 4;
    $uploader = "";
    if (!empty($_GET["category"])) {
        $category = urldecode($_GET["category"]);
    }
    $subCategory = "";
    if (!empty($_GET["subcategory"])) {
        $subCategory = urldecode($_GET["subcategory"]);
    }
    if (!empty($_GET["key"])) {
        $key = urldecode($_GET["key"]);
        $limit = 1;
    }
    if (!empty($_GET["uploader"])) {
        $uploader = urldecode($_GET["uploader"]);
    }
    $testPhrase = str_replace(' ', '', $phrase);
    if (strlen($testPhrase) < $limit) {
        http_response_code(404);
        $error = '{"statuscode":404,"message":"Your query must be at least 4 characters long without white space"}';
        die($error);
    }
    require_once "TorrentSearch.php";
    $torrent = new TorrentSearch($phrase, $category, $subCategory, $key, $uploader);
    $torrent->getTorrents();
} else {
    http_response_code(404);
    $error = '{"statuscode":404,"message":"Please enter a phrease."}';
    die($error);
}
Exemplo n.º 2
0
}

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);
$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';
Exemplo n.º 3
0
<?php

include SERVER_ROOT . '/sections/torrents/functions.php';
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';
} else {
    $OrderBy = $_GET['order_by'];
}
$GroupResults = !isset($_GET['group_results']) || $_GET['group_results'] != '0';
$Page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$Search = new TorrentSearch($GroupResults, $OrderBy, $OrderWay, $Page, TORRENTS_PER_PAGE);
$Results = $Search->query($_GET);
$Groups = $Search->get_groups();
$NumResults = $Search->record_count();
if ($Results === false) {
    json_die('error', 'Search returned an error. Make sure all parameters are valid and of the expected types.');
}
if ($NumResults == 0) {
    json_die('success', array('results' => array(), 'youMightLike' => array()));
}
$Bookmarks = Bookmarks::all_bookmarks('torrent');
$JsonGroups = array();
foreach ($Results as $Key => $GroupID) {
    $GroupInfo = $Groups[$GroupID];
    if (empty($GroupInfo['Torrents'])) {
        continue;