@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $page->title = "Terms and Conditions"; |
4 | -$page->meta_title = $page->settings->getSetting('title')." - Terms and conditions"; |
|
4 | +$page->meta_title = $page->settings->getSetting('title') . " - Terms and conditions"; |
|
5 | 5 | $page->meta_keywords = "terms,conditions"; |
6 | -$page->meta_description = "Terms and Conditions for ".$page->settings->getSetting('title'); |
|
6 | +$page->meta_description = "Terms and Conditions for " . $page->settings->getSetting('title'); |
|
7 | 7 | |
8 | 8 | $page->content = $page->smarty->fetch('terms.tpl'); |
9 | 9 |
@@ -34,10 +34,10 @@ |
||
34 | 34 | */ |
35 | 35 | public function render() |
36 | 36 | { |
37 | - $this->smarty->assign('page',$this); |
|
37 | + $this->smarty->assign('page', $this); |
|
38 | 38 | |
39 | 39 | $admin_menu = $this->smarty->fetch('adminmenu.tpl'); |
40 | - $this->smarty->assign('admin_menu',$admin_menu); |
|
40 | + $this->smarty->assign('admin_menu', $admin_menu); |
|
41 | 41 | |
42 | 42 | $this->page_template = "baseadminpage.tpl"; |
43 | 43 |
@@ -24,8 +24,9 @@ |
||
24 | 24 | ] |
25 | 25 | ); |
26 | 26 | |
27 | - if (!$this->users->isLoggedIn() || !isset($this->userdata["role"]) || $this->userdata["role"] != Users::ROLE_ADMIN) |
|
28 | - $this->show403(true); |
|
27 | + if (!$this->users->isLoggedIn() || !isset($this->userdata["role"]) || $this->userdata["role"] != Users::ROLE_ADMIN) { |
|
28 | + $this->show403(true); |
|
29 | + } |
|
29 | 30 | |
30 | 31 | } |
31 | 32 |
@@ -11,15 +11,17 @@ discard block |
||
11 | 11 | $nzbGet = new NZBGet($page); |
12 | 12 | $page->users = new Users(); |
13 | 13 | |
14 | -if (!$page->users->isLoggedIn()) |
|
14 | +if (!$page->users->isLoggedIn()) { |
|
15 | 15 | $page->show403(); |
16 | +} |
|
16 | 17 | |
17 | 18 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view'; |
18 | 19 | |
19 | 20 | $userid = $page->users->currentUserId(); |
20 | 21 | $data = $page->users->getById($userid); |
21 | -if (!$data) |
|
22 | +if (!$data) { |
|
22 | 23 | $page->show404(); |
24 | +} |
|
23 | 25 | |
24 | 26 | $errorStr = ''; |
25 | 27 | |
@@ -35,8 +37,9 @@ discard block |
||
35 | 37 | case 'submit': |
36 | 38 | |
37 | 39 | $data["email"] = $_POST['email']; |
38 | - if (isset($_POST['saburl']) && strlen(trim($_POST['saburl'])) > 0 && !Utility::endsWith($_POST['saburl'], "/")) |
|
39 | - $_POST['saburl'] = $_POST['saburl'] . "/"; |
|
40 | + if (isset($_POST['saburl']) && strlen(trim($_POST['saburl'])) > 0 && !Utility::endsWith($_POST['saburl'], "/")) { |
|
41 | + $_POST['saburl'] = $_POST['saburl'] . "/"; |
|
42 | + } |
|
40 | 43 | |
41 | 44 | if ($_POST['password'] != "" && $_POST['password'] != $_POST['confirmpassword']) { |
42 | 45 | $errorStr = "Password Mismatch"; |
@@ -90,8 +93,9 @@ discard block |
||
90 | 93 | $_POST['exccat'] = (!isset($_POST['exccat']) || !is_array($_POST['exccat'])) ? [] : $_POST['exccat']; |
91 | 94 | $page->users->addCategoryExclusions($userid, $_POST['exccat']); |
92 | 95 | |
93 | - if ($_POST['password'] != "") |
|
94 | - $page->users->updatePassword($userid, $_POST['password']); |
|
96 | + if ($_POST['password'] != "") { |
|
97 | + $page->users->updatePassword($userid, $_POST['password']); |
|
98 | + } |
|
95 | 99 | |
96 | 100 | header("Location:" . WWW_TOP . "/profile"); |
97 | 101 | die(); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $queueType = $error = ''; |
17 | 17 | $queue = null; |
18 | -switch($page->settings->getSetting('sabintegrationtype')) { |
|
18 | +switch ($page->settings->getSetting('sabintegrationtype')) { |
|
19 | 19 | case SABnzbd::INTEGRATION_TYPE_NONE: |
20 | 20 | if ($userData['queuetype'] == 2) { |
21 | 21 | $queueType = 'NZBGet'; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $queue = new SABnzbd($page); |
28 | 28 | break; |
29 | 29 | case SABnzbd::INTEGRATION_TYPE_USER: |
30 | - switch((int)$userData['queuetype']) { |
|
30 | + switch ((int)$userData['queuetype']) { |
|
31 | 31 | case 1: |
32 | 32 | $queueType = 'Sabnzbd'; |
33 | 33 | $queue = new SABnzbd($page); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $page->smarty->assign(array('queueType' => $queueType, 'error' => $error, 'user', $page->users)); |
85 | 85 | $page->title = "Your $queueType Download Queue"; |
86 | 86 | $page->meta_title = "View $queueType Queue"; |
87 | -$page->meta_keywords = "view," . strtolower($queueType) .",queue"; |
|
87 | +$page->meta_keywords = "view," . strtolower($queueType) . ",queue"; |
|
88 | 88 | $page->meta_description = "View $queueType Queue"; |
89 | 89 | |
90 | 90 | $page->content = $page->smarty->fetch('viewqueue.tpl'); |
@@ -82,10 +82,10 @@ |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $page->smarty->assign(array('queueType' => $queueType, 'error' => $error, 'user', $page->users)); |
85 | -$page->title = "Your $queueType Download Queue"; |
|
86 | -$page->meta_title = "View $queueType Queue"; |
|
85 | +$page->title = "your $queueType Download Queue"; |
|
86 | +$page->meta_title = "view $queueType Queue"; |
|
87 | 87 | $page->meta_keywords = "view," . strtolower($queueType) .",queue"; |
88 | -$page->meta_description = "View $queueType Queue"; |
|
88 | +$page->meta_description = "view $queueType Queue"; |
|
89 | 89 | |
90 | 90 | $page->content = $page->smarty->fetch('viewqueue.tpl'); |
91 | 91 | $page->render(); |
@@ -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 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | $page->smarty->assign('book', $book); |
17 | 17 | |
18 | - $page->title = "Info for ".$book['title']; |
|
18 | + $page->title = "Info for " . $book['title']; |
|
19 | 19 | $page->meta_title = ""; |
20 | 20 | $page->meta_keywords = ""; |
21 | 21 | $page->meta_description = ""; |
@@ -4,14 +4,15 @@ discard block |
||
4 | 4 | |
5 | 5 | $b = new Books; |
6 | 6 | |
7 | -if (!$page->users->isLoggedIn()) |
|
7 | +if (!$page->users->isLoggedIn()) { |
|
8 | 8 | $page->show403(); |
9 | +} |
|
9 | 10 | |
10 | -if (isset($_GET["id"]) && ctype_digit($_GET["id"])) |
|
11 | -{ |
|
11 | +if (isset($_GET["id"]) && ctype_digit($_GET["id"])) { |
|
12 | 12 | $book = $b->getBookInfo($_GET['id']); |
13 | - if (!$book) |
|
14 | - $page->show404(); |
|
13 | + if (!$book) { |
|
14 | + $page->show404(); |
|
15 | + } |
|
15 | 16 | |
16 | 17 | $page->smarty->assign('book', $book); |
17 | 18 | |
@@ -22,17 +23,17 @@ discard block |
||
22 | 23 | $page->smarty->registerPlugin('modifier', 'ss', 'stripslashes'); |
23 | 24 | |
24 | 25 | $modal = false; |
25 | - if (isset($_GET['modal'])) |
|
26 | - { |
|
26 | + if (isset($_GET['modal'])) { |
|
27 | 27 | $modal = true; |
28 | 28 | $page->smarty->assign('modal', true); |
29 | 29 | } |
30 | 30 | |
31 | 31 | $page->content = $page->smarty->fetch('viewbook.tpl'); |
32 | 32 | |
33 | - if ($modal) |
|
34 | - echo $page->content; |
|
35 | - else |
|
36 | - $page->render(); |
|
37 | -} |
|
33 | + if ($modal) { |
|
34 | + echo $page->content; |
|
35 | + } else { |
|
36 | + $page->render(); |
|
37 | + } |
|
38 | + } |
|
38 | 39 |
@@ -17,25 +17,25 @@ discard block |
||
17 | 17 | |
18 | 18 | switch ($reqtype) |
19 | 19 | { |
20 | - case "queue": |
|
21 | - { |
|
22 | - $json = $sab->getQueue(); |
|
23 | - if ($json !== false) |
|
24 | - { |
|
25 | - $obj = json_decode($json); |
|
26 | - $queue = $obj->{'jobs'}; |
|
27 | - $count = 1; |
|
20 | + case "queue": |
|
21 | + { |
|
22 | + $json = $sab->getQueue(); |
|
23 | + if ($json !== false) |
|
24 | + { |
|
25 | + $obj = json_decode($json); |
|
26 | + $queue = $obj->{'jobs'}; |
|
27 | + $count = 1; |
|
28 | 28 | |
29 | - $speed = $obj->{'speed'}; |
|
30 | - $queued = round($obj->{'mbleft'}, 2)."MB / ".round($obj->{'mb'}, 2)."MB"; |
|
31 | - $status = ucwords(strtolower($obj->{'state'})); |
|
29 | + $speed = $obj->{'speed'}; |
|
30 | + $queued = round($obj->{'mbleft'}, 2)."MB / ".round($obj->{'mb'}, 2)."MB"; |
|
31 | + $status = ucwords(strtolower($obj->{'state'})); |
|
32 | 32 | |
33 | - $output .= "<p><b>Download speed:</b> ".$speed."B/s - <b>Queued:</b> ".$queued." - <b>Status:</b> ".$status."</p>"; |
|
33 | + $output .= "<p><b>Download speed:</b> ".$speed."B/s - <b>Queued:</b> ".$queued." - <b>Status:</b> ".$status."</p>"; |
|
34 | 34 | |
35 | - if (count($queue) > 0) |
|
36 | - { |
|
37 | - $output.="<table class=\"data highlight\">"; |
|
38 | - $output.="<tr> |
|
35 | + if (count($queue) > 0) |
|
36 | + { |
|
37 | + $output.="<table class=\"data highlight\">"; |
|
38 | + $output.="<tr> |
|
39 | 39 | <th></th> |
40 | 40 | <th>Name</th> |
41 | 41 | <th style='width:80px;'>size</th> |
@@ -44,53 +44,53 @@ discard block |
||
44 | 44 | <th>time left</th> |
45 | 45 | <th></th> |
46 | 46 | </tr>"; |
47 | - foreach ($queue as $item) |
|
48 | - { |
|
49 | - if (strpos($item->{'filename'}, "fetch NZB") > 0) |
|
50 | - { |
|
51 | - } |
|
52 | - else |
|
53 | - { |
|
54 | - $output.="<tr>"; |
|
55 | - $output.="<td style='text-align:right;'>".$count."</td>"; |
|
56 | - $output.="<td>".htmlspecialchars($item->{'filename'}, ENT_QUOTES)."</td>"; |
|
57 | - $output.="<td style='text-align:right;'>".round($item->{'mb'}, 2)." MB</td>"; |
|
58 | - $output.="<td class='right'>".round($item->{'mbleft'}, 2)." MB</td>"; |
|
59 | - $output.="<td class='right'>".($item->{'mb'}==0?0:round($item->{'mbleft'}/$item->{'mb'}*100))."%</td>"; |
|
60 | - $output.="<td style='text-align:right;'>".$item->{'timeleft'}."</td>"; |
|
61 | - $output.="<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?del=".$item->{'id'}."'>delete</a></td>"; |
|
62 | - $output.="</tr>"; |
|
63 | - $count++; |
|
64 | - } |
|
65 | - } |
|
66 | - $output.="</table>"; |
|
67 | - } |
|
68 | - else |
|
69 | - { |
|
70 | - $output.="<p>The queue is currently empty.</p>"; |
|
71 | - } |
|
72 | - } |
|
73 | - else |
|
74 | - { |
|
75 | - $output.="<p>Error retreiving queue.</p>"; |
|
76 | - } |
|
47 | + foreach ($queue as $item) |
|
48 | + { |
|
49 | + if (strpos($item->{'filename'}, "fetch NZB") > 0) |
|
50 | + { |
|
51 | + } |
|
52 | + else |
|
53 | + { |
|
54 | + $output.="<tr>"; |
|
55 | + $output.="<td style='text-align:right;'>".$count."</td>"; |
|
56 | + $output.="<td>".htmlspecialchars($item->{'filename'}, ENT_QUOTES)."</td>"; |
|
57 | + $output.="<td style='text-align:right;'>".round($item->{'mb'}, 2)." MB</td>"; |
|
58 | + $output.="<td class='right'>".round($item->{'mbleft'}, 2)." MB</td>"; |
|
59 | + $output.="<td class='right'>".($item->{'mb'}==0?0:round($item->{'mbleft'}/$item->{'mb'}*100))."%</td>"; |
|
60 | + $output.="<td style='text-align:right;'>".$item->{'timeleft'}."</td>"; |
|
61 | + $output.="<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?del=".$item->{'id'}."'>delete</a></td>"; |
|
62 | + $output.="</tr>"; |
|
63 | + $count++; |
|
64 | + } |
|
65 | + } |
|
66 | + $output.="</table>"; |
|
67 | + } |
|
68 | + else |
|
69 | + { |
|
70 | + $output.="<p>The queue is currently empty.</p>"; |
|
71 | + } |
|
72 | + } |
|
73 | + else |
|
74 | + { |
|
75 | + $output.="<p>Error retreiving queue.</p>"; |
|
76 | + } |
|
77 | 77 | |
78 | - break; |
|
79 | - } |
|
80 | - case "history": |
|
81 | - { |
|
82 | - $json = $sab->getHistory(); |
|
83 | - if ($json !== false) |
|
84 | - { |
|
85 | - $obj = json_decode($json); |
|
86 | - $history = $obj->history->slots; |
|
87 | - $count = 1; |
|
78 | + break; |
|
79 | + } |
|
80 | + case "history": |
|
81 | + { |
|
82 | + $json = $sab->getHistory(); |
|
83 | + if ($json !== false) |
|
84 | + { |
|
85 | + $obj = json_decode($json); |
|
86 | + $history = $obj->history->slots; |
|
87 | + $count = 1; |
|
88 | 88 | |
89 | - if (count($history) > 0) |
|
90 | - { |
|
91 | - $output.="<h2>Download History</h2>"; |
|
92 | - $output.="<table class=\"data highlight\">"; |
|
93 | - $output.="<tr> |
|
89 | + if (count($history) > 0) |
|
90 | + { |
|
91 | + $output.="<h2>Download History</h2>"; |
|
92 | + $output.="<table class=\"data highlight\">"; |
|
93 | + $output.="<tr> |
|
94 | 94 | <th style='width:20px;'></th> |
95 | 95 | <th>Name</th> |
96 | 96 | <th>Category</th> |
@@ -99,33 +99,33 @@ discard block |
||
99 | 99 | <th style='text-align:center;'>dl time</th> |
100 | 100 | <th style='text-align:center;'>date</th> |
101 | 101 | </tr>"; |
102 | - foreach ($history as $item) |
|
103 | - { |
|
104 | - $output.="<tr>"; |
|
105 | - $output.="<td class='".($item->{'fail_message'} != "" ? "sabhistoryfail" : "sabhistorysuccess")."'></td>"; |
|
106 | - $output.="<td>".htmlspecialchars($item->{'name'}, ENT_QUOTES)."</td>"; |
|
107 | - $output.="<td style='text-align:center;'>".htmlspecialchars($item->{'category'}, ENT_QUOTES)."</td>"; |
|
108 | - $output.="<td title='".htmlspecialchars($item->{'fail_message'}, ENT_QUOTES)."' style='text-align:center;'>".$item->{'status'}."</td>"; |
|
109 | - $output.="<td style='text-align:right;'>".$item->{'size'}."</td>"; |
|
110 | - $output.="<td style='text-align:right;'>".gmdate("H:i:s", $item->{'download_time'})."</td>"; |
|
111 | - $output.="<td style='text-align:right;'>".gmdate("Y-m-d H:i", $item->{'completed'})."</td>"; |
|
112 | - $output.="</tr>\n"; |
|
113 | - $count++; |
|
114 | - } |
|
115 | - $output.="</table>"; |
|
116 | - } |
|
117 | - } |
|
102 | + foreach ($history as $item) |
|
103 | + { |
|
104 | + $output.="<tr>"; |
|
105 | + $output.="<td class='".($item->{'fail_message'} != "" ? "sabhistoryfail" : "sabhistorysuccess")."'></td>"; |
|
106 | + $output.="<td>".htmlspecialchars($item->{'name'}, ENT_QUOTES)."</td>"; |
|
107 | + $output.="<td style='text-align:center;'>".htmlspecialchars($item->{'category'}, ENT_QUOTES)."</td>"; |
|
108 | + $output.="<td title='".htmlspecialchars($item->{'fail_message'}, ENT_QUOTES)."' style='text-align:center;'>".$item->{'status'}."</td>"; |
|
109 | + $output.="<td style='text-align:right;'>".$item->{'size'}."</td>"; |
|
110 | + $output.="<td style='text-align:right;'>".gmdate("H:i:s", $item->{'download_time'})."</td>"; |
|
111 | + $output.="<td style='text-align:right;'>".gmdate("Y-m-d H:i", $item->{'completed'})."</td>"; |
|
112 | + $output.="</tr>\n"; |
|
113 | + $count++; |
|
114 | + } |
|
115 | + $output.="</table>"; |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | - break; |
|
120 | - } |
|
121 | - case "nzbget": |
|
122 | - { |
|
123 | - $queue = $nzbget->getQueue(); |
|
124 | - if (is_array($queue) && count($queue) > 0) |
|
125 | - { |
|
126 | - $count = 1; |
|
127 | - $output.="<table class=\"data highlight\">"; |
|
128 | - $output.="<tr> |
|
119 | + break; |
|
120 | + } |
|
121 | + case "nzbget": |
|
122 | + { |
|
123 | + $queue = $nzbget->getQueue(); |
|
124 | + if (is_array($queue) && count($queue) > 0) |
|
125 | + { |
|
126 | + $count = 1; |
|
127 | + $output.="<table class=\"data highlight\">"; |
|
128 | + $output.="<tr> |
|
129 | 129 | <th></th> |
130 | 130 | <th>Name</th> |
131 | 131 | <th style='width:80px;'>size</th> |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | <th>left</th> |
135 | 135 | <th></th> |
136 | 136 | </tr>"; |
137 | - foreach ($queue as $item) |
|
138 | - { |
|
139 | - $output.="<tr>"; |
|
140 | - $output.="<td style='text-align:right;'>".$count."</td>"; |
|
141 | - $output.="<td>".htmlspecialchars($item['NZBNicename'], ENT_QUOTES)."</td>"; |
|
142 | - $output.="<td style='text-align:right;'>".round($item['FileSizeMB'], 2)." MB</td>"; |
|
143 | - $output.="<td class='right'>".round($item['RemainingSizeMB'], 2)." MB</td>"; |
|
144 | - $output.="<td class='right'>".($item['FileSizeMB']==0?0:round($item['RemainingSizeMB']/$item['FileSizeMB']*100))."%</td>"; |
|
145 | - $output.="<td style='text-align:right;'>".$item['RemainingFileCount']."</td>"; |
|
146 | - $output.="<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?nzbgetdel=".$item['NZBID']."'>delete</a></td>"; |
|
147 | - $output.="</tr>"; |
|
148 | - $count++; |
|
149 | - } |
|
150 | - $output.="</table>"; |
|
151 | - } |
|
152 | - else |
|
153 | - { |
|
154 | - $output.="<p>The queue is currently empty.</p>"; |
|
155 | - } |
|
137 | + foreach ($queue as $item) |
|
138 | + { |
|
139 | + $output.="<tr>"; |
|
140 | + $output.="<td style='text-align:right;'>".$count."</td>"; |
|
141 | + $output.="<td>".htmlspecialchars($item['NZBNicename'], ENT_QUOTES)."</td>"; |
|
142 | + $output.="<td style='text-align:right;'>".round($item['FileSizeMB'], 2)." MB</td>"; |
|
143 | + $output.="<td class='right'>".round($item['RemainingSizeMB'], 2)." MB</td>"; |
|
144 | + $output.="<td class='right'>".($item['FileSizeMB']==0?0:round($item['RemainingSizeMB']/$item['FileSizeMB']*100))."%</td>"; |
|
145 | + $output.="<td style='text-align:right;'>".$item['RemainingFileCount']."</td>"; |
|
146 | + $output.="<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?nzbgetdel=".$item['NZBID']."'>delete</a></td>"; |
|
147 | + $output.="</tr>"; |
|
148 | + $count++; |
|
149 | + } |
|
150 | + $output.="</table>"; |
|
151 | + } |
|
152 | + else |
|
153 | + { |
|
154 | + $output.="<p>The queue is currently empty.</p>"; |
|
155 | + } |
|
156 | 156 | |
157 | - break; |
|
158 | - } |
|
157 | + break; |
|
158 | + } |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | print $output; |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | $count = 1; |
28 | 28 | |
29 | 29 | $speed = $obj->{'speed'}; |
30 | - $queued = round($obj->{'mbleft'}, 2)."MB / ".round($obj->{'mb'}, 2)."MB"; |
|
30 | + $queued = round($obj->{'mbleft'}, 2) . "MB / " . round($obj->{'mb'}, 2) . "MB"; |
|
31 | 31 | $status = ucwords(strtolower($obj->{'state'})); |
32 | 32 | |
33 | - $output .= "<p><b>Download speed:</b> ".$speed."B/s - <b>Queued:</b> ".$queued." - <b>Status:</b> ".$status."</p>"; |
|
33 | + $output .= "<p><b>Download speed:</b> " . $speed . "B/s - <b>Queued:</b> " . $queued . " - <b>Status:</b> " . $status . "</p>"; |
|
34 | 34 | |
35 | 35 | if (count($queue) > 0) |
36 | 36 | { |
37 | - $output.="<table class=\"data highlight\">"; |
|
38 | - $output.="<tr> |
|
37 | + $output .= "<table class=\"data highlight\">"; |
|
38 | + $output .= "<tr> |
|
39 | 39 | <th></th> |
40 | 40 | <th>Name</th> |
41 | 41 | <th style='width:80px;'>size</th> |
@@ -51,28 +51,28 @@ discard block |
||
51 | 51 | } |
52 | 52 | else |
53 | 53 | { |
54 | - $output.="<tr>"; |
|
55 | - $output.="<td style='text-align:right;'>".$count."</td>"; |
|
56 | - $output.="<td>".htmlspecialchars($item->{'filename'}, ENT_QUOTES)."</td>"; |
|
57 | - $output.="<td style='text-align:right;'>".round($item->{'mb'}, 2)." MB</td>"; |
|
58 | - $output.="<td class='right'>".round($item->{'mbleft'}, 2)." MB</td>"; |
|
59 | - $output.="<td class='right'>".($item->{'mb'}==0?0:round($item->{'mbleft'}/$item->{'mb'}*100))."%</td>"; |
|
60 | - $output.="<td style='text-align:right;'>".$item->{'timeleft'}."</td>"; |
|
61 | - $output.="<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?del=".$item->{'id'}."'>delete</a></td>"; |
|
62 | - $output.="</tr>"; |
|
54 | + $output .= "<tr>"; |
|
55 | + $output .= "<td style='text-align:right;'>" . $count . "</td>"; |
|
56 | + $output .= "<td>" . htmlspecialchars($item->{'filename'}, ENT_QUOTES) . "</td>"; |
|
57 | + $output .= "<td style='text-align:right;'>" . round($item->{'mb'}, 2) . " MB</td>"; |
|
58 | + $output .= "<td class='right'>" . round($item->{'mbleft'}, 2) . " MB</td>"; |
|
59 | + $output .= "<td class='right'>" . ($item->{'mb'} == 0 ? 0 : round($item->{'mbleft'} / $item->{'mb'} * 100)) . "%</td>"; |
|
60 | + $output .= "<td style='text-align:right;'>" . $item->{'timeleft'} . "</td>"; |
|
61 | + $output .= "<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?del=" . $item->{'id'} . "'>delete</a></td>"; |
|
62 | + $output .= "</tr>"; |
|
63 | 63 | $count++; |
64 | 64 | } |
65 | 65 | } |
66 | - $output.="</table>"; |
|
66 | + $output .= "</table>"; |
|
67 | 67 | } |
68 | 68 | else |
69 | 69 | { |
70 | - $output.="<p>The queue is currently empty.</p>"; |
|
70 | + $output .= "<p>The queue is currently empty.</p>"; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | else |
74 | 74 | { |
75 | - $output.="<p>Error retreiving queue.</p>"; |
|
75 | + $output .= "<p>Error retreiving queue.</p>"; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | break; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | |
89 | 89 | if (count($history) > 0) |
90 | 90 | { |
91 | - $output.="<h2>Download History</h2>"; |
|
92 | - $output.="<table class=\"data highlight\">"; |
|
93 | - $output.="<tr> |
|
91 | + $output .= "<h2>Download History</h2>"; |
|
92 | + $output .= "<table class=\"data highlight\">"; |
|
93 | + $output .= "<tr> |
|
94 | 94 | <th style='width:20px;'></th> |
95 | 95 | <th>Name</th> |
96 | 96 | <th>Category</th> |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | </tr>"; |
102 | 102 | foreach ($history as $item) |
103 | 103 | { |
104 | - $output.="<tr>"; |
|
105 | - $output.="<td class='".($item->{'fail_message'} != "" ? "sabhistoryfail" : "sabhistorysuccess")."'></td>"; |
|
106 | - $output.="<td>".htmlspecialchars($item->{'name'}, ENT_QUOTES)."</td>"; |
|
107 | - $output.="<td style='text-align:center;'>".htmlspecialchars($item->{'category'}, ENT_QUOTES)."</td>"; |
|
108 | - $output.="<td title='".htmlspecialchars($item->{'fail_message'}, ENT_QUOTES)."' style='text-align:center;'>".$item->{'status'}."</td>"; |
|
109 | - $output.="<td style='text-align:right;'>".$item->{'size'}."</td>"; |
|
110 | - $output.="<td style='text-align:right;'>".gmdate("H:i:s", $item->{'download_time'})."</td>"; |
|
111 | - $output.="<td style='text-align:right;'>".gmdate("Y-m-d H:i", $item->{'completed'})."</td>"; |
|
112 | - $output.="</tr>\n"; |
|
104 | + $output .= "<tr>"; |
|
105 | + $output .= "<td class='" . ($item->{'fail_message'} != "" ? "sabhistoryfail" : "sabhistorysuccess") . "'></td>"; |
|
106 | + $output .= "<td>" . htmlspecialchars($item->{'name'}, ENT_QUOTES) . "</td>"; |
|
107 | + $output .= "<td style='text-align:center;'>" . htmlspecialchars($item->{'category'}, ENT_QUOTES) . "</td>"; |
|
108 | + $output .= "<td title='" . htmlspecialchars($item->{'fail_message'}, ENT_QUOTES) . "' style='text-align:center;'>" . $item->{'status'} . "</td>"; |
|
109 | + $output .= "<td style='text-align:right;'>" . $item->{'size'} . "</td>"; |
|
110 | + $output .= "<td style='text-align:right;'>" . gmdate("H:i:s", $item->{'download_time'}) . "</td>"; |
|
111 | + $output .= "<td style='text-align:right;'>" . gmdate("Y-m-d H:i", $item->{'completed'}) . "</td>"; |
|
112 | + $output .= "</tr>\n"; |
|
113 | 113 | $count++; |
114 | 114 | } |
115 | - $output.="</table>"; |
|
115 | + $output .= "</table>"; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | if (is_array($queue) && count($queue) > 0) |
125 | 125 | { |
126 | 126 | $count = 1; |
127 | - $output.="<table class=\"data highlight\">"; |
|
128 | - $output.="<tr> |
|
127 | + $output .= "<table class=\"data highlight\">"; |
|
128 | + $output .= "<tr> |
|
129 | 129 | <th></th> |
130 | 130 | <th>Name</th> |
131 | 131 | <th style='width:80px;'>size</th> |
@@ -136,22 +136,22 @@ discard block |
||
136 | 136 | </tr>"; |
137 | 137 | foreach ($queue as $item) |
138 | 138 | { |
139 | - $output.="<tr>"; |
|
140 | - $output.="<td style='text-align:right;'>".$count."</td>"; |
|
141 | - $output.="<td>".htmlspecialchars($item['NZBNicename'], ENT_QUOTES)."</td>"; |
|
142 | - $output.="<td style='text-align:right;'>".round($item['FileSizeMB'], 2)." MB</td>"; |
|
143 | - $output.="<td class='right'>".round($item['RemainingSizeMB'], 2)." MB</td>"; |
|
144 | - $output.="<td class='right'>".($item['FileSizeMB']==0?0:round($item['RemainingSizeMB']/$item['FileSizeMB']*100))."%</td>"; |
|
145 | - $output.="<td style='text-align:right;'>".$item['RemainingFileCount']."</td>"; |
|
146 | - $output.="<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?nzbgetdel=".$item['NZBID']."'>delete</a></td>"; |
|
147 | - $output.="</tr>"; |
|
139 | + $output .= "<tr>"; |
|
140 | + $output .= "<td style='text-align:right;'>" . $count . "</td>"; |
|
141 | + $output .= "<td>" . htmlspecialchars($item['NZBNicename'], ENT_QUOTES) . "</td>"; |
|
142 | + $output .= "<td style='text-align:right;'>" . round($item['FileSizeMB'], 2) . " MB</td>"; |
|
143 | + $output .= "<td class='right'>" . round($item['RemainingSizeMB'], 2) . " MB</td>"; |
|
144 | + $output .= "<td class='right'>" . ($item['FileSizeMB'] == 0 ? 0 : round($item['RemainingSizeMB'] / $item['FileSizeMB'] * 100)) . "%</td>"; |
|
145 | + $output .= "<td style='text-align:right;'>" . $item['RemainingFileCount'] . "</td>"; |
|
146 | + $output .= "<td style='text-align:right;'><a onclick=\"return confirm('Are you sure?');\" href='?nzbgetdel=" . $item['NZBID'] . "'>delete</a></td>"; |
|
147 | + $output .= "</tr>"; |
|
148 | 148 | $count++; |
149 | 149 | } |
150 | - $output.="</table>"; |
|
150 | + $output .= "</table>"; |
|
151 | 151 | } |
152 | 152 | else |
153 | 153 | { |
154 | - $output.="<p>The queue is currently empty.</p>"; |
|
154 | + $output .= "<p>The queue is currently empty.</p>"; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | break; |
@@ -3,25 +3,25 @@ discard block |
||
3 | 3 | use nntmux\SABnzbd; |
4 | 4 | use nntmux\NZBGet; |
5 | 5 | |
6 | -if (!$page->users->isLoggedIn()) |
|
6 | +if (!$page->users->isLoggedIn()) { |
|
7 | 7 | $page->show403(); |
8 | +} |
|
8 | 9 | |
9 | 10 | $sab = new SABnzbd($page); |
10 | 11 | $nzbget = new NZBGet($page); |
11 | 12 | |
12 | -if (empty($sab->url) && empty($sab->apikey) && empty($nzbget->url) && empty($nzbget->username)) |
|
13 | +if (empty($sab->url) && empty($sab->apikey) && empty($nzbget->url) && empty($nzbget->username)) { |
|
13 | 14 | $page->show404(); |
15 | +} |
|
14 | 16 | |
15 | 17 | $output = ""; |
16 | 18 | $reqtype = isset($_REQUEST["type"]) ? $_REQUEST["type"] : "queue"; |
17 | 19 | |
18 | -switch ($reqtype) |
|
19 | -{ |
|
20 | +switch ($reqtype) { |
|
20 | 21 | case "queue": |
21 | 22 | { |
22 | 23 | $json = $sab->getQueue(); |
23 | - if ($json !== false) |
|
24 | - { |
|
24 | + if ($json !== false) { |
|
25 | 25 | $obj = json_decode($json); |
26 | 26 | $queue = $obj->{'jobs'}; |
27 | 27 | $count = 1; |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $output .= "<p><b>Download speed:</b> ".$speed."B/s - <b>Queued:</b> ".$queued." - <b>Status:</b> ".$status."</p>"; |
34 | 34 | |
35 | - if (count($queue) > 0) |
|
36 | - { |
|
35 | + if (count($queue) > 0) { |
|
37 | 36 | $output.="<table class=\"data highlight\">"; |
38 | 37 | $output.="<tr> |
39 | 38 | <th></th> |
@@ -44,13 +43,9 @@ discard block |
||
44 | 43 | <th>time left</th> |
45 | 44 | <th></th> |
46 | 45 | </tr>"; |
47 | - foreach ($queue as $item) |
|
48 | - { |
|
49 | - if (strpos($item->{'filename'}, "fetch NZB") > 0) |
|
50 | - { |
|
51 | - } |
|
52 | - else |
|
53 | - { |
|
46 | + foreach ($queue as $item) { |
|
47 | + if (strpos($item->{'filename'}, "fetch NZB") > 0) { |
|
48 | + } else { |
|
54 | 49 | $output.="<tr>"; |
55 | 50 | $output.="<td style='text-align:right;'>".$count."</td>"; |
56 | 51 | $output.="<td>".htmlspecialchars($item->{'filename'}, ENT_QUOTES)."</td>"; |
@@ -64,14 +59,10 @@ discard block |
||
64 | 59 | } |
65 | 60 | } |
66 | 61 | $output.="</table>"; |
67 | - } |
|
68 | - else |
|
69 | - { |
|
62 | + } else { |
|
70 | 63 | $output.="<p>The queue is currently empty.</p>"; |
71 | 64 | } |
72 | - } |
|
73 | - else |
|
74 | - { |
|
65 | + } else { |
|
75 | 66 | $output.="<p>Error retreiving queue.</p>"; |
76 | 67 | } |
77 | 68 | |
@@ -80,14 +71,12 @@ discard block |
||
80 | 71 | case "history": |
81 | 72 | { |
82 | 73 | $json = $sab->getHistory(); |
83 | - if ($json !== false) |
|
84 | - { |
|
74 | + if ($json !== false) { |
|
85 | 75 | $obj = json_decode($json); |
86 | 76 | $history = $obj->history->slots; |
87 | 77 | $count = 1; |
88 | 78 | |
89 | - if (count($history) > 0) |
|
90 | - { |
|
79 | + if (count($history) > 0) { |
|
91 | 80 | $output.="<h2>Download History</h2>"; |
92 | 81 | $output.="<table class=\"data highlight\">"; |
93 | 82 | $output.="<tr> |
@@ -99,8 +88,7 @@ discard block |
||
99 | 88 | <th style='text-align:center;'>dl time</th> |
100 | 89 | <th style='text-align:center;'>date</th> |
101 | 90 | </tr>"; |
102 | - foreach ($history as $item) |
|
103 | - { |
|
91 | + foreach ($history as $item) { |
|
104 | 92 | $output.="<tr>"; |
105 | 93 | $output.="<td class='".($item->{'fail_message'} != "" ? "sabhistoryfail" : "sabhistorysuccess")."'></td>"; |
106 | 94 | $output.="<td>".htmlspecialchars($item->{'name'}, ENT_QUOTES)."</td>"; |
@@ -121,8 +109,7 @@ discard block |
||
121 | 109 | case "nzbget": |
122 | 110 | { |
123 | 111 | $queue = $nzbget->getQueue(); |
124 | - if (is_array($queue) && count($queue) > 0) |
|
125 | - { |
|
112 | + if (is_array($queue) && count($queue) > 0) { |
|
126 | 113 | $count = 1; |
127 | 114 | $output.="<table class=\"data highlight\">"; |
128 | 115 | $output.="<tr> |
@@ -134,8 +121,7 @@ discard block |
||
134 | 121 | <th>left</th> |
135 | 122 | <th></th> |
136 | 123 | </tr>"; |
137 | - foreach ($queue as $item) |
|
138 | - { |
|
124 | + foreach ($queue as $item) { |
|
139 | 125 | $output.="<tr>"; |
140 | 126 | $output.="<td style='text-align:right;'>".$count."</td>"; |
141 | 127 | $output.="<td>".htmlspecialchars($item['NZBNicename'], ENT_QUOTES)."</td>"; |
@@ -148,9 +134,7 @@ discard block |
||
148 | 134 | $count++; |
149 | 135 | } |
150 | 136 | $output.="</table>"; |
151 | - } |
|
152 | - else |
|
153 | - { |
|
137 | + } else { |
|
154 | 138 | $output.="<p>The queue is currently empty.</p>"; |
155 | 139 | } |
156 | 140 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $id = $_REQUEST['id']; |
16 | 16 | //Get info for first guid to populate form |
17 | 17 | $rel = $releases->getByGuid($_REQUEST['id'][0]); |
18 | -} else { |
|
18 | +} else { |
|
19 | 19 | $id = $rel = ''; |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $id = $_REQUEST['id']; |
16 | 16 | //Get info for first guid to populate form |
17 | 17 | $rel = $releases->getByGuid($_REQUEST['id'][0]); |
18 | -} else { |
|
18 | +} else { |
|
19 | 19 | $id = $rel = ''; |
20 | 20 | } |
21 | 21 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | $page->smarty->assign('music', $mus); |
18 | 18 | |
19 | - $page->title = "Info for ".$mus['title']; |
|
19 | + $page->title = "Info for " . $mus['title']; |
|
20 | 20 | $page->meta_title = ""; |
21 | 21 | $page->meta_keywords = ""; |
22 | 22 | $page->meta_description = ""; |
@@ -4,15 +4,16 @@ discard block |
||
4 | 4 | |
5 | 5 | $music = new Music; |
6 | 6 | |
7 | -if (!$page->users->isLoggedIn()) |
|
7 | +if (!$page->users->isLoggedIn()) { |
|
8 | 8 | $page->show403(); |
9 | +} |
|
9 | 10 | |
10 | -if (isset($_GET["id"]) && ctype_digit($_GET["id"])) |
|
11 | -{ |
|
11 | +if (isset($_GET["id"]) && ctype_digit($_GET["id"])) { |
|
12 | 12 | $mus = $music->getMusicInfo($_GET['id']); |
13 | 13 | |
14 | - if (!$mus) |
|
15 | - $page->show404(); |
|
14 | + if (!$mus) { |
|
15 | + $page->show404(); |
|
16 | + } |
|
16 | 17 | |
17 | 18 | $page->smarty->assign('music', $mus); |
18 | 19 | |
@@ -23,17 +24,17 @@ discard block |
||
23 | 24 | $page->smarty->registerPlugin('modifier', 'ss', 'stripslashes'); |
24 | 25 | |
25 | 26 | $modal = false; |
26 | - if (isset($_GET['modal'])) |
|
27 | - { |
|
27 | + if (isset($_GET['modal'])) { |
|
28 | 28 | $modal = true; |
29 | 29 | $page->smarty->assign('modal', true); |
30 | 30 | } |
31 | 31 | |
32 | 32 | $page->content = $page->smarty->fetch('viewmusic.tpl'); |
33 | 33 | |
34 | - if ($modal) |
|
35 | - echo $page->content; |
|
36 | - else |
|
37 | - $page->render(); |
|
38 | -} |
|
34 | + if ($modal) { |
|
35 | + echo $page->content; |
|
36 | + } else { |
|
37 | + $page->render(); |
|
38 | + } |
|
39 | + } |
|
39 | 40 |