Files
newznab-tmux/app/Http/Controllers/NfoController.php
T
DariusIII 5a8fff0020 Apply fixes from StyleCI
[ci skip] [skip ci]
2019-11-01 19:52:18 +00:00

62 lines
1.6 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Release;
use App\Models\ReleaseNfo;
use Blacklight\utility\Utility;
use Illuminate\Http\Request;
class NfoController extends BasePageController
{
/**
* @param string $id
* @param \Illuminate\Http\Request $request
*
* @throws \Exception
*/
public function showNfo(Request $request, $id = '')
{
$this->setPrefs();
if ($id) {
$rel = Release::getByGuid($id);
if (! $rel) {
abort(404, 'Release does not exist');
}
$nfo = ReleaseNfo::getReleaseNfo($rel['id']);
if ($nfo !== null) {
$nfo['nfoUTF'] = Utility::cp437toUTF($nfo['nfo']);
$this->smarty->assign('rel', $rel);
$this->smarty->assign('nfo', $nfo);
$title = 'NFO File';
$meta_title = 'View Nfo';
$meta_keywords = 'view,nzb,nfo,description,details';
$meta_description = 'View Nfo File';
$modal = false;
if ($request->has('modal')) {
$modal = true;
$this->smarty->assign('modal', true);
}
$content = $this->smarty->fetch('viewnfo.tpl');
if ($modal) {
echo $content;
} else {
$this->smarty->assign(compact('title', 'content', 'meta_title', 'meta_keywords', 'meta_description'));
$this->pagerender();
}
} else {
abort(404, 'NFO does not exist');
}
}
}
}