diff --git a/Blacklight/Sitemap.php b/Blacklight/Sitemap.php deleted file mode 100755 index 05aa868c7..000000000 --- a/Blacklight/Sitemap.php +++ /dev/null @@ -1,21 +0,0 @@ -type = $t; - $this->name = $n; - $this->loc = $l; - $this->priority = $p; - $this->changefreq = $c; - } -} diff --git a/Changelog b/Changelog index 590c2726e..e39a8f9b2 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-04-16 DariusIII + * Chg: Add TermsController and add nzbvortex to queue controller * Chg: Update themes for series * Chg: Add SeriesController * Chg: Add controller for send to functions diff --git a/app/Http/Controllers/QueueController.php b/app/Http/Controllers/QueueController.php index 37a25c9f8..b98e0483b 100644 --- a/app/Http/Controllers/QueueController.php +++ b/app/Http/Controllers/QueueController.php @@ -4,8 +4,10 @@ namespace App\Http\Controllers; use App\Models\User; use Blacklight\NZBGet; +use Blacklight\NZBVortex; use Blacklight\SABnzbd; use App\Models\Settings; +use Blacklight\utility\Utility; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -38,7 +40,7 @@ class QueueController extends BasePageController switch ((int) $userData['queuetype']) { case 1: $queueType = 'Sabnzbd'; - $queue = new SABnzbd(); + $queue = new SABnzbd($this); break; case 2: $queueType = 'NZBGet'; @@ -183,7 +185,7 @@ class QueueController extends BasePageController public function sabnzbd() { $this->setPrefs(); - $sab = new SABnzbd(); + $sab = new SABnzbd($this); $output = ''; @@ -251,4 +253,91 @@ class QueueController extends BasePageController echo $output; } + + /** + * @throws \Exception + */ + public function nzbVortex() + { + $this->setPrefs(); + try { + if (isset($_GET['isAjax'])) { + $vortex = new NZBVortex; + + // I guess we Ajax this way. + if (isset($_GET['getOverview'])) { + $overview = $vortex->getOverview(); + $this->smarty->assign('overview', $overview); + $content = $this->smarty->fetch('nzbvortex-ajax.tpl'); + echo $content; + exit; + } + + if (isset($_GET['addQueue'])) { + $nzb = $_GET['addQueue']; + $vortex->addQueue($nzb); + exit; + } + + if (isset($_GET['resume'])) { + $vortex->resume((int) $_GET['resume']); + exit; + } + + if (isset($_GET['pause'])) { + $vortex->pause((int) $_GET['pause']); + exit; + } + + if (isset($_GET['moveup'])) { + $vortex->moveUp((int) $_GET['moveup']); + exit; + } + + if (isset($_GET['movedown'])) { + $vortex->moveDown((int) $_GET['movedown']); + exit; + } + + if (isset($_GET['movetop'])) { + $vortex->moveTop((int) $_GET['movetop']); + exit; + } + + if (isset($_GET['movebottom'])) { + $vortex->moveBottom((int) $_GET['movebottom']); + exit; + } + + if (isset($_GET['delete'])) { + $vortex->delete((int) $_GET['delete']); + exit; + } + + if (isset($_GET['filelist'])) { + $response = $vortex->getFilelist((int) $_GET['filelist']); + echo json_encode($response); + exit; + } + } + } catch (\Exception $e) { + header('HTTP/1.1 500 Internal Server Error'); + printf($e->getMessage()); + exit; + } + + $title = 'NZBVortex'; + + $content = $this->smarty->fetch('nzbvortex.tpl'); + + $this->smarty->assign( + [ + 'title' => $title, + 'content' => $content, + ] + ); + + $this->pagerender(); + + } } diff --git a/app/Http/Controllers/TermsController.php b/app/Http/Controllers/TermsController.php new file mode 100644 index 000000000..4c7327f0a --- /dev/null +++ b/app/Http/Controllers/TermsController.php @@ -0,0 +1,34 @@ +setPrefs(); + $title = 'Terms and Conditions'; + $meta_title = Settings::settingValue('site.main.title').' - Terms and conditions'; + $meta_keywords = 'terms,conditions'; + $meta_description = 'Terms and Conditions for '.Settings::settingValue('site.main.title'); + + $content = $this->smarty->fetch('terms.tpl'); + + $this->smarty->assign( + [ + 'title' => $title, + 'content' => $content, + 'meta_title' => $meta_title, + 'meta_keywords' => $meta_keywords, + 'meta_description' => $meta_description, + ] + ); + + $this->pagerender(); + } +} diff --git a/public/pages/sitemap.php b/public/pages/sitemap.php deleted file mode 100644 index e24afa19f..000000000 --- a/public/pages/sitemap.php +++ /dev/null @@ -1,87 +0,0 @@ -smarty; - -$arPages = []; - -$arPages[] = buildURL('Home', 'Home Page', '/', 'daily', '1.0'); - -$role = 0; -if ($page->userdata !== null) { - $role = $page->userdata['role']; -} - -// -// useful links -// -$contents = new Contents(); -$contentlist = $contents->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role); -foreach ($contentlist as $content) { - $arPages[] = buildURL('Useful Links', $content['title'], '/content/'.$content['id'].$content['url'], 'monthly', '0.50'); -} - -// -// articles -// -$contentlist = $contents->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role); -foreach ($contentlist as $content) { - $arPages[] = buildURL('Articles', $content['title'], '/content/'.$content['id'].$content['url'], 'monthly', '0.50'); -} - -// -// static pages -// -$arPages[] = buildURL('Useful Links', 'Contact Us', '/contact-us', 'yearly', '0.30'); -$arPages[] = buildURL('Useful Links', 'Site Map', '/sitemap', 'weekly', '0.50'); - -if ($page->userdata != null) { - $arPages[] = buildURL('Useful Links', 'Rss Feeds', '/rss', 'weekly', '0.50'); - $arPages[] = buildURL('Useful Links', 'API', '/apihelp', 'weekly', '0.50'); - - $arPages[] = buildURL('Nzb', 'Search Nzb', '/search', 'weekly', '0.50'); - $arPages[] = buildURL('Nzb', 'Search Raw', '/searchraw', 'daily', '0.80'); - $arPages[] = buildURL('Nzb', 'Browse Nzb', '/browse', 'daily', '0.80'); - $arPages[] = buildURL('Nzb', 'Browse Groups', '/browsegroup', 'daily', '0.80'); - $arPages[] = buildURL('Nzb', 'Movies', '/movies', 'daily', '0.80'); - $arPages[] = buildURL('Nzb', 'TV Series', '/series', 'daily', '0.80'); - $arPages[] = buildURL('Nzb', 'Anime', '/anime', 'daily', '0.80'); - $arPages[] = buildURL('Nzb', 'Music', '/music', 'daily', '0.80'); - $arPages[] = buildURL('Nzb', 'Console', '/console', 'daily', '0.80'); - - $arPages[] = buildURL('Forum', 'Forum', '/forum', 'daily', '0.80'); - - $arPages[] = buildURL('User', 'Cart', '/cart', 'weekly', '0.50'); - $arPages[] = buildURL('User', 'Profile', '/profile', 'weekly', '0.50'); -} - -// -// echo appropriate site map -// -asort($arPages); -$page->smarty->assign([ - 'sitemaps' => $arPages, - 'last_type' => '', - ] -); - -if (request()->has('type') && request()->input('type') === 'xml') { - echo $page->smarty->fetch('sitemap-xml.tpl'); -} else { - $page->title = Settings::settingValue('site.main.title').' site map'; - $page->meta_title = Settings::settingValue('site.main.title').' site map'; - $page->meta_keywords = 'sitemap,site,map'; - $page->meta_description = Settings::settingValue('site.main.title').' site map shows all our pages.'; - $page->content = $page->smarty->fetch('sitemap.tpl'); - $page->pagerender(); -} - -function buildURL($type, $name, $url, $freq = 'daily', $p = '1.0') -{ - $s = new Sitemap($type, $name, $url, $freq, $p); - - return $s; -} diff --git a/public/pages/terms-and-conditions.php b/public/pages/terms-and-conditions.php deleted file mode 100644 index 435158db8..000000000 --- a/public/pages/terms-and-conditions.php +++ /dev/null @@ -1,12 +0,0 @@ -title = 'Terms and Conditions'; -$page->meta_title = Settings::settingValue('site.main.title').' - Terms and conditions'; -$page->meta_keywords = 'terms,conditions'; -$page->meta_description = 'Terms and Conditions for '.Settings::settingValue('site.main.title'); - -$page->content = $page->smarty->fetch('terms.tpl'); - -$page->pagerender(); diff --git a/routes/web.php b/routes/web.php index 6bbaf2136..4c05f9fb5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -188,3 +188,9 @@ Route::post('sendtocouch', 'SendReleaseController@couchPotato'); Route::get('series', 'SeriesController@index'); Route::post('series', 'SeriesController@index'); + +Route::get('terms-and-conditions', 'TermsController@index'); + +Route::get('nzbvortex', 'QueueController@nzbvortex'); + +Route::post('nzbvortex', 'QueueController@nzbvortex');