mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update details pages
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2018-04-04 DariusIII
|
||||
* Chg: Update details pages
|
||||
* Chg: Add Api\ApiController, update routes/web.php
|
||||
* Chg: Add ApiHelp controller
|
||||
* Chg: Update links in themes for new routes
|
||||
|
||||
@@ -145,9 +145,9 @@ class BasePageController extends Controller
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPostBack(Request $request)
|
||||
public function isPostBack()
|
||||
{
|
||||
return $request->isMethod('POST');
|
||||
return \request()->isMethod('POST');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\DnzbFailure;
|
||||
use App\Models\Predb;
|
||||
use App\Models\Release;
|
||||
use App\Models\ReleaseComment;
|
||||
use App\Models\ReleaseFile;
|
||||
use App\Models\ReleaseNfo;
|
||||
use App\Models\ReleaseRegex;
|
||||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use App\Models\Video;
|
||||
use Blacklight\AniDB;
|
||||
use Blacklight\Books;
|
||||
use Blacklight\Console;
|
||||
use Blacklight\Games;
|
||||
use Blacklight\Movie;
|
||||
use Blacklight\Music;
|
||||
use Blacklight\ReleaseExtra;
|
||||
use Blacklight\Releases;
|
||||
use Blacklight\XXX;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DetailsController extends BasePageController
|
||||
{
|
||||
/**
|
||||
* @param $guid
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function show($guid)
|
||||
{
|
||||
$this->setPrefs();
|
||||
|
||||
if ($guid !== null) {
|
||||
$releases = new Releases(['Settings' => $this->settings]);
|
||||
$re = new ReleaseExtra;
|
||||
$data = Release::getByGuid($guid);
|
||||
$user = User::find(Auth::id());
|
||||
$cpapi = $user['cp_api'];
|
||||
$cpurl = $user['cp_url'];
|
||||
$releaseRegex = ReleaseRegex::query()->where('releases_id', '=', $data['id'])->first();
|
||||
|
||||
if (! $data) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
if ($this->isPostBack()) {
|
||||
ReleaseComment::addComment($data['id'], $data['gid'], \request()->input('txtAddComment'), Auth::id(), \request()->ip());
|
||||
}
|
||||
|
||||
$nfo = ReleaseNfo::getReleaseNfo($data['id']);
|
||||
$reVideo = $re->getVideo($data['id']);
|
||||
$reAudio = $re->getAudio($data['id']);
|
||||
$reSubs = $re->getSubs($data['id']);
|
||||
$comments = ReleaseComment::getComments($data['id']);
|
||||
$similars = $releases->searchSimilar($data['id'], $data['searchname'], 6, $this->userdata['categoryexclusions']);
|
||||
$failed = DnzbFailure::getFailedCount($data['id']);
|
||||
|
||||
$showInfo = '';
|
||||
if ($data['videos_id'] > 0) {
|
||||
$showInfo = Video::getByVideoID($data['videos_id']);
|
||||
}
|
||||
|
||||
$mov = '';
|
||||
if ($data['imdbid'] !== '' && $data['imdbid'] !== 0000000) {
|
||||
$movie = new Movie(['Settings' => $this->settings]);
|
||||
$mov = $movie->getMovieInfo($data['imdbid']);
|
||||
if (! empty($mov['title'])) {
|
||||
$mov['title'] = str_replace(['/', '\\'], '', $mov['title']);
|
||||
$mov['actors'] = makeFieldLinks($mov, 'actors', 'movies');
|
||||
$mov['genre'] = makeFieldLinks($mov, 'genre', 'movies');
|
||||
$mov['director'] = makeFieldLinks($mov, 'director', 'movies');
|
||||
if (Settings::settingValue('site.trailers.trailers_display')) {
|
||||
$trailer = empty($mov['trailer']) || $mov['trailer'] === '' ? $movie->getTrailer($data['imdbid']) : $mov['trailer'];
|
||||
if ($trailer) {
|
||||
$mov['trailer'] = sprintf('<iframe width="%d" height="%d" src="%s"></iframe>', Settings::settingValue('site.trailers.trailers_size_x'), Settings::settingValue('site.trailers.trailers_size_y'), $trailer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$xxx = '';
|
||||
if ($data['xxxinfo_id'] !== '' && $data['xxxinfo_id'] !== 0) {
|
||||
$x = new XXX();
|
||||
$xxx = $x->getXXXInfo($data['xxxinfo_id']);
|
||||
|
||||
if (isset($xxx['trailers'])) {
|
||||
$xxx['trailers'] = $x->insertSwf($xxx['classused'], $xxx['trailers']);
|
||||
}
|
||||
|
||||
if ($xxx && isset($xxx['title'])) {
|
||||
$xxx['title'] = str_replace(['/', '\\'], '', $xxx['title']);
|
||||
$xxx['actors'] = makeFieldLinks($xxx, 'actors', 'xxx');
|
||||
$xxx['genre'] = makeFieldLinks($xxx, 'genre', 'xxx');
|
||||
$xxx['director'] = makeFieldLinks($xxx, 'director', 'xxx');
|
||||
} else {
|
||||
$xxx = false;
|
||||
}
|
||||
}
|
||||
|
||||
$game = '';
|
||||
if ($data['gamesinfo_id'] !== '') {
|
||||
$g = new Games();
|
||||
$game = $g->getGamesInfoById($data['gamesinfo_id']);
|
||||
}
|
||||
|
||||
$mus = '';
|
||||
if ($data['musicinfo_id'] !== '') {
|
||||
$music = new Music(['Settings' => $this->settings]);
|
||||
$mus = $music->getMusicInfo($data['musicinfo_id']);
|
||||
}
|
||||
|
||||
$book = '';
|
||||
if ($data['bookinfo_id'] !== '') {
|
||||
$b = new Books();
|
||||
$book = $b->getBookInfo($data['bookinfo_id']);
|
||||
}
|
||||
|
||||
$con = '';
|
||||
if ($data['consoleinfo_id'] !== '') {
|
||||
$c = new Console();
|
||||
$con = $c->getConsoleInfo($data['consoleinfo_id']);
|
||||
}
|
||||
|
||||
$AniDBAPIArray = '';
|
||||
if ($data['anidbid'] > 0) {
|
||||
$AniDB = new AniDB(['Settings' => $releases->pdo]);
|
||||
$AniDBAPIArray = $AniDB->getAnimeInfo($data['anidbid']);
|
||||
}
|
||||
|
||||
$pre = Predb::getForRelease($data['predb_id']);
|
||||
|
||||
$releasefiles = ReleaseFile::getReleaseFiles($data['id']);
|
||||
|
||||
$this->smarty->assign('releasefiles', $releasefiles);
|
||||
$this->smarty->assign('release', $data);
|
||||
$this->smarty->assign('reVideo', $reVideo);
|
||||
$this->smarty->assign('reAudio', $reAudio);
|
||||
$this->smarty->assign('reSubs', $reSubs);
|
||||
$this->smarty->assign('nfo', $nfo);
|
||||
$this->smarty->assign('show', $showInfo);
|
||||
$this->smarty->assign('movie', $mov);
|
||||
$this->smarty->assign('xxx', $xxx);
|
||||
$this->smarty->assign('anidb', $AniDBAPIArray);
|
||||
$this->smarty->assign('music', $mus);
|
||||
$this->smarty->assign('con', $con);
|
||||
$this->smarty->assign('game', $game);
|
||||
$this->smarty->assign('book', $book);
|
||||
$this->smarty->assign('predb', $pre);
|
||||
$this->smarty->assign('comments', $comments);
|
||||
$this->smarty->assign('searchname', getSimilarName($data['searchname']));
|
||||
$this->smarty->assign('similars', $similars);
|
||||
$this->smarty->assign('privateprofiles', (int) Settings::settingValue('..privateprofiles') === 1);
|
||||
$this->smarty->assign('failed', $failed);
|
||||
$this->smarty->assign('cpapi', $cpapi);
|
||||
$this->smarty->assign('cpurl', $cpurl);
|
||||
$this->smarty->assign('regex', $releaseRegex);
|
||||
|
||||
$meta_title = 'View NZB';
|
||||
$meta_keywords = 'view,nzb,description,details';
|
||||
$meta_description = 'View NZB for'.$data['searchname'];
|
||||
|
||||
$content = $this->smarty->fetch('viewnzb.tpl');
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'content' => $content,
|
||||
'meta_title' => $meta_title,
|
||||
'meta_keywords' => $meta_keywords,
|
||||
'meta_description' => $meta_description,
|
||||
]
|
||||
);
|
||||
$this->pagerender();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -650,7 +650,8 @@
|
||||
No comments yet...
|
||||
</div>
|
||||
{/if}
|
||||
<form action="" method="post">
|
||||
<form action="/details" method="post">
|
||||
{{csrf_field()}}
|
||||
<label for="txtAddComment">Add Comment:</label><br/>
|
||||
<textarea id="txtAddComment" name="txtAddComment" rows="6" cols="60"></textarea>
|
||||
<br/>
|
||||
|
||||
@@ -662,7 +662,8 @@
|
||||
No comments yet...
|
||||
</div>
|
||||
{/if}
|
||||
<form action="" method="post">
|
||||
<form action="/details" method="post">
|
||||
{{csrf_field()}}
|
||||
<label for="txtAddComment">Add Comment:</label><br/>
|
||||
<textarea id="txtAddComment" name="txtAddComment" rows="6" cols="60"></textarea>
|
||||
<br/>
|
||||
|
||||
@@ -652,7 +652,8 @@
|
||||
No comments yet...
|
||||
</div>
|
||||
{/if}
|
||||
<form action="" method="post">
|
||||
<form action="/details" method="post">
|
||||
{{csrf_field()}}
|
||||
<label for="txtAddComment">Add Comment:</label><br/>
|
||||
<textarea id="txtAddComment" name="txtAddComment" rows="6" cols="60"></textarea>
|
||||
<br/>
|
||||
|
||||
+3
-4
@@ -16,7 +16,7 @@ Route::get('/', 'BasePageController@index');
|
||||
Auth::routes();
|
||||
|
||||
Route::get('login', 'Auth\LoginController@showLoginForm');
|
||||
Route::post('login', ['as' => 'login', 'uses' => 'Auth\LoginController@login']);
|
||||
Route::post('login', 'Auth\LoginController@login')->name('login');
|
||||
|
||||
Route::get('register', 'Auth\RegisterController@showRegistrationForm');
|
||||
Route::post('register', 'Auth\RegisterController@register');
|
||||
@@ -53,9 +53,8 @@ Route::get('/console', function () {
|
||||
redirect('/console');
|
||||
})->middleware('auth');
|
||||
|
||||
Route::get('/details/{id}', function () {
|
||||
redirect('/details');
|
||||
})->middleware('auth');
|
||||
Route::get('/details/{guid}', 'DetailsController@show');
|
||||
Route::post('/details/{guid}', 'DetailsController@show');
|
||||
|
||||
Route::get('/games', function () {
|
||||
redirect('/games');
|
||||
|
||||
Reference in New Issue
Block a user