コード例 #1
0
ファイル: profileedit.php プロジェクト: kaibosh/nZEDb
<?php

use nzedb\Category;
use nzedb\NZBGet;
use nzedb\SABnzbd;
use nzedb\Users;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$category = new Category(['Settings' => $page->settings]);
$sab = new SABnzbd($page);
$nzbGet = new NZBGet($page);
$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'];
        $data["firstname"] = $_POST['firstname'];
コード例 #2
0
ファイル: nzbgetqueuedata.php プロジェクト: kaibosh/nZEDb
<?php

use nzedb\NZBGet;
use nzedb\utility\Misc;
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 /> " . Misc::bytesToSizeString($status['AverageDownloadRate'], 2) . "/s </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Speed:</b><br /> " . Misc::bytesToSizeString($status['DownloadRate'], 2) . "/s </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Limit:</b><br /> " . Misc::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 /> " . Misc::bytesToSizeString($status['RemainingSizeLo'], 2) . " </div>\n\t\t\t\t<div style='width:16.666666667%;float:left;'><b>Free Space:</b><br /> " . Misc::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;
コード例 #3
0
ファイル: sendtoqueue.php プロジェクト: kaibosh/nZEDb
<?php

use nzedb\NZBGet;
use nzedb\SABnzbd;
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']);
}