Ejemplo n.º 1
0
<?php

require SERVER_ROOT . '/sections/torrents/functions.php';
$GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'RecordLabel', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time', 'VanityHouse');
$TorrentAllowed = array('ID', 'Media', 'Format', 'Encoding', 'Remastered', 'RemasterYear', 'RemasterTitle', 'RemasterRecordLabel', 'RemasterCatalogueNumber', 'Scene', 'HasLog', 'HasCue', 'LogScore', 'FileCount', 'Size', 'Seeders', 'Leechers', 'Snatched', 'FreeTorrent', 'Time', 'Description', 'FileList', 'FilePath', 'UserID', 'Username');
$TorrentID = (int) $_GET['id'];
$TorrentHash = (string) $_GET['hash'];
if ($TorrentID && $TorrentHash) {
    json_die("failure", "bad parameters");
}
if ($TorrentHash) {
    if (!is_valid_torrenthash($TorrentHash)) {
        json_die("failure", "bad hash parameter");
    } else {
        $TorrentID = (int) torrenthash_to_torrentid($TorrentHash);
        if (!$TorrentID) {
            json_die("failure", "bad hash parameter");
        }
    }
}
if ($TorrentID <= 0) {
    json_die("failure", "bad id parameter");
}
$TorrentCache = get_torrent_info($TorrentID, true, 0, true, true);
if (!$TorrentCache) {
    json_die("failure", "bad id parameter");
}
list($TorrentDetails, $TorrentList) = $TorrentCache;
if (!isset($TorrentList[$TorrentID])) {
    json_die("failure", "bad id parameter");
}
Ejemplo n.º 2
0
	} else {
		$NewWay = $DefaultWay;
	}
	return "torrents.php?order_way=$NewWay&amp;order_by=$SortKey&amp;".Format::get_url(array('order_way', 'order_by'));
}

if (!empty($_GET['searchstr']) || !empty($_GET['groupname'])) {
	if (!empty($_GET['searchstr'])) {
		$InfoHash = $_GET['searchstr'];

	} else {
		$InfoHash = $_GET['groupname'];
	}

	// Search by infohash
	if ($InfoHash = is_valid_torrenthash($InfoHash)) {
		$InfoHash = db_string(pack('H*', $InfoHash));
		$DB->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");
			die();
		}
	}
}

// Setting default search options
if (!empty($_GET['setdefault'])) {