|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\BasePageController; |
|
6
|
|
|
use App\Models\Release; |
|
7
|
|
|
use Blacklight\AniDB; |
|
8
|
|
|
|
|
9
|
|
|
class AdminAnidbController extends BasePageController |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @throws \Exception |
|
13
|
|
|
*/ |
|
14
|
|
|
public function index() |
|
15
|
|
|
{ |
|
16
|
|
|
$this->setAdminPrefs(); |
|
17
|
|
|
|
|
18
|
|
|
$AniDB = new AniDB(); |
|
19
|
|
|
$title = $meta_title = 'AniDB List'; |
|
20
|
|
|
|
|
21
|
|
|
$aname = ''; |
|
22
|
|
|
if (request()->has('animetitle') && ! empty(request()->input('animetitle'))) { |
|
23
|
|
|
$aname = request()->input('animetitle'); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
$this->smarty->assign('animetitle', $aname); |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
$anidblist = $AniDB->getAnimeRange($aname); |
|
29
|
|
|
$this->smarty->assign('anidblist', $anidblist); |
|
30
|
|
|
|
|
31
|
|
|
$content = $this->smarty->fetch('anidb-list.tpl'); |
|
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content')); |
|
34
|
|
|
|
|
35
|
|
|
$this->adminrender(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param $id |
|
40
|
|
|
* |
|
41
|
|
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector |
|
42
|
|
|
* @throws \Exception |
|
43
|
|
|
*/ |
|
44
|
|
|
public function edit($id) |
|
45
|
|
|
{ |
|
46
|
|
|
$this->setAdminPrefs(); |
|
47
|
|
|
|
|
48
|
|
|
$AniDB = new AniDB(); |
|
49
|
|
|
|
|
50
|
|
|
// Set the current action. |
|
51
|
|
|
$action = request()->input('action') ?? 'view'; |
|
52
|
|
|
|
|
53
|
|
|
switch ($action) { |
|
54
|
|
|
case 'submit': |
|
55
|
|
|
$AniDB->updateTitle( |
|
56
|
|
|
request()->input('anidbid'), |
|
57
|
|
|
request()->input('title'), |
|
58
|
|
|
request()->input('type'), |
|
59
|
|
|
request()->input('startdate'), |
|
60
|
|
|
request()->input('enddate'), |
|
61
|
|
|
request()->input('related'), |
|
62
|
|
|
request()->input('similar'), |
|
63
|
|
|
request()->input('creators'), |
|
64
|
|
|
request()->input('description'), |
|
65
|
|
|
request()->input('rating'), |
|
66
|
|
|
request()->input('categories'), |
|
67
|
|
|
request()->input('characters'), |
|
68
|
|
|
request()->input('epnos'), |
|
69
|
|
|
request()->input('airdates'), |
|
70
|
|
|
request()->input('episodetitles') |
|
71
|
|
|
); |
|
72
|
|
|
|
|
73
|
|
|
return redirect('admin/anidb-list'); |
|
74
|
|
|
break; |
|
|
|
|
|
|
75
|
|
|
|
|
76
|
|
|
case 'view': |
|
77
|
|
|
default: |
|
78
|
|
|
if (! empty($id)) { |
|
79
|
|
|
$this->title = 'AniDB Edit'; |
|
80
|
|
|
$AniDBAPIArray = $AniDB->getAnimeInfo($id); |
|
81
|
|
|
$this->smarty->assign('anime', $AniDBAPIArray); |
|
82
|
|
|
} |
|
83
|
|
|
break; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
$title = 'Edit AniDB Data'; |
|
87
|
|
|
$content = $this->smarty->fetch('anidb-edit.tpl'); |
|
88
|
|
|
|
|
89
|
|
|
$this->smarty->assign(compact('title', 'content')); |
|
90
|
|
|
|
|
91
|
|
|
$this->adminrender(); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Remove the specified resource from storage. |
|
96
|
|
|
* |
|
97
|
|
|
* @param int $id |
|
98
|
|
|
* |
|
99
|
|
|
* @throws \Exception |
|
100
|
|
|
*/ |
|
101
|
|
|
public function destroy($id) |
|
102
|
|
|
{ |
|
103
|
|
|
$this->setAdminPrefs(); |
|
104
|
|
|
|
|
105
|
|
|
$success = false; |
|
106
|
|
|
|
|
107
|
|
|
if (request()->has('id')) { |
|
108
|
|
|
$success = Release::removeAnidbIdFromReleases($id); |
|
109
|
|
|
$this->smarty->assign('anidbid', $id); |
|
110
|
|
|
} |
|
111
|
|
|
$this->smarty->assign('success', $success); |
|
112
|
|
|
|
|
113
|
|
|
$title = 'Remove anidbID from Releases'; |
|
114
|
|
|
$content = $this->smarty->fetch('anidb-remove.tpl'); |
|
115
|
|
|
$this->smarty->assign(compact('title', 'content')); |
|
116
|
|
|
$this->adminrender(); |
|
117
|
|
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.