Add TermsController and add nzbvortex to queue controller

This commit is contained in:
DariusIII
2018-04-16 22:14:06 +02:00
parent d1e717521e
commit 83313deeb7
7 changed files with 132 additions and 122 deletions
-21
View File
@@ -1,21 +0,0 @@
<?php
namespace Blacklight;
class Sitemap
{
public $type = '';
public $name = '';
public $loc = '';
public $priority = '';
public $changefreq = '';
public function __construct($t, $n, $l, $p, $c)
{
$this->type = $t;
$this->name = $n;
$this->loc = $l;
$this->priority = $p;
$this->changefreq = $c;
}
}
+1
View File
@@ -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
+91 -2
View File
@@ -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();
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Http\Controllers;
use App\Models\Settings;
class TermsController extends BasePageController
{
/**
* @throws \Exception
*/
public function index()
{
$this->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();
}
}
-87
View File
@@ -1,87 +0,0 @@
<?php
use Blacklight\Sitemap;
use App\Models\Settings;
use Blacklight\Contents;
$te = $page->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;
}
-12
View File
@@ -1,12 +0,0 @@
<?php
use App\Models\Settings;
$page->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();
+6
View File
@@ -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');