mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-03 08:50:22 -05:00
Merge branch 'master' into Moderation-Rework
# Conflicts: # app/Http/Controllers/Staff/ModerationController.php # routes/web.php
This commit is contained in:
@@ -149,14 +149,14 @@ Main:
|
||||
1. First grab the source-code and upload it to your web server. (If you have Git on your web server installed then clone it directly on your web server.)
|
||||
2. Open a terminal and SSH into your server.
|
||||
3. cd to the sites root directory
|
||||
4. Run `sudo chown -R www-data: storage bootstrap public config`
|
||||
4. Run `sudo chown -R www-data: storage bootstrap public config` and `sudo find . -type d -exec chmod 0755 '{}' + -or -type f -exec chmod 0644 '{}' +`
|
||||
5. Run `php -r "readfile('http://getcomposer.org/installer');" | sudo php -- --install-dir=/usr/bin/ --filename=composer`
|
||||
6. Edit your `.env` file with your APP, DB, REDIS and MAIL info.
|
||||
7. Run `php artisan key:generate` to generate your cipher key.
|
||||
6. Edit `.env.example` to `.env` and fill it with your APP, DB, REDIS and MAIL info.
|
||||
7. Run `composer install` to install dependencies.
|
||||
8. Edit `config/api-keys.php`, `config/app.php` and `config/other.php` (These house some basic settings. Be sure to visit the config manager from staff dashboard after up and running.)
|
||||
9. Add `* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1` to crontab. `/path/to/artisan` becomes whatever directory you put the codebase on your server. Like `* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1` .
|
||||
10. Run `composer install`
|
||||
11. Run `php artisan migrate --seed` (Migrates All Tables And Foreign Keys)
|
||||
10. Run `php artisan key:generate` to generate your cipher key.
|
||||
11. Run `php artisan migrate --seed` (Migrates All Tables And Foreign Keys)
|
||||
12. Suggest that you run `php artisan route:cache`. (Keep in mind you will have to re-run it anytime changes are made to the `routes/web.php` but it is beneficial with page load times).
|
||||
13. `sudo chown -R www-data: storage bootstrap public config`
|
||||
14. Go to your sites URL.
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
* @author HDVinnie
|
||||
*/
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RequestViewHelper
|
||||
{
|
||||
public static function view($results)
|
||||
{
|
||||
$data = [];
|
||||
|
||||
foreach ($results as $list) {
|
||||
|
||||
$category = "<i class='{$list->category->icon} torrent-icon' data-toggle='tooltip' title='' data-original-title='{$list->category->name} Torrent'></i>";
|
||||
$request_link = route('request', ['id' => $list->id]);
|
||||
$user_link = route('profil', ['username' => $list->user->username, 'id' => $list->user->id]);
|
||||
$user = "<a href='{$user_link}'>{$list->user->username}</a>";
|
||||
$datetime = date('Y-m-d H:m:s', strtotime($list->created_at));
|
||||
$datetime_inner = $list->created_at->diffForHumans();
|
||||
$request = trans('request.request');
|
||||
$claimed = trans('request.claimed');
|
||||
$pending = trans('request.pending');
|
||||
$unfilled = trans('request.unfilled');
|
||||
$filled = trans('request.filled');
|
||||
|
||||
$status = "";
|
||||
|
||||
if ($list->claimed != null && $list->filled_hash == null) {
|
||||
$status .= "<button class='btn btn-xs btn-primary' data-toggle='tooltip' title='' data-original-title='{$request} {$claimed}'>
|
||||
<i class='fa fa-suitcase'></i> {$claimed}</button>";
|
||||
} elseif ($list->filled_hash != null && $list->approved_by == null) {
|
||||
$status .= "<button class='btn btn-xs btn-info' data-toggle='tooltip' title='' data-original-title='{$request} {$pending}'>
|
||||
<i class='fa fa-question-circle'></i> {$pending}</button>";
|
||||
} elseif ($list->filled_hash == null) {
|
||||
$status .= "<button class='btn btn-xs btn-danger' data-toggle='tooltip' title='' data-original-title='{$request} {$unfilled}'>
|
||||
<i class='fa fa-times-circle'></i> {$unfilled}</button>";
|
||||
} else {
|
||||
$status .= "<button class='btn btn-xs btn-success' data-toggle='tooltip' title='' data-original-title='{$request} {$filled}'>
|
||||
<i class='fa fa-check-circle'></i> {$filled}</button>";
|
||||
}
|
||||
|
||||
$data[] =
|
||||
"<tr>
|
||||
<td>{$category}</td>
|
||||
<td><span class='label label-success' data-toggle='tooltip' title='' data-original-title='{$list->type}'>{$list->type}</span></td>
|
||||
<td><a class='view-torrent' data-id='{$list->id}' href='{$request_link}' data-toggle='tooltip' title='' data-original-title='{$list->name}'>{$list->name}</a></td>
|
||||
<td><span class='badge-user'>{$user}</span></td>
|
||||
<td><span class='badge-user'>{$list->votes}</span></td>
|
||||
<td>{$list->comments->count()}</td>
|
||||
<td>{$list->bounty}</td>
|
||||
<td><time datetime='{$datetime}'>{$datetime_inner}</time></td>
|
||||
<td>{$status}</td>
|
||||
</tr>";
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -21,47 +21,34 @@ use App\RequestsClaims;
|
||||
use App\Torrent;
|
||||
use App\Shoutbox;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Decoda\Decoda;
|
||||
use App\PrivateMessage;
|
||||
use App\Helpers\RequestViewHelper;
|
||||
use App\Repositories\RequestFacetedRepository;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Http\Request as IlluminateRequest;
|
||||
use App\Achievements\UserFilled25Requests;
|
||||
use App\Achievements\UserFilled50Requests;
|
||||
use App\Achievements\UserFilled75Requests;
|
||||
use App\Achievements\UserFilled100Requests;
|
||||
use Carbon\Carbon;
|
||||
use Decoda\Decoda;
|
||||
use \Toastr;
|
||||
use Cache;
|
||||
|
||||
class RequestController extends Controller
|
||||
{
|
||||
/**
|
||||
* Search for requests
|
||||
*
|
||||
* @access public
|
||||
* @return View page.requests
|
||||
*
|
||||
* @var RequestFacetedRepository
|
||||
*/
|
||||
public function search()
|
||||
private $repository;
|
||||
|
||||
public function __construct(RequestFacetedRepository $repository)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$num_req = Requests::count();
|
||||
$num_fil = Requests::whereNotNull('filled_by')->count();
|
||||
$num_unfil = Requests::whereNull('filled_by')->count();
|
||||
$total_bounty = Requests::all()->sum('bounty');
|
||||
$claimed_bounty = Requests::whereNotNull('filled_by')->sum('bounty');
|
||||
$unclaimed_bounty = Requests::whereNull('filled_by')->sum('bounty');
|
||||
$requests = Requests::where([
|
||||
['name', 'like', '%' . Request::get('name') . '%'],
|
||||
['category_id', '=', Request::get('category_id')],
|
||||
])->orderBy('created_at', 'DESC')->paginate(25);
|
||||
|
||||
$requests->setPath('?name=' . Request::get('name') . '&category_id=' . Request::get('category_id'));
|
||||
|
||||
return view('requests.requests', ['requests' => $requests, 'user' => $user, 'num_req' => $num_req, 'num_fil' => $num_fil, 'num_unfil' => $num_unfil, 'total_bounty' => $total_bounty, 'claimed_bounty' => $claimed_bounty, 'unclaimed_bounty' => $unclaimed_bounty, 'categories' => Category::all()]);
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,19 +67,118 @@ class RequestController extends Controller
|
||||
$total_bounty = Requests::all()->sum('bounty');
|
||||
$claimed_bounty = Requests::whereNotNull('filled_by')->sum('bounty');
|
||||
$unclaimed_bounty = Requests::whereNull('filled_by')->sum('bounty');
|
||||
if (Request::get('filled_requests') == true) {
|
||||
$requests = Requests::whereNotNull('filled_by')->orderBy('created_at', 'DESC')->paginate(20);
|
||||
$requests->setPath('?filled_requests=true');
|
||||
} elseif (Request::get('unfilled_requests') == true) {
|
||||
$requests = Requests::whereNull('filled_by')->orderBy('created_at', 'DESC')->paginate(20);
|
||||
$requests->setPath('?unfilled_requests=true');
|
||||
} elseif (Request::get('my_requests') == true) {
|
||||
$requests = Requests::where('user_id', '=', $user->id)->orderBy('created_at', 'DESC')->paginate(20);
|
||||
$requests->setPath('?my_requests=true');
|
||||
} else {
|
||||
$requests = Requests::orderBy('created_at', 'DESC')->paginate(20);
|
||||
|
||||
$requests = Requests::query();
|
||||
$repository = $this->repository;
|
||||
|
||||
return view('requests.requests', ['requests' => $requests, 'repository' => $repository, 'user' => $user, 'num_req' => $num_req, 'num_fil' => $num_fil, 'num_unfil' => $num_unfil, 'total_bounty' => $total_bounty, 'claimed_bounty' => $claimed_bounty, 'unclaimed_bounty' => $unclaimed_bounty]);
|
||||
}
|
||||
|
||||
public function faceted(IlluminateRequest $request, Requests $requests)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$search = $request->get('search');
|
||||
$imdb = $request->get('imdb');
|
||||
$tvdb = $request->get('tvdb');
|
||||
$tmdb = $request->get('tmdb');
|
||||
$mal = $request->get('mal');
|
||||
$categories = $request->get('categories');
|
||||
$types = $request->get('types');
|
||||
$myrequests = $request->get('myrequests');
|
||||
$unfilled = $request->get('unfilled');
|
||||
$claimed = $request->get('claimed');
|
||||
$pending = $request->get('pending');
|
||||
$filled = $request->get('filled');
|
||||
|
||||
$terms = explode(' ', $search);
|
||||
$search = '';
|
||||
foreach ($terms as $term) {
|
||||
$search .= '%' . $term . '%';
|
||||
}
|
||||
return view('requests.requests', ['requests' => $requests, 'user' => $user, 'num_req' => $num_req, 'num_fil' => $num_fil, 'num_unfil' => $num_unfil, 'total_bounty' => $total_bounty, 'claimed_bounty' => $claimed_bounty, 'unclaimed_bounty' => $unclaimed_bounty, 'categories' => Category::all()]);
|
||||
|
||||
$requests = $requests->newQuery();
|
||||
|
||||
if ($request->has('search') && $request->get('search') != null) {
|
||||
$requests->where('name', 'like', $search);
|
||||
}
|
||||
|
||||
if ($request->has('imdb') && $request->get('imdb') != null) {
|
||||
$requests->where('imdb', $imdb);
|
||||
}
|
||||
|
||||
if ($request->has('tvdb') && $request->get('tvdb') != null) {
|
||||
$requests->where('tvdb', $tvdb);
|
||||
}
|
||||
|
||||
if ($request->has('tmdb') && $request->get('tmdb') != null) {
|
||||
$requests->where('tmdb', $tmdb);
|
||||
}
|
||||
|
||||
if ($request->has('mal') && $request->get('mal') != null) {
|
||||
$requests->where('mal', $mal);
|
||||
}
|
||||
|
||||
if ($request->has('categories') && $request->get('categories') != null) {
|
||||
$requests->whereIn('category_id', $categories);
|
||||
}
|
||||
|
||||
if ($request->has('types') && $request->get('types') != null) {
|
||||
$requests->whereIn('type', $types);
|
||||
}
|
||||
|
||||
if ($request->has('myrequests') && $request->get('myrequests') != null) {
|
||||
$requests->where('user_id', $myrequests);
|
||||
}
|
||||
|
||||
if ($request->has('unfilled') && $request->get('unfilled') != null) {
|
||||
$requests->where('filled_hash', null);
|
||||
}
|
||||
|
||||
if ($request->has('claimed') && $request->get('claimed') != null) {
|
||||
$requests->where('claimed', '!=', null)->where('filled_hash', null);
|
||||
}
|
||||
|
||||
if ($request->has('pending') && $request->get('pending') != null) {
|
||||
$requests->where('filled_hash', '!=', null)->where('approved_by', null);
|
||||
}
|
||||
|
||||
if ($request->has('filled') && $request->get('filled') != null) {
|
||||
$requests->where('filled_hash', '!=', null)->where('approved_by', '!=', null);
|
||||
}
|
||||
|
||||
// pagination query starts
|
||||
$rows = $requests->count();
|
||||
|
||||
if($request->has('page')){
|
||||
$page = $request->get('page');
|
||||
$qty = $request->get('qty');
|
||||
$requests->skip(($page-1)*$qty);
|
||||
$active = $page;
|
||||
}else{
|
||||
$active = 1;
|
||||
}
|
||||
|
||||
if($request->has('qty')){
|
||||
$qty = $request->get('qty');
|
||||
$requests->take($qty);
|
||||
}else{
|
||||
$qty = 6;
|
||||
$requests->take($qty);
|
||||
}
|
||||
// pagination query ends
|
||||
|
||||
if($request->has('sorting')){
|
||||
$sorting = $request->get('sorting');
|
||||
$order = $request->get('direction');
|
||||
$requests->orderBy($sorting,$order);
|
||||
}
|
||||
|
||||
$listings = $requests->get();
|
||||
|
||||
$helper = new RequestViewHelper();
|
||||
$result = $helper->view($listings);
|
||||
|
||||
return ['result'=>$result,'rows'=>$rows,'qty'=>$qty,'active'=>$active];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ use App\FreeleechToken;
|
||||
|
||||
use App\Helpers\TorrentHelper;
|
||||
use App\Helpers\MediaInfo;
|
||||
use App\Repositories\FacetedRepository;
|
||||
use App\Repositories\TorrentFacetedRepository;
|
||||
use App\Services\Bencode;
|
||||
use App\Services\TorrentTools;
|
||||
use App\Services\FanArt;
|
||||
@@ -59,7 +59,7 @@ class TorrentController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @var FacetedRepository
|
||||
* @var TorrentFacetedRepository
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
* @author HDVinnie
|
||||
*/
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Requests;
|
||||
use App\Category;
|
||||
use App\Type;
|
||||
|
||||
class RequestFacetedRepository
|
||||
{
|
||||
/**
|
||||
* Return a collection of Category Name from storage
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function categories()
|
||||
{
|
||||
return Category::all()->pluck('name', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a collection of Type Name from storage
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function types()
|
||||
{
|
||||
return Type::all()->where('slug', '!=', 'sd')->sortBy('position')->pluck('name', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for sort the search result
|
||||
* @return array
|
||||
*/
|
||||
public function sorting()
|
||||
{
|
||||
return [
|
||||
'created_at' => 'Date',
|
||||
'name' => 'Name',
|
||||
'bounty' => 'Bounty',
|
||||
'votes' => 'Votes',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for sort the search result by direction
|
||||
* @return array
|
||||
*/
|
||||
public function direction()
|
||||
{
|
||||
return [
|
||||
'asc' => 'Ascending',
|
||||
'desc' => 'Descending'
|
||||
];
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@ use App\Torrent;
|
||||
use App\Category;
|
||||
use App\Type;
|
||||
|
||||
class FacetedRepository
|
||||
class TorrentFacetedRepository
|
||||
{
|
||||
/**
|
||||
* Return a collection of Category Name from storage
|
||||
@@ -13,7 +13,6 @@
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
@if($user->can_request == 0)
|
||||
<div class="container">
|
||||
<div class="jumbotron shadowed">
|
||||
@@ -27,31 +26,110 @@
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="well">
|
||||
<p class="lead text-orange text-center">{!! trans('request.no-refunds') !!}</p>
|
||||
</div>
|
||||
<div class="well">
|
||||
<form action="{{route('request_search')}}" style="display: inline;" method="get">
|
||||
<div class="form-group">
|
||||
<label for="category_id">{{ trans('torrent.category') }}</label>
|
||||
<select name="category_id" class="form-control">
|
||||
@foreach($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<!-- Search -->
|
||||
<div class="container box">
|
||||
<div class="well">
|
||||
<p class="lead text-orange text-center">{!! trans('request.no-refunds') !!}</p>
|
||||
</div>
|
||||
<center>
|
||||
<h3 class="filter-title">Current Filters</h3>
|
||||
<span id="filter-item-category"></span>
|
||||
<span id="filter-item-type"></span>
|
||||
</center>
|
||||
<hr> {{ Form::open(['action'=>'RequestController@requests','method'=>'get','class'=>'form-horizontal form-condensed form-torrent-search form-bordered']) }}
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-1 label label-default">Name</label>
|
||||
<div class="col-sm-9">
|
||||
{{ Form::text('search',null,['id'=>'search','placeholder'=>'Name or Title','class'=>'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="imdb" class="col-sm-1 label label-default">Number</label>
|
||||
<div class="col-sm-2">
|
||||
{{ Form::text('imdb',null,['id'=>'imdb','placeholder'=>'IMDB #','class'=>'form-control']) }}
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
{{ Form::text('tvdb',null,['id'=>'tvdb','placeholder'=>'TVDB #','class'=>'form-control']) }}
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
{{ Form::text('tmdb',null,['id'=>'tmdb','placeholder'=>'TMDB #','class'=>'form-control']) }}
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
{{ Form::text('mal',null,['id'=>'mal','placeholder'=>'MAL #','class'=>'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="category" class="col-sm-1 label label-default">Category</label>
|
||||
<div class="col-sm-10">
|
||||
@foreach($repository->categories() as $id => $category)
|
||||
<span class="badge-user">
|
||||
{{ Form::checkbox($category,$id,false,['class'=>'category']) }}
|
||||
{{ Form::label($category,$category,['class'=>'inline']) }}
|
||||
</span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="type" class="col-sm-1 label label-default">Type</label>
|
||||
<div class="col-sm-10">
|
||||
@foreach($repository->types() as $id => $type)
|
||||
<span class="badge-user">
|
||||
{{ Form::checkbox($type,$type,false,['class'=>'type']) }}
|
||||
{{ Form::label($type,$type,['class'=>'inline']) }}
|
||||
</span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="type" class="col-sm-1 label label-default">Extra</label>
|
||||
<div class="col-sm-10">
|
||||
<span class="badge-user">
|
||||
<label class="inline">
|
||||
{{ Form::checkbox('myrequests',$user->id,false,['id'=>'myrequests']) }} <span class="fa fa-user text-blue"></span> My Requests
|
||||
</label>
|
||||
</span>
|
||||
<span class="badge-user">
|
||||
<label class="inline">
|
||||
{{ Form::checkbox('unfilled','1',false,['id'=>'unfilled']) }} <span class="fa fa-times-circle text-blue"></span> Unfilled
|
||||
</label>
|
||||
</span>
|
||||
<span class="badge-user">
|
||||
<label class="inline">
|
||||
{{ Form::checkbox('claimed','1',false,['id'=>'claimed']) }} <span class="fa fa-suitcase text-blue"></span> Claimed
|
||||
</label>
|
||||
</span>
|
||||
<span class="badge-user">
|
||||
<label class="inline">
|
||||
{{ Form::checkbox('pending','1',false,['id'=>'pending']) }} <span class="fa fa-question-circle text-blue"></span> Pending
|
||||
</label>
|
||||
</span>
|
||||
<span class="badge-user">
|
||||
<label class="inline">
|
||||
{{ Form::checkbox('filled','1',false,['id'=>'filled']) }} <span class="fa fa-check-circle text-blue"></span> Filled
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
<br>
|
||||
<br>
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
{{ Form::label('sorting','Sort By:',['class'=>'control-label col-sm-2']) }}
|
||||
<div class="col-sm-2">
|
||||
{{ Form::select('sorting',$repository->sorting(),'created_at',['class'=>'form-control','id'=>'sorting','placeholder'=>'Select for sorting']) }}
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
{{ Form::select('direction',$repository->direction(),'desc',['class'=>'form-control','id'=>'direction']) }}
|
||||
</div>
|
||||
{{ Form::label('qty','Display:',['class'=>'control-label col-sm-2']) }}
|
||||
<div class="col-sm-2">
|
||||
{{ Form::select('qty',[25=>25,50=>50,100=>100],25,['class'=>'form-control','id'=>'qty']) }}
|
||||
</div>
|
||||
<input class="form-control" placeholder="{{ trans('common.search') }}" name="name" type="text" id="name">
|
||||
<button type="submit" class="btn btn-sm btn-primary" title="{{ trans('common.search') }}"><i class="fa fa-search"></i> {{ trans('common.search') }}</button>
|
||||
<a href="{{ route('requests') }}" class="btn btn-sm btn-warning" title="{{ trans('common.reset') }}"><i class="fa fa-repeat"></i> {{ trans('common.reset') }}</a>
|
||||
</form>
|
||||
<form action="{{route('requests')}}" style="display: inline; float:right;" method="get">
|
||||
<button type="submit" class="btn btn-sm btn-primary">{{ trans('request.all-requests') }}</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary" name="filled_requests" value="true" id="filled_requests">{{ trans('request.view-filled') }}</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary" name="unfilled_requests" value="true" id="unfilled_requests">{{ trans('request.view-unfilled') }}</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary" name="my_requests" value="true" id="my_requests">{{ trans('request.my-requests') }}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Search -->
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="block">
|
||||
@@ -61,10 +139,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<span class="badge-user" style="float: right;"><a href="{{ route('requests') }}"><strong>{{ trans('request.requests') }}:</strong></a> {{ $num_req }} |
|
||||
<a href="{{ route('requests') }}" name="filled_requests" value="true" id="filled_requests"><strong>{{ trans('request.filled') }}:</strong></a> {{ $num_fil }} |
|
||||
<a href="{{ route('requests') }}" name="unfilled_requests" value="true" id="unfilled_requests"><strong>{{ trans('request.unfilled') }}:</strong></a> {{ $num_unfil }}
|
||||
| <strong>{{ trans('request.total-bounty') }}:</strong> {{ $total_bounty }} {{ trans('bon.bon') }} | <strong>{{ trans('request.bounty-claimed') }}:</strong> {{ $claimed_bounty }} {{ trans('bon.bon') }} | <strong>{{ trans('request.bounty-unclaimed') }}:</strong> {{ $unclaimed_bounty }} {{ trans('bon.bon') }}</span>
|
||||
<span class="badge-user" style="float: right;">
|
||||
<strong>{{ trans('request.requests') }}:</strong> {{ $num_req }} |
|
||||
<strong>{{ trans('request.filled') }}:</strong> {{ $num_fil }} |
|
||||
<strong>{{ trans('request.unfilled') }}:</strong> {{ $num_unfil }} |
|
||||
<strong>{{ trans('request.total-bounty') }}:</strong> {{ $total_bounty }} {{ trans('bon.bon') }} |
|
||||
<strong>{{ trans('request.bounty-claimed') }}:</strong> {{ $claimed_bounty }} {{ trans('bon.bon') }} |
|
||||
<strong>{{ trans('request.bounty-unclaimed') }}:</strong> {{ $unclaimed_bounty }} {{ trans('bon.bon') }}
|
||||
</span>
|
||||
<a href="{{ route('add_request') }}" role="button" data-id="0" data-toggle="tooltip" title="" data-original-title="{{ trans('request.add-request') }}!" class="btn btn btn-success">{{ trans('request.add-request') }}</a>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
@@ -81,49 +163,169 @@
|
||||
<th>{{ trans('request.claimed') }} / {{ trans('request.filled') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($requests as $r)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="{{ $r->category->icon }} torrent-icon" data-toggle="tooltip" title="" data-original-title="{{ $r->category->name }} Torrent"></i>
|
||||
</td>
|
||||
<td>
|
||||
<span class="label label-success" data-toggle="tooltip" title="" data-original-title="{{ $r->type }}">{{ $r->type }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<a class="view-torrent" data-id="{{ $r->id }}" href="{{ route('request', array('id' => $r->id)) }}" data-toggle="tooltip" title="" data-original-title="{{ $r->name }}">{{ $r->name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge-user">{{ $r->user->username }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge-user">{{ $r->votes }}</span>
|
||||
</td>
|
||||
<td>{{ $r->comments->count() }}</td>
|
||||
<td>{{ $r->bounty }}</td>
|
||||
<td>{{ $r->created_at->diffForHumans() }}</td>
|
||||
<td>
|
||||
@if($r->claimed != null && $r->filled_hash == null)
|
||||
<button class="btn btn-xs btn-primary" data-toggle="tooltip" title="" data-original-title="{{ trans('request.request') }} {{ strtolower(trans('request.claimed')) }}">
|
||||
<i class="fa fa-suitcase"></i> {{ trans('request.claimed') }}</button>
|
||||
@elseif($r->filled_hash != null && $r->approved_by == null)
|
||||
<button class="btn btn-xs btn-info" data-toggle="tooltip" title="" data-original-title="{{ trans('request.request') }} {{ strtolower(trans('request.pending')) }}">
|
||||
<i class="fa fa-question-circle"></i> {{ trans('request.pending') }}</button>
|
||||
@elseif($r->filled_hash == null)
|
||||
<button class="btn btn-xs btn-danger" data-toggle="tooltip" title="" data-original-title="{{ trans('request.request') }} {{ strtolower(trans('request.unfilled')) }}">
|
||||
<i class="fa fa-times-circle"></i> {{ trans('request.unfilled') }}</button>
|
||||
@else
|
||||
<button class="btn btn-xs btn-success" data-toggle="tooltip" title="" data-original-title="{{ trans('request.request') }} {{ strtolower(trans('request.filled')) }}">
|
||||
<i class="fa fa-check-circle"></i> {{ trans('request.filled') }}</button>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
<tbody id="result">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $requests->links() }}
|
||||
<!-- Pagination -->
|
||||
<div class="text-center">
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination" id="pagination">
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Pagination -->
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@section('javascripts')
|
||||
<script>
|
||||
var xhr = new XMLHttpRequest();
|
||||
function faceted(page){
|
||||
var csrf = "{{ csrf_token() }}";
|
||||
var search = $("#search").val();
|
||||
var imdb = $("#imdb").val();
|
||||
var tvdb = $("#tvdb").val();
|
||||
var tmdb = $("#tmdb").val();
|
||||
var mal = $("#mal").val();
|
||||
var categories = [];
|
||||
var types = [];
|
||||
var sorting = $("#sorting").val();
|
||||
var direction = $("#direction").val();
|
||||
var qty = $("#qty").val();
|
||||
var categoryName = [];
|
||||
var typeName = [];
|
||||
var myrequests = (function() {
|
||||
if($("#myrequests").is(":checked")) {
|
||||
return $("#myrequests").val();
|
||||
}
|
||||
})();
|
||||
var unfilled = (function() {
|
||||
if($("#unfilled").is(":checked")) {
|
||||
return $("#unfilled").val();
|
||||
}
|
||||
})();
|
||||
var claimed = (function() {
|
||||
if($("#claimed").is(":checked")) {
|
||||
return $("#claimed").val();
|
||||
}
|
||||
})();
|
||||
var pending = (function() {
|
||||
if($("#pending").is(":checked")) {
|
||||
return $("#pending").val();
|
||||
}
|
||||
})();
|
||||
var filled = (function() {
|
||||
if($("#filled").is(":checked")) {
|
||||
return $("#filled").val();
|
||||
}
|
||||
})();
|
||||
$(".category:checked").each(function(){
|
||||
categories.push($(this).val());
|
||||
categoryName.push(this.name);
|
||||
$("#filter-item-category").html('<label class="label label-default">Category:</label>' +categoryName);
|
||||
});
|
||||
$(".type:checked").each(function(){
|
||||
types.push($(this).val());
|
||||
typeName.push(this.name);
|
||||
$("#filter-item-type").html('<label class="label label-default">Type:</label>' +typeName);
|
||||
});
|
||||
|
||||
if(categories.length == 0){
|
||||
$("#filter-item-category").html('')
|
||||
}
|
||||
if(types.length == 0){
|
||||
$("#filter-item-type").html('')
|
||||
}
|
||||
|
||||
if(xhr !== 'undefined'){
|
||||
xhr.abort();
|
||||
}
|
||||
|
||||
xhr = $.ajax({
|
||||
url: 'filterRequests',
|
||||
data: {_token:csrf,search:search,imdb:imdb,tvdb:tvdb,tmdb:tmdb,mal:mal,categories:categories,types:types,myrequests:myrequests,unfilled:unfilled,claimed:claimed,pending:pending,filled:filled,sorting:sorting,direction:direction,page:page,qty:qty},
|
||||
type: 'get',
|
||||
beforeSend:function(){
|
||||
$("#result").html('<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i>')
|
||||
}
|
||||
}).done(function(e){
|
||||
$("#result").html(e['result']);
|
||||
pagination(e['rows'],e['qty'],e['active']);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$(window).on("load",faceted())
|
||||
</script>
|
||||
<script>
|
||||
$("#search").keyup(function(){
|
||||
faceted();
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$("#imdb").keyup(function(){
|
||||
faceted();
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$("#tvdb").keyup(function(){
|
||||
faceted();
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$("#tmdb").keyup(function(){
|
||||
faceted();
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$("#mal").keyup(function(){
|
||||
faceted();
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$(".category,.type").on("click",function(){
|
||||
faceted();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#myrequests,#unfilled,#claimed,#pending,#filled").on("click",function(){
|
||||
faceted();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#sorting,#direction,#qty").on('change',function(){
|
||||
faceted();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function pagination(rows,qty,active){
|
||||
//var rows = Object.keys(e).length;
|
||||
var q = parseInt(qty);
|
||||
if(active == 1){
|
||||
var nav = '<li><a aria-label="Previous" style="cursor:not-allowed"><span aria-hidden="true">«</span></a></li>';
|
||||
}else{
|
||||
nav = '<li><a onclick="faceted('+(parseInt(active)-1)+')" aria-label="Previous"><span aria-hidden="true">«</span></a></li>';
|
||||
}
|
||||
for(var i=0,j=1;i<=rows;i+=q,j++){
|
||||
if((j >= parseInt(active)-6) && (j <= parseInt(active)+8)){
|
||||
nav += '<li class="" id="a'+j+'"><a onclick="faceted('+(j)+')">'+j+'</a>';
|
||||
}
|
||||
}
|
||||
if(active == Math.ceil(rows/qty)){
|
||||
nav += '<li><a aria-label="Next" style="cursor:not-allowed"><span aria-hidden="true">»</span></a></li>';
|
||||
}else{
|
||||
nav += '<li><a onclick="faceted('+(parseInt(active)+1)+')" aria-label="Next"><span aria-hidden="true">»</span></a></li>';
|
||||
}
|
||||
|
||||
$("#pagination").html(nav);
|
||||
|
||||
$("#a"+(parseInt(active))).addClass('active');
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
}
|
||||
|
||||
xhr = $.ajax({
|
||||
url: 'filter',
|
||||
url: 'filterTorrents',
|
||||
data: {_token:csrf,search:search,imdb:imdb,tvdb:tvdb,tmdb:tmdb,mal:mal,categories:categories,types:types,freeleech:freeleech,doubleupload:doubleupload,featured:featured,stream:stream,highspeed:highspeed,sd:sd,alive:alive,dying:dying,dead:dead,sorting:sorting,direction:direction,page:page,qty:qty},
|
||||
type: 'get',
|
||||
beforeSend:function(){
|
||||
|
||||
@@ -14,19 +14,17 @@
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<span class="badge-user" style="float: right;"><strong>Total Download:</strong>
|
||||
<span class="badge-extra text-red">{{ App\Helpers\StringHelper::formatBytes($his_downl,2) }}</span>
|
||||
<span class="badge-extra text-orange" data-toggle="tooltip" title="" data-original-title="Credited Download">{{ App\Helpers\StringHelper::formatBytes($his_downl_cre,2) }}</span>
|
||||
</span>
|
||||
<span class="badge-user" style="float: right;"><strong>Total Upload:</strong>
|
||||
<span class="badge-extra text-green">{{ App\Helpers\StringHelper::formatBytes($his_upl,2) }}</span>
|
||||
<span class="badge-extra text-blue" data-toggle="tooltip" title="" data-original-title="Credited Upload">{{ App\Helpers\StringHelper::formatBytes($his_upl_cre,2) }}</span>
|
||||
</span>
|
||||
<h1 class="title">My History Table</h1>
|
||||
<div class="block">
|
||||
<!-- History -->
|
||||
<span class="badge-user" style="float: right;"><strong>Total Download:</strong>
|
||||
<span class="badge-extra text-red">{{ App\Helpers\StringHelper::formatBytes($his_downl,2) }}</span>
|
||||
<span class="badge-extra text-orange" data-toggle="tooltip" title="" data-original-title="Credited Download">{{ App\Helpers\StringHelper::formatBytes($his_downl_cre,2) }}</span>
|
||||
</span>
|
||||
<span class="badge-user" style="float: right;"><strong>Total Upload:</strong>
|
||||
<span class="badge-extra text-green">{{ App\Helpers\StringHelper::formatBytes($his_upl,2) }}</span>
|
||||
<span class="badge-extra text-blue" data-toggle="tooltip" title="" data-original-title="Credited Upload">{{ App\Helpers\StringHelper::formatBytes($his_upl_cre,2) }}</span>
|
||||
</span>
|
||||
<br>
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<div class="head"><strong>Torrents History</strong></div>
|
||||
|
||||
+2
-2
@@ -164,6 +164,7 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::any('/deletePM/{pmid}', 'PrivateMessageController@deletePrivateMessage')->name('delete-pm');
|
||||
|
||||
// Requests
|
||||
Route::any('filterRequests', 'RequestController@faceted');
|
||||
Route::get('/requests', 'RequestController@requests')->name('requests');
|
||||
Route::any('/request/add', 'RequestController@addrequest')->name('add_request');
|
||||
Route::any('/request/{id}/edit', 'RequestController@editrequest')->name('edit_request');
|
||||
@@ -173,12 +174,11 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::any('/request/{id}/fill', 'RequestController@fillRequest')->name('fill_request');
|
||||
Route::any('/request/{id}/reject', 'RequestController@rejectRequest')->name('rejectRequest');
|
||||
Route::any('/request/{id}/vote', 'RequestController@addBonus')->name('add_votes');
|
||||
Route::get('/requests/search', 'RequestController@search')->name('request_search');
|
||||
Route::any('/request/{id}/claim', 'RequestController@claimRequest')->name('claimRequest');
|
||||
Route::any('/request/{id}/unclaim', 'RequestController@unclaimRequest')->name('unclaimRequest');
|
||||
|
||||
// Torrent
|
||||
Route::any('filter', 'TorrentController@faceted');
|
||||
Route::any('filterTorrents', 'TorrentController@faceted');
|
||||
Route::get('/torrents', 'TorrentController@torrents')->name('torrents');
|
||||
Route::get('/torrents/{slug}.{id}', 'TorrentController@torrent')->name('torrent');
|
||||
Route::get('/torrents/{slug}.{id}/peers', 'TorrentController@peers')->name('peers');
|
||||
|
||||
Reference in New Issue
Block a user