Code formatting (#1026)

This commit is contained in:
Cønstantine Kovalensky 2023-11-03 16:12:23 +04:00 committed by GitHub
commit 98bfecc0bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,12 +42,12 @@ if (strlen($info_hash) == 32) {
// 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 = [];
$info_hashes = [];
$torrents = [];
$info_hashes = [];
foreach ($info_hash_array[1] as $hash) {
foreach ($info_hash_array[1] as $hash) {
$decoded_hash = urldecode($hash);
@ -57,11 +57,11 @@ preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_arra
else{
$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']) {
$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);
if (count($rowset) > 0) {
if (!empty($rowset)) {
foreach ($rowset as $scrapes) {
$torrents['files'][$scrapes['info_hash']] = [
'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);
}
}
}
}
if (empty($torrents)) {
if (empty($torrents)) {
msg_die('Torrent not registered, info_hash = ' . $info_hash_hex);
}
}
die(\Arokettu\Bencode\Bencode::encode($torrents));
die(\Arokettu\Bencode\Bencode::encode($torrents));