Update NfoController, check for missing nfo

This commit is contained in:
DariusIII
2018-10-11 15:34:51 +02:00
parent d79d199873
commit cf4238ba24
2 changed files with 31 additions and 27 deletions
+30 -27
View File
@@ -15,7 +15,7 @@ class NfoController extends BasePageController
*
* @throws \Exception
*/
public function showNfo($id = '', Request $request)
public function showNfo(Request $request, $id = '')
{
$this->setPrefs();
@@ -23,41 +23,44 @@ class NfoController extends BasePageController
$rel = Release::getByGuid($id);
if (! $rel) {
$this->show404();
abort(404, 'Release does not exist');
}
$nfo = ReleaseNfo::getReleaseNfo($rel['id']);
$nfo['nfoUTF'] = Utility::cp437toUTF($nfo['nfo']);
$this->smarty->assign('rel', $rel);
$this->smarty->assign('nfo', $nfo);
if ($nfo !== null) {
$nfo['nfoUTF'] = Utility::cp437toUTF($nfo['nfo']);
$title = 'NFO File';
$meta_title = 'View Nfo';
$meta_keywords = 'view,nzb,nfo,description,details';
$meta_description = 'View Nfo File';
$this->smarty->assign('rel', $rel);
$this->smarty->assign('nfo', $nfo);
$modal = false;
if ($request->has('modal')) {
$modal = true;
$this->smarty->assign('modal', true);
}
$title = 'NFO File';
$meta_title = 'View Nfo';
$meta_keywords = 'view,nzb,nfo,description,details';
$meta_description = 'View Nfo File';
$content = $this->smarty->fetch('viewnfo.tpl');
$modal = false;
if ($request->has('modal')) {
$modal = true;
$this->smarty->assign('modal', true);
}
if ($modal) {
echo $content;
$content = $this->smarty->fetch('viewnfo.tpl');
if ($modal) {
echo $content;
} else {
$this->smarty->assign([
'title' => $title,
'content' => $content,
'meta_title' => $meta_title,
'meta_keywords' => $meta_keywords,
'meta_description' => $meta_description,
]);
$this->pagerender();
}
} else {
$this->smarty->assign(
[
'title' => $title,
'content' => $content,
'meta_title' => $meta_title,
'meta_keywords' => $meta_keywords,
'meta_description' => $meta_description,
]
);
$this->pagerender();
abort(404, 'NFO does not exist');
}
}
}