@@ -14,20 +14,20 @@ |
||
14 | 14 | $smarty = new Smarty(); |
15 | 15 | } |
16 | 16 | switch (true) { |
17 | - case is_string($smarty->plugins_dir) && is_dir($smarty->plugins_dir): |
|
18 | - $plugins_dir = $smarty->plugins_dir; |
|
19 | - break; |
|
20 | - case is_array($smarty->plugins_dir): |
|
21 | - $plugins_dir = ''; |
|
22 | - foreach ($smarty->plugins_dir as $dir) { |
|
23 | - if (is_string($dir) && is_dir($dir)) { |
|
24 | - $plugins_dir = $dir; |
|
25 | - break; |
|
17 | + case is_string($smarty->plugins_dir) && is_dir($smarty->plugins_dir): |
|
18 | + $plugins_dir = $smarty->plugins_dir; |
|
19 | + break; |
|
20 | + case is_array($smarty->plugins_dir): |
|
21 | + $plugins_dir = ''; |
|
22 | + foreach ($smarty->plugins_dir as $dir) { |
|
23 | + if (is_string($dir) && is_dir($dir)) { |
|
24 | + $plugins_dir = $dir; |
|
25 | + break; |
|
26 | + } |
|
26 | 27 | } |
27 | - } |
|
28 | - break; |
|
29 | - default: |
|
30 | - $plugins_dir = ''; |
|
28 | + break; |
|
29 | + default: |
|
30 | + $plugins_dir = ''; |
|
31 | 31 | } |
32 | 32 | if (!is_dir($plugins_dir)) { |
33 | 33 | exit('Fatal: Unable to find smarty plugins directory.' . PHP_EOL); |
@@ -22,173 +22,173 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | switch ($action) { |
25 | - case 'delete': |
|
26 | - $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
27 | - if (isset($_REQUEST['from'])) { |
|
28 | - header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
29 | - } else { |
|
30 | - header("Location:" . WWW_TOP . "/mymovies"); |
|
31 | - } |
|
32 | - if (!$movie) { |
|
33 | - $page->show404('Not subscribed'); |
|
34 | - } else { |
|
35 | - $um->delMovie($page->users->currentUserId(), $imdbid); |
|
36 | - } |
|
37 | - |
|
38 | - break; |
|
39 | - case 'add': |
|
40 | - case 'doadd': |
|
41 | - $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
42 | - if ($movie) { |
|
43 | - $page->show404('Already subscribed'); |
|
44 | - } else { |
|
45 | - $movie = $mv->getMovieInfo($imdbid); |
|
46 | - if (!$movie) { |
|
47 | - $page->show404('No matching movie.'); |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - if ($action == 'doadd') { |
|
52 | - $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
53 | - $um->addMovie($page->users->currentUserId(), $imdbid, $category); |
|
25 | + case 'delete': |
|
26 | + $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
54 | 27 | if (isset($_REQUEST['from'])) { |
55 | 28 | header("Location:" . WWW_TOP . $_REQUEST['from']); |
56 | 29 | } else { |
57 | 30 | header("Location:" . WWW_TOP . "/mymovies"); |
58 | 31 | } |
59 | - } else { |
|
60 | - $cat = new Category(['Settings' => $page->settings]); |
|
61 | - $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
62 | - $categories = []; |
|
63 | - foreach ($tmpcats as $c) { |
|
64 | - // If MOVIE WEB-DL categorization is disabled, don't include it as an option |
|
65 | - if ($page->settings->getSetting('catwebdl') == 0 && $c['id'] == Category::MOVIE_WEBDL) { |
|
66 | - continue; |
|
32 | + if (!$movie) { |
|
33 | + $page->show404('Not subscribed'); |
|
34 | + } else { |
|
35 | + $um->delMovie($page->users->currentUserId(), $imdbid); |
|
36 | + } |
|
37 | + |
|
38 | + break; |
|
39 | + case 'add': |
|
40 | + case 'doadd': |
|
41 | + $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
42 | + if ($movie) { |
|
43 | + $page->show404('Already subscribed'); |
|
44 | + } else { |
|
45 | + $movie = $mv->getMovieInfo($imdbid); |
|
46 | + if (!$movie) { |
|
47 | + $page->show404('No matching movie.'); |
|
67 | 48 | } |
68 | - $categories[$c['id']] = $c['title']; |
|
69 | 49 | } |
70 | - $page->smarty->assign('type', 'add'); |
|
71 | - $page->smarty->assign('cat_ids', array_keys($categories)); |
|
72 | - $page->smarty->assign('cat_names', $categories); |
|
73 | - $page->smarty->assign('cat_selected', []); |
|
74 | - $page->smarty->assign('imdbid', $imdbid); |
|
75 | - $page->smarty->assign('movie', $movie); |
|
76 | - $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
77 | - $page->render(); |
|
78 | - } |
|
79 | - break; |
|
80 | - case 'edit': |
|
81 | - case 'doedit': |
|
82 | - $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
83 | - |
|
84 | - if (!$movie) { |
|
85 | - $page->show404(); |
|
86 | - } |
|
87 | - |
|
88 | - if ($action == 'doedit') { |
|
89 | - $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
90 | - $um->updateMovie($page->users->currentUserId(), $imdbid, $category); |
|
91 | - if (isset($_REQUEST['from'])) { |
|
92 | - header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
50 | + |
|
51 | + if ($action == 'doadd') { |
|
52 | + $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
53 | + $um->addMovie($page->users->currentUserId(), $imdbid, $category); |
|
54 | + if (isset($_REQUEST['from'])) { |
|
55 | + header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
56 | + } else { |
|
57 | + header("Location:" . WWW_TOP . "/mymovies"); |
|
58 | + } |
|
93 | 59 | } else { |
94 | - header("Location:" . WWW_TOP . "/mymovies"); |
|
60 | + $cat = new Category(['Settings' => $page->settings]); |
|
61 | + $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
62 | + $categories = []; |
|
63 | + foreach ($tmpcats as $c) { |
|
64 | + // If MOVIE WEB-DL categorization is disabled, don't include it as an option |
|
65 | + if ($page->settings->getSetting('catwebdl') == 0 && $c['id'] == Category::MOVIE_WEBDL) { |
|
66 | + continue; |
|
67 | + } |
|
68 | + $categories[$c['id']] = $c['title']; |
|
69 | + } |
|
70 | + $page->smarty->assign('type', 'add'); |
|
71 | + $page->smarty->assign('cat_ids', array_keys($categories)); |
|
72 | + $page->smarty->assign('cat_names', $categories); |
|
73 | + $page->smarty->assign('cat_selected', []); |
|
74 | + $page->smarty->assign('imdbid', $imdbid); |
|
75 | + $page->smarty->assign('movie', $movie); |
|
76 | + $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
77 | + $page->render(); |
|
78 | + } |
|
79 | + break; |
|
80 | + case 'edit': |
|
81 | + case 'doedit': |
|
82 | + $movie = $um->getMovie($page->users->currentUserId(), $imdbid); |
|
83 | + |
|
84 | + if (!$movie) { |
|
85 | + $page->show404(); |
|
95 | 86 | } |
96 | - } else { |
|
97 | - $cat = new Category(['Settings' => $page->settings]); |
|
98 | 87 | |
88 | + if ($action == 'doedit') { |
|
89 | + $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
90 | + $um->updateMovie($page->users->currentUserId(), $imdbid, $category); |
|
91 | + if (isset($_REQUEST['from'])) { |
|
92 | + header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
93 | + } else { |
|
94 | + header("Location:" . WWW_TOP . "/mymovies"); |
|
95 | + } |
|
96 | + } else { |
|
97 | + $cat = new Category(['Settings' => $page->settings]); |
|
98 | + |
|
99 | + $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
100 | + $categories = []; |
|
101 | + foreach ($tmpcats as $c) { |
|
102 | + $categories[$c['id']] = $c['title']; |
|
103 | + } |
|
104 | + |
|
105 | + $page->smarty->assign('type', 'edit'); |
|
106 | + $page->smarty->assign('cat_ids', array_keys($categories)); |
|
107 | + $page->smarty->assign('cat_names', $categories); |
|
108 | + $page->smarty->assign('cat_selected', explode('|', $movie['categories'])); |
|
109 | + $page->smarty->assign('imdbid', $imdbid); |
|
110 | + $page->smarty->assign('movie', $movie); |
|
111 | + $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
112 | + $page->render(); |
|
113 | + } |
|
114 | + break; |
|
115 | + case 'browse': |
|
116 | + |
|
117 | + $page->title = "Browse My Shows"; |
|
118 | + $page->meta_title = "My Shows"; |
|
119 | + $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
120 | + $page->meta_description = "Browse Your Shows"; |
|
121 | + |
|
122 | + $movies = $um->getMovies($page->users->currentUserId()); |
|
123 | + |
|
124 | + $releases = new Releases(['Settings' => $page->settings]); |
|
125 | + $browsecount = $releases->getMovieCount($movies, -1, $page->userdata["categoryexclusions"]); |
|
126 | + |
|
127 | + $offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0; |
|
128 | + $ordering = $releases->getBrowseOrdering(); |
|
129 | + $orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; |
|
130 | + |
|
131 | + $results = []; |
|
132 | + $results = $mv->getMovieRange($movies, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); |
|
133 | + |
|
134 | + $page->smarty->assign('pagertotalitems', $browsecount); |
|
135 | + $page->smarty->assign('pageroffset', $offset); |
|
136 | + $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); |
|
137 | + $page->smarty->assign('pagerquerybase', WWW_TOP . "/mymovies/browse?ob=" . $orderby . "&offset="); |
|
138 | + $page->smarty->assign('pagerquerysuffix', "#results"); |
|
139 | + $page->smarty->assign('covgroup', ''); |
|
140 | + |
|
141 | + $pager = $page->smarty->fetch("pager.tpl"); |
|
142 | + $page->smarty->assign('pager', $pager); |
|
143 | + |
|
144 | + foreach ($ordering as $ordertype) { |
|
145 | + $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/mymovies/browse?ob=" . $ordertype . "&offset=0"); |
|
146 | + } |
|
147 | + |
|
148 | + $page->smarty->assign('lastvisit', $page->userdata['lastlogin']); |
|
149 | + |
|
150 | + $page->smarty->assign('results', $results); |
|
151 | + |
|
152 | + $page->smarty->assign('movies', true); |
|
153 | + |
|
154 | + $page->content = $page->smarty->fetch('browse.tpl'); |
|
155 | + $page->render(); |
|
156 | + break; |
|
157 | + default: |
|
158 | + |
|
159 | + $page->title = "My Movies"; |
|
160 | + $page->meta_title = "My Movies"; |
|
161 | + $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
162 | + $page->meta_description = "Manage Your Movies"; |
|
163 | + |
|
164 | + $cat = new Category(['Settings' => $page->settings]); |
|
99 | 165 | $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
100 | 166 | $categories = []; |
101 | 167 | foreach ($tmpcats as $c) { |
102 | 168 | $categories[$c['id']] = $c['title']; |
103 | 169 | } |
104 | 170 | |
105 | - $page->smarty->assign('type', 'edit'); |
|
106 | - $page->smarty->assign('cat_ids', array_keys($categories)); |
|
107 | - $page->smarty->assign('cat_names', $categories); |
|
108 | - $page->smarty->assign('cat_selected', explode('|', $movie['categories'])); |
|
109 | - $page->smarty->assign('imdbid', $imdbid); |
|
110 | - $page->smarty->assign('movie', $movie); |
|
111 | - $page->content = $page->smarty->fetch('mymovies-add.tpl'); |
|
112 | - $page->render(); |
|
113 | - } |
|
114 | - break; |
|
115 | - case 'browse': |
|
116 | - |
|
117 | - $page->title = "Browse My Shows"; |
|
118 | - $page->meta_title = "My Shows"; |
|
119 | - $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
120 | - $page->meta_description = "Browse Your Shows"; |
|
121 | - |
|
122 | - $movies = $um->getMovies($page->users->currentUserId()); |
|
123 | - |
|
124 | - $releases = new Releases(['Settings' => $page->settings]); |
|
125 | - $browsecount = $releases->getMovieCount($movies, -1, $page->userdata["categoryexclusions"]); |
|
126 | - |
|
127 | - $offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0; |
|
128 | - $ordering = $releases->getBrowseOrdering(); |
|
129 | - $orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; |
|
130 | - |
|
131 | - $results = []; |
|
132 | - $results = $mv->getMovieRange($movies, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); |
|
133 | - |
|
134 | - $page->smarty->assign('pagertotalitems', $browsecount); |
|
135 | - $page->smarty->assign('pageroffset', $offset); |
|
136 | - $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); |
|
137 | - $page->smarty->assign('pagerquerybase', WWW_TOP . "/mymovies/browse?ob=" . $orderby . "&offset="); |
|
138 | - $page->smarty->assign('pagerquerysuffix', "#results"); |
|
139 | - $page->smarty->assign('covgroup', ''); |
|
140 | - |
|
141 | - $pager = $page->smarty->fetch("pager.tpl"); |
|
142 | - $page->smarty->assign('pager', $pager); |
|
143 | - |
|
144 | - foreach ($ordering as $ordertype) { |
|
145 | - $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/mymovies/browse?ob=" . $ordertype . "&offset=0"); |
|
146 | - } |
|
147 | - |
|
148 | - $page->smarty->assign('lastvisit', $page->userdata['lastlogin']); |
|
149 | - |
|
150 | - $page->smarty->assign('results', $results); |
|
151 | - |
|
152 | - $page->smarty->assign('movies', true); |
|
153 | - |
|
154 | - $page->content = $page->smarty->fetch('browse.tpl'); |
|
155 | - $page->render(); |
|
156 | - break; |
|
157 | - default: |
|
158 | - |
|
159 | - $page->title = "My Movies"; |
|
160 | - $page->meta_title = "My Movies"; |
|
161 | - $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
162 | - $page->meta_description = "Manage Your Movies"; |
|
163 | - |
|
164 | - $cat = new Category(['Settings' => $page->settings]); |
|
165 | - $tmpcats = $cat->getChildren(Category::MOVIE_ROOT); |
|
166 | - $categories = []; |
|
167 | - foreach ($tmpcats as $c) { |
|
168 | - $categories[$c['id']] = $c['title']; |
|
169 | - } |
|
170 | - |
|
171 | - $movies = $um->getMovies($page->users->currentUserId()); |
|
172 | - $results = []; |
|
173 | - foreach ($movies as $moviek => $movie) { |
|
174 | - $showcats = explode('|', $movie['categories']); |
|
175 | - if (is_array($showcats) && sizeof($showcats) > 0) { |
|
176 | - $catarr = []; |
|
177 | - foreach ($showcats as $scat) { |
|
178 | - if (!empty($scat)) { |
|
179 | - $catarr[] = $categories[$scat]; |
|
171 | + $movies = $um->getMovies($page->users->currentUserId()); |
|
172 | + $results = []; |
|
173 | + foreach ($movies as $moviek => $movie) { |
|
174 | + $showcats = explode('|', $movie['categories']); |
|
175 | + if (is_array($showcats) && sizeof($showcats) > 0) { |
|
176 | + $catarr = []; |
|
177 | + foreach ($showcats as $scat) { |
|
178 | + if (!empty($scat)) { |
|
179 | + $catarr[] = $categories[$scat]; |
|
180 | + } |
|
180 | 181 | } |
182 | + $movie['categoryNames'] = implode(', ', $catarr); |
|
183 | + } else { |
|
184 | + $movie['categoryNames'] = ''; |
|
181 | 185 | } |
182 | - $movie['categoryNames'] = implode(', ', $catarr); |
|
183 | - } else { |
|
184 | - $movie['categoryNames'] = ''; |
|
185 | - } |
|
186 | 186 | |
187 | - $results[$moviek] = $movie; |
|
188 | - } |
|
189 | - $page->smarty->assign('movies', $results); |
|
187 | + $results[$moviek] = $movie; |
|
188 | + } |
|
189 | + $page->smarty->assign('movies', $results); |
|
190 | 190 | |
191 | - $page->content = $page->smarty->fetch('mymovies.tpl'); |
|
192 | - $page->render(); |
|
193 | - break; |
|
191 | + $page->content = $page->smarty->fetch('mymovies.tpl'); |
|
192 | + $page->render(); |
|
193 | + break; |
|
194 | 194 | } |
@@ -22,173 +22,173 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | switch ($action) { |
25 | - case 'delete': |
|
26 | - $show = $us->getShow($page->users->currentUserId(), $videoId); |
|
27 | - if (isset($_REQUEST['from'])) { |
|
28 | - header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
29 | - } else { |
|
30 | - header("Location:" . WWW_TOP . "/myshows"); |
|
31 | - } |
|
32 | - if (!$show) { |
|
33 | - $page->show404('Not subscribed'); |
|
34 | - } else { |
|
35 | - $us->delShow($page->users->currentUserId(), $videoId); |
|
36 | - } |
|
37 | - |
|
38 | - break; |
|
39 | - case 'add': |
|
40 | - case 'doadd': |
|
41 | - $show = $us->getShow($page->users->currentUserId(), $videoId); |
|
42 | - if ($show) { |
|
43 | - $page->show404('Already subscribed'); |
|
44 | - } else { |
|
45 | - $show = $tv->getByVideoID($videoId); |
|
46 | - if (!$show) { |
|
47 | - $page->show404('No matching show.'); |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - if ($action == 'doadd') { |
|
52 | - $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
53 | - $us->addShow($page->users->currentUserId(), $videoId, $category); |
|
25 | + case 'delete': |
|
26 | + $show = $us->getShow($page->users->currentUserId(), $videoId); |
|
54 | 27 | if (isset($_REQUEST['from'])) { |
55 | 28 | header("Location:" . WWW_TOP . $_REQUEST['from']); |
56 | 29 | } else { |
57 | 30 | header("Location:" . WWW_TOP . "/myshows"); |
58 | 31 | } |
59 | - } else { |
|
60 | - $cat = new Category(['Settings' => $page->settings]); |
|
61 | - $tmpcats = $cat->getChildren(Category::TV_ROOT); |
|
62 | - $categories = []; |
|
63 | - foreach ($tmpcats as $c) { |
|
64 | - // If TV WEB-DL categorization is disabled, don't include it as an option |
|
65 | - if ($page->settings->getSetting('catwebdl') == 0 && $c['id'] == Category::TV_WEBDL) { |
|
66 | - continue; |
|
32 | + if (!$show) { |
|
33 | + $page->show404('Not subscribed'); |
|
34 | + } else { |
|
35 | + $us->delShow($page->users->currentUserId(), $videoId); |
|
36 | + } |
|
37 | + |
|
38 | + break; |
|
39 | + case 'add': |
|
40 | + case 'doadd': |
|
41 | + $show = $us->getShow($page->users->currentUserId(), $videoId); |
|
42 | + if ($show) { |
|
43 | + $page->show404('Already subscribed'); |
|
44 | + } else { |
|
45 | + $show = $tv->getByVideoID($videoId); |
|
46 | + if (!$show) { |
|
47 | + $page->show404('No matching show.'); |
|
67 | 48 | } |
68 | - $categories[$c['id']] = $c['title']; |
|
69 | 49 | } |
70 | - $page->smarty->assign('type', 'add'); |
|
71 | - $page->smarty->assign('cat_ids', array_keys($categories)); |
|
72 | - $page->smarty->assign('cat_names', $categories); |
|
73 | - $page->smarty->assign('cat_selected', array()); |
|
74 | - $page->smarty->assign('video', $videoId); |
|
75 | - $page->smarty->assign('show', $show); |
|
76 | - $page->content = $page->smarty->fetch('myshows-add.tpl'); |
|
77 | - $page->render(); |
|
78 | - } |
|
79 | - break; |
|
80 | - case 'edit': |
|
81 | - case 'doedit': |
|
82 | - $show = $us->getShow($page->users->currentUserId(), $videoId); |
|
83 | - |
|
84 | - if (!$show) { |
|
85 | - $page->show404(); |
|
86 | - } |
|
87 | - |
|
88 | - if ($action == 'doedit') { |
|
89 | - $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
90 | - $us->updateShow($page->users->currentUserId(), $videoId, $category); |
|
91 | - if (isset($_REQUEST['from'])) { |
|
92 | - header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
50 | + |
|
51 | + if ($action == 'doadd') { |
|
52 | + $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
53 | + $us->addShow($page->users->currentUserId(), $videoId, $category); |
|
54 | + if (isset($_REQUEST['from'])) { |
|
55 | + header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
56 | + } else { |
|
57 | + header("Location:" . WWW_TOP . "/myshows"); |
|
58 | + } |
|
93 | 59 | } else { |
94 | - header("Location:" . WWW_TOP . "/myshows"); |
|
60 | + $cat = new Category(['Settings' => $page->settings]); |
|
61 | + $tmpcats = $cat->getChildren(Category::TV_ROOT); |
|
62 | + $categories = []; |
|
63 | + foreach ($tmpcats as $c) { |
|
64 | + // If TV WEB-DL categorization is disabled, don't include it as an option |
|
65 | + if ($page->settings->getSetting('catwebdl') == 0 && $c['id'] == Category::TV_WEBDL) { |
|
66 | + continue; |
|
67 | + } |
|
68 | + $categories[$c['id']] = $c['title']; |
|
69 | + } |
|
70 | + $page->smarty->assign('type', 'add'); |
|
71 | + $page->smarty->assign('cat_ids', array_keys($categories)); |
|
72 | + $page->smarty->assign('cat_names', $categories); |
|
73 | + $page->smarty->assign('cat_selected', array()); |
|
74 | + $page->smarty->assign('video', $videoId); |
|
75 | + $page->smarty->assign('show', $show); |
|
76 | + $page->content = $page->smarty->fetch('myshows-add.tpl'); |
|
77 | + $page->render(); |
|
78 | + } |
|
79 | + break; |
|
80 | + case 'edit': |
|
81 | + case 'doedit': |
|
82 | + $show = $us->getShow($page->users->currentUserId(), $videoId); |
|
83 | + |
|
84 | + if (!$show) { |
|
85 | + $page->show404(); |
|
95 | 86 | } |
96 | - } else { |
|
97 | - $cat = new Category(['Settings' => $page->settings]); |
|
98 | 87 | |
88 | + if ($action == 'doedit') { |
|
89 | + $category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] : []; |
|
90 | + $us->updateShow($page->users->currentUserId(), $videoId, $category); |
|
91 | + if (isset($_REQUEST['from'])) { |
|
92 | + header("Location:" . WWW_TOP . $_REQUEST['from']); |
|
93 | + } else { |
|
94 | + header("Location:" . WWW_TOP . "/myshows"); |
|
95 | + } |
|
96 | + } else { |
|
97 | + $cat = new Category(['Settings' => $page->settings]); |
|
98 | + |
|
99 | + $tmpcats = $cat->getChildren(Category::TV_ROOT); |
|
100 | + $categories = []; |
|
101 | + foreach ($tmpcats as $c) { |
|
102 | + $categories[$c['id']] = $c['title']; |
|
103 | + } |
|
104 | + |
|
105 | + $page->smarty->assign('type', 'edit'); |
|
106 | + $page->smarty->assign('cat_ids', array_keys($categories)); |
|
107 | + $page->smarty->assign('cat_names', $categories); |
|
108 | + $page->smarty->assign('cat_selected', explode('|', $show['categories'])); |
|
109 | + $page->smarty->assign('video', $videoId); |
|
110 | + $page->smarty->assign('show', $show); |
|
111 | + $page->content = $page->smarty->fetch('myshows-add.tpl'); |
|
112 | + $page->render(); |
|
113 | + } |
|
114 | + break; |
|
115 | + case 'browse': |
|
116 | + |
|
117 | + $page->title = "Browse My Shows"; |
|
118 | + $page->meta_title = "My Shows"; |
|
119 | + $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
120 | + $page->meta_description = "Browse Your Shows"; |
|
121 | + |
|
122 | + $shows = $us->getShows($page->users->currentUserId()); |
|
123 | + |
|
124 | + $releases = new Releases(['Settings' => $page->settings]); |
|
125 | + $browsecount = $releases->getShowsCount($shows, -1, $page->userdata["categoryexclusions"]); |
|
126 | + |
|
127 | + $offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0; |
|
128 | + $ordering = $releases->getBrowseOrdering(); |
|
129 | + $orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; |
|
130 | + |
|
131 | + $results = []; |
|
132 | + $results = $releases->getShowsRange($shows, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); |
|
133 | + |
|
134 | + $page->smarty->assign('pagertotalitems', $browsecount); |
|
135 | + $page->smarty->assign('pageroffset', $offset); |
|
136 | + $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); |
|
137 | + $page->smarty->assign('pagerquerybase', WWW_TOP . "/myshows/browse?ob=" . $orderby . "&offset="); |
|
138 | + $page->smarty->assign('pagerquerysuffix', "#results"); |
|
139 | + $page->smarty->assign('covgroup', ''); |
|
140 | + |
|
141 | + $pager = $page->smarty->fetch("pager.tpl"); |
|
142 | + $page->smarty->assign('pager', $pager); |
|
143 | + |
|
144 | + foreach ($ordering as $ordertype) { |
|
145 | + $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/myshows/browse?ob=" . $ordertype . "&offset=0"); |
|
146 | + } |
|
147 | + |
|
148 | + $page->smarty->assign('lastvisit', $page->userdata['lastlogin']); |
|
149 | + |
|
150 | + $page->smarty->assign('results', $results); |
|
151 | + |
|
152 | + $page->smarty->assign('shows', true); |
|
153 | + |
|
154 | + $page->content = $page->smarty->fetch('browse.tpl'); |
|
155 | + $page->render(); |
|
156 | + break; |
|
157 | + default: |
|
158 | + |
|
159 | + $page->title = "My Shows"; |
|
160 | + $page->meta_title = "My Shows"; |
|
161 | + $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
162 | + $page->meta_description = "Manage Your Shows"; |
|
163 | + |
|
164 | + $cat = new Category(['Settings' => $page->settings]); |
|
99 | 165 | $tmpcats = $cat->getChildren(Category::TV_ROOT); |
100 | 166 | $categories = []; |
101 | 167 | foreach ($tmpcats as $c) { |
102 | 168 | $categories[$c['id']] = $c['title']; |
103 | 169 | } |
104 | 170 | |
105 | - $page->smarty->assign('type', 'edit'); |
|
106 | - $page->smarty->assign('cat_ids', array_keys($categories)); |
|
107 | - $page->smarty->assign('cat_names', $categories); |
|
108 | - $page->smarty->assign('cat_selected', explode('|', $show['categories'])); |
|
109 | - $page->smarty->assign('video', $videoId); |
|
110 | - $page->smarty->assign('show', $show); |
|
111 | - $page->content = $page->smarty->fetch('myshows-add.tpl'); |
|
112 | - $page->render(); |
|
113 | - } |
|
114 | - break; |
|
115 | - case 'browse': |
|
116 | - |
|
117 | - $page->title = "Browse My Shows"; |
|
118 | - $page->meta_title = "My Shows"; |
|
119 | - $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
120 | - $page->meta_description = "Browse Your Shows"; |
|
121 | - |
|
122 | - $shows = $us->getShows($page->users->currentUserId()); |
|
123 | - |
|
124 | - $releases = new Releases(['Settings' => $page->settings]); |
|
125 | - $browsecount = $releases->getShowsCount($shows, -1, $page->userdata["categoryexclusions"]); |
|
126 | - |
|
127 | - $offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0; |
|
128 | - $ordering = $releases->getBrowseOrdering(); |
|
129 | - $orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; |
|
130 | - |
|
131 | - $results = []; |
|
132 | - $results = $releases->getShowsRange($shows, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); |
|
133 | - |
|
134 | - $page->smarty->assign('pagertotalitems', $browsecount); |
|
135 | - $page->smarty->assign('pageroffset', $offset); |
|
136 | - $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); |
|
137 | - $page->smarty->assign('pagerquerybase', WWW_TOP . "/myshows/browse?ob=" . $orderby . "&offset="); |
|
138 | - $page->smarty->assign('pagerquerysuffix', "#results"); |
|
139 | - $page->smarty->assign('covgroup', ''); |
|
140 | - |
|
141 | - $pager = $page->smarty->fetch("pager.tpl"); |
|
142 | - $page->smarty->assign('pager', $pager); |
|
143 | - |
|
144 | - foreach ($ordering as $ordertype) { |
|
145 | - $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/myshows/browse?ob=" . $ordertype . "&offset=0"); |
|
146 | - } |
|
147 | - |
|
148 | - $page->smarty->assign('lastvisit', $page->userdata['lastlogin']); |
|
149 | - |
|
150 | - $page->smarty->assign('results', $results); |
|
151 | - |
|
152 | - $page->smarty->assign('shows', true); |
|
153 | - |
|
154 | - $page->content = $page->smarty->fetch('browse.tpl'); |
|
155 | - $page->render(); |
|
156 | - break; |
|
157 | - default: |
|
158 | - |
|
159 | - $page->title = "My Shows"; |
|
160 | - $page->meta_title = "My Shows"; |
|
161 | - $page->meta_keywords = "search,add,to,cart,nzb,description,details"; |
|
162 | - $page->meta_description = "Manage Your Shows"; |
|
163 | - |
|
164 | - $cat = new Category(['Settings' => $page->settings]); |
|
165 | - $tmpcats = $cat->getChildren(Category::TV_ROOT); |
|
166 | - $categories = []; |
|
167 | - foreach ($tmpcats as $c) { |
|
168 | - $categories[$c['id']] = $c['title']; |
|
169 | - } |
|
170 | - |
|
171 | - $shows = $us->getShows($page->users->currentUserId()); |
|
172 | - $results = []; |
|
173 | - foreach ($shows as $showk => $show) { |
|
174 | - $showcats = explode('|', $show['categories']); |
|
175 | - if (is_array($showcats) && sizeof($showcats) > 0) { |
|
176 | - $catarr = []; |
|
177 | - foreach ($showcats as $scat) { |
|
178 | - if (!empty($scat)) { |
|
179 | - $catarr[] = $categories[$scat]; |
|
171 | + $shows = $us->getShows($page->users->currentUserId()); |
|
172 | + $results = []; |
|
173 | + foreach ($shows as $showk => $show) { |
|
174 | + $showcats = explode('|', $show['categories']); |
|
175 | + if (is_array($showcats) && sizeof($showcats) > 0) { |
|
176 | + $catarr = []; |
|
177 | + foreach ($showcats as $scat) { |
|
178 | + if (!empty($scat)) { |
|
179 | + $catarr[] = $categories[$scat]; |
|
180 | + } |
|
180 | 181 | } |
182 | + $show['categoryNames'] = implode(', ', $catarr); |
|
183 | + } else { |
|
184 | + $show['categoryNames'] = ''; |
|
181 | 185 | } |
182 | - $show['categoryNames'] = implode(', ', $catarr); |
|
183 | - } else { |
|
184 | - $show['categoryNames'] = ''; |
|
185 | - } |
|
186 | 186 | |
187 | - $results[$showk] = $show; |
|
188 | - } |
|
189 | - $page->smarty->assign('shows', $results); |
|
187 | + $results[$showk] = $show; |
|
188 | + } |
|
189 | + $page->smarty->assign('shows', $results); |
|
190 | 190 | |
191 | - $page->content = $page->smarty->fetch('myshows.tpl'); |
|
192 | - $page->render(); |
|
193 | - break; |
|
191 | + $page->content = $page->smarty->fetch('myshows.tpl'); |
|
192 | + $page->render(); |
|
193 | + break; |
|
194 | 194 | } |
@@ -32,43 +32,43 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | switch ($action) { |
35 | - case 'add': |
|
36 | - $user += [ |
|
37 | - 'role' => $defaultRole, |
|
38 | - 'notes' => '', |
|
39 | - 'invites' => $defaultInvites, |
|
40 | - 'movieview' => '1', |
|
41 | - 'xxxview' => '1', |
|
42 | - 'musicview' => '1', |
|
43 | - 'consoleview' => '1', |
|
44 | - 'gameview' => '1', |
|
45 | - 'bookview' => '1' |
|
46 | - ]; |
|
47 | - $page->smarty->assign('user', $user); |
|
48 | - break; |
|
49 | - case 'submit': |
|
50 | - |
|
51 | - if ($_POST["id"] == "") { |
|
52 | - $invites = $defaultinvites; |
|
53 | - foreach ($userroles as $role) { |
|
54 | - if ($role['id'] == $_POST['role']) |
|
55 | - $invites = $role['defaultinvites']; |
|
56 | - } |
|
57 | - $ret = $users->signup($_POST["username"], $_POST["password"], $_POST["email"], '', $_POST["role"], $_POST["notes"], $invites, "", true); |
|
58 | - } else { |
|
59 | - $ret = $users->update($_POST["id"], $_POST["username"], $_POST["email"], $_POST["grabs"], $_POST["role"], $_POST["notes"], $_POST["invites"], (isset($_POST['movieview']) ? "1" : "0"), (isset($_POST['musicview']) ? "1" : "0"), (isset($_POST['gameview']) ? "1" : "0"), (isset($_POST['xxxview']) ? "1" : "0"), (isset($_POST['consoleview']) ? "1" : "0"), (isset($_POST['bookview']) ? "1" : "0")); |
|
60 | - if ($_POST['password'] != "") { |
|
61 | - $users->updatePassword($_POST["id"], $_POST['password']); |
|
62 | - } |
|
63 | - if ($_POST['rolechangedate'] != "") { |
|
64 | - $users->updateUserRoleChangeDate($_POST["id"], $_POST["rolechangedate"]); |
|
35 | + case 'add': |
|
36 | + $user += [ |
|
37 | + 'role' => $defaultRole, |
|
38 | + 'notes' => '', |
|
39 | + 'invites' => $defaultInvites, |
|
40 | + 'movieview' => '1', |
|
41 | + 'xxxview' => '1', |
|
42 | + 'musicview' => '1', |
|
43 | + 'consoleview' => '1', |
|
44 | + 'gameview' => '1', |
|
45 | + 'bookview' => '1' |
|
46 | + ]; |
|
47 | + $page->smarty->assign('user', $user); |
|
48 | + break; |
|
49 | + case 'submit': |
|
50 | + |
|
51 | + if ($_POST["id"] == "") { |
|
52 | + $invites = $defaultinvites; |
|
53 | + foreach ($userroles as $role) { |
|
54 | + if ($role['id'] == $_POST['role']) |
|
55 | + $invites = $role['defaultinvites']; |
|
56 | + } |
|
57 | + $ret = $users->signup($_POST["username"], $_POST["password"], $_POST["email"], '', $_POST["role"], $_POST["notes"], $invites, "", true); |
|
58 | + } else { |
|
59 | + $ret = $users->update($_POST["id"], $_POST["username"], $_POST["email"], $_POST["grabs"], $_POST["role"], $_POST["notes"], $_POST["invites"], (isset($_POST['movieview']) ? "1" : "0"), (isset($_POST['musicview']) ? "1" : "0"), (isset($_POST['gameview']) ? "1" : "0"), (isset($_POST['xxxview']) ? "1" : "0"), (isset($_POST['consoleview']) ? "1" : "0"), (isset($_POST['bookview']) ? "1" : "0")); |
|
60 | + if ($_POST['password'] != "") { |
|
61 | + $users->updatePassword($_POST["id"], $_POST['password']); |
|
62 | + } |
|
63 | + if ($_POST['rolechangedate'] != "") { |
|
64 | + $users->updateUserRoleChangeDate($_POST["id"], $_POST["rolechangedate"]); |
|
65 | + } |
|
65 | 66 | } |
66 | - } |
|
67 | 67 | |
68 | - if ($ret >= 0) { |
|
69 | - header("Location:" . WWW_TOP . "/user-list.php"); |
|
70 | - } else { |
|
71 | - switch ($ret) { |
|
68 | + if ($ret >= 0) { |
|
69 | + header("Location:" . WWW_TOP . "/user-list.php"); |
|
70 | + } else { |
|
71 | + switch ($ret) { |
|
72 | 72 | case Users::ERR_SIGNUP_BADUNAME: |
73 | 73 | $page->smarty->assign('error', "Bad username. Try a better one."); |
74 | 74 | break; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | default: |
88 | 88 | $page->smarty->assign('error', "Unknown save error."); |
89 | 89 | break; |
90 | - } |
|
90 | + } |
|
91 | 91 | $user = [ |
92 | 92 | 'id' => $_POST["id"], |
93 | 93 | 'username' => $_POST["username"], |
@@ -102,18 +102,18 @@ discard block |
||
102 | 102 | $page->smarty->assign('user', $user); |
103 | 103 | } |
104 | 104 | break; |
105 | - case 'view': |
|
106 | - default: |
|
105 | + case 'view': |
|
106 | + default: |
|
107 | 107 | |
108 | - if (isset($_GET["id"])) { |
|
109 | - $page->title = "User Edit"; |
|
110 | - $id = $_GET["id"]; |
|
111 | - $user = $users->getById($id); |
|
108 | + if (isset($_GET["id"])) { |
|
109 | + $page->title = "User Edit"; |
|
110 | + $id = $_GET["id"]; |
|
111 | + $user = $users->getById($id); |
|
112 | 112 | |
113 | - $page->smarty->assign('user', $user); |
|
114 | - } |
|
113 | + $page->smarty->assign('user', $user); |
|
114 | + } |
|
115 | 115 | |
116 | - break; |
|
116 | + break; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | $page->smarty->assign('yesno_ids', array(1, 0)); |
@@ -13,15 +13,15 @@ |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | switch($_GET['action']) { |
16 | - case 1: |
|
17 | - $id = (int) $_GET['col_id']; |
|
18 | - (new Regexes(['Settings' => $admin->settings]))->deleteRegex($id); |
|
19 | - print "Regex $id deleted."; |
|
20 | - break; |
|
16 | + case 1: |
|
17 | + $id = (int) $_GET['col_id']; |
|
18 | + (new Regexes(['Settings' => $admin->settings]))->deleteRegex($id); |
|
19 | + print "Regex $id deleted."; |
|
20 | + break; |
|
21 | 21 | |
22 | - case 2: |
|
23 | - $id = (int) $_GET['bin_id']; |
|
24 | - (new Binaries(['Settings' => $admin->settings]))->deleteBlacklist($id); |
|
25 | - print "Blacklist $id deleted."; |
|
26 | - break; |
|
22 | + case 2: |
|
23 | + $id = (int) $_GET['bin_id']; |
|
24 | + (new Binaries(['Settings' => $admin->settings]))->deleteBlacklist($id); |
|
25 | + print "Blacklist $id deleted."; |
|
26 | + break; |
|
27 | 27 | } |
@@ -11,42 +11,42 @@ |
||
11 | 11 | } |
12 | 12 | |
13 | 13 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
14 | - case 'add': |
|
15 | - $page->title = "User Roles Add"; |
|
16 | - $role = [ |
|
17 | - 'id' => '', |
|
18 | - 'name' => '', |
|
19 | - 'apirequests' => '', |
|
20 | - 'downloadrequests' => '', |
|
21 | - 'defaultinvites' => '', |
|
22 | - 'canpreview' => 0, |
|
23 | - 'hideads' => 0 |
|
24 | - ]; |
|
25 | - $page->smarty->assign('role', $role); |
|
26 | - break; |
|
14 | + case 'add': |
|
15 | + $page->title = "User Roles Add"; |
|
16 | + $role = [ |
|
17 | + 'id' => '', |
|
18 | + 'name' => '', |
|
19 | + 'apirequests' => '', |
|
20 | + 'downloadrequests' => '', |
|
21 | + 'defaultinvites' => '', |
|
22 | + 'canpreview' => 0, |
|
23 | + 'hideads' => 0 |
|
24 | + ]; |
|
25 | + $page->smarty->assign('role', $role); |
|
26 | + break; |
|
27 | 27 | |
28 | - case 'submit': |
|
29 | - if ($_POST["id"] == "") { |
|
30 | - $ret = $page->users->addRole($_POST['name'], $_POST['apirequests'], $_POST['downloadrequests'], |
|
31 | - $_POST['defaultinvites'], $_POST['canpreview'], $_POST['hideads'] |
|
32 | - ); |
|
33 | - header("Location:" . WWW_TOP . "/role-list.php"); |
|
34 | - } else { |
|
35 | - $ret = $page->users->updateRole($_POST['id'], $_POST['name'], $_POST['apirequests'], |
|
36 | - $_POST['downloadrequests'], $_POST['defaultinvites'], $_POST['isdefault'], $_POST['canpreview'], $_POST['hideads'] |
|
37 | - ); |
|
38 | - header("Location:" . WWW_TOP . "/role-list.php"); |
|
39 | - } |
|
40 | - break; |
|
28 | + case 'submit': |
|
29 | + if ($_POST["id"] == "") { |
|
30 | + $ret = $page->users->addRole($_POST['name'], $_POST['apirequests'], $_POST['downloadrequests'], |
|
31 | + $_POST['defaultinvites'], $_POST['canpreview'], $_POST['hideads'] |
|
32 | + ); |
|
33 | + header("Location:" . WWW_TOP . "/role-list.php"); |
|
34 | + } else { |
|
35 | + $ret = $page->users->updateRole($_POST['id'], $_POST['name'], $_POST['apirequests'], |
|
36 | + $_POST['downloadrequests'], $_POST['defaultinvites'], $_POST['isdefault'], $_POST['canpreview'], $_POST['hideads'] |
|
37 | + ); |
|
38 | + header("Location:" . WWW_TOP . "/role-list.php"); |
|
39 | + } |
|
40 | + break; |
|
41 | 41 | |
42 | - case 'view': |
|
43 | - default: |
|
44 | - if (isset($_GET["id"])) { |
|
45 | - $page->title = "User Roles Edit"; |
|
46 | - $role = $page->users->getRoleById($_GET["id"]); |
|
47 | - $page->smarty->assign('role', $role); |
|
48 | - } |
|
49 | - break; |
|
42 | + case 'view': |
|
43 | + default: |
|
44 | + if (isset($_GET["id"])) { |
|
45 | + $page->title = "User Roles Edit"; |
|
46 | + $role = $page->users->getRoleById($_GET["id"]); |
|
47 | + $page->smarty->assign('role', $role); |
|
48 | + } |
|
49 | + break; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $page->smarty->assign('yesno_ids', [1, 0]); |
@@ -8,16 +8,16 @@ |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | switch (true) { |
11 | - case is_file(IRC_SCRAPER_CONFIG): |
|
12 | - break; |
|
13 | - case is_file(NN_ROOT . 'misc/testing/IRCScraper/settings.php'): |
|
14 | - rename(NN_ROOT . 'misc/testing/IRCScraper/settings.php', IRC_SCRAPER_CONFIG); |
|
15 | - break; |
|
16 | - default: |
|
17 | - exit( |
|
18 | - 'Copy ' . NN_CONFIGS . 'ircscraper_settings_example.php to ' . |
|
19 | - IRC_SCRAPER_CONFIG . ' and change the settings.' . PHP_EOL |
|
20 | - ); |
|
11 | + case is_file(IRC_SCRAPER_CONFIG): |
|
12 | + break; |
|
13 | + case is_file(NN_ROOT . 'misc/testing/IRCScraper/settings.php'): |
|
14 | + rename(NN_ROOT . 'misc/testing/IRCScraper/settings.php', IRC_SCRAPER_CONFIG); |
|
15 | + break; |
|
16 | + default: |
|
17 | + exit( |
|
18 | + 'Copy ' . NN_CONFIGS . 'ircscraper_settings_example.php to ' . |
|
19 | + IRC_SCRAPER_CONFIG . ' and change the settings.' . PHP_EOL |
|
20 | + ); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if (!isset($argv[1]) || $argv[1] != 'true') { |