<?php require_once WWW_DIR . "/lib/nzbget.php"; if (!$page->users->isLoggedIn()) { $page->show403(); } if (empty($_GET["id"])) { $page->show404(); } $nzbget = new NZBGet($page); if (empty($nzbget->url)) { $page->show404(); } if (empty($nzbget->username)) { $page->show404(); } if (empty($nzbget->password)) { $page->show404(); } $guid = $_GET["id"]; $nzbget->sendToNZBGet($guid);
<?php require_once WWW_DIR . "/lib/sabnzbd.php"; require_once WWW_DIR . "/lib/nzbget.php"; if (!$users->isLoggedIn()) { $page->show403(); } $sab = new SABnzbd($page); $nzbget = new NZBGet($page); if (empty($sab->url) && empty($sab->apikey) && empty($nzbget->url) && empty($nzbget->username)) { $page->show404(); } $output = ""; $reqtype = isset($_REQUEST["type"]) ? $_REQUEST["type"] : "queue"; switch ($reqtype) { case "queue": $json = $sab->getQueue(); if ($json !== false) { $obj = json_decode($json); $queue = $obj->{'jobs'}; $count = 1; $speed = $obj->{'speed'}; $queued = round($obj->{'mbleft'}, 2) . "MB / " . round($obj->{'mb'}, 2) . "MB"; $status = ucwords(strtolower($obj->{'state'})); $output .= "<p><b>Download speed:</b> " . $speed . "B/s - <b>Queued:</b> " . $queued . " - <b>Status:</b> " . $status . "</p>"; if (count($queue) > 0) { $output .= "<table class=\"data highlight\">"; $output .= "<tr>\r\n <th></th>\r\n <th>Name</th>\r\n <th style='width:80px;'>size</th>\r\n <th style='width:80px;'>left</th>\r\n <th style='width:50px;'>%</th>\r\n <th>time left</th>\r\n <th></th>\r\n </tr>"; foreach ($queue as $item) { if (strpos($item->{'filename'}, "fetch NZB") > 0) { } else {
<?php require_once WWW_DIR . "/lib/sabnzbd.php"; require_once WWW_DIR . "/lib/nzbget.php"; if (!$users->isLoggedIn()) { $page->show403(); } $sab = new SABnzbd($page); $nzbget = new NZBGet($page); if (empty($sab->url) && empty($sab->apikey) && empty($nzbget->url) && empty($nzbget->username)) { $page->show404(); } if (isset($_REQUEST["del"])) { $sab->delFromQueue($_REQUEST['del']); } if (isset($_REQUEST["nzbgetdel"])) { $nzbget->delFromQueue($_REQUEST['nzbgetdel']); } $page->smarty->assign('sabserver', $sab->url); $page->smarty->assign('nzbgetserver', $nzbget->url); $page->smarty->assign('showsabhistory', $sab->apikeytype == SABnzbd::API_TYPE_FULL); $page->title = "Your Download Queue"; $page->meta_title = "View Download Queue"; $page->meta_keywords = "view,download,queue"; $page->meta_description = "View Download Queue"; $page->content = $page->smarty->fetch('viewqueue.tpl'); $page->render();
<?php use newznab\utility\Utility; $category = new Category(); $sab = new SABnzbd($page); $nzbGet = new NZBGet($page); $page->users = new Users(); if (!$page->users->isLoggedIn()) { $page->show403(); } $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view'; $userid = $page->users->currentUserId(); $data = $page->users->getById($userid); if (!$data) { $page->show404(); } $errorStr = ''; switch ($action) { case 'newapikey': $page->users->updateRssKey($userid); header("Location: profileedit"); break; case 'clearcookies': $sab->unsetCookie(); header("Location: profileedit"); break; case 'submit': $data["email"] = $_POST['email']; if (isset($_POST['saburl']) && strlen(trim($_POST['saburl'])) > 0 && !Utility::endsWith($_POST['saburl'], "/")) { $_POST['saburl'] = $_POST['saburl'] . "/"; }
<?php require_once WWW_DIR . "/lib/category.php"; require_once WWW_DIR . "/lib/sabnzbd.php"; require_once WWW_DIR . "/lib/nzbget.php"; require_once WWW_DIR . "/lib/util.php"; $category = new Category(); $sab = new SABnzbd($page); $nzbget = new NZBGet($page); if (!$users->isLoggedIn()) { $page->show403(); } $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view'; $userid = $users->currentUserId(); $data = $users->getById($userid); if (!$data) { $page->show404(); } $errorStr = ''; switch ($action) { case 'newapikey': $users->updateRssKey($userid); header("Location: profileedit"); break; case 'clearcookies': $sab->unsetCookie(); header("Location: profileedit"); break; case 'submit': $data["email"] = $_POST['email']; if (isset($_POST['saburl']) && strlen(trim($_POST['saburl'])) > 0 && !endsWith($_POST['saburl'], "/")) {
<?php if (!$page->users->isLoggedIn()) { $page->show403(); } if (empty($_GET["id"])) { $page->show404(); } $user = $page->users->getById($page->users->currentUserId()); if ($user['queuetype'] != 2) { $sab = new SABnzbd($page); if (empty($sab->url)) { $page->show404(); } if (empty($sab->apikey)) { $page->show404(); } $sab->sendToSab($_GET["id"]); } elseif ($user['queuetype'] == 2) { $nzbget = new NZBGet($page); $nzbget->sendURLToNZBGet($_GET['id']); }
<?php use newznab\utility\Utility; if (!$page->users->isLoggedIn()) { $page->show403(); } $nzbget = new NZBGet($page); $output = ""; $data = $nzbget->getQueue(); if ($data !== false) { if (count($data > 0)) { $status = $nzbget->status(); if ($status !== false) { $output .= "<div class='container text-center' style='display:block;'>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Avg Speed:</b><br /> " . Utility::bytesToSizeString($status['AverageDownloadRate'], 2) . "/s </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Speed:</b><br /> " . Utility::bytesToSizeString($status['DownloadRate'], 2) . "/s </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Limit:</b><br /> " . Utility::bytesToSizeString($status['DownloadLimit'], 2) . "/s </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Queue Left(no pars):</b><br /> " . Utility::bytesToSizeString($status['RemainingSizeLo'], 2) . " </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Free Space:</b><br /> " . Utility::bytesToSizeString($status['FreeDiskSpaceMB'] * 1024000, 2) . " </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Status:</b><br /> " . ($status['Download2Paused'] == 1 ? 'Paused' : 'Downloading') . " </div>\n\t\t\t</div>"; } $count = 1; $output .= "<table class='table table-striped table-condensed table-highlight data'>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr >\n\t\t\t\t\t\t<th style='width=10px;text-align:center;'>#</th>\n\t\t\t\t\t\t<th style='text-align:left;'>Name</th>\n\t\t\t\t\t\t<th style='width:80px;text-align:center;'>Size</th>\n\t\t\t\t\t\t<th style='width:80px;text-align:center;'>Left(+pars)</th>\n\t\t\t\t\t\t<th style='width:50px;text-align:center;'>Done</th>\n\t\t\t\t\t\t<th style='width:80px;text-align:center;'>Status</th>\n\t\t\t\t\t\t<th style='width:50px;text-align:center;'>Delete</th>\n\t\t\t\t\t\t<th style='width:80px;text-align:center;'><a href='?pall'>Pause all</a></th>\n\t\t\t\t\t\t<th style='width:80px;text-align:center;'><a href='?rall'>Resume all</a></th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>"; foreach ($data as $item) { $output .= "<tr>" . "<td style='text-align:center;width:10px'>" . $count . "</td>" . "<td style='text-align:left;'>" . $item['NZBName'] . "</td>" . "<td style='text-align:center;'>" . $item['FileSizeMB'] . " MB</td>" . "<td style='text-align:center;'>" . $item['RemainingSizeMB'] . " MB</td>" . "<td style='text-align:center;'>" . ($item['FileSizeMB'] == 0 ? 0 : round(100 - $item['RemainingSizeMB'] / $item['FileSizeMB'] * 100)) . "%</td>" . "<td style='text-align:center;'>" . ($item['ActiveDownloads'] > 0 ? 'Downloading' : 'Paused') . "</td>" . "<td style='text-align:center;'><a onclick=\"return confirm('Are you sure?');\" href='?del=" . $item['LastID'] . "'>Delete</a></td>" . "<td style='text-align:center;'><a href='?pause=" . $item['LastID'] . "'>Pause</a></td>" . "<td style='text-align:center;'><a href='?resume=" . $item['LastID'] . "'>Resume</a></td>" . "</tr>"; $count++; } $output .= "</tbody>\n\t\t</table>"; } else { $output .= "<br /><br /><p style='text-align:center;'>The queue is currently empty.</p>"; } } else { $output .= "<p style='text-align:center;'>Error retreiving queue.</p>"; } print $output;