mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 05:13:54 -07:00
Code formatting (#1026)
This commit is contained in:
parent
671446e089
commit
98bfecc0bf
1 changed files with 41 additions and 41 deletions
|
@ -42,12 +42,12 @@ if (strlen($info_hash) == 32) {
|
||||||
|
|
||||||
// Handle multiple hashes
|
// Handle multiple hashes
|
||||||
|
|
||||||
preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_array);
|
preg_match_all('/info_hash=([^&]*)/i', $_SERVER['QUERY_STRING'], $info_hash_array);
|
||||||
|
|
||||||
$torrents = [];
|
$torrents = [];
|
||||||
$info_hashes = [];
|
$info_hashes = [];
|
||||||
|
|
||||||
foreach ($info_hash_array[1] as $hash) {
|
foreach ($info_hash_array[1] as $hash) {
|
||||||
|
|
||||||
$decoded_hash = urldecode($hash);
|
$decoded_hash = urldecode($hash);
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_arra
|
||||||
else{
|
else{
|
||||||
$info_hashes[] = '\''. DB()->escape(($decoded_hash)) . '\'';
|
$info_hashes[] = '\''. DB()->escape(($decoded_hash)) . '\'';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$info_hash_count = count($info_hashes);
|
$info_hash_count = count($info_hashes);
|
||||||
|
|
||||||
if (!empty($info_hash_count)) {
|
if (!empty($info_hash_count)) {
|
||||||
|
|
||||||
if ($info_hash_count > $bb_cfg['max_scrapes']) {
|
if ($info_hash_count > $bb_cfg['max_scrapes']) {
|
||||||
$info_hashes = array_slice($info_hashes, 0, $bb_cfg['max_scrapes']);
|
$info_hashes = array_slice($info_hashes, 0, $bb_cfg['max_scrapes']);
|
||||||
|
@ -78,7 +78,7 @@ preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_arra
|
||||||
|
|
||||||
$rowset = DB()->fetch_rowset($sql);
|
$rowset = DB()->fetch_rowset($sql);
|
||||||
|
|
||||||
if (count($rowset) > 0) {
|
if (!empty($rowset)) {
|
||||||
foreach ($rowset as $scrapes) {
|
foreach ($rowset as $scrapes) {
|
||||||
$torrents['files'][$scrapes['info_hash']] = [
|
$torrents['files'][$scrapes['info_hash']] = [
|
||||||
'complete' => (int)$scrapes['seeders'],
|
'complete' => (int)$scrapes['seeders'],
|
||||||
|
@ -88,10 +88,10 @@ preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_arra
|
||||||
CACHE('tr_cache')->set(SCRAPE_LIST_PREFIX . bin2hex($scrapes['info_hash']), array_slice($torrents['files'], -1, null, true), SCRAPE_LIST_EXPIRE);
|
CACHE('tr_cache')->set(SCRAPE_LIST_PREFIX . bin2hex($scrapes['info_hash']), array_slice($torrents['files'], -1, null, true), SCRAPE_LIST_EXPIRE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($torrents)) {
|
if (empty($torrents)) {
|
||||||
msg_die('Torrent not registered, info_hash = ' . $info_hash_hex);
|
msg_die('Torrent not registered, info_hash = ' . $info_hash_hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
die(\Arokettu\Bencode\Bencode::encode($torrents));
|
die(\Arokettu\Bencode\Bencode::encode($torrents));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue