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