mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-04 09:20:21 -05:00
Apply fixes from StyleCI
[ci skip] [skip ci]
This commit is contained in:
@@ -75,6 +75,7 @@ class TorrentController extends Controller
|
||||
* Displays Torrent List View.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function torrents(Request $request)
|
||||
@@ -104,6 +105,7 @@ class TorrentController extends Controller
|
||||
* @param Request $request
|
||||
* @param $category_id
|
||||
* @param $tmdb
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function similar(Request $request, $category_id, $tmdb)
|
||||
@@ -117,7 +119,7 @@ class TorrentController extends Controller
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
if (! $torrents || $torrents->count() < 1) {
|
||||
if (!$torrents || $torrents->count() < 1) {
|
||||
abort(404, 'No Similar Torrents Found');
|
||||
}
|
||||
|
||||
@@ -133,9 +135,11 @@ class TorrentController extends Controller
|
||||
* Displays Torrent Cards View.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*
|
||||
* @throws \ErrorException
|
||||
* @throws \HttpInvalidParamException
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function cardLayout(Request $request)
|
||||
{
|
||||
@@ -178,7 +182,8 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Torrent Filter Remember Setting.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function filtered(Request $request)
|
||||
@@ -201,10 +206,12 @@ class TorrentController extends Controller
|
||||
* Torrent Grouping.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*
|
||||
* @throws \ErrorException
|
||||
* @throws \HttpInvalidParamException
|
||||
* @throws \Throwable
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function groupingLayout(Request $request)
|
||||
{
|
||||
@@ -225,7 +232,7 @@ class TorrentController extends Controller
|
||||
|
||||
$prelauncher = $torrent->orderBy('s'.$sorting, $order)->pluck('imdb')->toArray();
|
||||
|
||||
if (! is_array($prelauncher)) {
|
||||
if (!is_array($prelauncher)) {
|
||||
$prelauncher = [];
|
||||
}
|
||||
$links = new Paginator($prelauncher, count($prelauncher), $qty);
|
||||
@@ -240,18 +247,18 @@ class TorrentController extends Controller
|
||||
$launcher = Torrent::with(['user', 'category'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy($sorting, $order);
|
||||
foreach ($launcher->cursor() as $chunk) {
|
||||
if ($chunk->imdb) {
|
||||
if (! array_key_exists($chunk->imdb, $totals)) {
|
||||
if (!array_key_exists($chunk->imdb, $totals)) {
|
||||
$totals[$chunk->imdb] = 1;
|
||||
} else {
|
||||
$totals[$chunk->imdb] = $totals[$chunk->imdb] + 1;
|
||||
}
|
||||
if (! array_key_exists('imdb'.$chunk->imdb, $cache)) {
|
||||
if (!array_key_exists('imdb'.$chunk->imdb, $cache)) {
|
||||
$cache['imdb'.$chunk->imdb] = [];
|
||||
}
|
||||
if (! array_key_exists('imdb'.$chunk->imdb, $counts)) {
|
||||
if (!array_key_exists('imdb'.$chunk->imdb, $counts)) {
|
||||
$counts['imdb'.$chunk->imdb] = 0;
|
||||
}
|
||||
if (! array_key_exists('imdb'.$chunk->imdb, $attributes)) {
|
||||
if (!array_key_exists('imdb'.$chunk->imdb, $attributes)) {
|
||||
$attributes['imdb'.$chunk->imdb]['seeders'] = 0;
|
||||
$attributes['imdb'.$chunk->imdb]['leechers'] = 0;
|
||||
$attributes['imdb'.$chunk->imdb]['times_completed'] = 0;
|
||||
@@ -262,10 +269,10 @@ class TorrentController extends Controller
|
||||
$attributes['imdb'.$chunk->imdb]['times_completed'] += $chunk->times_completed;
|
||||
$attributes['imdb'.$chunk->imdb]['seeders'] += $chunk->seeders;
|
||||
$attributes['imdb'.$chunk->imdb]['leechers'] += $chunk->leechers;
|
||||
if (! array_key_exists($chunk->type, $attributes['imdb'.$chunk->imdb])) {
|
||||
if (!array_key_exists($chunk->type, $attributes['imdb'.$chunk->imdb])) {
|
||||
$attributes['imdb'.$chunk->imdb]['types'][$chunk->type] = $chunk->type;
|
||||
}
|
||||
if (! array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) {
|
||||
if (!array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) {
|
||||
$attributes['imdb'.$chunk->imdb]['categories'][$chunk->category_id] = $chunk->category_id;
|
||||
}
|
||||
$cache['imdb'.$chunk->imdb]['torrent'.$counts['imdb'.$chunk->imdb]] = [
|
||||
@@ -335,12 +342,13 @@ class TorrentController extends Controller
|
||||
* Uses Input's To Put Together A Search.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Torrent $torrent
|
||||
* @param Torrent $torrent
|
||||
*
|
||||
* @return array
|
||||
* @throws \ErrorException
|
||||
* @throws \HttpInvalidParamException
|
||||
* @throws \Throwable
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function faceted(Request $request, Torrent $torrent)
|
||||
{
|
||||
@@ -434,7 +442,7 @@ class TorrentController extends Controller
|
||||
if ($request->has('direction') && $request->input('direction') != null) {
|
||||
$order = $request->input('direction');
|
||||
}
|
||||
if (! $sorting || $sorting == null || ! $order || $order == null) {
|
||||
if (!$sorting || $sorting == null || !$order || $order == null) {
|
||||
$sorting = 'created_at';
|
||||
$order = 'desc';
|
||||
// $order = 'asc';
|
||||
@@ -555,7 +563,7 @@ class TorrentController extends Controller
|
||||
}
|
||||
} elseif ($nohistory == 1) {
|
||||
$history = History::select(['torrents.id'])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('history.user_id', '=', $user->id)->get()->toArray();
|
||||
if (! $history || ! is_array($history)) {
|
||||
if (!$history || !is_array($history)) {
|
||||
$history = [];
|
||||
}
|
||||
$torrent = $torrent->with(['user', 'category', 'tags'])->withCount(['thanks', 'comments'])->whereNotIn('torrents.id', $history);
|
||||
@@ -699,7 +707,7 @@ class TorrentController extends Controller
|
||||
|
||||
$prelauncher = $torrent->orderBy('s'.$sorting, $order)->pluck('imdb')->toArray();
|
||||
|
||||
if (! is_array($prelauncher)) {
|
||||
if (!is_array($prelauncher)) {
|
||||
$prelauncher = [];
|
||||
}
|
||||
$links = new Paginator($prelauncher, count($prelauncher), $qty);
|
||||
@@ -717,18 +725,18 @@ class TorrentController extends Controller
|
||||
$launcher = Torrent::with(['user', 'category', 'tags'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy($sorting, $order);
|
||||
foreach ($launcher->cursor() as $chunk) {
|
||||
if ($chunk->imdb) {
|
||||
if (! array_key_exists($chunk->imdb, $totals)) {
|
||||
if (!array_key_exists($chunk->imdb, $totals)) {
|
||||
$totals[$chunk->imdb] = 1;
|
||||
} else {
|
||||
$totals[$chunk->imdb] = $totals[$chunk->imdb] + 1;
|
||||
}
|
||||
if (! array_key_exists('imdb'.$chunk->imdb, $cache)) {
|
||||
if (!array_key_exists('imdb'.$chunk->imdb, $cache)) {
|
||||
$cache['imdb'.$chunk->imdb] = [];
|
||||
}
|
||||
if (! array_key_exists('imdb'.$chunk->imdb, $counts)) {
|
||||
if (!array_key_exists('imdb'.$chunk->imdb, $counts)) {
|
||||
$counts['imdb'.$chunk->imdb] = 0;
|
||||
}
|
||||
if (! array_key_exists('imdb'.$chunk->imdb, $attributes)) {
|
||||
if (!array_key_exists('imdb'.$chunk->imdb, $attributes)) {
|
||||
$attributes['imdb'.$chunk->imdb]['seeders'] = 0;
|
||||
$attributes['imdb'.$chunk->imdb]['leechers'] = 0;
|
||||
$attributes['imdb'.$chunk->imdb]['times_completed'] = 0;
|
||||
@@ -739,10 +747,10 @@ class TorrentController extends Controller
|
||||
$attributes['imdb'.$chunk->imdb]['times_completed'] += $chunk->times_completed;
|
||||
$attributes['imdb'.$chunk->imdb]['seeders'] += $chunk->seeders;
|
||||
$attributes['imdb'.$chunk->imdb]['leechers'] += $chunk->leechers;
|
||||
if (! array_key_exists($chunk->type, $attributes['imdb'.$chunk->imdb])) {
|
||||
if (!array_key_exists($chunk->type, $attributes['imdb'.$chunk->imdb])) {
|
||||
$attributes['imdb'.$chunk->imdb]['types'][$chunk->type] = $chunk->type;
|
||||
}
|
||||
if (! array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) {
|
||||
if (!array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) {
|
||||
$attributes['imdb'.$chunk->imdb]['categories'][$chunk->category_id] = $chunk->category_id;
|
||||
}
|
||||
$cache['imdb'.$chunk->imdb]['torrent'.$counts['imdb'.$chunk->imdb]] = [
|
||||
@@ -765,7 +773,7 @@ class TorrentController extends Controller
|
||||
} elseif ($history == 1) {
|
||||
$prelauncher = $torrent->orderBy('torrents.sticky', 'desc')->orderBy('torrents.'.$sorting, $order)->pluck('id')->toArray();
|
||||
|
||||
if (! is_array($prelauncher)) {
|
||||
if (!is_array($prelauncher)) {
|
||||
$prelauncher = [];
|
||||
}
|
||||
|
||||
@@ -891,12 +899,13 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Display The Torrent.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @throws \ErrorException
|
||||
* @throws \HttpInvalidParamException
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function torrent(Request $request, $id)
|
||||
{
|
||||
@@ -1007,7 +1016,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Torrent Edit Form.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
@@ -1029,7 +1038,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Edit A Torrent.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1221,10 +1230,10 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Torrent Upload Form.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $title
|
||||
* @param int $imdb
|
||||
* @param int $tmdb
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $title
|
||||
* @param int $imdb
|
||||
* @param int $tmdb
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
@@ -1245,11 +1254,12 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Upload A Torrent.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
* @throws \ErrorException
|
||||
* @throws \HttpInvalidParamException
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function upload(Request $request)
|
||||
{
|
||||
@@ -1427,7 +1437,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Download Check.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
@@ -1443,7 +1453,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Download A Torrent.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
* @param $rsskey
|
||||
*
|
||||
@@ -1452,7 +1462,7 @@ class TorrentController extends Controller
|
||||
public function download(Request $request, $id, $rsskey = null)
|
||||
{
|
||||
$user = $request->user();
|
||||
if (! $user && $rsskey) {
|
||||
if (!$user && $rsskey) {
|
||||
$user = User::where('rsskey', '=', $rsskey)->firstOrFail();
|
||||
}
|
||||
|
||||
@@ -1480,7 +1490,7 @@ class TorrentController extends Controller
|
||||
$tmpFileName = str_replace([' ', '/', '\\'], ['.', '-', '-'], '['.config('torrent.source').']'.$torrent->name.'.torrent');
|
||||
|
||||
// The torrent file exist ?
|
||||
if (! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) {
|
||||
if (!file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) {
|
||||
return redirect()->route('torrent', ['id' => $torrent->id])
|
||||
->withErrors('Torrent File Not Found! Please Report This Torrent!');
|
||||
} else {
|
||||
@@ -1509,7 +1519,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Bump A Torrent.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1547,7 +1557,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Sticky A Torrent.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1572,7 +1582,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* 100% Freeleech A Torrent.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1608,7 +1618,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Feature A Torrent.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1648,7 +1658,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Double Upload A Torrent.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1682,7 +1692,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Reseed Request A Torrent.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1718,7 +1728,7 @@ class TorrentController extends Controller
|
||||
/**
|
||||
* Use Freeleech Token On A Torrent.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
@@ -1729,7 +1739,7 @@ class TorrentController extends Controller
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$active_token = FreeleechToken::where('user_id', '=', $user->id)->where('torrent_id', '=', $torrent->id)->first();
|
||||
|
||||
if ($user->fl_tokens >= 1 && ! $active_token) {
|
||||
if ($user->fl_tokens >= 1 && !$active_token) {
|
||||
$token = new FreeleechToken();
|
||||
$token->user_id = $user->id;
|
||||
$token->torrent_id = $torrent->id;
|
||||
|
||||
Reference in New Issue
Block a user