Update Console and Details controllers, change behaviour on missing data

This commit is contained in:
DariusIII
2018-11-19 15:11:20 +01:00
parent 880e49db0f
commit d2bdd6955f
3 changed files with 10 additions and 12 deletions
+1
View File
@@ -1,4 +1,5 @@
2018-11-19 DariusIII
* Chg: Update Console and Details controllers, change behaviour on missing data
* Chg: Update ContentController, do not show 404 page on missing content but return json message
* Fix: Fix display of contact form when logged in
2018-11-18 DariusIII
+2 -1
View File
@@ -13,6 +13,7 @@ class ConsoleController extends BasePageController
* @param \Illuminate\Http\Request $request
* @param string $id
*
* @return \Illuminate\Http\JsonResponse
* @throws \Exception
*/
public function show(Request $request, $id = '')
@@ -92,7 +93,7 @@ class ConsoleController extends BasePageController
if ($cdata !== null) {
$this->smarty->assign('catname', $cdata);
} else {
$this->show404();
return response()->json(['message' => 'There are no categories set.'], 404);
}
}
+7 -11
View File
@@ -29,6 +29,7 @@ class DetailsController extends BasePageController
/**
* @param $guid
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function show($guid)
@@ -45,7 +46,7 @@ class DetailsController extends BasePageController
$releaseRegex = ReleaseRegex::query()->where('releases_id', '=', $data['id'])->first();
if (! $data) {
$this->show404();
return redirect()->back();
}
if ($this->isPostBack()) {
@@ -105,32 +106,27 @@ class DetailsController extends BasePageController
$game = '';
if ($data['gamesinfo_id'] !== '') {
$g = new Games();
$game = $g->getGamesInfoById($data['gamesinfo_id']);
$game = (new Games())->getGamesInfoById($data['gamesinfo_id']);
}
$mus = '';
if ($data['musicinfo_id'] !== '') {
$music = new Music(['Settings' => $this->settings]);
$mus = $music->getMusicInfo($data['musicinfo_id']);
$mus = (new Music(['Settings' => $this->settings]))->getMusicInfo($data['musicinfo_id']);
}
$book = '';
if ($data['bookinfo_id'] !== '') {
$b = new Books();
$book = $b->getBookInfo($data['bookinfo_id']);
$book = (new Books())->getBookInfo($data['bookinfo_id']);
}
$con = '';
if ($data['consoleinfo_id'] !== '') {
$c = new Console();
$con = $c->getConsoleInfo($data['consoleinfo_id']);
$con = (new Console())->getConsoleInfo($data['consoleinfo_id']);
}
$AniDBAPIArray = '';
if ($data['anidbid'] > 0) {
$AniDB = new AniDB();
$AniDBAPIArray = $AniDB->getAnimeInfo($data['anidbid']);
$AniDBAPIArray = (new AniDB())->getAnimeInfo($data['anidbid']);
}
$pre = Predb::getForRelease($data['predb_id']);